| 8 |
|
#include "UseTheForce/ForceFields.hpp" |
| 9 |
|
#include "primitives/SRI.hpp" |
| 10 |
|
#include "utils/simError.h" |
| 11 |
< |
|
| 12 |
< |
#include "UseTheForce/fortranWrappers.hpp" |
| 11 |
> |
#include "types/DirectionalAtomType.hpp" |
| 12 |
> |
#include "UseTheForce/DarkSide/lj_interface.h" |
| 13 |
> |
#include "UseTheForce/DarkSide/dipole_interface.h" |
| 14 |
> |
#include "UseTheForce/DarkSide/sticky_interface.h" |
| 15 |
|
|
| 16 |
|
#ifdef IS_MPI |
| 17 |
|
#include "UseTheForce/mpiForceField.h" |
| 454 |
|
|
| 455 |
|
DUFF::DUFF(){ |
| 456 |
|
|
| 457 |
< |
char fileName[200]; |
| 458 |
< |
char* ffPath_env = "FORCE_PARAM_PATH"; |
| 457 |
< |
char* ffPath; |
| 458 |
< |
char temp[200]; |
| 457 |
> |
string fileName; |
| 458 |
> |
string tempString; |
| 459 |
|
|
| 460 |
|
headAtomType = NULL; |
| 461 |
|
currentAtomType = NULL; |
| 466 |
|
headTorsionType = NULL; |
| 467 |
|
currentTorsionType = NULL; |
| 468 |
|
|
| 469 |
– |
// do the funtion wrapping |
| 470 |
– |
wrapMeFF( this ); |
| 469 |
|
|
| 472 |
– |
|
| 470 |
|
#ifdef IS_MPI |
| 471 |
|
int i; |
| 472 |
|
|
| 565 |
|
|
| 566 |
|
// generate the force file name |
| 567 |
|
|
| 568 |
< |
strcpy( fileName, "DUFF.frc" ); |
| 568 |
> |
fileName = "DUFF.frc"; |
| 569 |
|
// fprintf( stderr,"Trying to open %s\n", fileName ); |
| 570 |
|
|
| 571 |
|
// attempt to open the file in the current directory first. |
| 572 |
|
|
| 573 |
< |
frcFile = fopen( fileName, "r" ); |
| 573 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
| 574 |
|
|
| 575 |
|
if( frcFile == NULL ){ |
| 576 |
|
|
| 577 |
|
// next see if the force path enviorment variable is set |
| 578 |
< |
|
| 579 |
< |
ffPath = getenv( ffPath_env ); |
| 580 |
< |
if( ffPath == NULL ) { |
| 581 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
| 582 |
< |
} |
| 578 |
> |
|
| 579 |
> |
tempString = ffPath + "/" + fileName; |
| 580 |
> |
fileName = tempString; |
| 581 |
> |
|
| 582 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
| 583 |
|
|
| 587 |
– |
|
| 588 |
– |
strcpy( temp, ffPath ); |
| 589 |
– |
strcat( temp, "/" ); |
| 590 |
– |
strcat( temp, fileName ); |
| 591 |
– |
strcpy( fileName, temp ); |
| 592 |
– |
|
| 593 |
– |
frcFile = fopen( fileName, "r" ); |
| 594 |
– |
|
| 584 |
|
if( frcFile == NULL ){ |
| 585 |
|
|
| 586 |
|
sprintf( painCave.errMsg, |
| 588 |
|
"\t%s\n" |
| 589 |
|
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
| 590 |
|
"variable?\n", |
| 591 |
< |
fileName ); |
| 591 |
> |
fileName.c_str() ); |
| 592 |
|
painCave.severity = OOPSE_ERROR; |
| 593 |
|
painCave.isFatal = 1; |
| 594 |
|
simError(); |
| 642 |
|
} |
| 643 |
|
|
| 644 |
|
|
| 645 |
< |
void DUFF::initForceField( int ljMixRule ){ |
| 645 |
> |
void DUFF::initForceField(){ |
| 646 |
|
|
| 647 |
< |
initFortran( ljMixRule, entry_plug->useReactionField ); |
| 647 |
> |
initFortran( entry_plug->useReactionField ); |
| 648 |
|
} |
| 649 |
|
|
| 661 |
– |
double DUFF::getAtomTypeMass (char* atomType) { |
| 650 |
|
|
| 663 |
– |
currentAtomType = headAtomType->find( atomType ); |
| 664 |
– |
if( currentAtomType == NULL ){ |
| 665 |
– |
sprintf( painCave.errMsg, |
| 666 |
– |
"AtomType error, %s not found in force file.\n", |
| 667 |
– |
atomType ); |
| 668 |
– |
painCave.isFatal = 1; |
| 669 |
– |
simError(); |
| 670 |
– |
} |
| 671 |
– |
|
| 672 |
– |
return currentAtomType->mass; |
| 673 |
– |
} |
| 674 |
– |
|
| 651 |
|
void DUFF::readParams( void ){ |
| 652 |
|
|
| 653 |
< |
int identNum; |
| 653 |
> |
int identNum, isError; |
| 654 |
|
|
| 655 |
|
atomStruct atomInfo; |
| 656 |
|
bondStruct bondInfo; |
| 657 |
|
bendStruct bendInfo; |
| 658 |
|
torsionStruct torsionInfo; |
| 659 |
+ |
|
| 660 |
+ |
AtomType* at; |
| 661 |
|
|
| 662 |
|
bigSigma = 0.0; |
| 663 |
|
|
| 758 |
|
} |
| 759 |
|
|
| 760 |
|
#endif // is_mpi |
| 761 |
< |
|
| 784 |
< |
|
| 785 |
< |
|
| 786 |
< |
// call new A_types in fortran |
| 787 |
< |
|
| 788 |
< |
int isError; |
| 789 |
< |
|
| 761 |
> |
|
| 762 |
|
// dummy variables |
| 763 |
< |
|
| 764 |
< |
int isGB = 0; |
| 765 |
< |
int isLJ = 1; |
| 766 |
< |
int isEAM =0; |
| 767 |
< |
int isCharge = 0; |
| 768 |
< |
double charge=0.0; |
| 769 |
< |
|
| 770 |
< |
currentAtomType = headAtomType->next;; |
| 771 |
< |
while( currentAtomType != NULL ){ |
| 772 |
< |
|
| 773 |
< |
if(currentAtomType->isDipole) entry_plug->useDipoles = 1; |
| 774 |
< |
if(currentAtomType->isSSD) { |
| 775 |
< |
entry_plug->useSticky = 1; |
| 776 |
< |
set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0), |
| 777 |
< |
&(currentAtomType->v0p), |
| 778 |
< |
&(currentAtomType->rl), &(currentAtomType->ru), |
| 779 |
< |
&(currentAtomType->rlp), &(currentAtomType->rup)); |
| 763 |
> |
|
| 764 |
> |
currentAtomType = headAtomType->next;; |
| 765 |
> |
while( currentAtomType != NULL ){ |
| 766 |
> |
|
| 767 |
> |
if( currentAtomType->name[0] != '\0' ){ |
| 768 |
> |
|
| 769 |
> |
if (currentAtomType->isSSD || currentAtomType->isDipole) |
| 770 |
> |
at = new DirectionalAtomType(); |
| 771 |
> |
else |
| 772 |
> |
at = new AtomType(); |
| 773 |
> |
|
| 774 |
> |
if (currentAtomType->isSSD) { |
| 775 |
> |
((DirectionalAtomType*)at)->setSticky(); |
| 776 |
> |
} |
| 777 |
> |
|
| 778 |
> |
if (currentAtomType->isDipole) { |
| 779 |
> |
((DirectionalAtomType*)at)->setDipole(); |
| 780 |
> |
} |
| 781 |
> |
|
| 782 |
> |
at->setIdent(currentAtomType->ident); |
| 783 |
> |
at->setName(currentAtomType->name); |
| 784 |
> |
at->setLennardJones(); |
| 785 |
> |
at->complete(); |
| 786 |
|
} |
| 787 |
+ |
currentAtomType = currentAtomType->next; |
| 788 |
+ |
} |
| 789 |
+ |
|
| 790 |
+ |
currentAtomType = headAtomType->next;; |
| 791 |
+ |
while( currentAtomType != NULL ){ |
| 792 |
|
|
| 793 |
|
if( currentAtomType->name[0] != '\0' ){ |
| 794 |
|
isError = 0; |
| 795 |
< |
makeAtype( &(currentAtomType->ident), |
| 796 |
< |
&isLJ, |
| 814 |
< |
&(currentAtomType->isSSD), |
| 815 |
< |
&(currentAtomType->isDipole), |
| 816 |
< |
&isGB, |
| 817 |
< |
&isEAM, |
| 818 |
< |
&isCharge, |
| 819 |
< |
&(currentAtomType->epslon), |
| 820 |
< |
&(currentAtomType->sigma), |
| 821 |
< |
&charge, |
| 822 |
< |
&(currentAtomType->dipole), |
| 823 |
< |
&isError ); |
| 795 |
> |
newLJtype( &(currentAtomType->ident), &(currentAtomType->sigma), |
| 796 |
> |
&(currentAtomType->epslon), &isError); |
| 797 |
|
if( isError ){ |
| 798 |
< |
sprintf( painCave.errMsg, |
| 799 |
< |
"Error initializing the \"%s\" atom type in fortran\n", |
| 800 |
< |
currentAtomType->name ); |
| 801 |
< |
painCave.isFatal = 1; |
| 802 |
< |
simError(); |
| 798 |
> |
sprintf( painCave.errMsg, |
| 799 |
> |
"Error initializing the \"%s\" LJ type in fortran\n", |
| 800 |
> |
currentAtomType->name ); |
| 801 |
> |
painCave.isFatal = 1; |
| 802 |
> |
simError(); |
| 803 |
> |
} |
| 804 |
> |
|
| 805 |
> |
if (currentAtomType->isDipole) { |
| 806 |
> |
newDipoleType(&(currentAtomType->ident), &(currentAtomType->dipole), |
| 807 |
> |
&isError); |
| 808 |
> |
if( isError ){ |
| 809 |
> |
sprintf( painCave.errMsg, |
| 810 |
> |
"Error initializing the \"%s\" dipole type in fortran\n", |
| 811 |
> |
currentAtomType->name ); |
| 812 |
> |
painCave.isFatal = 1; |
| 813 |
> |
simError(); |
| 814 |
> |
} |
| 815 |
> |
} |
| 816 |
> |
|
| 817 |
> |
if(currentAtomType->isSSD) { |
| 818 |
> |
makeStickyType( &(currentAtomType->w0), &(currentAtomType->v0), |
| 819 |
> |
&(currentAtomType->v0p), |
| 820 |
> |
&(currentAtomType->rl), &(currentAtomType->ru), |
| 821 |
> |
&(currentAtomType->rlp), &(currentAtomType->rup)); |
| 822 |
|
} |
| 823 |
+ |
|
| 824 |
|
} |
| 825 |
|
currentAtomType = currentAtomType->next; |
| 826 |
|
} |
| 1083 |
|
MPIcheckPoint(); |
| 1084 |
|
|
| 1085 |
|
#endif // is_mpi |
| 1093 |
– |
|
| 1094 |
– |
entry_plug->useLJ = 1; |
| 1086 |
|
} |
| 1087 |
|
|
| 1088 |
|
|
| 1142 |
|
the_atoms[i]->setMass( currentAtomType->mass ); |
| 1143 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
| 1144 |
|
|
| 1145 |
+ |
if (currentAtomType->isSSD) entry_plug->useSticky = 1; |
| 1146 |
+ |
if (currentAtomType->isDipole) entry_plug->useDipoles = 1; |
| 1147 |
+ |
// Fix this later. We'll set it a bunch of times. |
| 1148 |
+ |
entry_plug->useLennardJones = 1; |
| 1149 |
+ |
|
| 1150 |
+ |
|
| 1151 |
|
if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; |
| 1152 |
|
|
| 1153 |
|
if( currentAtomType->isDipole ){ |