1+ // #include "ff/amoebamod.h"
2+ #include " ff/atom.h"
3+ #include " ff/hippomod.h"
4+ #include " ff/image.h"
5+ #include " ff/nblist.h"
6+ // #include "ff/pme.h"
7+ #include " ff/switch.h"
8+ #include " seq/pair_polar_chgpen.h"
9+ // #include "tool/gpucard.h"
10+ #include < array>
11+ #include < fstream>
12+
13+ namespace tinker {
14+ void alterpol ()
15+ {
16+ real cut = switchCut (Switch::REPULS);
17+ real off = switchOff (Switch::REPULS);
18+
19+ const real off2 = off * off;
20+ const int maxnlst = mlist_unit->maxnlst ; // question
21+ const auto * mlst = mlist_unit.deviceptr (); // question
22+
23+ size_t bufsize = bufferSize (); // question
24+ PairPolarGrad pgrad; // question
25+
26+ // initialize polscale and polinv
27+ for (int i = 0 ; i < n; ++i) {
28+ polscale[i][1 ][1 ] = 1 .f ;
29+ polscale[i][1 ][2 ] = 0 .f ;
30+ polscale[i][1 ][3 ] = 0 .f ;
31+ polscale[i][2 ][1 ] = 0 .f ;
32+ polscale[i][2 ][2 ] = 1 .f ;
33+ polscale[i][2 ][3 ] = 0 .f ;
34+ polscale[i][3 ][1 ] = 0 .f ;
35+ polscale[i][3 ][2 ] = 0 .f ;
36+ polscale[i][3 ][3 ] = 1 .f ;
37+ polinv[i][1 ][1 ] = 1 .f ;
38+ polinv[i][1 ][2 ] = 0 .f ;
39+ polinv[i][1 ][3 ] = 0 .f ;
40+ polinv[i][2 ][1 ] = 0 .f ;
41+ polinv[i][2 ][2 ] = 1 .f ;
42+ polinv[i][2 ][3 ] = 0 .f ;
43+ polinv[i][3 ][1 ] = 0 .f ;
44+ polinv[i][3 ][2 ] = 0 .f ;
45+ polinv[i][3 ][3 ] = 1 .f ;
46+ }
47+
48+ // find variable polarizability scale matrix at each site
49+ for (int i = 0 ; i < n; ++i) {
50+ real springi = kpep[i];
51+ real sizi = prepep[i];
52+ real alphai = dmppep[i];
53+ int epli = lpep[i];
54+
55+ int nmlsti = mlst->nlst [i]; // question
56+ int base = i * maxnlst; // question
57+ for (int kk = 0 ; kk < nmlsti; ++kk) {
58+ int offset = kk & (bufsize - 1 ); // question (copied from epolar.cpp)
59+ int k = mlst->lst [base + kk]; // question
60+ int eplk = lpep[k];
61+ if (epli || eplk) {
62+ real xr = x[k] - x[i];
63+ real yr = y[k] - y[i];
64+ real zr = z[k] - z[i];
65+
66+ zero (pgrad); // question
67+ real r2 = image2 (xr, yr, zr);
68+ if (r2 <= off2) {
69+ real r = REAL_SQRT (r2);
70+ real sizk = prepep[k];
71+ real alphak = dmppep[k];
72+ // call dampexpl
73+ }
74+ }
75+ }
76+ }
77+ }
78+ }
0 commit comments