| 81 |
|
n_components = the_globals->getNComponents(); |
| 82 |
|
strcpy( force_field, the_globals->getForceField() ); |
| 83 |
|
strcpy( ensemble, the_globals->getEnsemble() ); |
| 84 |
+ |
strcpy( simnfo->ensemble, ensemble ); |
| 85 |
+ |
|
| 86 |
+ |
strcpy( simnfo->mixingRule, the_globals->getMixingRule() ); |
| 87 |
+ |
simnfo->usePBC = the_globals->getPBC(); |
| 88 |
+ |
|
| 89 |
+ |
|
| 90 |
|
|
| 91 |
|
if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF(); |
| 92 |
|
else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); |
| 105 |
|
MPIcheckPoint(); |
| 106 |
|
#endif // is_mpi |
| 107 |
|
|
| 108 |
+ |
|
| 109 |
+ |
|
| 110 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
| 111 |
|
the_components = the_globals->getComponents(); |
| 112 |
|
components_nmol = new int[n_components]; |
| 308 |
|
|
| 309 |
|
if( simnfo->n_SRI ){ |
| 310 |
|
the_sris = new SRI*[simnfo->n_SRI]; |
| 311 |
< |
the_excludes = new ex_pair[simnfo->n_SRI]; |
| 311 |
> |
the_excludes = new int[2 * simnfo->n_SRI]; |
| 312 |
> |
simnfo->globalExcludes = new int; |
| 313 |
> |
} |
| 314 |
> |
else{ |
| 315 |
> |
the_excludes = new int; |
| 316 |
> |
simnfo->globalExcludes = new int; |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
// set the arrays into the SimInfo object |
| 321 |
|
simnfo->atoms = the_atoms; |
| 322 |
|
simnfo->sr_interactions = the_sris; |
| 323 |
|
simnfo->n_exclude = tot_SRI; |
| 324 |
+ |
simnfo->nGlobalExcludes = 0; |
| 325 |
|
simnfo->excludes = the_excludes; |
| 326 |
|
|
| 327 |
|
|
| 402 |
|
the_ff->setSimInfo( simnfo ); |
| 403 |
|
|
| 404 |
|
makeAtoms(); |
| 405 |
< |
// |
| 405 |
> |
simnfo->identArray = new int[simnfo->n_atoms]; |
| 406 |
> |
for(i=0; i<simnfo->n_atoms; i++){ |
| 407 |
> |
simnfo->identArray[i] = the_atoms[i]->getIdent(); |
| 408 |
> |
} |
| 409 |
> |
|
| 410 |
|
if( tot_bonds ){ |
| 411 |
|
makeBonds(); |
| 412 |
|
} |
| 586 |
|
if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff ); |
| 587 |
|
if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff ); |
| 588 |
|
|
| 589 |
+ |
|
| 590 |
+ |
|
| 591 |
+ |
// initialize the Fortran |
| 592 |
+ |
|
| 593 |
+ |
simnfo->refreshSim(); |
| 594 |
+ |
|
| 595 |
+ |
if( !stcmp( simnfo->mixingRule, "standard") ){ |
| 596 |
+ |
the_ff->initForceField( LB_MIXING_RULE ); |
| 597 |
+ |
} |
| 598 |
+ |
else if( !stcmp( simnfo->mixingRule, "explicit") ){ |
| 599 |
+ |
the_ff->initForceField( EXPLICIT_MIXING_RULE ); |
| 600 |
+ |
} |
| 601 |
+ |
else{ |
| 602 |
+ |
sprintf( painCave.errMsg, |
| 603 |
+ |
"SimSetup Error: unknown mixing rule -> \"%s\"\n", |
| 604 |
+ |
simnfo->mixingRule ); |
| 605 |
+ |
painCave.isFatal = 1; |
| 606 |
+ |
simError(); |
| 607 |
+ |
} |
| 608 |
+ |
|
| 609 |
+ |
|
| 610 |
+ |
#ifdef IS_MPI |
| 611 |
+ |
strcpy( checkPointMsg, |
| 612 |
+ |
"Successfully intialized the mixingRule for Fortran." ); |
| 613 |
+ |
MPIcheckPoint(); |
| 614 |
+ |
#endif // is_mpi |
| 615 |
|
} |
| 616 |
|
|
| 617 |
|
void SimSetup::makeAtoms( void ){ |
| 721 |
|
current_bond = comp_stamps[i]->getBond( k ); |
| 722 |
|
the_bonds[index].a = current_bond->getA() + offset; |
| 723 |
|
the_bonds[index].b = current_bond->getB() + offset; |
| 724 |
+ |
|
| 725 |
+ |
exI = the_bonds[index].a; |
| 726 |
+ |
exJ = the_bonds[index].b; |
| 727 |
+ |
|
| 728 |
+ |
// exclude_I must always be the smaller of the pair |
| 729 |
+ |
if( exI > exJ ){ |
| 730 |
+ |
tempEx = exI; |
| 731 |
+ |
exI = exJ; |
| 732 |
+ |
exJ = tempEx; |
| 733 |
+ |
} |
| 734 |
+ |
|
| 735 |
|
|
| 736 |
< |
the_excludes[index].i = the_bonds[index].a; |
| 737 |
< |
the_excludes[index].j = the_bonds[index].b; |
| 736 |
> |
#ifdef IS_MPI |
| 737 |
> |
|
| 738 |
> |
the_excludes[index*2] = |
| 739 |
> |
the_atoms[exI]->getGlobalIndex() + 1; |
| 740 |
> |
the_excludes[index*2 + 1] = |
| 741 |
> |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 742 |
> |
|
| 743 |
> |
#else // isn't MPI |
| 744 |
|
|
| 745 |
+ |
the_excludes[index*2] = exI + 1; |
| 746 |
+ |
the_excludes[index*2 + 1] = exJ + 1; |
| 747 |
+ |
// fortran index from 1 (hence the +1 in the indexing) |
| 748 |
+ |
#endif //is_mpi |
| 749 |
+ |
|
| 750 |
|
// increment the index and repeat; |
| 751 |
|
index++; |
| 752 |
|
} |
| 765 |
|
|
| 766 |
|
void SimSetup::makeBends( void ){ |
| 767 |
|
|
| 768 |
< |
int i, j, k, index, offset, molIndex; |
| 768 |
> |
int i, j, k, index, offset, molIndex, exI, exJ; |
| 769 |
|
bend_set* the_bends; |
| 770 |
|
BendStamp* current_bend; |
| 771 |
+ |
LinkedAssign* extras; |
| 772 |
+ |
LinkedAssign* current_extra; |
| 773 |
+ |
|
| 774 |
|
|
| 775 |
|
the_bends = new bend_set[tot_bends]; |
| 776 |
|
index = 0; |
| 792 |
|
the_bends[index].b = current_bend->getB() + offset; |
| 793 |
|
the_bends[index].c = current_bend->getC() + offset; |
| 794 |
|
|
| 795 |
< |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
| 796 |
< |
the_excludes[index + tot_bonds].j = the_bends[index].c; |
| 795 |
> |
if( current_bend->haveExtras() ){ |
| 796 |
> |
|
| 797 |
> |
extras = current_bend->getExtras(); |
| 798 |
> |
current_extra = extras; |
| 799 |
> |
|
| 800 |
> |
while( current_extra != NULL ){ |
| 801 |
> |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
| 802 |
> |
|
| 803 |
> |
switch( current_extra->getType() ){ |
| 804 |
> |
|
| 805 |
> |
case 0: |
| 806 |
> |
the_bends[index].ghost = |
| 807 |
> |
current_extra->getInt() + offset; |
| 808 |
> |
the_bends[index].isGhost = 1; |
| 809 |
> |
break; |
| 810 |
> |
|
| 811 |
> |
case 1: |
| 812 |
> |
the_bends[index].ghost = |
| 813 |
> |
(int)current_extra->getDouble() + offset; |
| 814 |
> |
the_bends[index].isGhost = 1; |
| 815 |
> |
break; |
| 816 |
> |
|
| 817 |
> |
default: |
| 818 |
> |
sprintf( painCave.errMsg, |
| 819 |
> |
"SimSetup Error: ghostVectorSource was neiter a " |
| 820 |
> |
"double nor an int.\n" |
| 821 |
> |
"-->Bend[%d] in %s\n", |
| 822 |
> |
k, comp_stamps[i]->getID() ); |
| 823 |
> |
painCave.isFatal = 1; |
| 824 |
> |
simError(); |
| 825 |
> |
} |
| 826 |
> |
} |
| 827 |
> |
|
| 828 |
> |
else{ |
| 829 |
> |
|
| 830 |
> |
sprintf( painCave.errMsg, |
| 831 |
> |
"SimSetup Error: unhandled bend assignment:\n" |
| 832 |
> |
" -->%s in Bend[%d] in %s\n", |
| 833 |
> |
current_extra->getlhs(), |
| 834 |
> |
k, comp_stamps[i]->getID() ); |
| 835 |
> |
painCave.isFatal = 1; |
| 836 |
> |
simError(); |
| 837 |
> |
} |
| 838 |
> |
|
| 839 |
> |
current_extra = current_extra->getNext(); |
| 840 |
> |
} |
| 841 |
> |
} |
| 842 |
|
|
| 843 |
+ |
if( !the_bends[index].isGhost ){ |
| 844 |
+ |
|
| 845 |
+ |
exI = the_bends[index].a; |
| 846 |
+ |
exJ = the_bends[index].c; |
| 847 |
+ |
} |
| 848 |
+ |
else{ |
| 849 |
+ |
|
| 850 |
+ |
exI = the_bends[index].a; |
| 851 |
+ |
exJ = the_bends[index].b; |
| 852 |
+ |
} |
| 853 |
+ |
|
| 854 |
+ |
// exclude_I must always be the smaller of the pair |
| 855 |
+ |
if( exI > exJ ){ |
| 856 |
+ |
tempEx = exI; |
| 857 |
+ |
exI = exJ; |
| 858 |
+ |
exJ = tempEx; |
| 859 |
+ |
} |
| 860 |
+ |
|
| 861 |
+ |
|
| 862 |
+ |
#ifdef IS_MPI |
| 863 |
+ |
|
| 864 |
+ |
the_excludes[(index + tot_bonds)*2] = |
| 865 |
+ |
the_atoms[exI]->getGlobalIndex() + 1; |
| 866 |
+ |
the_excludes[(index + tot_bonds)*2 + 1] = |
| 867 |
+ |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 868 |
+ |
|
| 869 |
+ |
#else // isn't MPI |
| 870 |
+ |
|
| 871 |
+ |
the_excludes[(index + tot_bonds)*2] = exI + 1; |
| 872 |
+ |
the_excludes[(index + tot_bonds)*2 + 1] = exJ + 1; |
| 873 |
+ |
// fortran index from 1 (hence the +1 in the indexing) |
| 874 |
+ |
#endif //is_mpi |
| 875 |
+ |
|
| 876 |
+ |
|
| 877 |
|
// increment the index and repeat; |
| 878 |
|
index++; |
| 879 |
|
} |
| 887 |
|
} |
| 888 |
|
} |
| 889 |
|
|
| 890 |
+ |
#ifdef IS_MPI |
| 891 |
+ |
sprintf( checkPointMsg, |
| 892 |
+ |
"Successfully created the bends list.\n" ); |
| 893 |
+ |
MPIcheckPoint(); |
| 894 |
+ |
#endif // is_mpi |
| 895 |
+ |
|
| 896 |
+ |
|
| 897 |
|
the_ff->initializeBends( the_bends ); |
| 898 |
|
} |
| 899 |
|
|
| 900 |
|
void SimSetup::makeTorsions( void ){ |
| 901 |
|
|
| 902 |
< |
int i, j, k, index, offset, molIndex; |
| 902 |
> |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 903 |
|
torsion_set* the_torsions; |
| 904 |
|
TorsionStamp* current_torsion; |
| 905 |
|
|
| 924 |
|
the_torsions[index].c = current_torsion->getC() + offset; |
| 925 |
|
the_torsions[index].d = current_torsion->getD() + offset; |
| 926 |
|
|
| 927 |
< |
the_excludes[index + tot_bonds + tot_bends].i = the_torsions[index].a; |
| 928 |
< |
the_excludes[index + tot_bonds + tot_bends].j = the_torsions[index].d; |
| 927 |
> |
exI = the_torsions[index].a; |
| 928 |
> |
exJ = the_torsions[index].d; |
| 929 |
|
|
| 930 |
+ |
|
| 931 |
+ |
// exclude_I must always be the smaller of the pair |
| 932 |
+ |
if( exI > exJ ){ |
| 933 |
+ |
tempEx = exI; |
| 934 |
+ |
exI = exJ; |
| 935 |
+ |
exJ = tempEx; |
| 936 |
+ |
} |
| 937 |
+ |
|
| 938 |
+ |
|
| 939 |
+ |
#ifdef IS_MPI |
| 940 |
+ |
|
| 941 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2] = |
| 942 |
+ |
the_atoms[exI]->getGlobalIndex() + 1; |
| 943 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = |
| 944 |
+ |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 945 |
+ |
|
| 946 |
+ |
#else // isn't MPI |
| 947 |
+ |
|
| 948 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2] = exI + 1; |
| 949 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = exJ + 1; |
| 950 |
+ |
// fortran indexes from 1 (hence the +1 in the indexing) |
| 951 |
+ |
#endif //is_mpi |
| 952 |
+ |
|
| 953 |
+ |
|
| 954 |
|
// increment the index and repeat; |
| 955 |
|
index++; |
| 956 |
|
} |