2 |
|
|
3 |
|
#ifdef IS_MPI |
4 |
|
#include <mpi.h> |
5 |
– |
#include <mpi++.h> |
5 |
|
#endif // is_mpi |
6 |
|
|
7 |
|
|
15 |
|
|
16 |
|
#ifdef IS_MPI |
17 |
|
double tempBig = bigSigma; |
18 |
< |
MPI::COMM_WORLD.Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX ); |
18 |
> |
MPI_Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX, |
19 |
> |
MPI_COMM_WORLD); |
20 |
|
#endif //is_mpi |
21 |
|
|
22 |
|
//calc rCut and rList |
39 |
|
double* frc; |
40 |
|
double* pos; |
41 |
|
double* trq; |
42 |
– |
double* tau; |
42 |
|
double* A; |
43 |
|
double* u_l;; |
44 |
|
DirectionalAtom* dAtom; |
45 |
|
|
47 |
– |
double ut[3]; |
48 |
– |
|
49 |
– |
//u_l = new double[entry_plug->n_atoms]; |
50 |
– |
|
46 |
|
short int passedCalcPot = (short int)calcPot; |
47 |
|
short int passedCalcStress = (short int)calcStress; |
48 |
|
|
49 |
< |
// forces are zeroed here, before any are acumulated. |
49 |
> |
// forces are zeroed here, before any are accumulated. |
50 |
|
// NOTE: do not rezero the forces in Fortran. |
51 |
|
|
57 |
– |
|
52 |
|
for(i=0; i<entry_plug->n_atoms; i++){ |
53 |
< |
entry_plug->atoms[i]->zeroForces(); |
60 |
< |
|
61 |
< |
if( entry_plug->atoms[i]->isDirectional() ){ |
62 |
< |
dAtom = (DirectionalAtom *)entry_plug->atoms[i]; |
63 |
< |
dAtom->getU(ut); |
64 |
< |
|
65 |
< |
|
66 |
< |
if(dAtom->getIndex()== 1){ |
67 |
< |
std::cerr << "atom 2's u_l = " << ut[0] << ", " << ut[1] |
68 |
< |
<< ", " << ut[2] << "\n"; |
69 |
< |
} |
70 |
< |
} |
71 |
< |
|
53 |
> |
entry_plug->atoms[i]->zeroForces(); |
54 |
|
} |
55 |
|
|
56 |
|
for(i=0; i<entry_plug->n_mol; i++ ){ |
62 |
|
trq = Atom::getTrqArray(); |
63 |
|
A = Atom::getAmatArray(); |
64 |
|
u_l = Atom::getUlArray(); |
83 |
– |
tau = entry_plug->tau; |
84 |
– |
|
65 |
|
|
66 |
|
isError = 0; |
67 |
|
entry_plug->lrPot = 0.0; |
68 |
|
|
69 |
+ |
for (i=0; i<9; i++) { |
70 |
+ |
entry_plug->tau[i] = 0.0; |
71 |
+ |
} |
72 |
|
|
90 |
– |
|
73 |
|
fortranForceLoop( pos, |
74 |
|
A, |
75 |
|
u_l, |
76 |
|
frc, |
77 |
|
trq, |
78 |
< |
tau, |
78 |
> |
entry_plug->tau, |
79 |
|
&(entry_plug->lrPot), |
80 |
|
&passedCalcPot, |
81 |
|
&passedCalcStress, |
82 |
|
&isError ); |
83 |
|
|
102 |
– |
|
103 |
– |
// delete[] u_l; |
104 |
– |
|
84 |
|
if( isError ){ |
85 |
|
sprintf( painCave.errMsg, |
86 |
|
"Error returned from the fortran force calculation.\n" ); |