| 15 | 
  | 
#include "mpiForceField.h" | 
| 16 | 
  | 
#endif // is_mpi | 
| 17 | 
  | 
 | 
| 18 | 
+ | 
 | 
| 19 | 
+ | 
// define some bond Types | 
| 20 | 
+ | 
 | 
| 21 | 
+ | 
#define FIXED_BOND    0 | 
| 22 | 
+ | 
#define HARMONIC_BOND 1 | 
| 23 | 
+ | 
 | 
| 24 | 
+ | 
 | 
| 25 | 
  | 
namespace TPE {  // restrict the access of the folowing to this file only. | 
| 26 | 
  | 
 | 
| 27 | 
  | 
 | 
| 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 | 
  | 
   | 
| 180 | 
  | 
      next = NULL; | 
| 181 | 
  | 
      nameA[0] = '\0'; | 
| 182 | 
  | 
      nameB[0] = '\0'; | 
| 175 | 
– | 
      type[0] = '\0'; | 
| 183 | 
  | 
    } | 
| 184 | 
  | 
    ~LinkedBondType(){ if( next != NULL ) delete next; } | 
| 185 | 
  | 
 | 
| 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 | 
  | 
     | 
| 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 | 
  | 
 | 
| 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 | 
  | 
  }; | 
| 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 | 
  | 
   | 
| 1199 | 
  | 
      simError(); | 
| 1200 | 
  | 
    } | 
| 1201 | 
  | 
     | 
| 1202 | 
< | 
    if( !strcmp( currentBondType->type, "fixed" ) ){ | 
| 1203 | 
< | 
       | 
| 1202 | 
> | 
    switch( currentBondType->type ){ | 
| 1203 | 
> | 
 | 
| 1204 | 
> | 
    case FIXED_BOND: | 
| 1205 | 
> | 
             | 
| 1206 | 
  | 
      bondArray[i] = new ConstrainedBond( *the_atoms[a],  | 
| 1207 | 
  | 
                                          *the_atoms[b], | 
| 1208 | 
  | 
                                          currentBondType->d0 ); | 
| 1209 | 
  | 
      entry_plug->n_constraints++; | 
| 1210 | 
+ | 
      break; | 
| 1211 | 
+ | 
 | 
| 1212 | 
+ | 
    case HARMONIC_BOND: | 
| 1213 | 
+ | 
       | 
| 1214 | 
+ | 
      bondArray[i] = new HarmonicBond( *the_atoms[a], | 
| 1215 | 
+ | 
                                       *the_atoms[b], | 
| 1216 | 
+ | 
                                       currentBondType->d0, | 
| 1217 | 
+ | 
                                       currentBondType->k0 ); | 
| 1218 | 
+ | 
      break; | 
| 1219 | 
+ | 
       | 
| 1220 | 
+ | 
    default: | 
| 1221 | 
+ | 
 | 
| 1222 | 
+ | 
      break; | 
| 1223 | 
+ | 
      // do nothing | 
| 1224 | 
  | 
    } | 
| 1225 | 
  | 
  } | 
| 1226 | 
  | 
} | 
| 1505 | 
  | 
int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ | 
| 1506 | 
  | 
  | 
| 1507 | 
  | 
  char* the_token; | 
| 1508 | 
+ | 
  char bondType[30]; | 
| 1509 | 
  | 
   | 
| 1510 | 
  | 
  the_token = strtok( lineBuffer, " \n\t,;" ); | 
| 1511 | 
  | 
  if( the_token != NULL ){ | 
| 1528 | 
  | 
      simError(); | 
| 1529 | 
  | 
    } | 
| 1530 | 
  | 
     | 
| 1531 | 
< | 
    strcpy( info.type, the_token ); | 
| 1531 | 
> | 
    strcpy( bondType, the_token ); | 
| 1532 | 
  | 
     | 
| 1533 | 
< | 
    if( !strcmp( info.type, "fixed" ) ){ | 
| 1533 | 
> | 
    if( !strcmp( bondType, "fixed" ) ){ | 
| 1534 | 
> | 
      info.type = FIXED_BOND; | 
| 1535 | 
> | 
       | 
| 1536 | 
> | 
      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ | 
| 1537 | 
> | 
        sprintf( painCave.errMsg, | 
| 1538 | 
> | 
                 "Error parseing BondTypes: line %d\n", lineNum ); | 
| 1539 | 
> | 
        painCave.isFatal = 1; | 
| 1540 | 
> | 
        simError(); | 
| 1541 | 
> | 
      } | 
| 1542 | 
> | 
       | 
| 1543 | 
> | 
      info.d0 = atof( the_token ); | 
| 1544 | 
> | 
    } | 
| 1545 | 
> | 
    else if( !strcmp( bondType, "harmonic" ) ){ | 
| 1546 | 
> | 
      info.type = HARMONIC_BOND; | 
| 1547 | 
> | 
       | 
| 1548 | 
  | 
      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ | 
| 1549 | 
  | 
        sprintf( painCave.errMsg, | 
| 1550 | 
  | 
                 "Error parseing BondTypes: line %d\n", lineNum ); | 
| 1553 | 
  | 
      } | 
| 1554 | 
  | 
       | 
| 1555 | 
  | 
      info.d0 = atof( the_token ); | 
| 1556 | 
+ | 
 | 
| 1557 | 
+ | 
      if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ | 
| 1558 | 
+ | 
        sprintf( painCave.errMsg, | 
| 1559 | 
+ | 
                 "Error parseing BondTypes: line %d\n", lineNum ); | 
| 1560 | 
+ | 
        painCave.isFatal = 1; | 
| 1561 | 
+ | 
        simError(); | 
| 1562 | 
+ | 
      } | 
| 1563 | 
+ | 
       | 
| 1564 | 
+ | 
      info.k0 = atof( the_token ); | 
| 1565 | 
  | 
    } | 
| 1566 | 
+ | 
 | 
| 1567 | 
  | 
    else{ | 
| 1568 | 
  | 
      sprintf( painCave.errMsg,  | 
| 1569 | 
  | 
               "Unknown DUFF bond type \"%s\" at line %d\n", |