ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE_old/src/mdtools/libmdCode/ForceFields.cpp
Revision: 362
Committed: Tue Mar 18 21:25:45 2003 UTC (21 years, 4 months ago) by mmeineke
File size: 1810 byte(s)
Log Message:
shed implementation of the Fortran interfaces.

File Contents

# Content
1 #include <cstdlib>
2
3 #ifdef IS_MPI
4 #include <mpi.h>
5 #endif // is_mpi
6
7
8 #include <simError.h>
9 #include <ForceFields.hpp>
10 #include <Atom.hpp>
11 #include <fortranWrappers.hpp>
12
13
14 void ForceFields::doForces( int calcPot, int calcStress ){
15
16 int i, isError;
17 double* frc;
18 double* pos;
19 double* trq;
20 double* tau;
21 double* A;
22 double* u_l;
23
24 short int passedCalcPot = (short int)calcPot;
25 short int passedCalcStress = (short int)calcStress;
26
27 // forces are zeroed here, before any are acumulated.
28 // NOTE: do not rezero the forces in Fortran.
29
30 for(i=0; i<entry_plug->n_atoms; i++){
31 entry_plug->atoms[i]->zeroForces();
32 }
33
34 frc = Atom::getFrcArray();
35 pos = Atom::getPosArray();
36 trq = Atom::getTrqArray();
37 A = Atom::getAmatArray();
38 u_l = Atom::getUlArray();
39
40 tau = entry_plug->tau;
41
42 isError = 0;
43 fortranForceLoop( pos,
44 A,
45 u_l,
46 frc,
47 trq,
48 tau,
49 &(entry_plug->lrPot),
50 &passedCalcPot,
51 &passedCalcStress,
52 &isError );
53
54
55 if( isError ){
56 sprintf( painCave.errMsg,
57 "Error returned from the fortran force calculation.\n" );
58 painCave.isFatal = 1;
59 simError();
60 }
61
62 #ifdef IS_MPI
63 sprintf( checkPointMsg,
64 "returned from the force calculation.\n" );
65 MPIcheckPoint();
66 #endif // is_mpi
67
68 }
69
70
71 void ForceFields::initFortran(int ljMixPolicy, int useReactionField ){
72
73 int isError;
74
75 isError = 0;
76 initfortran( &ljMixPolicy, &useReactionField, &isError );
77
78 if(isError){
79 sprintf( painCave.errMsg,
80 "ForceField error: There was an error initializing the forceField in fortran.\n" );
81 painCave.isFatal = 1;
82 simError();
83 }
84
85
86 #ifdef IS_MPI
87 sprintf( checkPointMsg, "ForceField successfully initialized the fortran component list.\n" );
88 MPIcheckPoint();
89 #endif // is_mpi
90
91 delete[] ident;
92
93 }