ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/DUFF.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/DUFF.cpp (file contents):
Revision 559 by mmeineke, Thu Jun 19 22:02:44 2003 UTC vs.
Revision 631 by chuckv, Thu Jul 17 19:25:51 2003 UTC

# Line 15 | Line 15 | namespace TPE {  // restrict the access of the folowin
15   #include "mpiForceField.h"
16   #endif // is_mpi
17  
18 namespace TPE {  // restrict the access of the folowing to this file only.
18  
19 + // define some bond Types
20  
21 + #define FIXED_BOND    0
22 + #define HARMONIC_BOND 1
23 +
24 +
25 + namespace DUFF_NS {  // restrict the access of the folowing to this file only.
26 +
27 +
28    // Declare the structures that will be passed by MPI
29    
30    typedef struct{
# Line 39 | Line 46 | namespace TPE {  // restrict the access of the folowin
46    typedef struct{
47      char nameA[15];
48      char nameB[15];
42    char type[30];
49      double d0;
50 +    double k0;
51      int last;      //  0  -> default
52                     //  1  -> tells nodes to stop listening
53 +    int type;
54    } bondStruct;
55    
56    
# Line 111 | Line 119 | namespace TPE {  // restrict the access of the folowin
119        
120        if( !strcmp( info.name, name ) ){
121          sprintf( painCave.errMsg,
122 <                 "Duplicate TraPPE_Ex atom type \"%s\" found in "
123 <                 "the TraPPE_ExFF param file./n",
122 >                 "Duplicate DUFF atom type \"%s\" found in "
123 >                 "the DUFF param file./n",
124                   name );
125          painCave.isFatal = 1;
126          simError();
# Line 172 | Line 180 | namespace TPE {  // restrict the access of the folowin
180        next = NULL;
181        nameA[0] = '\0';
182        nameB[0] = '\0';
175      type[0] = '\0';
183      }
184      ~LinkedBondType(){ if( next != NULL ) delete next; }
185  
# Line 194 | Line 201 | namespace TPE {  // restrict the access of the folowin
201        
202        if(dup){
203          sprintf( painCave.errMsg,
204 <                 "Duplicate TraPPE_Ex bond type \"%s - %s\" found in "
205 <                 "the TraPPE_ExFF param file./n",
204 >                 "Duplicate DUFF bond type \"%s - %s\" found in "
205 >                 "the DUFF param file./n",
206                   nameA, nameB );
207          painCave.isFatal = 1;
208          simError();
# Line 207 | Line 214 | namespace TPE {  // restrict the access of the folowin
214          next = new LinkedBondType();
215          strcpy(next->nameA, info.nameA);
216          strcpy(next->nameB, info.nameB);
217 <        strcpy(next->type,  info.type);
217 >        next->type = info.type;
218          next->d0 = info.d0;
219 +        next->k0 = info.k0;
220        }
221      }
222      
# Line 216 | Line 224 | namespace TPE {  // restrict the access of the folowin
224      void duplicate( bondStruct &info ){
225        strcpy(info.nameA, nameA);
226        strcpy(info.nameB, nameB);
227 <      strcpy(info.type,  type);
227 >      info.type = type;
228        info.d0   = d0;
229 +      info.k0   = k0;
230        info.last = 0;
231      }
232  
# Line 226 | Line 235 | namespace TPE {  // restrict the access of the folowin
235  
236      char nameA[15];
237      char nameB[15];
238 <    char type[30];
238 >    int type;
239      double d0;
240 +    double k0;
241  
242      LinkedBondType* next;
243    };
# Line 264 | Line 274 | namespace TPE {  // restrict the access of the folowin
274  
275        if(dup){
276          sprintf( painCave.errMsg,
277 <                 "Duplicate TraPPE_Ex bend type \"%s - %s - %s\" found in "
278 <                 "the TraPPE_ExFF param file./n",
277 >                 "Duplicate DUFF bend type \"%s - %s - %s\" found in "
278 >                 "the DUFF param file./n",
279                   nameA, nameB, nameC );
280          painCave.isFatal = 1;
281          simError();
# Line 349 | Line 359 | namespace TPE {  // restrict the access of the folowin
359        
360        if(dup){
361          sprintf( painCave.errMsg,
362 <                 "Duplicate TraPPE_Ex torsion type \"%s - %s - %s - %s\" found in "
363 <                 "the TraPPE_ExFF param file./n", nameA, nameB, nameC, nameD );
362 >                 "Duplicate DUFF torsion type \"%s - %s - %s - %s\" found in "
363 >                 "the DUFF param file./n", nameA, nameB, nameC, nameD );
364          painCave.isFatal = 1;
365          simError();
366        }
# Line 410 | Line 420 | using namespace TPE;
420  
421   } // namespace
422  
423 < using namespace TPE;
423 > using namespace DUFF_NS;
424  
425  
426   //****************************************************************
# Line 418 | Line 428 | TraPPE_ExFF::TraPPE_ExFF(){
428   //****************************************************************
429  
430  
431 < TraPPE_ExFF::TraPPE_ExFF(){
431 > DUFF::DUFF(){
432  
433    char fileName[200];
434    char* ffPath_env = "FORCE_PARAM_PATH";
# Line 468 | Line 478 | TraPPE_ExFF::TraPPE_ExFF(){
478    // Init the bondStruct mpi type
479    
480    bondStruct bondProto; // mpiPrototype
481 <  int bondBC[3] = {60,1,1};  // block counts
481 >  int bondBC[3] = {30,2,2};  // block counts
482    MPI_Aint bondDspls[3];           // displacements
483    MPI_Datatype bondMbrTypes[3];    // member mpi types
484    
# Line 537 | Line 547 | TraPPE_ExFF::TraPPE_ExFF(){
547      
548      // generate the force file name
549      
550 <    strcpy( fileName, "TraPPE_Ex.frc" );
550 >    strcpy( fileName, "DUFF.frc" );
551      //    fprintf( stderr,"Trying to open %s\n", fileName );
552      
553      // attempt to open the file in the current directory first.
# Line 576 | Line 586 | TraPPE_ExFF::TraPPE_ExFF(){
586   #ifdef IS_MPI
587    }
588    
589 <  sprintf( checkPointMsg, "TraPPE_ExFF file opened sucessfully." );
589 >  sprintf( checkPointMsg, "DUFF file opened sucessfully." );
590    MPIcheckPoint();
591    
592   #endif // is_mpi
593   }
594  
595  
596 < TraPPE_ExFF::~TraPPE_ExFF(){
596 > DUFF::~DUFF(){
597  
598    if( headAtomType != NULL ) delete headAtomType;
599    if( headBondType != NULL ) delete headBondType;
# Line 601 | Line 611 | void TraPPE_ExFF::cleanMe( void ){
611   #endif // is_mpi
612   }
613  
614 < void TraPPE_ExFF::cleanMe( void ){
614 > void DUFF::cleanMe( void ){
615  
616   #ifdef IS_MPI
617    
# Line 620 | Line 630 | void TraPPE_ExFF::initForceField( int ljMixRule ){
630   }
631  
632  
633 < void TraPPE_ExFF::initForceField( int ljMixRule ){
633 > void DUFF::initForceField( int ljMixRule ){
634    
635    initFortran( ljMixRule, entry_plug->useReactionField );
636   }
637  
638  
639 < void TraPPE_ExFF::readParams( void ){
639 > void DUFF::readParams( void ){
640  
641    int i, a, b, c, d;
642    int identNum;
# Line 698 | Line 708 | void TraPPE_ExFF::readParams( void ){
708      // send out the linked list to all the other processes
709  
710      sprintf( checkPointMsg,
711 <             "TraPPE_ExFF atom structures read successfully." );
711 >             "DUFF atom structures read successfully." );
712      MPIcheckPoint();
713  
714      currentAtomType = headAtomType->next; //skip the first element who is a place holder.
# Line 710 | Line 720 | void TraPPE_ExFF::readParams( void ){
720        sendFrcStruct( &atomInfo, mpiAtomStructType );
721  
722        sprintf( checkPointMsg,
723 <               "successfully sent TraPPE_Ex force type: \"%s\"\n",
723 >               "successfully sent DUFF force type: \"%s\"\n",
724                 atomInfo.name );
725        MPIcheckPoint();
726  
# Line 754 | Line 764 | void TraPPE_ExFF::readParams( void ){
764    
765    int isGB = 0;
766    int isLJ = 1;
767 +  int isEAM =0;
768    double GB_dummy = 0.0;
769    
770    
# Line 773 | Line 784 | void TraPPE_ExFF::readParams( void ){
784                   &(currentAtomType->isSSD),
785                   &(currentAtomType->isDipole),
786                   &isGB,
787 +                 &isEAM,
788                   &(currentAtomType->epslon),
789                   &(currentAtomType->sigma),
790                   &(currentAtomType->dipole),
# Line 790 | Line 802 | void TraPPE_ExFF::readParams( void ){
802        
803   #ifdef IS_MPI
804    sprintf( checkPointMsg,
805 <           "TraPPE_ExFF atom structures successfully sent to fortran\n" );
805 >           "DUFF atom structures successfully sent to fortran\n" );
806    MPIcheckPoint();
807   #endif // is_mpi
808  
# Line 844 | Line 856 | void TraPPE_ExFF::readParams( void ){
856      // send out the linked list to all the other processes
857      
858      sprintf( checkPointMsg,
859 <             "TraPPE_Ex bond structures read successfully." );
859 >             "DUFF bond structures read successfully." );
860      MPIcheckPoint();
861      
862      currentBondType = headBondType->next;
# Line 874 | Line 886 | void TraPPE_ExFF::readParams( void ){
886    }
887  
888    sprintf( checkPointMsg,
889 <           "TraPPE_ExFF bond structures broadcast successfully." );
889 >           "DUFF bond structures broadcast successfully." );
890    MPIcheckPoint();
891  
892   #endif // is_mpi
# Line 927 | Line 939 | void TraPPE_ExFF::readParams( void ){
939      // send out the linked list to all the other processes
940  
941      sprintf( checkPointMsg,
942 <             "TraPPE_Ex bend structures read successfully." );
942 >             "DUFF bend structures read successfully." );
943      MPIcheckPoint();
944  
945      currentBendType = headBendType->next;
# Line 957 | Line 969 | void TraPPE_ExFF::readParams( void ){
969    }
970  
971    sprintf( checkPointMsg,
972 <           "TraPPE_ExFF bend structures broadcast successfully." );
972 >           "DUFF bend structures broadcast successfully." );
973    MPIcheckPoint();
974  
975   #endif // is_mpi
# Line 1012 | Line 1024 | void TraPPE_ExFF::readParams( void ){
1024      // send out the linked list to all the other processes
1025      
1026      sprintf( checkPointMsg,
1027 <             "TraPPE_Ex torsion structures read successfully." );
1027 >             "DUFF torsion structures read successfully." );
1028      MPIcheckPoint();
1029      
1030      currentTorsionType = headTorsionType->next;
# Line 1042 | Line 1054 | void TraPPE_ExFF::readParams( void ){
1054    }
1055  
1056    sprintf( checkPointMsg,
1057 <           "TraPPE_ExFF torsion structures broadcast successfully." );
1057 >           "DUFF torsion structures broadcast successfully." );
1058    MPIcheckPoint();
1059  
1060   #endif // is_mpi
# Line 1052 | Line 1064 | void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom**
1064  
1065  
1066  
1067 < void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom** the_atoms ){
1067 > void DUFF::initializeAtoms( int nAtoms, Atom** the_atoms ){
1068    
1069    
1070    //////////////////////////////////////////////////
# Line 1141 | Line 1153 | void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom**
1153        else{
1154          
1155          sprintf( painCave.errMsg,
1156 <                "TraPPE_ExFF error: Atom \"%s\" is a dipole, yet no standard"
1156 >                "DUFF error: Atom \"%s\" is a dipole, yet no standard"
1157                   " orientation was specifed in the BASS file.\n",
1158                   currentAtomType->name );
1159          painCave.isFatal = 1;
# Line 1151 | Line 1163 | void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom**
1163      else{
1164        if( the_atoms[i]->isDirectional() ){
1165          sprintf( painCave.errMsg,
1166 <                 "TraPPE_ExFF error: Atom \"%s\" was given a standard"
1166 >                 "DUFF error: Atom \"%s\" was given a standard"
1167                   "orientation in the BASS file, yet it is not a dipole.\n",
1168                   currentAtomType->name);
1169          painCave.isFatal = 1;
# Line 1161 | Line 1173 | void TraPPE_ExFF::initializeBonds( int nBonds, Bond**
1173    }
1174   }
1175  
1176 < void TraPPE_ExFF::initializeBonds( int nBonds, Bond** bondArray,
1176 > void DUFF::initializeBonds( int nBonds, Bond** bondArray,
1177                                     bond_pair* the_bonds ){
1178    int i,a,b;
1179    char* atomA;
# Line 1189 | Line 1201 | void TraPPE_ExFF::initializeBonds( int nBonds, Bond**
1201        simError();
1202      }
1203      
1204 <    if( !strcmp( currentBondType->type, "fixed" ) ){
1205 <      
1204 >    switch( currentBondType->type ){
1205 >
1206 >    case FIXED_BOND:
1207 >            
1208        bondArray[i] = new ConstrainedBond( *the_atoms[a],
1209                                            *the_atoms[b],
1210                                            currentBondType->d0 );
1211        entry_plug->n_constraints++;
1212 +      break;
1213 +
1214 +    case HARMONIC_BOND:
1215 +      
1216 +      bondArray[i] = new HarmonicBond( *the_atoms[a],
1217 +                                       *the_atoms[b],
1218 +                                       currentBondType->d0,
1219 +                                       currentBondType->k0 );
1220 +      break;
1221 +      
1222 +    default:
1223 +
1224 +      break;
1225 +      // do nothing
1226      }
1227    }
1228   }
1229  
1230 < void TraPPE_ExFF::initializeBends( int nBends, Bend** bendArray,
1230 > void DUFF::initializeBends( int nBends, Bend** bendArray,
1231                                     bend_set* the_bends ){
1232    
1233    QuadraticBend* qBend;
# Line 1280 | Line 1308 | void TraPPE_ExFF::initializeTorsions( int nTorsions, T
1308    }
1309   }
1310  
1311 < void TraPPE_ExFF::initializeTorsions( int nTorsions, Torsion** torsionArray,
1311 > void DUFF::initializeTorsions( int nTorsions, Torsion** torsionArray,
1312                                        torsion_set* the_torsions ){
1313  
1314    int i, a, b, c, d;
# Line 1327 | Line 1355 | void TraPPE_ExFF::fastForward( char* stopText, char* s
1355    }
1356   }
1357  
1358 < void TraPPE_ExFF::fastForward( char* stopText, char* searchOwner ){
1358 > void DUFF::fastForward( char* stopText, char* searchOwner ){
1359  
1360    int foundText = 0;
1361    char* the_token;
# Line 1382 | Line 1410 | int TPE::parseAtom( char *lineBuffer, int lineNum, ato
1410   }
1411  
1412  
1413 < int TPE::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){
1413 > int DUFF_NS::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){
1414  
1415    char* the_token;
1416    
# Line 1476 | Line 1504 | int TPE::parseBond( char *lineBuffer, int lineNum, bon
1504    else return 0;
1505   }
1506  
1507 < int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){
1507 > int DUFF_NS::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){
1508  
1509    char* the_token;
1510 +  char bondType[30];
1511    
1512    the_token = strtok( lineBuffer, " \n\t,;" );
1513    if( the_token != NULL ){
# Line 1501 | Line 1530 | int TPE::parseBond( char *lineBuffer, int lineNum, bon
1530        simError();
1531      }
1532      
1533 <    strcpy( info.type, the_token );
1533 >    strcpy( bondType, the_token );
1534      
1535 <    if( !strcmp( info.type, "fixed" ) ){
1535 >    if( !strcmp( bondType, "fixed" ) ){
1536 >      info.type = FIXED_BOND;
1537 >      
1538        if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1539          sprintf( painCave.errMsg,
1540                   "Error parseing BondTypes: line %d\n", lineNum );
# Line 1513 | Line 1544 | int TPE::parseBond( char *lineBuffer, int lineNum, bon
1544        
1545        info.d0 = atof( the_token );
1546      }
1547 +    else if( !strcmp( bondType, "harmonic" ) ){
1548 +      info.type = HARMONIC_BOND;
1549 +      
1550 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1551 +        sprintf( painCave.errMsg,
1552 +                 "Error parseing BondTypes: line %d\n", lineNum );
1553 +        painCave.isFatal = 1;
1554 +        simError();
1555 +      }
1556 +      
1557 +      info.d0 = atof( the_token );
1558 +
1559 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1560 +        sprintf( painCave.errMsg,
1561 +                 "Error parseing BondTypes: line %d\n", lineNum );
1562 +        painCave.isFatal = 1;
1563 +        simError();
1564 +      }
1565 +      
1566 +      info.k0 = atof( the_token );
1567 +    }
1568 +
1569      else{
1570        sprintf( painCave.errMsg,
1571 <               "Unknown TraPPE_Ex bond type \"%s\" at line %d\n",
1571 >               "Unknown DUFF bond type \"%s\" at line %d\n",
1572                 info.type,
1573                 lineNum );
1574        painCave.isFatal = 1;
# Line 1528 | Line 1581 | int TPE::parseBend( char *lineBuffer, int lineNum, ben
1581   }
1582  
1583  
1584 < int TPE::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){
1584 > int DUFF_NS::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){
1585  
1586    char* the_token;
1587    
# Line 1604 | Line 1657 | int TPE::parseBend( char *lineBuffer, int lineNum, ben
1657      
1658      else{
1659        sprintf( painCave.errMsg,
1660 <               "Unknown TraPPE_Ex bend type \"%s\" at line %d\n",
1660 >               "Unknown DUFF bend type \"%s\" at line %d\n",
1661                 info.type,
1662                 lineNum );
1663        painCave.isFatal = 1;
# Line 1616 | Line 1669 | int TPE::parseTorsion( char *lineBuffer, int lineNum,
1669    else return 0;
1670   }
1671  
1672 < int TPE::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){
1672 > int DUFF_NS::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){
1673    
1674    char*  the_token;
1675  
# Line 1702 | Line 1755 | int TPE::parseTorsion( char *lineBuffer, int lineNum,
1755      
1756      else{
1757        sprintf( painCave.errMsg,
1758 <               "Unknown TraPPE_Ex torsion type \"%s\" at line %d\n",
1758 >               "Unknown DUFF torsion type \"%s\" at line %d\n",
1759                 info.type,
1760                 lineNum );
1761        painCave.isFatal = 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines