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 561 by mmeineke, Fri Jun 20 20:29:36 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 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 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 410 | Line 420 | using namespace TPE;
420  
421   } // namespace
422  
423 < using namespace TPE;
423 > using namespace DUFF_NS;
424  
425  
426   //****************************************************************
# Line 468 | Line 478 | DUFF::DUFF(){
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 754 | Line 764 | void DUFF::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 DUFF::readParams( void ){
784                   &(currentAtomType->isSSD),
785                   &(currentAtomType->isDipole),
786                   &isGB,
787 +                 &isEAM,
788                   &(currentAtomType->epslon),
789                   &(currentAtomType->sigma),
790                   &(currentAtomType->dipole),
# Line 1189 | Line 1201 | void DUFF::initializeBonds( int nBonds, Bond** bondArr
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   }
# 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 DUFF bond type \"%s\" at line %d\n",
# 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 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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines