| 114 |
|
|
| 115 |
|
if( next != NULL ) next->add(info); |
| 116 |
|
else{ |
| 117 |
< |
next = new LinkedType(); |
| 117 |
> |
next = new LinkedAtomType(); |
| 118 |
|
strcpy(next->name, info.name); |
| 119 |
|
next->isDipole = info.isDipole; |
| 120 |
|
next->isSSD = info.isSSD; |
| 197 |
|
|
| 198 |
|
if( next != NULL ) next->add(info); |
| 199 |
|
else{ |
| 200 |
< |
next = new LinkedType(); |
| 200 |
> |
next = new LinkedBondType(); |
| 201 |
|
strcpy(next->nameA, info.nameA); |
| 202 |
|
strcpy(next->nameB, info.nameB); |
| 203 |
|
strcpy(next->type, info.type); |
| 266 |
|
|
| 267 |
|
if( next != NULL ) next->add(info); |
| 268 |
|
else{ |
| 269 |
< |
next = new LinkedType(); |
| 269 |
> |
next = new LinkedBendType(); |
| 270 |
|
strcpy(next->nameA, info.nameA); |
| 271 |
|
strcpy(next->nameB, info.nameB); |
| 272 |
|
strcpy(next->nameC, info.nameC); |
| 350 |
|
|
| 351 |
|
if( next != NULL ) next->add(info); |
| 352 |
|
else{ |
| 353 |
< |
next = new LinkedType(); |
| 353 |
> |
next = new LinkedTorsionType(); |
| 354 |
|
strcpy(next->nameA, info.nameA); |
| 355 |
|
strcpy(next->nameB, info.nameB); |
| 356 |
|
strcpy(next->nameC, info.nameC); |
| 621 |
|
|
| 622 |
|
void TraPPE_ExFF::readParams( void ){ |
| 623 |
|
|
| 624 |
< |
int i; |
| 624 |
> |
int i, a, b, c, d; |
| 625 |
|
int identNum; |
| 626 |
+ |
char* atomA; |
| 627 |
+ |
char* atomB; |
| 628 |
+ |
char* atomC; |
| 629 |
+ |
char* atomD; |
| 630 |
|
|
| 631 |
|
atomStruct atomInfo; |
| 632 |
|
bondStruct bondInfo; |
| 633 |
|
bendStruct bendInfo; |
| 634 |
|
torsionStruct torsionInfo; |
| 635 |
|
|
| 636 |
< |
|
| 636 |
> |
bigSigma = 0.0; |
| 637 |
> |
|
| 638 |
|
atomInfo.last = 1; |
| 639 |
|
bondInfo.last = 1; |
| 640 |
|
bendInfo.last = 1; |
| 720 |
|
|
| 721 |
|
MPIcheckPoint(); |
| 722 |
|
|
| 723 |
< |
headAtomType = new LinkedType; |
| 723 |
> |
headAtomType = new LinkedAtomType; |
| 724 |
|
recieveFrcStruct( &atomInfo, mpiAtomStructType ); |
| 725 |
|
|
| 726 |
|
while( !atomInfo.last ){ |
| 792 |
|
|
| 793 |
|
|
| 794 |
|
// read in the bonds |
| 790 |
– |
|
| 795 |
|
|
| 796 |
< |
|
| 797 |
< |
|
| 798 |
< |
} |
| 796 |
> |
#ifdef IS_MPI |
| 797 |
> |
if( worldRank == 0 ){ |
| 798 |
> |
#endif |
| 799 |
> |
|
| 800 |
> |
// read in the bond types. |
| 801 |
> |
|
| 802 |
> |
headBondType = new LinkedBondType; |
| 803 |
> |
|
| 804 |
> |
fastForward( "BondTypes", "initializeBonds" ); |
| 805 |
|
|
| 806 |
+ |
// we are now at the bondTypes section |
| 807 |
|
|
| 808 |
< |
|
| 809 |
< |
void TraPPE_ExFF::initializeAtoms( void ){ |
| 810 |
< |
|
| 808 |
> |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 809 |
> |
lineNum++; |
| 810 |
> |
|
| 811 |
> |
|
| 812 |
> |
// read a line, and start parseing out the atom types |
| 813 |
|
|
| 814 |
+ |
if( eof_test == NULL ){ |
| 815 |
+ |
sprintf( painCave.errMsg, |
| 816 |
+ |
"Error in reading bonds from force file at line %d.\n", |
| 817 |
+ |
lineNum ); |
| 818 |
+ |
painCave.isFatal = 1; |
| 819 |
+ |
simError(); |
| 820 |
+ |
} |
| 821 |
+ |
|
| 822 |
+ |
// stop reading at end of file, or at next section |
| 823 |
+ |
while( readLine[0] != '#' && eof_test != NULL ){ |
| 824 |
+ |
|
| 825 |
+ |
// toss comment lines |
| 826 |
+ |
if( readLine[0] != '!' ){ |
| 827 |
+ |
|
| 828 |
+ |
// the parser returns 0 if the line was blank |
| 829 |
+ |
if( parseBond( readLine, lineNum, bondInfo ) ){ |
| 830 |
+ |
headBondType->add( bondInfo ); |
| 831 |
+ |
} |
| 832 |
+ |
} |
| 833 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 834 |
+ |
lineNum++; |
| 835 |
+ |
} |
| 836 |
+ |
|
| 837 |
+ |
#ifdef IS_MPI |
| 838 |
+ |
|
| 839 |
+ |
// send out the linked list to all the other processes |
| 840 |
+ |
|
| 841 |
+ |
sprintf( checkPointMsg, |
| 842 |
+ |
"TraPPE_Ex bond structures read successfully." ); |
| 843 |
+ |
MPIcheckPoint(); |
| 844 |
+ |
|
| 845 |
+ |
currentBondType = headBondType; |
| 846 |
+ |
while( currentBondType != NULL ){ |
| 847 |
+ |
currentBondType->duplicate( bondInfo ); |
| 848 |
+ |
sendFrcStruct( &bondInfo, mpiBondStructType ); |
| 849 |
+ |
currentBondType = currentBondType->next; |
| 850 |
+ |
} |
| 851 |
+ |
bondInfo.last = 1; |
| 852 |
+ |
sendFrcStruct( &bondInfo, mpiBondStructType ); |
| 853 |
+ |
|
| 854 |
+ |
} |
| 855 |
+ |
|
| 856 |
+ |
else{ |
| 857 |
+ |
|
| 858 |
+ |
// listen for node 0 to send out the force params |
| 859 |
+ |
|
| 860 |
+ |
MPIcheckPoint(); |
| 861 |
+ |
|
| 862 |
+ |
headBondType = new LinkedBondType; |
| 863 |
+ |
recieveFrcStruct( &bondInfo, mpiBondStructType ); |
| 864 |
+ |
while( !bondInfo.last ){ |
| 865 |
+ |
|
| 866 |
+ |
headBondType->add( bondInfo ); |
| 867 |
+ |
recieveFrcStruct( &bondInfo, mpiBondStructType ); |
| 868 |
+ |
} |
| 869 |
+ |
} |
| 870 |
+ |
#endif // is_mpi |
| 871 |
|
|
| 872 |
+ |
|
| 873 |
+ |
// read in the bends |
| 874 |
+ |
|
| 875 |
+ |
#ifdef IS_MPI |
| 876 |
+ |
if( worldRank == 0 ){ |
| 877 |
+ |
#endif |
| 878 |
+ |
|
| 879 |
+ |
// read in the bend types. |
| 880 |
+ |
|
| 881 |
+ |
headBendType = new LinkedBendType; |
| 882 |
+ |
|
| 883 |
+ |
fastForward( "BendTypes", "initializeBends" ); |
| 884 |
+ |
|
| 885 |
+ |
// we are now at the bendTypes section |
| 886 |
+ |
|
| 887 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 888 |
+ |
lineNum++; |
| 889 |
+ |
|
| 890 |
+ |
// read a line, and start parseing out the bend types |
| 891 |
+ |
|
| 892 |
+ |
if( eof_test == NULL ){ |
| 893 |
+ |
sprintf( painCave.errMsg, |
| 894 |
+ |
"Error in reading bends from force file at line %d.\n", |
| 895 |
+ |
lineNum ); |
| 896 |
+ |
painCave.isFatal = 1; |
| 897 |
+ |
simError(); |
| 898 |
+ |
} |
| 899 |
+ |
|
| 900 |
+ |
// stop reading at end of file, or at next section |
| 901 |
+ |
while( readLine[0] != '#' && eof_test != NULL ){ |
| 902 |
+ |
|
| 903 |
+ |
// toss comment lines |
| 904 |
+ |
if( readLine[0] != '!' ){ |
| 905 |
+ |
|
| 906 |
+ |
// the parser returns 0 if the line was blank |
| 907 |
+ |
if( parseBend( readLine, lineNum, bendInfo ) ){ |
| 908 |
+ |
headBendType->add( bendInfo ); |
| 909 |
+ |
} |
| 910 |
+ |
} |
| 911 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 912 |
+ |
lineNum++; |
| 913 |
+ |
} |
| 914 |
+ |
|
| 915 |
+ |
#ifdef IS_MPI |
| 916 |
+ |
|
| 917 |
+ |
// send out the linked list to all the other processes |
| 918 |
+ |
|
| 919 |
+ |
sprintf( checkPointMsg, |
| 920 |
+ |
"TraPPE_Ex bend structures read successfully." ); |
| 921 |
+ |
MPIcheckPoint(); |
| 922 |
+ |
|
| 923 |
+ |
currentBendType = headBendType; |
| 924 |
+ |
while( currentBendType != NULL ){ |
| 925 |
+ |
currentBendType->duplicate( bendInfo ); |
| 926 |
+ |
sendFrcStruct( &bendInfo, mpiBendStructType ); |
| 927 |
+ |
currentBendType = currentBendType->next; |
| 928 |
+ |
} |
| 929 |
+ |
bendInfo.last = 1; |
| 930 |
+ |
sendFrcStruct( &bendInfo, mpiBendStructType ); |
| 931 |
+ |
|
| 932 |
+ |
} |
| 933 |
|
|
| 934 |
+ |
else{ |
| 935 |
+ |
|
| 936 |
+ |
// listen for node 0 to send out the force params |
| 937 |
+ |
|
| 938 |
+ |
MPIcheckPoint(); |
| 939 |
|
|
| 940 |
+ |
headBendType = new LinkedBendType; |
| 941 |
+ |
recieveFrcStruct( &bendInfo, mpiBendStructType ); |
| 942 |
+ |
while( !bendInfo.last ){ |
| 943 |
+ |
|
| 944 |
+ |
headBendType->add( bendInfo ); |
| 945 |
+ |
recieveFrcStruct( &bendInfo, mpiBendStructType ); |
| 946 |
+ |
} |
| 947 |
+ |
} |
| 948 |
+ |
#endif // is_mpi |
| 949 |
+ |
|
| 950 |
+ |
|
| 951 |
+ |
// read in the torsions |
| 952 |
+ |
|
| 953 |
+ |
#ifdef IS_MPI |
| 954 |
+ |
if( worldRank == 0 ){ |
| 955 |
+ |
#endif |
| 956 |
+ |
|
| 957 |
+ |
// read in the torsion types. |
| 958 |
+ |
|
| 959 |
+ |
headTorsionType = new LinkedTorsionType; |
| 960 |
+ |
|
| 961 |
+ |
fastForward( "TorsionTypes", "initializeTorsions" ); |
| 962 |
+ |
|
| 963 |
+ |
// we are now at the torsionTypes section |
| 964 |
+ |
|
| 965 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 966 |
+ |
lineNum++; |
| 967 |
+ |
|
| 968 |
+ |
|
| 969 |
+ |
// read a line, and start parseing out the atom types |
| 970 |
+ |
|
| 971 |
+ |
if( eof_test == NULL ){ |
| 972 |
+ |
sprintf( painCave.errMsg, |
| 973 |
+ |
"Error in reading torsions from force file at line %d.\n", |
| 974 |
+ |
lineNum ); |
| 975 |
+ |
painCave.isFatal = 1; |
| 976 |
+ |
simError(); |
| 977 |
+ |
} |
| 978 |
+ |
|
| 979 |
+ |
// stop reading at end of file, or at next section |
| 980 |
+ |
while( readLine[0] != '#' && eof_test != NULL ){ |
| 981 |
+ |
|
| 982 |
+ |
// toss comment lines |
| 983 |
+ |
if( readLine[0] != '!' ){ |
| 984 |
+ |
|
| 985 |
+ |
// the parser returns 0 if the line was blank |
| 986 |
+ |
if( parseTorsion( readLine, lineNum, torsionInfo ) ){ |
| 987 |
+ |
headTorsionType->add( torsionInfo ); |
| 988 |
+ |
|
| 989 |
+ |
} |
| 990 |
+ |
} |
| 991 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 992 |
+ |
lineNum++; |
| 993 |
+ |
} |
| 994 |
+ |
|
| 995 |
+ |
#ifdef IS_MPI |
| 996 |
+ |
|
| 997 |
+ |
// send out the linked list to all the other processes |
| 998 |
+ |
|
| 999 |
+ |
sprintf( checkPointMsg, |
| 1000 |
+ |
"TraPPE_Ex torsion structures read successfully." ); |
| 1001 |
+ |
MPIcheckPoint(); |
| 1002 |
+ |
|
| 1003 |
+ |
currentTorsionType = headTorsionType; |
| 1004 |
+ |
while( currentTorsionType != NULL ){ |
| 1005 |
+ |
currentTorsionType->duplicate( torsionInfo ); |
| 1006 |
+ |
sendFrcStruct( &torsionInfo, mpiTorsionStructType ); |
| 1007 |
+ |
currentTorsionType = currentTorsionType->next; |
| 1008 |
+ |
} |
| 1009 |
+ |
torsionInfo.last = 1; |
| 1010 |
+ |
sendFrcStruct( &torsionInfo, mpiTorsionStructType ); |
| 1011 |
+ |
|
| 1012 |
+ |
} |
| 1013 |
+ |
|
| 1014 |
+ |
else{ |
| 1015 |
+ |
|
| 1016 |
+ |
// listen for node 0 to send out the force params |
| 1017 |
+ |
|
| 1018 |
+ |
MPIcheckPoint(); |
| 1019 |
+ |
|
| 1020 |
+ |
headTorsionType = new LinkedTorsionType; |
| 1021 |
+ |
recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
| 1022 |
+ |
while( !torsionInfo.last ){ |
| 1023 |
+ |
|
| 1024 |
+ |
headTorsionType->add( torsionInfo ); |
| 1025 |
+ |
recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
| 1026 |
+ |
} |
| 1027 |
+ |
} |
| 1028 |
+ |
#endif // is_mpi |
| 1029 |
+ |
|
| 1030 |
+ |
} |
| 1031 |
+ |
|
| 1032 |
+ |
|
| 1033 |
+ |
|
| 1034 |
+ |
void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
| 1035 |
|
|
| 805 |
– |
Atom** the_atoms; |
| 806 |
– |
int nAtoms; |
| 807 |
– |
the_atoms = entry_plug->atoms; |
| 808 |
– |
nAtoms = entry_plug->n_atoms; |
| 1036 |
|
|
| 1037 |
|
////////////////////////////////////////////////// |
| 1038 |
|
// a quick water fix |
| 1064 |
|
headI[2][1] = 0.0; |
| 1065 |
|
headI[2][2] = 250; |
| 1066 |
|
|
| 840 |
– |
|
| 841 |
– |
|
| 1067 |
|
////////////////////////////////////////////////// |
| 1068 |
|
|
| 844 |
– |
|
| 845 |
– |
|
| 1069 |
|
|
| 1070 |
|
// initialize the atoms |
| 1071 |
|
|
| 849 |
– |
double bigSigma = 0.0; |
| 1072 |
|
DirectionalAtom* dAtom; |
| 1073 |
|
|
| 1074 |
< |
for( i=0; i<nAtoms; i++ ){ |
| 1074 |
> |
for(int i=0; i<nAtoms; i++ ){ |
| 1075 |
|
|
| 854 |
– |
|
| 1076 |
|
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
| 1077 |
|
if( currentAtomType == NULL ){ |
| 1078 |
|
sprintf( painCave.errMsg, |
| 1139 |
|
} |
| 1140 |
|
} |
| 1141 |
|
|
| 921 |
– |
#ifdef IS_MPI |
| 922 |
– |
double tempBig = bigSigma; |
| 923 |
– |
MPI::COMM_WORLD.Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX ); |
| 924 |
– |
#endif //is_mpi |
| 1142 |
|
|
| 926 |
– |
//calc rCut and rList |
| 927 |
– |
|
| 928 |
– |
entry_plug->rCut = 2.5 * bigSigma; |
| 929 |
– |
|
| 930 |
– |
if(entry_plug->rCut > (entry_plug->box_x / 2.0)) |
| 931 |
– |
entry_plug->rCut = entry_plug->box_x / 2.0; |
| 932 |
– |
|
| 933 |
– |
if(entry_plug->rCut > (entry_plug->box_y / 2.0)) |
| 934 |
– |
entry_plug->rCut = entry_plug->box_y / 2.0; |
| 935 |
– |
|
| 936 |
– |
if(entry_plug->rCut > (entry_plug->box_z / 2.0)) |
| 937 |
– |
entry_plug->rCut = entry_plug->box_z / 2.0; |
| 938 |
– |
|
| 939 |
– |
entry_plug->rList = entry_plug->rCut + 1.0; |
| 940 |
– |
|
| 941 |
– |
entry_plug->useLJ = 1; // use Lennard Jones is on by default |
| 942 |
– |
|
| 943 |
– |
// clean up the memory |
| 944 |
– |
|
| 945 |
– |
delete headAtomType; |
| 946 |
– |
|
| 1143 |
|
#ifdef IS_MPI |
| 1144 |
|
sprintf( checkPointMsg, "TraPPE_Ex atoms initialized succesfully" ); |
| 1145 |
|
MPIcheckPoint(); |
| 1147 |
|
|
| 1148 |
|
} |
| 1149 |
|
|
| 1150 |
< |
void TraPPE_ExFF::initializeBonds( bond_pair* the_bonds ){ |
| 1150 |
> |
void TraPPE_ExFF::initializeBonds( int nBonds, Bond** bondArray, |
| 1151 |
> |
bond_pair* the_bonds ){ |
| 1152 |
> |
int i,a,b; |
| 1153 |
> |
char* atomA; |
| 1154 |
> |
char* atomB; |
| 1155 |
|
|
| 956 |
– |
|
| 957 |
– |
|
| 958 |
– |
|
| 959 |
– |
|
| 960 |
– |
|
| 961 |
– |
|
| 962 |
– |
info.last = 1; // initialize last to have the last set. |
| 963 |
– |
// if things go well, last will be set to 0 |
| 964 |
– |
|
| 965 |
– |
SRI **the_sris; |
| 1156 |
|
Atom** the_atoms; |
| 967 |
– |
int nBonds; |
| 968 |
– |
the_sris = entry_plug->sr_interactions; |
| 1157 |
|
the_atoms = entry_plug->atoms; |
| 970 |
– |
nBonds = entry_plug->n_bonds; |
| 971 |
– |
|
| 972 |
– |
int i, a, b; |
| 973 |
– |
char* atomA; |
| 974 |
– |
char* atomB; |
| 1158 |
|
|
| 976 |
– |
#ifdef IS_MPI |
| 977 |
– |
if( worldRank == 0 ){ |
| 978 |
– |
#endif |
| 979 |
– |
|
| 980 |
– |
// read in the bond types. |
| 981 |
– |
|
| 982 |
– |
headBondType = new LinkedType; |
| 983 |
– |
|
| 984 |
– |
fastForward( "BondTypes", "initializeBonds" ); |
| 1159 |
|
|
| 986 |
– |
// we are now at the bondTypes section |
| 987 |
– |
|
| 988 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 989 |
– |
lineNum++; |
| 990 |
– |
|
| 991 |
– |
|
| 992 |
– |
// read a line, and start parseing out the atom types |
| 993 |
– |
|
| 994 |
– |
if( eof_test == NULL ){ |
| 995 |
– |
sprintf( painCave.errMsg, |
| 996 |
– |
"Error in reading bonds from force file at line %d.\n", |
| 997 |
– |
lineNum ); |
| 998 |
– |
painCave.isFatal = 1; |
| 999 |
– |
simError(); |
| 1000 |
– |
} |
| 1001 |
– |
|
| 1002 |
– |
// stop reading at end of file, or at next section |
| 1003 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
| 1004 |
– |
|
| 1005 |
– |
// toss comment lines |
| 1006 |
– |
if( readLine[0] != '!' ){ |
| 1007 |
– |
|
| 1008 |
– |
// the parser returns 0 if the line was blank |
| 1009 |
– |
if( parseBond( readLine, lineNum, info ) ){ |
| 1010 |
– |
headBondType->add( info ); |
| 1011 |
– |
} |
| 1012 |
– |
} |
| 1013 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 1014 |
– |
lineNum++; |
| 1015 |
– |
} |
| 1016 |
– |
|
| 1017 |
– |
#ifdef IS_MPI |
| 1018 |
– |
|
| 1019 |
– |
// send out the linked list to all the other processes |
| 1020 |
– |
|
| 1021 |
– |
sprintf( checkPointMsg, |
| 1022 |
– |
"TraPPE_Ex bond structures read successfully." ); |
| 1023 |
– |
MPIcheckPoint(); |
| 1024 |
– |
|
| 1025 |
– |
currentBondType = headBondType; |
| 1026 |
– |
while( currentBondType != NULL ){ |
| 1027 |
– |
currentBondType->duplicate( info ); |
| 1028 |
– |
sendFrcStruct( &info, mpiBondStructType ); |
| 1029 |
– |
currentBondType = currentBondType->next; |
| 1030 |
– |
} |
| 1031 |
– |
info.last = 1; |
| 1032 |
– |
sendFrcStruct( &info, mpiBondStructType ); |
| 1033 |
– |
|
| 1034 |
– |
} |
| 1035 |
– |
|
| 1036 |
– |
else{ |
| 1037 |
– |
|
| 1038 |
– |
// listen for node 0 to send out the force params |
| 1039 |
– |
|
| 1040 |
– |
MPIcheckPoint(); |
| 1041 |
– |
|
| 1042 |
– |
headBondType = new LinkedType; |
| 1043 |
– |
recieveFrcStruct( &info, mpiBondStructType ); |
| 1044 |
– |
while( !info.last ){ |
| 1045 |
– |
|
| 1046 |
– |
headBondType->add( info ); |
| 1047 |
– |
recieveFrcStruct( &info, mpiBondStructType ); |
| 1048 |
– |
} |
| 1049 |
– |
} |
| 1050 |
– |
#endif // is_mpi |
| 1051 |
– |
|
| 1052 |
– |
|
| 1160 |
|
// initialize the Bonds |
| 1161 |
|
|
| 1055 |
– |
|
| 1162 |
|
for( i=0; i<nBonds; i++ ){ |
| 1163 |
|
|
| 1164 |
|
a = the_bonds[i].a; |
| 1177 |
|
|
| 1178 |
|
if( !strcmp( currentBondType->type, "fixed" ) ){ |
| 1179 |
|
|
| 1180 |
< |
the_sris[i] = new ConstrainedBond( *the_atoms[a], |
| 1181 |
< |
*the_atoms[b], |
| 1182 |
< |
currentBondType->d0 ); |
| 1180 |
> |
bondArray[i] = new ConstrainedBond( *the_atoms[a], |
| 1181 |
> |
*the_atoms[b], |
| 1182 |
> |
currentBondType->d0 ); |
| 1183 |
|
entry_plug->n_constraints++; |
| 1184 |
|
} |
| 1185 |
|
} |
| 1080 |
– |
|
| 1081 |
– |
|
| 1082 |
– |
// clean up the memory |
| 1186 |
|
|
| 1084 |
– |
delete headBondType; |
| 1085 |
– |
|
| 1187 |
|
#ifdef IS_MPI |
| 1188 |
|
sprintf( checkPointMsg, "TraPPE_Ex bonds initialized succesfully" ); |
| 1189 |
|
MPIcheckPoint(); |
| 1191 |
|
|
| 1192 |
|
} |
| 1193 |
|
|
| 1194 |
< |
void TraPPE_ExFF::initializeBends( bend_set* the_bends ){ |
| 1194 |
> |
void TraPPE_ExFF::initializeBends( int nBends, Bend** bendArray, |
| 1195 |
> |
bend_set* the_bends ){ |
| 1196 |
|
|
| 1095 |
– |
|
| 1096 |
– |
|
| 1097 |
– |
|
| 1098 |
– |
bendStruct info; |
| 1099 |
– |
info.last = 1; // initialize last to have the last set. |
| 1100 |
– |
// if things go well, last will be set to 0 |
| 1101 |
– |
|
| 1197 |
|
QuadraticBend* qBend; |
| 1198 |
|
GhostBend* gBend; |
| 1104 |
– |
SRI **the_sris; |
| 1199 |
|
Atom** the_atoms; |
| 1106 |
– |
int nBends; |
| 1107 |
– |
the_sris = entry_plug->sr_interactions; |
| 1200 |
|
the_atoms = entry_plug->atoms; |
| 1201 |
< |
nBends = entry_plug->n_bends; |
| 1110 |
< |
|
| 1201 |
> |
|
| 1202 |
|
int i, a, b, c; |
| 1203 |
|
char* atomA; |
| 1204 |
|
char* atomB; |
| 1205 |
|
char* atomC; |
| 1115 |
– |
|
| 1116 |
– |
|
| 1117 |
– |
#ifdef IS_MPI |
| 1118 |
– |
if( worldRank == 0 ){ |
| 1119 |
– |
#endif |
| 1120 |
– |
|
| 1121 |
– |
// read in the bend types. |
| 1122 |
– |
|
| 1123 |
– |
headBendType = new LinkedType; |
| 1124 |
– |
|
| 1125 |
– |
fastForward( "BendTypes", "initializeBends" ); |
| 1126 |
– |
|
| 1127 |
– |
// we are now at the bendTypes section |
| 1128 |
– |
|
| 1129 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 1130 |
– |
lineNum++; |
| 1131 |
– |
|
| 1132 |
– |
// read a line, and start parseing out the bend types |
| 1133 |
– |
|
| 1134 |
– |
if( eof_test == NULL ){ |
| 1135 |
– |
sprintf( painCave.errMsg, |
| 1136 |
– |
"Error in reading bends from force file at line %d.\n", |
| 1137 |
– |
lineNum ); |
| 1138 |
– |
painCave.isFatal = 1; |
| 1139 |
– |
simError(); |
| 1140 |
– |
} |
| 1141 |
– |
|
| 1142 |
– |
// stop reading at end of file, or at next section |
| 1143 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
| 1144 |
– |
|
| 1145 |
– |
// toss comment lines |
| 1146 |
– |
if( readLine[0] != '!' ){ |
| 1147 |
– |
|
| 1148 |
– |
// the parser returns 0 if the line was blank |
| 1149 |
– |
if( parseBend( readLine, lineNum, info ) ){ |
| 1150 |
– |
headBendType->add( info ); |
| 1151 |
– |
} |
| 1152 |
– |
} |
| 1153 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 1154 |
– |
lineNum++; |
| 1155 |
– |
} |
| 1156 |
– |
|
| 1157 |
– |
#ifdef IS_MPI |
| 1158 |
– |
|
| 1159 |
– |
// send out the linked list to all the other processes |
| 1160 |
– |
|
| 1161 |
– |
sprintf( checkPointMsg, |
| 1162 |
– |
"TraPPE_Ex bend structures read successfully." ); |
| 1163 |
– |
MPIcheckPoint(); |
| 1164 |
– |
|
| 1165 |
– |
currentBendType = headBendType; |
| 1166 |
– |
while( currentBendType != NULL ){ |
| 1167 |
– |
currentBendType->duplicate( info ); |
| 1168 |
– |
sendFrcStruct( &info, mpiBendStructType ); |
| 1169 |
– |
currentBendType = currentBendType->next; |
| 1170 |
– |
} |
| 1171 |
– |
info.last = 1; |
| 1172 |
– |
sendFrcStruct( &info, mpiBendStructType ); |
| 1173 |
– |
|
| 1174 |
– |
} |
| 1175 |
– |
|
| 1176 |
– |
else{ |
| 1177 |
– |
|
| 1178 |
– |
// listen for node 0 to send out the force params |
| 1179 |
– |
|
| 1180 |
– |
MPIcheckPoint(); |
| 1181 |
– |
|
| 1182 |
– |
headBendType = new LinkedType; |
| 1183 |
– |
recieveFrcStruct( &info, mpiBendStructType ); |
| 1184 |
– |
while( !info.last ){ |
| 1185 |
– |
|
| 1186 |
– |
headBendType->add( info ); |
| 1187 |
– |
recieveFrcStruct( &info, mpiBendStructType ); |
| 1188 |
– |
} |
| 1189 |
– |
} |
| 1190 |
– |
#endif // is_mpi |
| 1206 |
|
|
| 1207 |
|
// initialize the Bends |
| 1193 |
– |
|
| 1194 |
– |
int index; |
| 1208 |
|
|
| 1209 |
|
for( i=0; i<nBends; i++ ){ |
| 1210 |
|
|
| 1229 |
|
|
| 1230 |
|
if( !strcmp( currentBendType->type, "quadratic" ) ){ |
| 1231 |
|
|
| 1219 |
– |
index = i + entry_plug->n_bonds; |
| 1220 |
– |
|
| 1232 |
|
if( the_bends[i].isGhost){ |
| 1233 |
|
|
| 1234 |
|
if( the_bends[i].ghost == b ){ |
| 1256 |
|
currentBendType->k2, |
| 1257 |
|
currentBendType->k3, |
| 1258 |
|
currentBendType->t0 ); |
| 1259 |
< |
the_sris[index] = gBend; |
| 1259 |
> |
bendArray[i] = gBend; |
| 1260 |
|
} |
| 1261 |
|
else{ |
| 1262 |
|
qBend = new QuadraticBend( *the_atoms[a], |
| 1266 |
|
currentBendType->k2, |
| 1267 |
|
currentBendType->k3, |
| 1268 |
|
currentBendType->t0 ); |
| 1269 |
< |
the_sris[index] = qBend; |
| 1269 |
> |
bendArray[i] = qBend; |
| 1270 |
|
} |
| 1271 |
|
} |
| 1272 |
|
} |
| 1273 |
|
|
| 1263 |
– |
|
| 1264 |
– |
// clean up the memory |
| 1265 |
– |
|
| 1266 |
– |
delete headBendType; |
| 1267 |
– |
|
| 1274 |
|
#ifdef IS_MPI |
| 1275 |
|
sprintf( checkPointMsg, "TraPPE_Ex bends initialized succesfully" ); |
| 1276 |
|
MPIcheckPoint(); |
| 1278 |
|
|
| 1279 |
|
} |
| 1280 |
|
|
| 1281 |
< |
void TraPPE_ExFF::initializeTorsions( torsion_set* the_torsions ){ |
| 1281 |
> |
void TraPPE_ExFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
| 1282 |
> |
torsion_set* the_torsions ){ |
| 1283 |
|
|
| 1284 |
< |
|
| 1278 |
< |
|
| 1279 |
< |
|
| 1280 |
< |
torsionStruct info; |
| 1281 |
< |
info.last = 1; // initialize last to have the last set. |
| 1282 |
< |
// if things go well, last will be set to 0 |
| 1283 |
< |
|
| 1284 |
< |
int i, a, b, c, d, index; |
| 1284 |
> |
int i, a, b, c, d; |
| 1285 |
|
char* atomA; |
| 1286 |
|
char* atomB; |
| 1287 |
|
char* atomC; |
| 1288 |
|
char* atomD; |
| 1289 |
– |
CubicTorsion* cTors; |
| 1289 |
|
|
| 1290 |
< |
SRI **the_sris; |
| 1290 |
> |
CubicTorsion* cTors; |
| 1291 |
|
Atom** the_atoms; |
| 1293 |
– |
int nTorsions; |
| 1294 |
– |
the_sris = entry_plug->sr_interactions; |
| 1292 |
|
the_atoms = entry_plug->atoms; |
| 1296 |
– |
nTorsions = entry_plug->n_torsions; |
| 1297 |
– |
|
| 1298 |
– |
#ifdef IS_MPI |
| 1299 |
– |
if( worldRank == 0 ){ |
| 1300 |
– |
#endif |
| 1301 |
– |
|
| 1302 |
– |
// read in the torsion types. |
| 1303 |
– |
|
| 1304 |
– |
headTorsionType = new LinkedType; |
| 1305 |
– |
|
| 1306 |
– |
fastForward( "TorsionTypes", "initializeTorsions" ); |
| 1307 |
– |
|
| 1308 |
– |
// we are now at the torsionTypes section |
| 1309 |
– |
|
| 1310 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 1311 |
– |
lineNum++; |
| 1312 |
– |
|
| 1313 |
– |
|
| 1314 |
– |
// read a line, and start parseing out the atom types |
| 1315 |
– |
|
| 1316 |
– |
if( eof_test == NULL ){ |
| 1317 |
– |
sprintf( painCave.errMsg, |
| 1318 |
– |
"Error in reading torsions from force file at line %d.\n", |
| 1319 |
– |
lineNum ); |
| 1320 |
– |
painCave.isFatal = 1; |
| 1321 |
– |
simError(); |
| 1322 |
– |
} |
| 1323 |
– |
|
| 1324 |
– |
// stop reading at end of file, or at next section |
| 1325 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
| 1326 |
– |
|
| 1327 |
– |
// toss comment lines |
| 1328 |
– |
if( readLine[0] != '!' ){ |
| 1329 |
– |
|
| 1330 |
– |
// the parser returns 0 if the line was blank |
| 1331 |
– |
if( parseTorsion( readLine, lineNum, info ) ){ |
| 1332 |
– |
headTorsionType->add( info ); |
| 1333 |
– |
|
| 1334 |
– |
} |
| 1335 |
– |
} |
| 1336 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
| 1337 |
– |
lineNum++; |
| 1338 |
– |
} |
| 1339 |
– |
|
| 1340 |
– |
#ifdef IS_MPI |
| 1341 |
– |
|
| 1342 |
– |
// send out the linked list to all the other processes |
| 1343 |
– |
|
| 1344 |
– |
sprintf( checkPointMsg, |
| 1345 |
– |
"TraPPE_Ex torsion structures read successfully." ); |
| 1346 |
– |
MPIcheckPoint(); |
| 1347 |
– |
|
| 1348 |
– |
currentTorsionType = headTorsionType; |
| 1349 |
– |
while( currentTorsionType != NULL ){ |
| 1350 |
– |
currentTorsionType->duplicate( info ); |
| 1351 |
– |
sendFrcStruct( &info, mpiTorsionStructType ); |
| 1352 |
– |
currentTorsionType = currentTorsionType->next; |
| 1353 |
– |
} |
| 1354 |
– |
info.last = 1; |
| 1355 |
– |
sendFrcStruct( &info, mpiTorsionStructType ); |
| 1356 |
– |
|
| 1357 |
– |
} |
| 1358 |
– |
|
| 1359 |
– |
else{ |
| 1360 |
– |
|
| 1361 |
– |
// listen for node 0 to send out the force params |
| 1362 |
– |
|
| 1363 |
– |
MPIcheckPoint(); |
| 1364 |
– |
|
| 1365 |
– |
headTorsionType = new LinkedType; |
| 1366 |
– |
recieveFrcStruct( &info, mpiTorsionStructType ); |
| 1367 |
– |
while( !info.last ){ |
| 1293 |
|
|
| 1369 |
– |
headTorsionType->add( info ); |
| 1370 |
– |
recieveFrcStruct( &info, mpiTorsionStructType ); |
| 1371 |
– |
} |
| 1372 |
– |
} |
| 1373 |
– |
#endif // is_mpi |
| 1374 |
– |
|
| 1294 |
|
// initialize the Torsions |
| 1295 |
|
|
| 1296 |
|
for( i=0; i<nTorsions; i++ ){ |
| 1315 |
|
} |
| 1316 |
|
|
| 1317 |
|
if( !strcmp( currentTorsionType->type, "cubic" ) ){ |
| 1399 |
– |
index = i + entry_plug->n_bonds + entry_plug->n_bends; |
| 1318 |
|
|
| 1319 |
|
cTors = new CubicTorsion( *the_atoms[a], *the_atoms[b], |
| 1320 |
|
*the_atoms[c], *the_atoms[d] ); |
| 1321 |
|
cTors->setConstants( currentTorsionType->k1, currentTorsionType->k2, |
| 1322 |
|
currentTorsionType->k3, currentTorsionType->k4 ); |
| 1323 |
< |
the_sris[index] = cTors; |
| 1323 |
> |
torsionArray[i] = cTors; |
| 1324 |
|
} |
| 1325 |
|
} |
| 1408 |
– |
|
| 1409 |
– |
|
| 1410 |
– |
// clean up the memory |
| 1411 |
– |
|
| 1412 |
– |
delete headTorsionType; |
| 1326 |
|
|
| 1327 |
|
#ifdef IS_MPI |
| 1328 |
|
sprintf( checkPointMsg, "TraPPE_Ex torsions initialized succesfully" ); |