ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE_old/src/mdtools/libmdCode/ForceFields.cpp
Revision: 359
Committed: Mon Mar 17 21:38:57 2003 UTC (21 years, 5 months ago) by mmeineke
File size: 1719 byte(s)
Log Message:
adding more to the interface

File Contents

# User Rev Content
1 mmeineke 299 #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 ){
15    
16     int i, isError;
17     double* frc;
18     double* pos;
19     double* trq;
20     double* tau;
21     double* A;
22     double* mu;
23     double* u_l;
24    
25     short int passedCalcPot = (short int)calcPot;
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     mu = Atom::getMuArray();
39     u_l = Atom::getUlArray();
40    
41     tau = entry_plug->tau;
42    
43     isError = 0;
44     fortranForceLoop( pos, A, mu, u_l, frc, trq, tau, &(entry_plug->lrPot),
45     &passedCalcPot, &isError );
46    
47    
48     if( isError ){
49     sprintf( painCave.errMsg,
50     "Error returned from the fortran force calculation.\n" );
51     painCave.isFatal = 1;
52     simError();
53     }
54    
55     #ifdef IS_MPI
56     sprintf( checkPointMsg,
57     "returned from the force calculation.\n" );
58     MPIcheckPoint();
59     #endif // is_mpi
60    
61     }
62    
63    
64 mmeineke 359 void ForceFields::initFortran(int ljMixPolicy, int useReactionField ){
65 mmeineke 299
66     int isError;
67 mmeineke 359
68 mmeineke 299 isError = 0;
69 mmeineke 359 initfortran( &ljMixPolicy, &useReactionField, &isError );
70 mmeineke 299
71     if(isError){
72     sprintf( painCave.errMsg,
73 mmeineke 359 "ForceField error: There was an error initializing the forceField in fortran.\n" );
74 mmeineke 299 painCave.isFatal = 1;
75     simError();
76     }
77    
78    
79     #ifdef IS_MPI
80     sprintf( checkPointMsg, "ForceField successfully initialized the fortran component list.\n" );
81     MPIcheckPoint();
82     #endif // is_mpi
83    
84     delete[] ident;
85    
86     }