Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvaratoms_kernel.h
1#ifndef COLVARATOMS_KERNEL_H
2#define COLVARATOMS_KERNEL_H
3
4#include "colvar_rotation_derivative.h"
5#include "colvarmodule.h"
6// #include "colvar_gpu_support.h"
7#include "colvartypes.h"
8
9#if defined(COLVARS_CUDA) || defined(COLVARS_HIP)
10
11namespace colvars_gpu {
12
13int atoms_pos_from_proxy(
14 const int* atoms_proxy_index,
15 const cvm::real* atoms_pos_proxy,
16 cvm::real* atoms_pos_ag,
17 unsigned int num_atoms,
18 unsigned int proxy_stride,
19 cudaGraphNode_t& node,
20 cudaGraph_t& graph,
21 const std::vector<cudaGraphNode_t>& dependencies);
22
23// For debug gradients
24int atoms_pos_from_proxy(
25 const int* atoms_proxy_index,
26 const cvm::real* atoms_pos_proxy,
27 cvm::real* atoms_pos_ag,
28 unsigned int num_atoms,
29 unsigned int proxy_stride,
30 cudaStream_t stream);
31
32int change_one_coordinate(
33 cvm::real* atoms_pos_ag,
34 size_t atom_id_in_group, int xyz,
35 cvm::real step_size,
36 unsigned int num_atoms,
37 cudaStream_t stream);
38
39int atoms_calc_cog_com(
40 const cvm::real* atoms_pos_ag,
41 const cvm::real* atoms_mass,
42 unsigned int num_atoms,
43 cvm::rvector* d_cog_tmp,
44 cvm::rvector* d_cog_out,
45 cvm::rvector* d_cog_origin,
46 cvm::rvector* d_com_tmp,
47 cvm::rvector* d_com_out,
48 cvm::rvector* h_cog_out,
49 cvm::rvector* h_com_out,
50 cvm::real total_mass,
51 unsigned int* tbcount,
52 cudaGraphNode_t& node,
53 cudaGraph_t& graph,
54 const std::vector<cudaGraphNode_t>& dependencies);
55
56int atoms_calc_cog(
57 const cvm::real* atoms_pos_ag,
58 unsigned int num_atoms,
59 cvm::rvector* d_cog_tmp,
60 cvm::rvector* d_cog_out,
61 cvm::rvector* d_cog_origin,
62 cvm::rvector* h_cog_out,
63 unsigned int* tbcount,
64 cudaGraphNode_t& node,
65 cudaGraph_t& graph,
66 const std::vector<cudaGraphNode_t>& dependencies);
67
68int atoms_total_force_from_proxy(
69 const int* atoms_proxy_index,
70 const cvm::real* atoms_total_force_proxy,
71 cvm::real* atoms_total_force_ag,
72 bool rotate,
74 unsigned int num_atoms,
75 unsigned int proxy_stride,
76 cudaStream_t stream);
77
78int apply_main_colvar_force_to_proxy(
79 const int* atoms_proxy_index,
80 cvm::real* atoms_applied_force_proxy,
81 const cvm::real* atoms_grad_ag,
82 cvm::real* colvar_force,
83 bool rotate,
85 unsigned int num_atoms,
86 unsigned int proxy_stride,
87 cudaGraphNode_t& node,
88 cudaGraph_t& graph,
89 const std::vector<cudaGraphNode_t>& dependencies);
90
91int apply_fitting_colvar_force_to_proxy(
92 const int* atoms_proxy_index,
93 cvm::real* atoms_applied_force_proxy,
94 const cvm::real* atoms_grad_ag,
95 cvm::real* colvar_force,
96 unsigned int num_atoms,
97 unsigned int proxy_stride,
98 cudaGraphNode_t& node,
99 cudaGraph_t& graph,
100 const std::vector<cudaGraphNode_t>& dependencies);
101
102int accumulate_cpu_force(
103 const cvm::real* h_atoms_force,
104 cvm::real* d_atoms_force,
105 unsigned int num_atoms,
106 cudaGraphNode_t& node,
107 cudaGraph_t& graph,
108 const std::vector<cudaGraphNode_t>& dependencies);
109
110int calc_fit_gradients_impl_loop1(
111 const cvm::real* pos_unrotated,
112 cvm::real* main_grad,
114 const cvm::quaternion* q,
115 unsigned int num_atoms_main,
116 unsigned int num_atoms_fitting,
117 double3* atom_grad,
118 double* sum_dxdq,
119 cvm::rmatrix* dxdC,
120 unsigned int* tbcount,
121 bool ag_center, bool ag_rotate,
122 cudaGraphNode_t& node,
123 cudaGraph_t& graph,
124 const std::vector<cudaGraphNode_t>& dependencies);
125
126int calc_fit_gradients_impl_loop2(
127 cvm::real* fit_grad,
129 const double3* atom_grad,
130 const cvm::rmatrix* dxdC,
131 unsigned int group_for_fit_size,
132 bool ag_center, bool ag_rotate,
133 cudaGraphNode_t& node,
134 cudaGraph_t& graph,
135 const std::vector<cudaGraphNode_t>& dependencies);
136
137int apply_translation(
138 cvm::real* atoms_pos_ag,
139 cvm::real translation_vector_factor,
140 const cvm::rvector* translation_vector,
141 unsigned int num_atoms,
142 cudaGraphNode_t& node,
143 cudaGraph_t& graph,
144 const std::vector<cudaGraphNode_t>& dependencies);
145
146int rotate_with_quaternion(
147 cvm::real* atoms_pos_ag,
149 unsigned int num_atoms,
150 cudaGraphNode_t& node,
151 cudaGraph_t& graph,
152 const std::vector<cudaGraphNode_t>& dependencies);
153
154int apply_force_with_inverse_rotation(
155 const cvm::real* atoms_force,
156 const cvm::quaternion* q,
157 const int* atoms_proxy_index,
158 cvm::real* proxy_new_force,
159 unsigned int num_atoms,
160 unsigned int proxy_stride,
161 cudaGraphNode_t& node,
162 cudaGraph_t& graph,
163 const std::vector<cudaGraphNode_t>& dependencies);
164
165int apply_force(
166 const cvm::real* atoms_force,
167 const int* atoms_proxy_index,
168 cvm::real* proxy_new_force,
169 unsigned int num_atoms,
170 unsigned int proxy_stride,
171 cudaGraphNode_t& node,
172 cudaGraph_t& graph,
173 const std::vector<cudaGraphNode_t>& dependencies);
174
175int calc_fit_forces_impl_loop1(
176 const cvm::real* pos_unrotated,
177 cvm::real* main_force,
179 const cvm::quaternion* q,
180 unsigned int num_atoms_main,
181 unsigned int num_atoms_fitting,
182 double3* atom_grad,
183 double* sum_dxdq,
184 cvm::rmatrix* dxdC,
185 unsigned int* tbcount,
186 bool ag_center, bool ag_rotate,
187 cudaGraphNode_t& node,
188 cudaGraph_t& graph,
189 const std::vector<cudaGraphNode_t>& dependencies);
190
191int calc_fit_forces_impl_loop2(
193 const double3* atom_grad,
194 const cvm::rmatrix* dxdC,
195 const int* atoms_proxy_index,
196 cvm::real* proxy_new_force,
197 unsigned int group_for_fit_size,
198 unsigned int proxy_stride,
199 bool ag_center, bool ag_rotate,
200 cudaGraphNode_t& node,
201 cudaGraph_t& graph,
202 const std::vector<cudaGraphNode_t>& dependencies);
203
204}
205
206#elif defined(COLVARS_SYCL)
207// TODO: SYCL
208#endif
209#endif // COLVARATOMS_KERNEL_H
1-dimensional vector of real numbers with four components and a quaternion algebra
Definition: colvartypes.h:978
2-dimensional array of real numbers with three components along each dimension (works with colvarmodu...
Definition: colvartypes.h:901
vector of real numbers with three components
Definition: colvartypes.h:726
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:98
Collective variables main module.
Definition: colvar_rotation_derivative.h:622