--- trunk/OOPSE/libmdtools/DUFF.cpp 2003/07/17 19:25:51 631 +++ trunk/OOPSE/libmdtools/DUFF.cpp 2004/01/22 17:34:20 976 @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include using namespace std; @@ -32,10 +32,17 @@ namespace DUFF_NS { // restrict the access of the fol double mass; double epslon; double sigma; + double charge; double dipole; double w0; double v0; + double v0p; + double rl; + double ru; + double rlp; + double rup; int isSSD; + int isCharge; int isDipole; int ident; int last; // 0 -> default @@ -138,6 +145,11 @@ namespace DUFF_NS { // restrict the access of the fol next->dipole = info.dipole; next->w0 = info.w0; next->v0 = info.v0; + next->v0p = info.v0p; + next->rl = info.rl; + next->ru = info.ru; + next->rlp = info.rlp; + next->rup = info.rup; next->ident = info.ident; } } @@ -154,6 +166,11 @@ namespace DUFF_NS { // restrict the access of the fol info.dipole = dipole; info.w0 = w0; info.v0 = v0; + info.v0p = v0p; + info.rl = rl; + info.ru = ru; + info.rlp = rlp; + info.rup = rup; info.ident = ident; info.last = 0; } @@ -170,6 +187,11 @@ namespace DUFF_NS { // restrict the access of the fol double dipole; double w0; double v0; + double v0p; + double rl; + double ru; + double rlp; + double rup; int ident; LinkedAtomType* next; }; @@ -434,7 +456,6 @@ DUFF::DUFF(){ char* ffPath_env = "FORCE_PARAM_PATH"; char* ffPath; char temp[200]; - char errMsg[1000]; headAtomType = NULL; currentAtomType = NULL; @@ -456,7 +477,7 @@ DUFF::DUFF(){ // Init the atomStruct mpi type atomStruct atomProto; // mpiPrototype - int atomBC[3] = {15,6,4}; // block counts + int atomBC[3] = {15,12,5}; // block counts MPI_Aint atomDspls[3]; // displacements MPI_Datatype atomMbrTypes[3]; // member mpi types @@ -638,12 +659,7 @@ void DUFF::readParams( void ){ void DUFF::readParams( void ){ - int i, a, b, c, d; int identNum; - char* atomA; - char* atomB; - char* atomC; - char* atomD; atomStruct atomInfo; bondStruct bondInfo; @@ -715,8 +731,6 @@ void DUFF::readParams( void ){ while( currentAtomType != NULL ){ currentAtomType->duplicate( atomInfo ); - - sendFrcStruct( &atomInfo, mpiAtomStructType ); sprintf( checkPointMsg, @@ -734,21 +748,19 @@ void DUFF::readParams( void ){ else{ // listen for node 0 to send out the force params - + MPIcheckPoint(); headAtomType = new LinkedAtomType; - recieveFrcStruct( &atomInfo, mpiAtomStructType ); + receiveFrcStruct( &atomInfo, mpiAtomStructType ); while( !atomInfo.last ){ - - headAtomType->add( atomInfo ); MPIcheckPoint(); - recieveFrcStruct( &atomInfo, mpiAtomStructType ); + receiveFrcStruct( &atomInfo, mpiAtomStructType ); } } @@ -765,16 +777,19 @@ void DUFF::readParams( void ){ int isGB = 0; int isLJ = 1; int isEAM =0; - double GB_dummy = 0.0; - - + int isCharge = 0; + double charge=0.0; + currentAtomType = headAtomType->next;; while( currentAtomType != NULL ){ - if(currentAtomType->isDipole) entry_plug->useDipole = 1; + if(currentAtomType->isDipole) entry_plug->useDipoles = 1; if(currentAtomType->isSSD) { entry_plug->useSticky = 1; - set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0)); + set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0), + &(currentAtomType->v0p), + &(currentAtomType->rl), &(currentAtomType->ru), + &(currentAtomType->rlp), &(currentAtomType->rup)); } if( currentAtomType->name[0] != '\0' ){ @@ -785,8 +800,10 @@ void DUFF::readParams( void ){ &(currentAtomType->isDipole), &isGB, &isEAM, + &isCharge, &(currentAtomType->epslon), &(currentAtomType->sigma), + &charge, &(currentAtomType->dipole), &isError ); if( isError ){ @@ -877,11 +894,11 @@ void DUFF::readParams( void ){ MPIcheckPoint(); headBondType = new LinkedBondType; - recieveFrcStruct( &bondInfo, mpiBondStructType ); + receiveFrcStruct( &bondInfo, mpiBondStructType ); while( !bondInfo.last ){ headBondType->add( bondInfo ); - recieveFrcStruct( &bondInfo, mpiBondStructType ); + receiveFrcStruct( &bondInfo, mpiBondStructType ); } } @@ -960,11 +977,11 @@ void DUFF::readParams( void ){ MPIcheckPoint(); headBendType = new LinkedBendType; - recieveFrcStruct( &bendInfo, mpiBendStructType ); + receiveFrcStruct( &bendInfo, mpiBendStructType ); while( !bendInfo.last ){ headBendType->add( bendInfo ); - recieveFrcStruct( &bendInfo, mpiBendStructType ); + receiveFrcStruct( &bendInfo, mpiBendStructType ); } } @@ -1045,11 +1062,11 @@ void DUFF::readParams( void ){ MPIcheckPoint(); headTorsionType = new LinkedTorsionType; - recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); + receiveFrcStruct( &torsionInfo, mpiTorsionStructType ); while( !torsionInfo.last ){ headTorsionType->add( torsionInfo ); - recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); + receiveFrcStruct( &torsionInfo, mpiTorsionStructType ); } } @@ -1287,7 +1304,8 @@ void DUFF::initializeBends( int nBends, Bend** bendArr } gBend = new GhostBend( *the_atoms[a], - *the_atoms[b] ); + *the_atoms[b]); + gBend->setConstants( currentBendType->k1, currentBendType->k2, currentBendType->k3, @@ -1303,7 +1321,7 @@ void DUFF::initializeBends( int nBends, Bend** bendArr currentBendType->k3, currentBendType->t0 ); bendArray[i] = qBend; - } + } } } } @@ -1496,8 +1514,52 @@ int DUFF_NS::parseAtom( char *lineBuffer, int lineNum, } info.v0 = atof( the_token ); + if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ + sprintf( painCave.errMsg, + "Error parseing AtomTypes: line %d\n", lineNum ); + painCave.isFatal = 1; + simError(); + } + + info.v0p = atof( the_token ); + + if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ + sprintf( painCave.errMsg, + "Error parseing AtomTypes: line %d\n", lineNum ); + painCave.isFatal = 1; + simError(); + } + + info.rl = atof( the_token ); + + if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ + sprintf( painCave.errMsg, + "Error parseing AtomTypes: line %d\n", lineNum ); + painCave.isFatal = 1; + simError(); + } + + info.ru = atof( the_token ); + + if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ + sprintf( painCave.errMsg, + "Error parseing AtomTypes: line %d\n", lineNum ); + painCave.isFatal = 1; + simError(); + } + + info.rlp = atof( the_token ); + + if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ + sprintf( painCave.errMsg, + "Error parseing AtomTypes: line %d\n", lineNum ); + painCave.isFatal = 1; + simError(); + } + + info.rup = atof( the_token ); } - else info.v0 = info.w0 = 0.0; + else info.v0 = info.w0 = info.v0p = info.rl = info.ru = info.rlp = info.rup = 0.0; return 1; } @@ -1543,6 +1605,8 @@ int DUFF_NS::parseBond( char *lineBuffer, int lineNum, } info.d0 = atof( the_token ); + + info.k0=0.0; } else if( !strcmp( bondType, "harmonic" ) ){ info.type = HARMONIC_BOND; @@ -1569,7 +1633,7 @@ int DUFF_NS::parseBond( char *lineBuffer, int lineNum, else{ sprintf( painCave.errMsg, "Unknown DUFF bond type \"%s\" at line %d\n", - info.type, + bondType, lineNum ); painCave.isFatal = 1; simError();