Skip to content

Commit 848b368

Browse files
committed
started working on alterpol
1 parent ad37e02 commit 848b368

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

src/acc/cmakesrc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ estrtor.cpp
3434
etors.cpp
3535
etortor.cpp
3636
eurey.cpp
37+
hippo/alterpol.cpp
3738
hippo/cflux.cpp
3839
hippo/echgtrn.cpp
3940
hippo/edisp.cpp

src/acc/hippo/alterpol.cpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
}

src/hippo/alterpol.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)