ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/interface_implementation/LJ_FF.cpp
(Generate patch)

Comparing trunk/mdtools/interface_implementation/LJ_FF.cpp (file contents):
Revision 235 by mmeineke, Fri Jan 10 21:56:06 2003 UTC vs.
Revision 236 by mmeineke, Mon Jan 13 22:06:21 2003 UTC

# Line 38 | Line 38 | extern "C" {
38   extern "C" {
39    void forcefactory_( char* forceName,
40                        int* status,
41 <                      void (*wrapFunction)( void (*
41 >                      void (*wrapFunction)( void (*p1)( int* ident,
42 >                                                        double* mass,
43 >                                                        double* epslon,
44 >                                                        double* sigma,
45 >                                                        int* status ),
46 >                                            void (*p2)( void ),
47 >                                            void (*p3)( double* positionArray,
48 >                                                        double* forceArray,
49 >                                                        double* potentialEnergy,
50 >                                                        short int* doPotentialCalc )),
51 >                      int forceNameLength );
52 > }
53  
54  
55 + void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon,
56 +                                   double* sigma, int* status ),
57 +                        void (*p2)( void ),
58 +                        void (*p3)( double* positionArray,double* forceArray,
59 +                                    double* potentialEnergy,
60 +                                    short int* doPotentialCalc ) );
61  
62 + void (*newLJtype)( int* ident, double* mass, double* epslon, double* sigma,
63 +                   int* status );
64 +
65 + void (*initLJfortran)( void );
66 +
67 + LJ_FF* currentLJwrap;
68 +
69 +
70 + //****************************************************************
71 + // begins the actual forcefield stuff.  
72 + //****************************************************************
73 +
74   LJ_FF::LJ_FF(){
75  
76    char fileName[200];
# Line 50 | Line 79 | LJ_FF::LJ_FF(){
79    char temp[200];
80    char errMsg[1000];
81  
82 +  // do the funtion wrapping
83 +  currentLJwrap = this;
84 +  wrapMe();
85 +
86   #ifdef IS_MPI
87    int i;
88    
# Line 142 | Line 175 | LJ_FF::~LJ_FF(){
175      fclose( frcFile );
176      
177   #ifdef IS_MPI
178 +  }
179 + #endif // is_mpi
180 + }
181 +
182 +
183 + void LJ_FF::wrapMe( void ){
184 +  
185 +  char* currentFF = "LJ";
186 +  int isError = 0;
187 +  
188 +  forcefactory_( currentFF, &isError, LJfunctionWrapper, strlen(currentFF) );
189 +
190 +  if( isError ){
191 +    
192 +    sprintf( painCave.errMsg,
193 +             "LJ_FF error: an error was returned from fortran when the "
194 +             "the functions were being wrapped.\n" );
195 +    painCave.isFatal = 1;
196 +    simError();
197    }
198 +
199 + #ifdef IS_MPI
200 +  sprintf( checkPointMsg, "LJ_FF functions succesfully wrapped." );
201 +  MPIcheckPoint();
202   #endif // is_mpi
203   }
204 +  
205  
206 + void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon,
207 +                                   double* sigma, int* status ),
208 +                        void (*p2)( void ),
209 +                        void (*p3)( double* positionArray,double* forceArray,
210 +                                    double* potentialEnergy,
211 +                                    short int* doPotentialCalc ) ){
212 +  
213 +  
214 +  p1 = newLJtype;
215 +  p2 = initLJfortran;
216 +  this->setLJfortran( p3 );
217 + }
218 +
219 +
220 +
221   void LJ_FF::initializeAtoms( void ){
222    
223    class LinkedType {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines