2 |
|
|
3 |
|
#ifdef IS_MPI |
4 |
|
#include <mpi.h> |
5 |
+ |
#include <mpi++.h> |
6 |
|
#endif // is_mpi |
7 |
|
|
8 |
|
|
12 |
|
#include "fortranWrappers.hpp" |
13 |
|
|
14 |
|
|
15 |
+ |
void ForceFields::calcRcut( void ){ |
16 |
+ |
|
17 |
+ |
#ifdef IS_MPI |
18 |
+ |
double tempBig = bigSigma; |
19 |
+ |
MPI::COMM_WORLD.Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX ); |
20 |
+ |
#endif //is_mpi |
21 |
+ |
|
22 |
+ |
//calc rCut and rList |
23 |
+ |
|
24 |
+ |
entry_plug->rCut = 2.5 * bigSigma; |
25 |
+ |
if(entry_plug->rCut > (entry_plug->box_x / 2.0)) |
26 |
+ |
entry_plug->rCut = entry_plug->box_x / 2.0; |
27 |
+ |
if(entry_plug->rCut > (entry_plug->box_y / 2.0)) |
28 |
+ |
entry_plug->rCut = entry_plug->box_y / 2.0; |
29 |
+ |
if(entry_plug->rCut > (entry_plug->box_z / 2.0)) |
30 |
+ |
entry_plug->rCut = entry_plug->box_z / 2.0; |
31 |
+ |
|
32 |
+ |
entry_plug->rList = entry_plug->rCut + 1.0; |
33 |
+ |
|
34 |
+ |
} |
35 |
+ |
|
36 |
|
void ForceFields::doForces( int calcPot, int calcStress ){ |
37 |
|
|
38 |
|
int i, isError; |
53 |
|
entry_plug->atoms[i]->zeroForces(); |
54 |
|
} |
55 |
|
|
56 |
+ |
for(i=0; i<entry_plug->n_mol; i++ ){ |
57 |
+ |
entry_plug->molecules[i].calcForces(); |
58 |
+ |
} |
59 |
+ |
|
60 |
|
frc = Atom::getFrcArray(); |
61 |
|
pos = Atom::getPosArray(); |
62 |
|
trq = Atom::getTrqArray(); |
63 |
|
A = Atom::getAmatArray(); |
64 |
|
u_l = Atom::getUlArray(); |
39 |
– |
|
65 |
|
tau = entry_plug->tau; |
66 |
< |
|
66 |
> |
|
67 |
> |
|
68 |
|
isError = 0; |
69 |
|
entry_plug->lrPot = 0.0; |
70 |
+ |
|
71 |
+ |
|
72 |
+ |
|
73 |
|
fortranForceLoop( pos, |
74 |
|
A, |
75 |
|
u_l, |
82 |
|
&isError ); |
83 |
|
|
84 |
|
|
85 |
+ |
|
86 |
+ |
|
87 |
|
if( isError ){ |
88 |
|
sprintf( painCave.errMsg, |
89 |
|
"Error returned from the fortran force calculation.\n" ); |