34 |
|
|
35 |
|
} |
36 |
|
|
37 |
+ |
void ForceFields::setRcut( double LJrcut ) { |
38 |
+ |
|
39 |
+ |
#ifdef IS_MPI |
40 |
+ |
double tempBig = bigSigma; |
41 |
+ |
MPI_Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX, |
42 |
+ |
MPI_COMM_WORLD); |
43 |
+ |
#endif //is_mpi |
44 |
+ |
|
45 |
+ |
if (LJrcut < 2.5 * bigSigma) { |
46 |
+ |
sprintf( painCave.errMsg, |
47 |
+ |
"Setting Lennard-Jones cutoff radius to %lf.\n" |
48 |
+ |
"\tThis value is smaller than %lf, which is\n" |
49 |
+ |
"\t2.5 * bigSigma, where bigSigma is the largest\n" |
50 |
+ |
"\tvalue of sigma present in the simulation.\n" |
51 |
+ |
"\tThis is potentially a problem since the LJ potential may\n" |
52 |
+ |
"\tbe appreciable at this distance. If you don't want the\n" |
53 |
+ |
"\tsmaller cutoff, change the LJrcut variable.\n", |
54 |
+ |
LJrcut, 2.5*bigSigma); |
55 |
+ |
painCave.isFatal = 0; |
56 |
+ |
simError(); |
57 |
+ |
} else { |
58 |
+ |
sprintf( painCave.errMsg, |
59 |
+ |
"Setting Lennard-Jones cutoff radius to %lf.\n" |
60 |
+ |
"\tThis value is larger than %lf, which is\n" |
61 |
+ |
"\t2.5 * bigSigma, where bigSigma is the largest\n" |
62 |
+ |
"\tvalue of sigma present in the simulation. This should\n" |
63 |
+ |
"\tnot be a problem, but could adversely effect performance.\n", |
64 |
+ |
LJrcut, 2.5*bigSigma); |
65 |
+ |
painCave.isFatal = 0; |
66 |
+ |
simError(); |
67 |
+ |
} |
68 |
+ |
|
69 |
+ |
//calc rCut and rList |
70 |
+ |
|
71 |
+ |
entry_plug->setDefaultRcut( LJrcut ); |
72 |
+ |
} |
73 |
+ |
|
74 |
|
void ForceFields::doForces( int calcPot, int calcStress ){ |
75 |
|
|
76 |
|
int i, isError; |
78 |
|
double* pos; |
79 |
|
double* trq; |
80 |
|
double* A; |
81 |
< |
double* u_l;; |
81 |
> |
double* u_l; |
82 |
> |
double* rc; |
83 |
> |
double* massRatio; |
84 |
|
SimState* config; |
85 |
|
|
86 |
|
short int passedCalcPot = (short int)calcPot; |
98 |
|
#endif |
99 |
|
|
100 |
|
for(i=0; i<entry_plug->n_mol; i++ ){ |
101 |
+ |
// CalcForces in molecules takes care of mapping rigid body coordinates |
102 |
+ |
// into atomic coordinates |
103 |
|
entry_plug->molecules[i].calcForces(); |
104 |
|
} |
105 |
|
|
114 |
|
trq = config->getTrqArray(); |
115 |
|
A = config->getAmatArray(); |
116 |
|
u_l = config->getUlArray(); |
117 |
+ |
rc = config->getRcArray(); |
118 |
+ |
massRatio = config->getMassRatioArray(); |
119 |
|
|
120 |
|
isError = 0; |
121 |
|
entry_plug->lrPot = 0.0; |
130 |
|
#endif |
131 |
|
|
132 |
|
fortranForceLoop( pos, |
133 |
+ |
rc, |
134 |
|
A, |
135 |
|
u_l, |
136 |
|
frc, |
141 |
|
&passedCalcStress, |
142 |
|
&isError ); |
143 |
|
|
144 |
+ |
|
145 |
|
#ifdef PROFILE |
146 |
|
endProfile(pro8); |
147 |
|
#endif |
154 |
|
simError(); |
155 |
|
} |
156 |
|
|
157 |
+ |
for(i=0; i<entry_plug->n_mol; i++ ){ |
158 |
+ |
entry_plug->molecules[i].atoms2rigidBodies(); |
159 |
+ |
} |
160 |
+ |
|
161 |
+ |
|
162 |
|
#ifdef IS_MPI |
163 |
|
sprintf( checkPointMsg, |
164 |
|
"returned from the force calculation.\n" ); |