23 |
|
|
24 |
|
namespace WATER_NS{ |
25 |
|
|
26 |
< |
// Declare the structures that will be passed by the parser and MPI |
26 |
> |
// Declare the structures that will be passed by the parser and MPI |
27 |
|
|
28 |
|
typedef struct{ |
29 |
|
char name[15]; |
41 |
|
|
42 |
|
typedef struct{ |
43 |
|
char name[15]; |
44 |
+ |
double Ixx; |
45 |
+ |
double Iyy; |
46 |
+ |
double Izz; |
47 |
|
double dipole; |
48 |
|
double w0; |
49 |
|
double v0; |
175 |
|
strcpy(next->name, info.name); |
176 |
|
next->isDipole = info.isDipole; |
177 |
|
next->isSticky = info.isSticky; |
178 |
< |
next->dipole = info.dipole; |
178 |
> |
next->Ixx = info.Ixx; |
179 |
> |
next->Iyy = info.Iyy; |
180 |
> |
next->Izz = info.Izz; |
181 |
> |
next->dipole = info.dipole; |
182 |
|
next->w0 = info.w0; |
183 |
|
next->v0 = info.v0; |
184 |
|
next->v0p = info.v0p; |
195 |
|
strcpy(info.name, name); |
196 |
|
info.isDipole = isDipole; |
197 |
|
info.isSticky = isSticky; |
198 |
+ |
info.Ixx = Ixx; |
199 |
+ |
info.Iyy = Iyy; |
200 |
+ |
info.Izz = Izz; |
201 |
|
info.dipole = dipole; |
202 |
|
info.w0 = w0; |
203 |
|
info.v0 = v0; |
214 |
|
char name[15]; |
215 |
|
int isDipole; |
216 |
|
int isSticky; |
217 |
+ |
double Ixx; |
218 |
+ |
double Iyy; |
219 |
+ |
double Izz; |
220 |
|
double dipole; |
221 |
|
double w0; |
222 |
|
double v0; |
232 |
|
LinkedAtomType* currentAtomType; |
233 |
|
LinkedDirectionalType* headDirectionalType; |
234 |
|
LinkedDirectionalType* currentDirectionalType; |
235 |
< |
} |
235 |
> |
} // namespace |
236 |
|
|
237 |
|
using namespace WATER_NS; |
238 |
|
|
269 |
|
|
270 |
|
MPI_Address(&atomProto.name, &atomDspls[0]); |
271 |
|
MPI_Address(&atomProto.mass, &atomDspls[1]); |
272 |
< |
MPI_Address(&atomProto.ident, &atomDspls[2]); |
272 |
> |
MPI_Address(&atomProto.isDirectional, &atomDspls[2]); |
273 |
|
|
274 |
|
atomMbrTypes[0] = MPI_CHAR; |
275 |
|
atomMbrTypes[1] = MPI_DOUBLE; |
286 |
|
// Init the directionalStruct mpi type |
287 |
|
|
288 |
|
directionalStruct directionalProto; // mpiPrototype |
289 |
< |
int directionalBC[3] = {15,8,3}; // block counts |
289 |
> |
int directionalBC[3] = {15,11,3}; // block counts |
290 |
|
MPI_Aint directionalDspls[3]; // displacements |
291 |
|
MPI_Datatype directionalMbrTypes[3]; // member mpi types |
292 |
|
|
293 |
|
MPI_Address(&directionalProto.name, &directionalDspls[0]); |
294 |
< |
MPI_Address(&directionalProto.mass, &directionalDspls[1]); |
295 |
< |
MPI_Address(&directionalProto.ident, &directionalDspls[2]); |
294 |
> |
MPI_Address(&directionalProto.Ixx, &directionalDspls[1]); |
295 |
> |
MPI_Address(&directionalProto.isDipole, &directionalDspls[2]); |
296 |
|
|
297 |
|
directionalMbrTypes[0] = MPI_CHAR; |
298 |
|
directionalMbrTypes[1] = MPI_DOUBLE; |
305 |
|
MPI_Type_commit(&mpiDirectionalStructType); |
306 |
|
|
307 |
|
// *********************************************************************** |
308 |
< |
|
308 |
> |
|
309 |
|
if( worldRank == 0 ){ |
310 |
|
#endif |
311 |
|
|
399 |
|
void WATER::readParams( void ){ |
400 |
|
|
401 |
|
int identNum; |
402 |
+ |
int tempDirect0, tempDirect1; |
403 |
|
|
404 |
|
atomStruct atomInfo; |
405 |
|
directionalStruct directionalInfo; |
406 |
+ |
fpos_t *atomPos; |
407 |
|
|
408 |
|
atomInfo.last = 1; // initialize last to have the last set. |
409 |
|
directionalInfo.last = 1; // if things go well, last will be set to 0 |
410 |
|
|
411 |
|
atomPos = new fpos_t; |
412 |
|
bigSigma = 0.0; |
413 |
< |
|
413 |
> |
|
414 |
|
#ifdef IS_MPI |
415 |
|
if( worldRank == 0 ){ |
416 |
|
#endif |
418 |
|
// read in the atom types. |
419 |
|
|
420 |
|
headAtomType = new LinkedAtomType; |
421 |
+ |
headDirectionalType = new LinkedDirectionalType; |
422 |
|
|
423 |
|
fastForward( "AtomTypes", "initializeAtoms" ); |
424 |
< |
|
424 |
> |
|
425 |
|
// we are now at the AtomTypes section. |
426 |
|
|
427 |
|
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
429 |
|
|
430 |
|
|
431 |
|
// read a line, and start parsing out the atom types |
432 |
< |
|
432 |
> |
|
433 |
|
if( eof_test == NULL ){ |
434 |
|
sprintf( painCave.errMsg, |
435 |
|
"Error in reading Atoms from force file at line %d.\n", |
457 |
|
sectionSearch( "DirectionalTypes", atomInfo.name, |
458 |
|
"initializeDirectional" ); |
459 |
|
parseDirectional( readLine, lineNum, directionalInfo ); |
460 |
+ |
headDirectionalType->add( directionalInfo ); |
461 |
|
|
462 |
|
// return to the AtomTypes section |
463 |
|
fsetpos( frcFile, atomPos ); |
470 |
|
} |
471 |
|
|
472 |
|
#ifdef IS_MPI |
473 |
< |
|
473 |
> |
|
474 |
|
// send out the linked list to all the other processes |
475 |
|
|
476 |
|
sprintf( checkPointMsg, |
477 |
< |
"WATER atom structures read successfully." ); |
477 |
> |
"WATER atom and directional structures read successfully." ); |
478 |
|
MPIcheckPoint(); |
479 |
+ |
currentAtomType = headAtomType->next; //skip the first element place holder |
480 |
+ |
currentDirectionalType = headDirectionalType->next; // same w/ directional |
481 |
|
|
464 |
– |
currentAtomType = headAtomType->next; //skip the first element who is a place holder. |
482 |
|
while( currentAtomType != NULL ){ |
483 |
|
currentAtomType->duplicate( atomInfo ); |
484 |
< |
|
484 |
> |
|
485 |
|
sendFrcStruct( &atomInfo, mpiAtomStructType ); |
486 |
|
|
487 |
|
sprintf( checkPointMsg, |
488 |
|
"successfully sent WATER force type: \"%s\"\n", |
489 |
|
atomInfo.name ); |
473 |
– |
MPIcheckPoint(); |
490 |
|
|
491 |
+ |
if ( atomInfo.isDirectional ){ |
492 |
+ |
// send out the directional linked list to all the other processes |
493 |
+ |
|
494 |
+ |
currentDirectionalType->duplicate( directionalInfo ); |
495 |
+ |
sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
496 |
+ |
|
497 |
+ |
sprintf( checkPointMsg, |
498 |
+ |
"successfully sent WATER directional type: \"%s\"\n", |
499 |
+ |
directionalInfo.name ); |
500 |
+ |
} |
501 |
+ |
|
502 |
+ |
MPIcheckPoint(); |
503 |
+ |
tempDirect0 = atomInfo.isDirectional; |
504 |
|
currentAtomType = currentAtomType->next; |
505 |
+ |
if( tempDirect0 ) |
506 |
+ |
currentDirectionalType = currentDirectionalType->next; |
507 |
|
} |
508 |
+ |
|
509 |
|
atomInfo.last = 1; |
510 |
|
sendFrcStruct( &atomInfo, mpiAtomStructType ); |
511 |
< |
|
512 |
< |
if ( atomInfo.isDirectional ){ |
481 |
< |
// send out the linked list to all the other processes |
482 |
< |
|
483 |
< |
sprintf( checkPointMsg, |
484 |
< |
"WATER directional structures read successfully." ); |
485 |
< |
MPIcheckPoint(); |
486 |
< |
|
487 |
< |
currentDirectionalType = headDirectionalType->next; |
488 |
< |
while( currentDirectionalType != NULL ){ |
489 |
< |
currentDirectionalType->duplicate( directionalInfo ); |
490 |
< |
sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
491 |
< |
currentDirectionalType = currentDirectionalType->next; |
492 |
< |
} |
493 |
< |
directionalInfo.last = 1; |
511 |
> |
directionalInfo.last = 1; |
512 |
> |
if ( atomInfo.isDirectional ) |
513 |
|
sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
495 |
– |
} |
514 |
|
} |
515 |
|
|
516 |
|
else{ |
499 |
– |
|
517 |
|
// listen for node 0 to send out the force params |
518 |
|
|
519 |
|
MPIcheckPoint(); |
520 |
< |
|
520 |
> |
|
521 |
|
headAtomType = new LinkedAtomType; |
522 |
+ |
headDirectionalType = new LinkedDirectionalType; |
523 |
|
receiveFrcStruct( &atomInfo, mpiAtomStructType ); |
524 |
< |
|
524 |
> |
|
525 |
> |
if ( atomInfo.isDirectional ) |
526 |
> |
receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
527 |
> |
|
528 |
|
while( !atomInfo.last ){ |
529 |
< |
|
529 |
> |
|
530 |
|
headAtomType->add( atomInfo ); |
531 |
|
|
532 |
|
MPIcheckPoint(); |
533 |
< |
|
533 |
> |
|
534 |
|
receiveFrcStruct( &atomInfo, mpiAtomStructType ); |
514 |
– |
} |
535 |
|
|
536 |
< |
if ( atomInfo.isDirectional ) { |
517 |
< |
// listen for node 0 to send out the force params |
518 |
< |
|
519 |
< |
MPIcheckPoint(); |
520 |
< |
|
521 |
< |
headDirectionalType = new LinkedDirectionalType; |
522 |
< |
receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
523 |
< |
while( !directionalInfo.last ){ |
524 |
< |
|
536 |
> |
if( atomInfo.isDirectional ){ |
537 |
|
headDirectionalType->add( directionalInfo ); |
538 |
+ |
|
539 |
|
receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
540 |
|
} |
528 |
– |
|
529 |
– |
sprintf( checkPointMsg, |
530 |
– |
"WATER directional structures broadcast successfully." ); |
531 |
– |
MPIcheckPoint(); |
541 |
|
} |
542 |
|
} |
543 |
|
|
544 |
|
#endif // is_mpi |
536 |
– |
|
537 |
– |
|
545 |
|
|
546 |
|
// call new A_types in fortran |
547 |
|
|
550 |
|
// dummy variables |
551 |
|
int isGB = 0; |
552 |
|
int isEAM = 0; |
553 |
< |
|
554 |
< |
currentAtomType = headAtomType; |
553 |
> |
int notDipole = 0; |
554 |
> |
int notSSD = 0; |
555 |
> |
double noDipMoment = 0.0; |
556 |
> |
|
557 |
> |
|
558 |
> |
currentAtomType = headAtomType->next; |
559 |
> |
currentDirectionalType = headDirectionalType->next; |
560 |
> |
|
561 |
|
while( currentAtomType != NULL ){ |
562 |
|
|
563 |
|
if( currentAtomType->isLJ ) entry_plug->useLJ = 1; |
564 |
< |
if( currentAtomType->isCharge ) entry_plug->useCharge = 1; |
564 |
> |
if( currentAtomType->isCharge ) entry_plug->useCharges = 1; |
565 |
|
if( currentAtomType->isDirectional ){ |
566 |
< |
if ( currentAtomType->isDipole ){ |
567 |
< |
entry_plug->useDipoles = 1; |
568 |
< |
&(currentAtomType->dipole); |
556 |
< |
} |
557 |
< |
if ( currentAtomType->isSticky ) { |
566 |
> |
// only directional atoms can have dipoles or be sticky |
567 |
> |
if ( currentDirectionalType->isDipole ) entry_plug->useDipoles = 1; |
568 |
> |
if ( currentDirectionalType->isSticky ) { |
569 |
|
entry_plug->useSticky = 1; |
570 |
< |
set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0), |
571 |
< |
&(currentAtomType->v0p), |
572 |
< |
&(currentAtomType->rl), &(currentAtomType->ru), |
573 |
< |
&(currentAtomType->rlp), &(currentAtomType->rup)); |
570 |
> |
set_sticky_params( &(currentDirectionalType->w0), |
571 |
> |
&(currentDirectionalType->v0), |
572 |
> |
&(currentDirectionalType->v0p), |
573 |
> |
&(currentDirectionalType->rl), |
574 |
> |
&(currentDirectionalType->ru), |
575 |
> |
&(currentDirectionalType->rlp), |
576 |
> |
&(currentDirectionalType->rup)); |
577 |
|
} |
578 |
+ |
if( currentAtomType->name[0] != '\0' ){ |
579 |
+ |
isError = 0; |
580 |
+ |
makeAtype( &(currentAtomType->ident), |
581 |
+ |
&(currentAtomType->isLJ), |
582 |
+ |
&(currentDirectionalType->isSticky), |
583 |
+ |
&(currentDirectionalType->isDipole), |
584 |
+ |
&isGB, |
585 |
+ |
&isEAM, |
586 |
+ |
&(currentAtomType->isCharge), |
587 |
+ |
&(currentAtomType->epslon), |
588 |
+ |
&(currentAtomType->sigma), |
589 |
+ |
&(currentAtomType->charge), |
590 |
+ |
&(currentDirectionalType->dipole), |
591 |
+ |
&isError ); |
592 |
+ |
if( isError ){ |
593 |
+ |
sprintf( painCave.errMsg, |
594 |
+ |
"Error initializing the \"%s\" atom type in fortran\n", |
595 |
+ |
currentAtomType->name ); |
596 |
+ |
painCave.isFatal = 1; |
597 |
+ |
simError(); |
598 |
+ |
} |
599 |
+ |
} |
600 |
+ |
currentDirectionalType->next; |
601 |
|
} |
602 |
< |
if( currentAtomType->name[0] != '\0' ){ |
603 |
< |
isError = 0; |
604 |
< |
makeAtype( &(currentAtomType->ident), |
605 |
< |
&isGB, |
606 |
< |
&isEAM, |
607 |
< |
&(currentAtomType->isDirectional), |
608 |
< |
&(currentAtomType->isLJ), |
609 |
< |
&(currentAtomType->isCharge), |
610 |
< |
&(currentAtomType->epslon), |
611 |
< |
&(currentAtomType->sigma), |
612 |
< |
&(currentAtomType->charge), |
613 |
< |
&isError ); |
614 |
< |
if( isError ){ |
615 |
< |
sprintf( painCave.errMsg, |
616 |
< |
"Error initializing the \"%s\" atom type in fortran\n", |
617 |
< |
currentAtomType->name ); |
618 |
< |
painCave.isFatal = 1; |
619 |
< |
simError(); |
602 |
> |
|
603 |
> |
else { |
604 |
> |
// use all dummy variables if this is not a directional atom |
605 |
> |
if( currentAtomType->name[0] != '\0' ){ |
606 |
> |
isError = 0; |
607 |
> |
makeAtype( &(currentAtomType->ident), |
608 |
> |
&(currentAtomType->isLJ), |
609 |
> |
¬SSD, |
610 |
> |
¬Dipole, |
611 |
> |
&isGB, |
612 |
> |
&isEAM, |
613 |
> |
&(currentAtomType->isCharge), |
614 |
> |
&(currentAtomType->epslon), |
615 |
> |
&(currentAtomType->sigma), |
616 |
> |
&(currentAtomType->charge), |
617 |
> |
&noDipMoment, |
618 |
> |
&isError ); |
619 |
> |
if( isError ){ |
620 |
> |
sprintf( painCave.errMsg, |
621 |
> |
"Error initializing the \"%s\" atom type in fortran\n", |
622 |
> |
currentAtomType->name ); |
623 |
> |
painCave.isFatal = 1; |
624 |
> |
simError(); |
625 |
> |
} |
626 |
|
} |
627 |
|
} |
628 |
|
currentAtomType = currentAtomType->next; |
630 |
|
|
631 |
|
#ifdef IS_MPI |
632 |
|
sprintf( checkPointMsg, |
633 |
< |
"WATER atom structures successfully sent to fortran\n" ); |
633 |
> |
"WATER atom and directional structures successfully" |
634 |
> |
"sent to fortran\n" ); |
635 |
|
MPIcheckPoint(); |
636 |
|
#endif // is_mpi |
593 |
– |
|
594 |
– |
|
595 |
– |
|
596 |
– |
// now read in the directional stuff |
637 |
|
|
598 |
– |
#ifdef IS_MPI |
599 |
– |
if( worldRank == 0 ) { |
600 |
– |
#endif |
601 |
– |
|
602 |
– |
// read in the directional types |
603 |
– |
|
604 |
– |
headDirectionalType = new LinkedDirectionalType; |
605 |
– |
|
606 |
– |
fastForward( "DirectionalTypes", "initializeDirectionals" ); |
607 |
– |
|
608 |
– |
// we are now at the directionalTypes section |
609 |
– |
|
610 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
611 |
– |
lineNum++; |
612 |
– |
|
613 |
– |
|
614 |
– |
// read a line, and start parsing out the atom types |
615 |
– |
|
616 |
– |
if( eof_test == NULL ){ |
617 |
– |
sprintf( painCave.errMsg, |
618 |
– |
"Error in reading directionals from force file at line %d.\n", |
619 |
– |
lineNum ); |
620 |
– |
painCave.isFatal = 1; |
621 |
– |
simError(); |
622 |
– |
} |
623 |
– |
|
624 |
– |
// stop reading at end of file, or at next section |
625 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
626 |
– |
|
627 |
– |
// toss comment lines |
628 |
– |
if( readLine[0] != '!' ){ |
629 |
– |
|
630 |
– |
// the parser returns 0 if the line was blank |
631 |
– |
if( parseDirectional( readLine, lineNum, directionalInfo ) ){ |
632 |
– |
headDirectionalType->add( directionalInfo ); |
633 |
– |
} |
634 |
– |
} |
635 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
636 |
– |
lineNum++; |
637 |
– |
} |
638 |
– |
|
639 |
– |
#ifdef IS_MPI |
640 |
– |
|
641 |
– |
// send out the linked list to all the other processes |
642 |
– |
|
643 |
– |
sprintf( checkPointMsg, |
644 |
– |
"DUFF directional structures read successfully." ); |
645 |
– |
MPIcheckPoint(); |
646 |
– |
|
647 |
– |
currentDirectionalType = headDirectionalType->next; |
648 |
– |
while( currentDirectionalType != NULL ){ |
649 |
– |
currentDirectionalType->duplicate( directionalInfo ); |
650 |
– |
sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
651 |
– |
currentDirectionalType = currentDirectionalType->next; |
652 |
– |
} |
653 |
– |
directionalInfo.last = 1; |
654 |
– |
sendFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
655 |
– |
|
656 |
– |
} |
657 |
– |
|
658 |
– |
else{ |
659 |
– |
|
660 |
– |
// listen for node 0 to send out the force params |
661 |
– |
|
662 |
– |
MPIcheckPoint(); |
663 |
– |
|
664 |
– |
headDirectionalType = new LinkedDirectionalType; |
665 |
– |
receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
666 |
– |
while( !directionalInfo.last ){ |
667 |
– |
|
668 |
– |
headDirectionalType->add( directionalInfo ); |
669 |
– |
receiveFrcStruct( &directionalInfo, mpiDirectionalStructType ); |
670 |
– |
} |
671 |
– |
} |
672 |
– |
|
673 |
– |
sprintf( checkPointMsg, |
674 |
– |
"WATER directional structures broadcast successfully." ); |
675 |
– |
MPIcheckPoint(); |
676 |
– |
|
677 |
– |
#endif // is_mpi |
638 |
|
} |
639 |
|
|
640 |
|
|
641 |
|
void WATER::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
642 |
|
|
643 |
< |
int i; |
643 |
> |
int i,j,k; |
644 |
|
|
645 |
|
// initialize the atoms |
646 |
< |
|
646 |
> |
DirectionalAtom* dAtom; |
647 |
> |
double ji[3]; |
648 |
> |
double inertialMat[3][3]; |
649 |
|
|
650 |
|
for( i=0; i<nAtoms; i++ ){ |
689 |
– |
|
651 |
|
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
652 |
|
if( currentAtomType == NULL ){ |
653 |
|
sprintf( painCave.errMsg, |
656 |
|
painCave.isFatal = 1; |
657 |
|
simError(); |
658 |
|
} |
698 |
– |
|
699 |
– |
the_atoms[i]->setisLJ( currentAtomType->isLJ); |
700 |
– |
the_atoms[i]->setisCharge( currentAtomType->isCharge); |
659 |
|
the_atoms[i]->setMass( currentAtomType->mass ); |
702 |
– |
the_atoms[i]->setEpslon( currentAtomType->epslon ); |
703 |
– |
the_atoms[i]->setSigma( currentAtomType->sigma ); |
704 |
– |
the_atoms[i]->setCharge( currentAtomType->charge ); |
660 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
661 |
|
|
662 |
< |
} |
708 |
< |
} |
662 |
> |
if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; |
663 |
|
|
664 |
< |
void WATER::initializeDirectional( int nAtoms, Atom** the_atoms ){ |
711 |
< |
|
712 |
< |
int i; |
664 |
> |
the_atoms[i]->setHasCharge(currentAtomType->isCharge); |
665 |
|
|
666 |
< |
// initialize the atoms |
667 |
< |
|
666 |
> |
if( currentAtomType->isDirectional ){ |
667 |
> |
currentDirectionalType = |
668 |
> |
headDirectionalType->find( the_atoms[i]->getType() ); |
669 |
> |
if( currentDirectionalType == NULL ){ |
670 |
> |
sprintf( painCave.errMsg, |
671 |
> |
"DirectionalType error, %s not found in force file.\n", |
672 |
> |
the_atoms[i]->getType() ); |
673 |
> |
painCave.isFatal = 1; |
674 |
> |
simError(); |
675 |
> |
} |
676 |
|
|
677 |
< |
for( i=0; i<nAtoms; i++ ){ |
678 |
< |
|
679 |
< |
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
680 |
< |
if( currentAtomType == NULL ){ |
721 |
< |
sprintf( painCave.errMsg, |
722 |
< |
"AtomType error, %s not found in force file.\n", |
723 |
< |
the_atoms[i]->getType() ); |
724 |
< |
painCave.isFatal = 1; |
725 |
< |
simError(); |
726 |
< |
} |
677 |
> |
// zero out the moments of inertia matrix |
678 |
> |
for( j=0; j<3; j++ ) |
679 |
> |
for( k=0; k<3; k++ ) |
680 |
> |
inertialMat[j][k] = 0.0; |
681 |
|
|
682 |
< |
the_atoms[i]->setisLJ( currentAtomType->isLJ); |
683 |
< |
the_atoms[i]->setisCharge( currentAtomType->isCharge); |
684 |
< |
the_atoms[i]->setMass( currentAtomType->mass ); |
685 |
< |
the_atoms[i]->setEpslon( currentAtomType->epslon ); |
686 |
< |
the_atoms[i]->setSigma( currentAtomType->sigma ); |
687 |
< |
the_atoms[i]->setCharge( currentAtomType->charge ); |
688 |
< |
the_atoms[i]->setIdent( currentAtomType->ident ); |
682 |
> |
// load the force file moments of inertia |
683 |
> |
inertialMat[0][0] = currentDirectionalType->Ixx; |
684 |
> |
inertialMat[1][1] = currentDirectionalType->Iyy; |
685 |
> |
inertialMat[2][2] = currentDirectionalType->Izz; |
686 |
> |
|
687 |
> |
dAtom = (DirectionalAtom *) the_atoms[i]; |
688 |
> |
dAtom->setHasDipole( currentDirectionalType->isDipole ); |
689 |
|
|
690 |
+ |
ji[0] = 0.0; |
691 |
+ |
ji[1] = 0.0; |
692 |
+ |
ji[2] = 0.0; |
693 |
+ |
dAtom->setJ( ji ); |
694 |
+ |
dAtom->setI( inertialMat ); |
695 |
+ |
|
696 |
+ |
entry_plug->n_dipoles++; |
697 |
+ |
} |
698 |
|
} |
699 |
|
} |
700 |
|
|
790 |
|
int foundSection = 0; |
791 |
|
int foundText = 0; |
792 |
|
char* the_token; |
793 |
< |
tempPos = new fpos_t; |
793 |
> |
fpos_t *tempPos; |
794 |
|
|
795 |
|
rewind( frcFile ); |
796 |
|
lineNum = 0; |
797 |
+ |
tempPos = new fpos_t; |
798 |
|
|
799 |
|
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
800 |
|
lineNum++; |
806 |
|
simError(); |
807 |
|
} |
808 |
|
|
846 |
– |
|
809 |
|
while( !foundSection ){ |
810 |
|
while( eof_test != NULL && readLine[0] != '#' ){ |
811 |
|
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
820 |
|
painCave.isFatal = 1; |
821 |
|
simError(); |
822 |
|
} |
861 |
– |
|
823 |
|
the_token = strtok( readLine, " ,;\t#\n" ); |
824 |
|
foundSection = !strcmp( secHead, the_token ); |
825 |
|
|
865 |
– |
|
826 |
|
if( !foundSection ){ |
827 |
|
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
828 |
|
lineNum++; |
837 |
|
simError(); |
838 |
|
} |
839 |
|
} |
840 |
< |
} |
841 |
< |
|
840 |
> |
} |
841 |
> |
|
842 |
|
while( !foundText ){ |
843 |
< |
if( !foundText ){ |
844 |
< |
fgetpos( frcFile, tempPos ); |
845 |
< |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
846 |
< |
lineNum++; |
847 |
< |
|
848 |
< |
if( eof_test == NULL ){ |
849 |
< |
sprintf( painCave.errMsg, |
850 |
< |
"Error fast forwarding force file for %s at " |
851 |
< |
"line %d: file ended unexpectedly.\n", |
852 |
< |
searchOwner, |
853 |
< |
lineNum ); |
854 |
< |
painCave.isFatal = 1; |
843 |
> |
|
844 |
> |
fgetpos( frcFile, tempPos ); |
845 |
> |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
846 |
> |
lineNum++; |
847 |
> |
|
848 |
> |
if( eof_test == NULL ){ |
849 |
> |
sprintf( painCave.errMsg, |
850 |
> |
"Error fast forwarding force file for %s at " |
851 |
> |
"line %d: file ended unexpectedly.\n", |
852 |
> |
searchOwner, |
853 |
> |
lineNum ); |
854 |
> |
painCave.isFatal = 1; |
855 |
|
simError(); |
856 |
< |
} |
897 |
< |
} |
856 |
> |
} |
857 |
|
|
858 |
|
the_token = strtok( readLine, " ,;\t#\n" ); |
859 |
< |
foundText = !strcmp( stopText, the_token ); |
859 |
> |
if( the_token != NULL ){ |
860 |
> |
foundText = !strcmp( stopText, the_token ); |
861 |
> |
} |
862 |
|
} |
863 |
< |
|
864 |
< |
fsetPos( frcFile, tempPos ); |
863 |
> |
fsetpos( frcFile, tempPos ); |
864 |
> |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
865 |
> |
lineNum++; |
866 |
|
} |
867 |
|
|
868 |
|
|
977 |
|
simError(); |
978 |
|
} |
979 |
|
|
980 |
< |
info.I_xx = atof( the_token ); |
980 |
> |
info.Ixx = atof( the_token ); |
981 |
|
|
982 |
|
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
983 |
|
sprintf( painCave.errMsg, |
986 |
|
simError(); |
987 |
|
} |
988 |
|
|
989 |
< |
info.I_yy = atof( the_token ); |
989 |
> |
info.Iyy = atof( the_token ); |
990 |
|
|
991 |
|
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
992 |
|
sprintf( painCave.errMsg, |
995 |
|
simError(); |
996 |
|
} |
997 |
|
|
998 |
< |
info.I_zz = atof( the_token ); |
998 |
> |
info.Izz = atof( the_token ); |
999 |
|
|
1000 |
|
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1001 |
|
sprintf( painCave.errMsg, |