12 |
|
#include "UseTheForce/ForceFields.hpp" |
13 |
|
#include "primitives/SRI.hpp" |
14 |
|
#include "utils/simError.h" |
15 |
< |
|
16 |
< |
|
17 |
< |
#include "UseTheForce/DarkSide/atype_interface.h" |
15 |
> |
#include "types/DirectionalAtomType.hpp" |
16 |
> |
#include "UseTheForce/DarkSide/lj_interface.h" |
17 |
> |
#include "UseTheForce/DarkSide/charge_interface.h" |
18 |
> |
#include "UseTheForce/DarkSide/dipole_interface.h" |
19 |
|
#include "UseTheForce/DarkSide/sticky_interface.h" |
20 |
|
|
21 |
|
#ifdef IS_MPI |
392 |
|
} |
393 |
|
|
394 |
|
|
395 |
< |
void WATER::initForceField( int ljMixRule ){ |
395 |
> |
void WATER::initForceField(){ |
396 |
|
|
397 |
< |
initFortran( ljMixRule, entry_plug->useReactionField ); |
397 |
> |
initFortran(entry_plug->useReactionField ); |
398 |
|
} |
399 |
|
|
400 |
|
|
401 |
|
void WATER::readParams( void ){ |
402 |
|
|
403 |
< |
int identNum; |
403 |
> |
int identNum, isError; |
404 |
|
int tempDirect0, tempDirect1; |
405 |
|
|
406 |
|
atomStruct atomInfo; |
407 |
|
directionalStruct directionalInfo; |
408 |
|
fpos_t *atomPos; |
409 |
|
|
410 |
+ |
AtomType* at; |
411 |
+ |
|
412 |
|
atomInfo.last = 1; // initialize last to have the last set. |
413 |
|
directionalInfo.last = 1; // if things go well, last will be set to 0 |
414 |
|
|
547 |
|
|
548 |
|
#endif // is_mpi |
549 |
|
|
547 |
– |
// call new A_types in fortran |
548 |
– |
|
549 |
– |
int isError; |
550 |
– |
|
550 |
|
// dummy variables |
552 |
– |
int isGB = 0; |
553 |
– |
int isEAM = 0; |
554 |
– |
int notDipole = 0; |
555 |
– |
int notSSD = 0; |
556 |
– |
double noDipMoment = 0.0; |
551 |
|
|
558 |
– |
|
552 |
|
currentAtomType = headAtomType->next; |
553 |
|
currentDirectionalType = headDirectionalType->next; |
554 |
|
|
555 |
|
while( currentAtomType != NULL ){ |
556 |
< |
|
557 |
< |
if( currentAtomType->isLJ ) entry_plug->useLJ = 1; |
558 |
< |
if( currentAtomType->isCharge ) entry_plug->useCharges = 1; |
559 |
< |
if( currentAtomType->isDirectional ){ |
560 |
< |
// only directional atoms can have dipoles or be sticky |
561 |
< |
if ( currentDirectionalType->isDipole ) entry_plug->useDipoles = 1; |
562 |
< |
if ( currentDirectionalType->isSticky ) { |
563 |
< |
entry_plug->useSticky = 1; |
571 |
< |
set_sticky_params( &(currentDirectionalType->w0), |
572 |
< |
&(currentDirectionalType->v0), |
573 |
< |
&(currentDirectionalType->v0p), |
574 |
< |
&(currentDirectionalType->rl), |
575 |
< |
&(currentDirectionalType->ru), |
576 |
< |
&(currentDirectionalType->rlp), |
577 |
< |
&(currentDirectionalType->rup)); |
556 |
> |
if( currentAtomType->name[0] != '\0' ){ |
557 |
> |
if (currentAtomType->isDirectional) |
558 |
> |
DirectionalAtomType* at = new DirectionalAtomType(); |
559 |
> |
else |
560 |
> |
AtomType* at = new AtomType(); |
561 |
> |
|
562 |
> |
if (currentAtomType->isLJ) { |
563 |
> |
at->setLennardJones(); |
564 |
|
} |
565 |
< |
if( currentAtomType->name[0] != '\0' ){ |
566 |
< |
isError = 0; |
567 |
< |
makeAtype( &(currentAtomType->ident), |
568 |
< |
&(currentAtomType->isLJ), |
569 |
< |
&(currentDirectionalType->isSticky), |
570 |
< |
&(currentDirectionalType->isDipole), |
571 |
< |
&isGB, |
572 |
< |
&isEAM, |
573 |
< |
&(currentAtomType->isCharge), |
574 |
< |
&(currentAtomType->epslon), |
575 |
< |
&(currentAtomType->sigma), |
576 |
< |
&(currentAtomType->charge), |
577 |
< |
&(currentDirectionalType->dipole), |
578 |
< |
&isError ); |
593 |
< |
if( isError ){ |
594 |
< |
sprintf( painCave.errMsg, |
595 |
< |
"Error initializing the \"%s\" atom type in fortran\n", |
596 |
< |
currentAtomType->name ); |
597 |
< |
painCave.isFatal = 1; |
598 |
< |
simError(); |
565 |
> |
|
566 |
> |
if (currentAtomType->isCharge) { |
567 |
> |
at->setCharge(); |
568 |
> |
} |
569 |
> |
|
570 |
> |
if (currentAtomType->isDirectional) { |
571 |
> |
if (currentDirectionalType->isSticky) { |
572 |
> |
((DirectionalAtomType*)at)->setDipole(); |
573 |
> |
entry_plug->useDipoles = 1; |
574 |
> |
} |
575 |
> |
|
576 |
> |
if (currentDirectionalType->isSticky) { |
577 |
> |
((DirectionalAtomType*)at)->setSticky(); |
578 |
> |
entry_plug->useSticky = 1; |
579 |
|
} |
580 |
|
} |
581 |
< |
currentDirectionalType->next; |
581 |
> |
|
582 |
> |
at->setIdent(currentAtomType->ident); |
583 |
> |
at->setName(currentAtomType->name); |
584 |
> |
at->complete(); |
585 |
|
} |
586 |
+ |
currentAtomType = currentAtomType->next; |
587 |
+ |
} |
588 |
|
|
589 |
< |
else { |
590 |
< |
// use all dummy variables if this is not a directional atom |
591 |
< |
if( currentAtomType->name[0] != '\0' ){ |
592 |
< |
isError = 0; |
593 |
< |
makeAtype( &(currentAtomType->ident), |
594 |
< |
&(currentAtomType->isLJ), |
595 |
< |
¬SSD, |
596 |
< |
¬Dipole, |
597 |
< |
&isGB, |
598 |
< |
&isEAM, |
599 |
< |
&(currentAtomType->isCharge), |
600 |
< |
&(currentAtomType->epslon), |
601 |
< |
&(currentAtomType->sigma), |
602 |
< |
&(currentAtomType->charge), |
603 |
< |
&noDipMoment, |
604 |
< |
&isError ); |
589 |
> |
currentAtomType = headAtomType->next; |
590 |
> |
currentDirectionalType = headDirectionalType->next; |
591 |
> |
|
592 |
> |
while( currentAtomType != NULL ){ |
593 |
> |
|
594 |
> |
if( currentAtomType->isLJ ){ |
595 |
> |
isError = 0; |
596 |
> |
newLJtype( &(currentAtomType->ident), &(currentAtomType->sigma), |
597 |
> |
&(currentAtomType->epslon), &isError); |
598 |
> |
if( isError ){ |
599 |
> |
sprintf( painCave.errMsg, |
600 |
> |
"Error initializing the \"%s\" LJ type in fortran\n", |
601 |
> |
currentAtomType->name ); |
602 |
> |
painCave.isFatal = 1; |
603 |
> |
simError(); |
604 |
> |
} |
605 |
> |
} |
606 |
> |
|
607 |
> |
if (currentAtomType->isCharge) { |
608 |
> |
newChargeType(&(currentAtomType->ident), &(currentAtomType->charge), |
609 |
> |
&isError); |
610 |
> |
if( isError ){ |
611 |
> |
sprintf( painCave.errMsg, |
612 |
> |
"Error initializing the \"%s\" charge type in fortran\n", |
613 |
> |
currentAtomType->name ); |
614 |
> |
painCave.isFatal = 1; |
615 |
> |
simError(); |
616 |
> |
} |
617 |
> |
} |
618 |
> |
|
619 |
> |
if (currentAtomType->isDirectional){ |
620 |
> |
if (currentDirectionalType->isDipole) { |
621 |
> |
newDipoleType(&(currentAtomType->ident), |
622 |
> |
&(currentDirectionalType->dipole), |
623 |
> |
&isError); |
624 |
|
if( isError ){ |
625 |
|
sprintf( painCave.errMsg, |
626 |
< |
"Error initializing the \"%s\" atom type in fortran\n", |
627 |
< |
currentAtomType->name ); |
626 |
> |
"Error initializing the \"%s\" dipole type in fortran\n", |
627 |
> |
currentDirectionalType->name ); |
628 |
|
painCave.isFatal = 1; |
629 |
|
simError(); |
630 |
|
} |
631 |
+ |
} |
632 |
+ |
|
633 |
+ |
if(currentDirectionalType->isSticky) { |
634 |
+ |
makeStickyType( &(currentDirectionalType->w0), |
635 |
+ |
&(currentDirectionalType->v0), |
636 |
+ |
&(currentDirectionalType->v0p), |
637 |
+ |
&(currentDirectionalType->rl), |
638 |
+ |
&(currentDirectionalType->ru), |
639 |
+ |
&(currentDirectionalType->rlp), |
640 |
+ |
&(currentDirectionalType->rup)); |
641 |
|
} |
642 |
|
} |
643 |
|
currentAtomType = currentAtomType->next; |
644 |
|
} |
645 |
< |
|
645 |
> |
|
646 |
|
#ifdef IS_MPI |
647 |
|
sprintf( checkPointMsg, |
648 |
|
"WATER atom and directional structures successfully" |
649 |
|
"sent to fortran\n" ); |
650 |
|
MPIcheckPoint(); |
651 |
|
#endif // is_mpi |
652 |
< |
|
652 |
> |
|
653 |
|
} |
654 |
|
|
655 |
|
|