--- trunk/OOPSE/libmdtools/WATER.cpp 2004/01/27 19:38:27 989 +++ trunk/OOPSE/libmdtools/WATER.cpp 2004/01/30 15:01:09 999 @@ -305,7 +305,7 @@ WATER::WATER(){ MPI_Type_commit(&mpiDirectionalStructType); // *********************************************************************** - + if( worldRank == 0 ){ #endif @@ -399,6 +399,7 @@ void WATER::readParams( void ){ void WATER::readParams( void ){ int identNum; + int tempDirect0, tempDirect1; atomStruct atomInfo; directionalStruct directionalInfo; @@ -409,7 +410,7 @@ void WATER::readParams( void ){ atomPos = new fpos_t; bigSigma = 0.0; - + #ifdef IS_MPI if( worldRank == 0 ){ #endif @@ -420,7 +421,7 @@ void WATER::readParams( void ){ headDirectionalType = new LinkedDirectionalType; fastForward( "AtomTypes", "initializeAtoms" ); - + // we are now at the AtomTypes section. eof_test = fgets( readLine, sizeof(readLine), frcFile ); @@ -428,7 +429,7 @@ void WATER::readParams( void ){ // read a line, and start parsing out the atom types - + if( eof_test == NULL ){ sprintf( painCave.errMsg, "Error in reading Atoms from force file at line %d.\n", @@ -469,81 +470,74 @@ void WATER::readParams( void ){ } #ifdef IS_MPI - + // send out the linked list to all the other processes sprintf( checkPointMsg, - "WATER atom structures read successfully." ); + "WATER atom and directional structures read successfully." ); MPIcheckPoint(); - currentAtomType = headAtomType->next; //skip the first element who is a place holder. + currentAtomType = headAtomType->next; //skip the first element place holder + currentDirectionalType = headDirectionalType->next; // same w/ directional + while( currentAtomType != NULL ){ currentAtomType->duplicate( atomInfo ); - + sendFrcStruct( &atomInfo, mpiAtomStructType ); sprintf( checkPointMsg, "successfully sent WATER force type: \"%s\"\n", atomInfo.name ); - MPIcheckPoint(); + if ( atomInfo.isDirectional ){ + // send out the directional linked list to all the other processes + + currentDirectionalType->duplicate( directionalInfo ); + sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); + + sprintf( checkPointMsg, + "successfully sent WATER directional type: \"%s\"\n", + directionalInfo.name ); + } + + MPIcheckPoint(); + tempDirect0 = atomInfo.isDirectional; currentAtomType = currentAtomType->next; + if( tempDirect0 ) + currentDirectionalType = currentDirectionalType->next; } - + atomInfo.last = 1; sendFrcStruct( &atomInfo, mpiAtomStructType ); - - if ( atomInfo.isDirectional ){ - // send out the linked list to all the other processes - - sprintf( checkPointMsg, - "WATER directional structures read successfully." ); - MPIcheckPoint(); - - currentDirectionalType = headDirectionalType->next; - while( currentDirectionalType != NULL ){ - currentDirectionalType->duplicate( directionalInfo ); - sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); - currentDirectionalType = currentDirectionalType->next; - } - directionalInfo.last = 1; + directionalInfo.last = 1; + if ( atomInfo.isDirectional ) sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); - } } - + else{ - // listen for node 0 to send out the force params MPIcheckPoint(); headAtomType = new LinkedAtomType; - receiveFrcStruct( &atomInfo, mpiAtomStructType ); - + headDirectionalType = new LinkedDirectionalType; + receiveFrcStruct( &atomInfo, mpiAtomStructType ); + + if ( atomInfo.isDirectional ) + receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); + while( !atomInfo.last ){ - + headAtomType->add( atomInfo ); MPIcheckPoint(); - + receiveFrcStruct( &atomInfo, mpiAtomStructType ); - } - if ( atomInfo.isDirectional ) { - // listen for node 0 to send out the force params - - MPIcheckPoint(); - - headDirectionalType = new LinkedDirectionalType; - receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); - while( !directionalInfo.last ){ - + if( atomInfo.isDirectional ){ headDirectionalType->add( directionalInfo ); + receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); } - - sprintf( checkPointMsg, - "WATER directional structures broadcast successfully." ); - MPIcheckPoint(); } } @@ -636,7 +630,8 @@ void WATER::readParams( void ){ #ifdef IS_MPI sprintf( checkPointMsg, - "WATER atom structures successfully sent to fortran\n" ); + "WATER atom and directional structures successfully" + "sent to fortran\n" ); MPIcheckPoint(); #endif // is_mpi @@ -645,16 +640,14 @@ void WATER::initializeAtoms( int nAtoms, Atom** the_at void WATER::initializeAtoms( int nAtoms, Atom** the_atoms ){ - int i,j; + int i,j,k; // initialize the atoms DirectionalAtom* dAtom; double inertialMat[3][3]; for( i=0; ifind( the_atoms[i]->getType() ); - fprintf(stderr, "%s is the type\n", the_atoms[i]->getType()); if( currentAtomType == NULL ){ sprintf( painCave.errMsg, "AtomType error, %s not found in force file.\n", @@ -662,19 +655,16 @@ void WATER::initializeAtoms( int nAtoms, Atom** the_at painCave.isFatal = 1; simError(); } - fprintf(stderr, "flag 2\n"); if( currentAtomType->isLJ ) the_atoms[i]->setLJ(); if( currentAtomType->isCharge ) the_atoms[i]->setCharged(); the_atoms[i]->setMass( currentAtomType->mass ); the_atoms[i]->setIdent( currentAtomType->ident ); - fprintf(stderr, "flag 3\n"); + if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; if( currentAtomType->isDirectional ){ - fprintf(stderr, "flag 4\n"); currentDirectionalType = headDirectionalType->find( the_atoms[i]->getType() ); - fprintf(stderr, "%s is the type\n", the_atoms[i]->getType()); if( currentDirectionalType == NULL ){ sprintf( painCave.errMsg, "DirectionalType error, %s not found in force file.\n", @@ -684,32 +674,28 @@ void WATER::initializeAtoms( int nAtoms, Atom** the_at } // zero out the moments of inertia matrix - for( i=0; i<3; i++ ) - for( j=0; j<3; j++ ) - inertialMat[i][j] = 0.0; + for( j=0; j<3; j++ ) + for( k=0; k<3; k++ ) + inertialMat[j][k] = 0.0; // load the force file moments of inertia inertialMat[0][0] = currentDirectionalType->Ixx; inertialMat[1][1] = currentDirectionalType->Iyy; inertialMat[2][2] = currentDirectionalType->Izz; - fprintf(stderr, "Let's try pointing to isDirectional\n"); - fprintf(stderr, "%i what is this\n",the_atoms[i]->isDirectional()); + dAtom = (DirectionalAtom *) the_atoms[i]; - fprintf(stderr, "%i is isDipole\n", currentDirectionalType->isDipole); dAtom->setHasDipole( currentDirectionalType->isDipole ); dAtom->setMu( currentDirectionalType->dipole ); - fprintf(stderr, "flag 5\n"); dAtom->setMu( currentDirectionalType->dipole ); - fprintf(stderr,"flag 6\n"); + // if it's sticky then it's an SSD type dAtom->setSSD( currentDirectionalType->isSticky ); dAtom->setJx( 0.0 ); dAtom->setJy( 0.0 ); dAtom->setJz( 0.0 ); dAtom->setI( inertialMat ); - fprintf(stderr, "flag 7\n"); + entry_plug->n_dipoles++; - fprintf(stderr, "flag 8\n"); } else{ sprintf( painCave.errMsg,