diff --git a/lib/gpu/lal_lj_tip4p_long.cu b/lib/gpu/lal_lj_tip4p_long.cu index e6c0022ca0..07a7ae7913 100644 --- a/lib/gpu/lal_lj_tip4p_long.cu +++ b/lib/gpu/lal_lj_tip4p_long.cu @@ -57,16 +57,26 @@ _texture( q_tex,int2); #define q_tex q_ #endif +/* ---------------------------------------------------------------------- + GPU analogue of Atom::map inline method, + but now limited to map_array mapping style. + Map global ID to local index of atom. +---------------------------------------------------------------------- */ ucl_inline int atom_mapping(const __global int *map, tagint glob) { return map[glob]; } +/* ---------------------------------------------------------------------- + GPU version of Domain::closest_image(int, int) method. + Return local index of atom J or any of its images that is closest to atom I + if J is not a valid index like -1, just return it. +---------------------------------------------------------------------- */ ucl_inline int closest_image(int i, int j, const __global int* sametag, const __global numtyp4 *restrict x_) { if (j < 0) return j; - numtyp4 xi; fetch4(xi,i,pos_tex); // = x[i]; + numtyp4 xi; fetch4(xi,i,pos_tex); numtyp4 xj; fetch4(xj,j,pos_tex); int closest = j; @@ -92,6 +102,10 @@ ucl_inline int closest_image(int i, int j, const __global int* sametag, return closest; } +/* ---------------------------------------------------------------------- + For molecule that consists of atoms O, H1 and H2 compute position + of virtual charge site xM (return parameter) +---------------------------------------------------------------------- */ ucl_inline void compute_newsite(int iO, int iH1, int iH2, __global numtyp4 *xM, numtyp q, numtyp alpha, const __global numtyp4 *restrict x_) { @@ -118,23 +132,34 @@ ucl_inline void compute_newsite(int iO, int iH1, int iH2, *xM = M; } -__kernel void k_lj_tip4p_long_distrib(const __global numtyp4 *restrict x_, +/* ---------------------------------------------------------------------- + Compute resulting forces (ans), energies and virial (engv). + An additional term is calculated based on the previously + calculated values on the virlual sites (ansO), + which should be distributed over the real atoms. + For some hydrogens, the corresponding oxygens are + not local atoms and the ansO value is not calculated. + The required increase is calculated directly in the main function. +---------------------------------------------------------------------- */ +__kernel void k_lj_tip4p_long_distrib( + const __global numtyp4 *restrict x_, __global acctyp4 *restrict ans, __global acctyp *restrict engv, const int eflag, const int vflag, const int inum, const int nbor_pitch, const int t_per_atom, - __global int *restrict hneigh, - __global numtyp4 *restrict m, + const __global int *restrict hneigh, + const __global numtyp4 *restrict m, const int typeO, const int typeH, const numtyp alpha, - const __global numtyp *restrict q_, const __global acctyp4 *restrict ansO) { + const __global numtyp *restrict q_, + const __global acctyp4 *restrict ansO) { int i = BLOCK_ID_X*(BLOCK_SIZE_X)+THREAD_ID_X; acctyp4 f; f.x=(acctyp)0; f.y=(acctyp)0; f.z=(acctyp)0; if (i