--- trunk/mdtools/interface_implementation/LJ_FF.cpp 2003/01/20 22:36:12 239 +++ trunk/mdtools/interface_implementation/LJ_FF.cpp 2003/01/22 21:45:20 240 @@ -43,7 +43,9 @@ extern "C" { double* epslon, double* sigma, int* status ), - void (*p2)( void ), + void (*p2)( int *nLocal, + int *identArray, + int *isError ), void (*p3)( double* positionArray, double* forceArray, double* potentialEnergy, @@ -54,7 +56,7 @@ void LJfunctionWrapper( void (*p1)( int* ident, double void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, double* sigma, int* status ), - void (*p2)( void ), + void (*p2)( int *nLocal, int *identArray, int *isError ), void (*p3)( double* positionArray,double* forceArray, double* potentialEnergy, short int* doPotentialCalc ) ); @@ -62,7 +64,7 @@ void (*initLJfortran)( void ); void (*newLJtype)( int* ident, double* mass, double* epslon, double* sigma, int* status ); -void (*initLJfortran)( void ); +void (*initLJfortran) ( int *nLocal, int *identArray, int *isError ) LJ_FF* currentLJwrap; @@ -382,13 +384,13 @@ void LJ_FF::initializeAtoms( void ){ currentAtomType = headAtomType; while( currentAtomType != NULL ){ - if( currentAtomType->name[0] != NULL ){ + if( currentAtomType->name[0] != '\0' ){ isError = 0; newLJtype( &(currentAtomType->ident), &(currentAtomType->mass), &(currentAtomType->epslon), &(currentAtomType->sigma), - isError ); + &isError ); if( isError ){ sprintf( painCave.errMsg, "Error initializing the \"%s\" atom type in fortran\n", @@ -440,6 +442,8 @@ void LJ_FF::initializeAtoms( void ){ MPIcheckPoint(); #endif // is_mpi + initFortran(); + } void LJ_FF::initializeBonds( bond_pair* the_bonds ){ @@ -604,3 +608,36 @@ void LJ_FF::doForces( void ){ doLJfortran( pos, frc, potE, calcPot ); } +void LJ_FF::initFortran( void ){ + + int nLocal = entry_plug->n_atoms; + int *ident; + int isError; + int i; + + ident = new int[nLocal]; + + for(i=0; iatoms[i]->getIdent(); + } + + isError = 0; + initLJfortran( &nLocal, ident, &isError ); + + if(isError){ + sprintf( painCave.errMsg, + "LJ_FF error: There was an error initializing the component list in fortran.\n" ); + painCave.isFatal = 1; + simError(); + } + + +#ifdef IS_MPI + sprintf( checkPointMsg, "LJ_FF successfully initialized the fortran component list.\n" ); + MPIcheckPoint(); +#endif // is_mpi + + delete[] ident; + +} +