13 #include "Atoms.decl.h"
15 #include "CPcharmParaInfo.decl.h"
18 #include "uber/Uber.h"
59 unsigned int handleForcesCount;
70 double tau,beta,omega2PIMD;
72 CkReductionMsg *contribMsg[2];
77 CProxySection_AtomsCompute proxyHeadBeads;
78 CProxySection_AtomsCompute proxyAllBeads;
79 bool atomsCMrecv,atomsPIMDXrecv;
80 bool amBeadRoot, amZerothBead;
86 FILE *temperScreenFile;
89 AtomsCompute(
int,
int,
int,
int,
int ,
int ,
int,
double ,
Atom *,
AtomNHC *,
int nChareAtoms,
UberCollection thisInstance);
93 void accept_PIMD_x(
double _x,
double _y,
double _z,
int atomI);
94 void accept_PIMD_Fu(
double _fxu,
double _fyu,
double _fzu,
int atomI);
95 void accept_PIMD_Fu_and_u(
double _fxu,
double _fyu,
double _fzu,
double _xu,
double _yu,
double _zu,
int atomI);
97 void accept_PIMD_u(
double _ux,
double _uy,
double _uz,
int atomI);
98 void acceptNewTemperature(
double temp);
101 void atomsDone(CkReductionMsg *);
106 void sendAtoms(
double,
double ,
double,
double,
int,
int,
int);
115 double *fx = fastAtoms.fx;
116 double *fy = fastAtoms.fy;
117 double *fz = fastAtoms.fz;
118 for(
int i=0; i<natm; i++){
128 void zeronhc(){
for(
int i=0;i<natm;i++){atomsNHC[i].posKT = 0;}}
130 void copySlowToFast(){
131 double *x = fastAtoms.x;
132 double *y = fastAtoms.y;
133 double *z = fastAtoms.z;
134 double *fx = fastAtoms.fx;
135 double *fy = fastAtoms.fy;
136 double *fz = fastAtoms.fz;
137 for(
int i=0;i<natm;i++){
147 void copyFastToSlow(){
148 double *x = fastAtoms.x;
149 double *y = fastAtoms.y;
150 double *z = fastAtoms.z;
151 double *fx = fastAtoms.fx;
152 double *fy = fastAtoms.fy;
153 double *fz = fastAtoms.fz;
154 for(
int i=0;i<natm;i++){
166 tau = beta/((double)numPIMDBeads);
167 omega2PIMD = 1.0/(tau*beta);
168 massPIMDScal[0] = 1.0;
169 for(
int ip=2;ip<=numPIMDBeads;ip++){
170 massPIMDScal[(ip-1)] = ((
double)(ip))/((double)(ip-1));
174 void switchPIMDBeadForceMass(
int mybead,
int natmStr,
int natmEnd,
double *pot){
175 #define _CHECK_PIMD_TRANSFORMS_OFF_
176 #ifdef _CHECK_PIMD_TRANSFORMS_
177 CkPrintf(
"switchPIMDBeadForceMass: I am bead %d strt dumping stuff\n",mybead);
179 for(
int i=natmStr;i<natmEnd;i++){
180 #ifdef _CHECK_PIMD_TRANSFORMS_
181 CkPrintf(
"b=%d atm=%d : %g %g %g : %g %g %g : %g %g %g : %g %g %g\n",
183 atoms[i].x,atoms[i].y,atoms[i].z,atoms[i].xu,atoms[i].yu,atoms[i].zu,
184 atoms[i].fx,atoms[i].fy,atoms[i].fz,atoms[i].fxu,atoms[i].fyu,atoms[i].fzu);
186 atoms[i].fx = atoms[i].fxu;
187 atoms[i].fy = atoms[i].fyu;
188 atoms[i].fz = atoms[i].fzu;
189 atoms[i].xold = atoms[i].x;
190 atoms[i].yold = atoms[i].y;
191 atoms[i].zold = atoms[i].z;
192 atoms[i].x = atoms[i].xu;
193 atoms[i].y = atoms[i].yu;
194 atoms[i].z = atoms[i].zu;
196 #ifdef _CHECK_PIMD_TRANSFORMS_
197 CkPrintf(
"switchPIMDBeadForceMass: I am bead %d end dumping stuff\n",mybead);
200 int mybead1 = mybead-1;
202 for(
int i=natmStr;i<natmEnd;i++){
203 atoms[i].m *= massPIMDScal[mybead1];
204 atoms[i].fx -= omega2PIMD*atoms[i].m*atoms[i].x;
205 atoms[i].fy -= omega2PIMD*atoms[i].m*atoms[i].y;
206 atoms[i].fz -= omega2PIMD*atoms[i].m*atoms[i].z;
207 pot[0] += omega2PIMD*atoms[i].m*(
208 atoms[i].x*atoms[i].x
209 +atoms[i].y*atoms[i].y
210 +atoms[i].z*atoms[i].z);
216 void unswitchPIMDMass(
int mybead,
int natmStr,
int natmEnd){
217 int mybead1 = mybead-1;
218 for(
int i=natmStr;i<natmEnd;i++){
219 atoms[i].m /= massPIMDScal[mybead1];
220 atoms[i].xu = atoms[i].x;
221 atoms[i].yu = atoms[i].y;
222 atoms[i].zu = atoms[i].z;
231 #endif // ATOMSCOMPUTE_H
void outputAtmEnergy()
= Atom energy output
holds the UberIndex and the offset for proxies
void recvContributeForces(CkReductionMsg *)
recvContributeForces Every Array member has all the forces at present.
void accept_PIMD_Fu_and_u(double _fxu, double _fyu, double _fzu, double _xu, double _yu, double _zu, int atomI)
= is broadcast to us
void send_PIMD_Fx_and_x()
void acceptAtoms(AtomMsg *)
Take packed message of a chunk of the atoms with updated positions.
void startRealSpaceForces()
trigger force computation based on real forces available in each processor's chare then contribute to...
void accept_PIMD_u(double _ux, double _uy, double _uz, int atomI)
= done during initialization in 1st iteration
void recvContribute(CkReductionMsg *)
recvContribute Every Array member is sent all the forces at present.
~AtomsCompute()
Destructor.
void integrateAtoms()
Integrate atoms.
void send_PIMD_x()
= done during initialization in 1st iteration
void sendAtoms(double, double, double, double, int, int, int)
This thing is sending its updated atoms to all elements.
void accept_PIMD_Fu(double _fxu, double _fyu, double _fzu, int atomI)
= is broadcast to us
void accept_PIMD_x(double _x, double _y, double _z, int atomI)
void init()
= Bead root is the 0th element.
void bcastAtomsToAtomCache()
For dynamics we have to update all the caches with the new coordinates.