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 704 by tim, Wed Aug 20 19:11: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 28 | Line 35 | namespace TPE {  // restrict the access of the folowin
35      double dipole;
36      double w0;
37      double v0;
38 +    double v0p;
39 +    double rl;
40 +    double ru;
41 +    double rlp;
42 +    double rup;
43      int isSSD;
44      int isDipole;
45      int ident;
# Line 39 | Line 51 | namespace TPE {  // restrict the access of the folowin
51    typedef struct{
52      char nameA[15];
53      char nameB[15];
42    char type[30];
54      double d0;
55 +    double k0;
56      int last;      //  0  -> default
57                     //  1  -> tells nodes to stop listening
58 +    int type;
59    } bondStruct;
60    
61    
# Line 130 | Line 143 | namespace TPE {  // restrict the access of the folowin
143          next->dipole   = info.dipole;
144          next->w0       = info.w0;
145          next->v0       = info.v0;
146 +        next->v0p      = info.v0p;
147 +        next->rl       = info.rl;
148 +        next->ru       = info.ru;
149 +        next->rlp      = info.rlp;
150 +        next->rup      = info.rup;
151          next->ident    = info.ident;
152        }
153      }
# Line 146 | Line 164 | namespace TPE {  // restrict the access of the folowin
164        info.dipole   = dipole;
165        info.w0       = w0;
166        info.v0       = v0;
167 +      info.v0p      = v0p;
168 +      info.rl       = rl;
169 +      info.ru       = ru;
170 +      info.rlp      = rlp;
171 +      info.rup      = rup;
172        info.ident    = ident;
173        info.last     = 0;
174      }
# Line 162 | Line 185 | namespace TPE {  // restrict the access of the folowin
185      double dipole;
186      double w0;
187      double v0;
188 +    double v0p;
189 +    double rl;
190 +    double ru;
191 +    double rlp;
192 +    double rup;
193      int ident;
194      LinkedAtomType* next;
195    };
# Line 172 | Line 200 | namespace TPE {  // restrict the access of the folowin
200        next = NULL;
201        nameA[0] = '\0';
202        nameB[0] = '\0';
175      type[0] = '\0';
203      }
204      ~LinkedBondType(){ if( next != NULL ) delete next; }
205  
# Line 207 | Line 234 | namespace TPE {  // restrict the access of the folowin
234          next = new LinkedBondType();
235          strcpy(next->nameA, info.nameA);
236          strcpy(next->nameB, info.nameB);
237 <        strcpy(next->type,  info.type);
237 >        next->type = info.type;
238          next->d0 = info.d0;
239 +        next->k0 = info.k0;
240        }
241      }
242      
# Line 216 | Line 244 | namespace TPE {  // restrict the access of the folowin
244      void duplicate( bondStruct &info ){
245        strcpy(info.nameA, nameA);
246        strcpy(info.nameB, nameB);
247 <      strcpy(info.type,  type);
247 >      info.type = type;
248        info.d0   = d0;
249 +      info.k0   = k0;
250        info.last = 0;
251      }
252  
# Line 226 | Line 255 | namespace TPE {  // restrict the access of the folowin
255  
256      char nameA[15];
257      char nameB[15];
258 <    char type[30];
258 >    int type;
259      double d0;
260 +    double k0;
261  
262      LinkedBondType* next;
263    };
# Line 410 | Line 440 | using namespace TPE;
440  
441   } // namespace
442  
443 < using namespace TPE;
443 > using namespace DUFF_NS;
444  
445  
446   //****************************************************************
# Line 468 | Line 498 | DUFF::DUFF(){
498    // Init the bondStruct mpi type
499    
500    bondStruct bondProto; // mpiPrototype
501 <  int bondBC[3] = {60,1,1};  // block counts
501 >  int bondBC[3] = {30,2,2};  // block counts
502    MPI_Aint bondDspls[3];           // displacements
503    MPI_Datatype bondMbrTypes[3];    // member mpi types
504    
# Line 754 | Line 784 | void DUFF::readParams( void ){
784    
785    int isGB = 0;
786    int isLJ = 1;
787 +  int isEAM =0;
788    double GB_dummy = 0.0;
789    
790    
# Line 763 | Line 794 | void DUFF::readParams( void ){
794      if(currentAtomType->isDipole) entry_plug->useDipole = 1;
795      if(currentAtomType->isSSD) {
796        entry_plug->useSticky = 1;
797 <      set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0));
797 >      set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0),
798 >                         &(currentAtomType->v0p),
799 >                         &(currentAtomType->rl), &(currentAtomType->ru),
800 >                         &(currentAtomType->rlp), &(currentAtomType->rup));
801      }
802  
803      if( currentAtomType->name[0] != '\0' ){
# Line 773 | Line 807 | void DUFF::readParams( void ){
807                   &(currentAtomType->isSSD),
808                   &(currentAtomType->isDipole),
809                   &isGB,
810 +                 &isEAM,
811                   &(currentAtomType->epslon),
812                   &(currentAtomType->sigma),
813                   &(currentAtomType->dipole),
# Line 1189 | Line 1224 | void DUFF::initializeBonds( int nBonds, Bond** bondArr
1224        simError();
1225      }
1226      
1227 <    if( !strcmp( currentBondType->type, "fixed" ) ){
1228 <      
1227 >    switch( currentBondType->type ){
1228 >
1229 >    case FIXED_BOND:
1230 >            
1231        bondArray[i] = new ConstrainedBond( *the_atoms[a],
1232                                            *the_atoms[b],
1233                                            currentBondType->d0 );
1234        entry_plug->n_constraints++;
1235 +      break;
1236 +
1237 +    case HARMONIC_BOND:
1238 +      
1239 +      bondArray[i] = new HarmonicBond( *the_atoms[a],
1240 +                                       *the_atoms[b],
1241 +                                       currentBondType->d0,
1242 +                                       currentBondType->k0 );
1243 +      break;
1244 +      
1245 +    default:
1246 +
1247 +      break;
1248 +      // do nothing
1249      }
1250    }
1251   }
# Line 1259 | Line 1310 | void DUFF::initializeBends( int nBends, Bend** bendArr
1310          }
1311          
1312          gBend = new GhostBend( *the_atoms[a],
1313 <                               *the_atoms[b] );                        
1313 >                               *the_atoms[b],
1314 >                               *the_atoms[c] );
1315 >                                                                      
1316          gBend->setConstants( currentBendType->k1,
1317                               currentBendType->k2,
1318                               currentBendType->k3,
# Line 1275 | Line 1328 | void DUFF::initializeBends( int nBends, Bend** bendArr
1328                               currentBendType->k3,
1329                               currentBendType->t0 );
1330          bendArray[i] = qBend;
1331 <      }
1331 >      }      
1332      }
1333    }
1334   }
# Line 1382 | Line 1435 | int TPE::parseAtom( char *lineBuffer, int lineNum, ato
1435   }
1436  
1437  
1438 < int TPE::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){
1438 > int DUFF_NS::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){
1439  
1440    char* the_token;
1441    
# Line 1468 | Line 1521 | int TPE::parseAtom( char *lineBuffer, int lineNum, ato
1521        }
1522        
1523        info.v0 = atof( the_token );
1524 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1525 +        sprintf( painCave.errMsg,
1526 +                 "Error parseing AtomTypes: line %d\n", lineNum );
1527 +        painCave.isFatal = 1;
1528 +        simError();
1529 +      }
1530 +      
1531 +      info.v0p = atof( the_token );
1532 +
1533 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1534 +        sprintf( painCave.errMsg,
1535 +                 "Error parseing AtomTypes: line %d\n", lineNum );
1536 +        painCave.isFatal = 1;
1537 +        simError();
1538 +      }
1539 +      
1540 +      info.rl = atof( the_token );
1541 +
1542 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1543 +        sprintf( painCave.errMsg,
1544 +                 "Error parseing AtomTypes: line %d\n", lineNum );
1545 +        painCave.isFatal = 1;
1546 +        simError();
1547 +      }
1548 +      
1549 +      info.ru = atof( the_token );
1550 +
1551 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1552 +        sprintf( painCave.errMsg,
1553 +                 "Error parseing AtomTypes: line %d\n", lineNum );
1554 +        painCave.isFatal = 1;
1555 +        simError();
1556 +      }
1557 +      
1558 +      info.rlp = atof( the_token );
1559 +
1560 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1561 +        sprintf( painCave.errMsg,
1562 +                 "Error parseing AtomTypes: line %d\n", lineNum );
1563 +        painCave.isFatal = 1;
1564 +        simError();
1565 +      }
1566 +      
1567 +      info.rup = atof( the_token );
1568      }
1569 <    else info.v0 = info.w0 = 0.0;
1569 >    else info.v0 = info.w0 = info.v0p = info.rl = info.ru = info.rlp = info.rup = 0.0;
1570  
1571      return 1;
1572    }
1573    else return 0;
1574   }
1575  
1576 < int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){
1576 > int DUFF_NS::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){
1577  
1578    char* the_token;
1579 +  char bondType[30];
1580    
1581    the_token = strtok( lineBuffer, " \n\t,;" );
1582    if( the_token != NULL ){
# Line 1501 | Line 1599 | int TPE::parseBond( char *lineBuffer, int lineNum, bon
1599        simError();
1600      }
1601      
1602 <    strcpy( info.type, the_token );
1602 >    strcpy( bondType, the_token );
1603      
1604 <    if( !strcmp( info.type, "fixed" ) ){
1604 >    if( !strcmp( bondType, "fixed" ) ){
1605 >      info.type = FIXED_BOND;
1606 >      
1607        if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1608          sprintf( painCave.errMsg,
1609                   "Error parseing BondTypes: line %d\n", lineNum );
# Line 1512 | Line 1612 | int TPE::parseBond( char *lineBuffer, int lineNum, bon
1612        }
1613        
1614        info.d0 = atof( the_token );
1615 +      
1616 +      info.k0=0.0;
1617      }
1618 +    else if( !strcmp( bondType, "harmonic" ) ){
1619 +      info.type = HARMONIC_BOND;
1620 +      
1621 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1622 +        sprintf( painCave.errMsg,
1623 +                 "Error parseing BondTypes: line %d\n", lineNum );
1624 +        painCave.isFatal = 1;
1625 +        simError();
1626 +      }
1627 +      
1628 +      info.d0 = atof( the_token );
1629 +
1630 +      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){
1631 +        sprintf( painCave.errMsg,
1632 +                 "Error parseing BondTypes: line %d\n", lineNum );
1633 +        painCave.isFatal = 1;
1634 +        simError();
1635 +      }
1636 +      
1637 +      info.k0 = atof( the_token );
1638 +    }
1639 +
1640      else{
1641        sprintf( painCave.errMsg,
1642                 "Unknown DUFF bond type \"%s\" at line %d\n",
# Line 1528 | Line 1652 | int TPE::parseBend( char *lineBuffer, int lineNum, ben
1652   }
1653  
1654  
1655 < int TPE::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){
1655 > int DUFF_NS::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){
1656  
1657    char* the_token;
1658    
# Line 1616 | Line 1740 | int TPE::parseTorsion( char *lineBuffer, int lineNum,
1740    else return 0;
1741   }
1742  
1743 < int TPE::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){
1743 > int DUFF_NS::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){
1744    
1745    char*  the_token;
1746  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines