| 307 |
|
|
| 308 |
|
|
| 309 |
|
if( simnfo->n_SRI ){ |
| 310 |
< |
the_sris = new SRI*[simnfo->n_SRI]; |
| 311 |
< |
the_excludes = new int[2 * simnfo->n_SRI]; |
| 310 |
> |
Exclude::createArray(simnfo->n_SRI); |
| 311 |
> |
the_excludes = new Exclude*[simnfo->n_SRI]; |
| 312 |
|
simnfo->globalExcludes = new int; |
| 313 |
|
simnfo->n_exclude = tot_SRI; |
| 314 |
|
} |
| 315 |
|
else{ |
| 316 |
|
|
| 317 |
< |
the_excludes = new int[2]; |
| 318 |
< |
the_excludes[0] = 0; |
| 319 |
< |
the_excludes[1] = 0; |
| 317 |
> |
Exclude::createArray( 1 ); |
| 318 |
> |
the_excludes = new Exclude*; |
| 319 |
> |
the_excludes[0] = new Exclude(0); |
| 320 |
> |
the_excludes[0]->setPair( 0,0 ); |
| 321 |
|
simnfo->globalExcludes = new int; |
| 322 |
|
simnfo->globalExcludes[0] = 0; |
| 323 |
< |
|
| 323 |
< |
simnfo->n_exclude = 1; |
| 323 |
> |
simnfo->n_exclude = 0; |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
// set the arrays into the SimInfo object |
| 671 |
|
#endif // is_mpi |
| 672 |
|
} |
| 673 |
|
|
| 674 |
– |
void SimSetup::makeAtoms( void ){ |
| 674 |
|
|
| 675 |
< |
int i, j, k, index; |
| 677 |
< |
double ux, uy, uz, uSqr, u; |
| 678 |
< |
AtomStamp* current_atom; |
| 675 |
> |
void SimSetup::makeMolecules( void ){ |
| 676 |
|
|
| 677 |
+ |
int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; |
| 678 |
+ |
molInit info; |
| 679 |
|
DirectionalAtom* dAtom; |
| 680 |
< |
int molIndex, molStart, molEnd, nMemb, lMolIndex; |
| 680 |
> |
LinkedAssign* extras; |
| 681 |
> |
LinkedAssign* current_extra; |
| 682 |
> |
AtomStamp* currentAtom; |
| 683 |
> |
BondStamp* currentBond; |
| 684 |
> |
BendStamp* currentBend; |
| 685 |
> |
TorsionStamp* currentTorsion; |
| 686 |
> |
|
| 687 |
> |
//init the forceField paramters |
| 688 |
|
|
| 689 |
< |
lMolIndex = 0; |
| 684 |
< |
molIndex = 0; |
| 685 |
< |
index = 0; |
| 686 |
< |
for( i=0; i<n_components; i++ ){ |
| 689 |
> |
the_ff->readParams(); |
| 690 |
|
|
| 691 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
| 691 |
> |
|
| 692 |
> |
// init the molecules |
| 693 |
|
|
| 694 |
< |
#ifdef IS_MPI |
| 695 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
| 696 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
| 697 |
< |
#endif // is_mpi |
| 694 |
> |
atomOffset = 0; |
| 695 |
> |
excludeOffset = 0; |
| 696 |
> |
for(i=0; i<simnfo->n_mol; i++){ |
| 697 |
> |
|
| 698 |
> |
stampID = the_molecules[i].getStampID(); |
| 699 |
|
|
| 700 |
< |
molStart = index; |
| 701 |
< |
nMemb = comp_stamps[i]->getNAtoms(); |
| 702 |
< |
for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ |
| 703 |
< |
|
| 704 |
< |
current_atom = comp_stamps[i]->getAtom( k ); |
| 700 |
< |
if( current_atom->haveOrientation() ){ |
| 701 |
< |
|
| 702 |
< |
dAtom = new DirectionalAtom(index); |
| 703 |
< |
simnfo->n_oriented++; |
| 704 |
< |
the_atoms[index] = dAtom; |
| 705 |
< |
|
| 706 |
< |
ux = current_atom->getOrntX(); |
| 707 |
< |
uy = current_atom->getOrntY(); |
| 708 |
< |
uz = current_atom->getOrntZ(); |
| 709 |
< |
|
| 710 |
< |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
| 711 |
< |
|
| 712 |
< |
u = sqrt( uSqr ); |
| 713 |
< |
ux = ux / u; |
| 714 |
< |
uy = uy / u; |
| 715 |
< |
uz = uz / u; |
| 716 |
< |
|
| 717 |
< |
dAtom->setSUx( ux ); |
| 718 |
< |
dAtom->setSUy( uy ); |
| 719 |
< |
dAtom->setSUz( uz ); |
| 720 |
< |
} |
| 721 |
< |
else{ |
| 722 |
< |
the_atoms[index] = new GeneralAtom(index); |
| 723 |
< |
} |
| 724 |
< |
the_atoms[index]->setType( current_atom->getType() ); |
| 725 |
< |
the_atoms[index]->setIndex( index ); |
| 726 |
< |
|
| 727 |
< |
// increment the index and repeat; |
| 728 |
< |
index++; |
| 729 |
< |
} |
| 730 |
< |
|
| 731 |
< |
molEnd = index -1; |
| 732 |
< |
the_molecules[lMolIndex].setNMembers( nMemb ); |
| 733 |
< |
the_molecules[lMolIndex].setStartAtom( molStart ); |
| 734 |
< |
the_molecules[lMolIndex].setEndAtom( molEnd ); |
| 735 |
< |
the_molecules[lMolIndex].setStampID( i ); |
| 736 |
< |
lMolIndex++; |
| 700 |
> |
info.nAtoms = comp_stamps[stampID]->getNAtoms(); |
| 701 |
> |
info.nBonds = comp_stamps[stampID]->getNBonds(); |
| 702 |
> |
info.nBends = comp_stamps[stampID]->getNBends(); |
| 703 |
> |
info.nTorsions = comp_stamps[stampID]->getNTorsions(); |
| 704 |
> |
info.nExcludes = info.nBonds + info.nBends + info.nTorsions; |
| 705 |
|
|
| 706 |
< |
#ifdef IS_MPI |
| 707 |
< |
} |
| 708 |
< |
#endif //is_mpi |
| 709 |
< |
|
| 710 |
< |
molIndex++; |
| 743 |
< |
} |
| 744 |
< |
} |
| 706 |
> |
info.myAtoms = &the_atoms[atomOffset]; |
| 707 |
> |
info.myExcludes = &the_excludes[excludeOffset]; |
| 708 |
> |
info.myBonds = new Bond*[info.nBonds]; |
| 709 |
> |
info.myBends = new Bend*[info.nBends]; |
| 710 |
> |
info.myTorsions = new Torsions*[info.nTorsions]; |
| 711 |
|
|
| 712 |
< |
#ifdef IS_MPI |
| 713 |
< |
for( i=0; i<mpiSim->getMyNlocal(); i++ ) the_atoms[i]->setGlobalIndex( globalIndex[i] ); |
| 714 |
< |
|
| 715 |
< |
delete[] globalIndex; |
| 716 |
< |
|
| 717 |
< |
mpiSim->mpiRefresh(); |
| 718 |
< |
#endif //IS_MPI |
| 719 |
< |
|
| 720 |
< |
the_ff->initializeAtoms(); |
| 721 |
< |
} |
| 756 |
< |
|
| 757 |
< |
void SimSetup::makeBonds( void ){ |
| 758 |
< |
|
| 759 |
< |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 760 |
< |
bond_pair* the_bonds; |
| 761 |
< |
BondStamp* current_bond; |
| 762 |
< |
|
| 763 |
< |
the_bonds = new bond_pair[tot_bonds]; |
| 764 |
< |
index = 0; |
| 765 |
< |
offset = 0; |
| 766 |
< |
molIndex = 0; |
| 767 |
< |
|
| 768 |
< |
for( i=0; i<n_components; i++ ){ |
| 769 |
< |
|
| 770 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
| 771 |
< |
|
| 772 |
< |
#ifdef IS_MPI |
| 773 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
| 774 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
| 775 |
< |
#endif // is_mpi |
| 712 |
> |
theBonds = new bond_pair[info.nBonds]; |
| 713 |
> |
theBends = new bend_set[info.nBends]; |
| 714 |
> |
theTorsions = new torsion_set[info.nTorsions]; |
| 715 |
> |
|
| 716 |
> |
// make the Atoms |
| 717 |
> |
|
| 718 |
> |
for(j=0; j<info.nAtoms; j++){ |
| 719 |
> |
|
| 720 |
> |
currentAtom = theComponents[stampID]->getAtom( j ); |
| 721 |
> |
if( currentAtom->haveOrientation() ){ |
| 722 |
|
|
| 723 |
< |
for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ |
| 724 |
< |
|
| 725 |
< |
current_bond = comp_stamps[i]->getBond( k ); |
| 780 |
< |
the_bonds[index].a = current_bond->getA() + offset; |
| 781 |
< |
the_bonds[index].b = current_bond->getB() + offset; |
| 782 |
< |
|
| 783 |
< |
exI = the_bonds[index].a; |
| 784 |
< |
exJ = the_bonds[index].b; |
| 785 |
< |
|
| 786 |
< |
// exclude_I must always be the smaller of the pair |
| 787 |
< |
if( exI > exJ ){ |
| 788 |
< |
tempEx = exI; |
| 789 |
< |
exI = exJ; |
| 790 |
< |
exJ = tempEx; |
| 791 |
< |
} |
| 792 |
< |
|
| 793 |
< |
|
| 794 |
< |
#ifdef IS_MPI |
| 795 |
< |
|
| 796 |
< |
the_excludes[index*2] = |
| 797 |
< |
the_atoms[exI]->getGlobalIndex() + 1; |
| 798 |
< |
the_excludes[index*2 + 1] = |
| 799 |
< |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 800 |
< |
|
| 801 |
< |
#else // isn't MPI |
| 802 |
< |
|
| 803 |
< |
the_excludes[index*2] = exI + 1; |
| 804 |
< |
the_excludes[index*2 + 1] = exJ + 1; |
| 805 |
< |
// fortran index from 1 (hence the +1 in the indexing) |
| 806 |
< |
#endif //is_mpi |
| 807 |
< |
|
| 808 |
< |
// increment the index and repeat; |
| 809 |
< |
index++; |
| 810 |
< |
} |
| 811 |
< |
offset += comp_stamps[i]->getNAtoms(); |
| 723 |
> |
dAtom = new DirectionalAtom(j + atomOffset); |
| 724 |
> |
simnfo->n_oriented++; |
| 725 |
> |
info.myAtoms[j] = dAtom; |
| 726 |
|
|
| 727 |
< |
#ifdef IS_MPI |
| 727 |
> |
ux = currentAtom->getOrntX(); |
| 728 |
> |
uy = currentAtom->getOrntY(); |
| 729 |
> |
uz = currentAtom->getOrntZ(); |
| 730 |
> |
|
| 731 |
> |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
| 732 |
> |
|
| 733 |
> |
u = sqrt( uSqr ); |
| 734 |
> |
ux = ux / u; |
| 735 |
> |
uy = uy / u; |
| 736 |
> |
uz = uz / u; |
| 737 |
> |
|
| 738 |
> |
dAtom->setSUx( ux ); |
| 739 |
> |
dAtom->setSUy( uy ); |
| 740 |
> |
dAtom->setSUz( uz ); |
| 741 |
|
} |
| 742 |
< |
#endif //is_mpi |
| 742 |
> |
else{ |
| 743 |
> |
info.myAtoms[j] = new GeneralAtom(j + atomOffset); |
| 744 |
> |
} |
| 745 |
> |
info.myAtoms[j]->setType( currentAtom->getType() ); |
| 746 |
> |
|
| 747 |
> |
#ifdef IS_MPI |
| 748 |
|
|
| 749 |
< |
molIndex++; |
| 750 |
< |
} |
| 751 |
< |
} |
| 749 |
> |
info.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
| 750 |
> |
|
| 751 |
> |
#endif // is_mpi |
| 752 |
> |
} |
| 753 |
> |
|
| 754 |
> |
// make the bonds |
| 755 |
> |
for(j=0; j<info.nBonds; j++){ |
| 756 |
> |
|
| 757 |
> |
currentBond = comp_stamps[stampID]->getBond( j ); |
| 758 |
> |
theBonds[j].a = currentBond->getA() + atomOffset; |
| 759 |
> |
theBonds[j].b = currentBond->getB() + atomOffset; |
| 760 |
|
|
| 761 |
< |
the_ff->initializeBonds( the_bonds ); |
| 762 |
< |
} |
| 761 |
> |
exI = theBonds[i].a; |
| 762 |
> |
exJ = theBonds[i].b; |
| 763 |
|
|
| 764 |
< |
void SimSetup::makeBends( void ){ |
| 765 |
< |
|
| 766 |
< |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 767 |
< |
bend_set* the_bends; |
| 768 |
< |
BendStamp* current_bend; |
| 769 |
< |
LinkedAssign* extras; |
| 830 |
< |
LinkedAssign* current_extra; |
| 831 |
< |
|
| 832 |
< |
|
| 833 |
< |
the_bends = new bend_set[tot_bends]; |
| 834 |
< |
index = 0; |
| 835 |
< |
offset = 0; |
| 836 |
< |
molIndex = 0; |
| 837 |
< |
for( i=0; i<n_components; i++ ){ |
| 838 |
< |
|
| 839 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
| 840 |
< |
|
| 764 |
> |
// exclude_I must always be the smaller of the pair |
| 765 |
> |
if( exI > exJ ){ |
| 766 |
> |
tempEx = exI; |
| 767 |
> |
exI = exJ; |
| 768 |
> |
exJ = tempEx; |
| 769 |
> |
} |
| 770 |
|
#ifdef IS_MPI |
| 771 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
| 772 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
| 773 |
< |
#endif // is_mpi |
| 771 |
> |
tempEx = exI; |
| 772 |
> |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
| 773 |
> |
tempEx = exJ; |
| 774 |
> |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
| 775 |
> |
|
| 776 |
> |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
| 777 |
> |
#else // isn't MPI |
| 778 |
> |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
| 779 |
> |
#endif //is_mpi |
| 780 |
> |
} |
| 781 |
> |
excludeOffset += info.nBonds; |
| 782 |
|
|
| 783 |
< |
for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ |
| 784 |
< |
|
| 785 |
< |
current_bend = comp_stamps[i]->getBend( k ); |
| 786 |
< |
the_bends[index].a = current_bend->getA() + offset; |
| 787 |
< |
the_bends[index].b = current_bend->getB() + offset; |
| 788 |
< |
the_bends[index].c = current_bend->getC() + offset; |
| 789 |
< |
|
| 790 |
< |
if( current_bend->haveExtras() ){ |
| 791 |
< |
|
| 855 |
< |
extras = current_bend->getExtras(); |
| 856 |
< |
current_extra = extras; |
| 783 |
> |
//make the bends |
| 784 |
> |
for(j=0; j<info.nBends; j++){ |
| 785 |
> |
|
| 786 |
> |
currentBend = comp_stamps[stampID]->getBend( j ); |
| 787 |
> |
theBends[j].a = currentBend->getA() + atomOffset; |
| 788 |
> |
theBends[j].b = currentBend->getB() + atomOffset; |
| 789 |
> |
theBends[j].c = currentBend->getC() + atomOffset; |
| 790 |
> |
|
| 791 |
> |
if( currentBend->haveExtras() ){ |
| 792 |
|
|
| 793 |
< |
while( current_extra != NULL ){ |
| 794 |
< |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
| 793 |
> |
extras = current_bend->getExtras(); |
| 794 |
> |
current_extra = extras; |
| 795 |
> |
|
| 796 |
> |
while( current_extra != NULL ){ |
| 797 |
> |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
| 798 |
|
|
| 799 |
< |
switch( current_extra->getType() ){ |
| 799 |
> |
switch( current_extra->getType() ){ |
| 800 |
> |
|
| 801 |
> |
case 0: |
| 802 |
> |
theBends[j].ghost = |
| 803 |
> |
current_extra->getInt() + atomOffset; |
| 804 |
> |
theBends[j].isGhost = 1; |
| 805 |
> |
break; |
| 806 |
|
|
| 807 |
< |
case 0: |
| 808 |
< |
the_bends[index].ghost = |
| 809 |
< |
current_extra->getInt() + offset; |
| 810 |
< |
the_bends[index].isGhost = 1; |
| 811 |
< |
break; |
| 868 |
< |
|
| 869 |
< |
case 1: |
| 870 |
< |
the_bends[index].ghost = |
| 871 |
< |
(int)current_extra->getDouble() + offset; |
| 872 |
< |
the_bends[index].isGhost = 1; |
| 873 |
< |
break; |
| 874 |
< |
|
| 875 |
< |
default: |
| 876 |
< |
sprintf( painCave.errMsg, |
| 877 |
< |
"SimSetup Error: ghostVectorSource was neiter a " |
| 878 |
< |
"double nor an int.\n" |
| 879 |
< |
"-->Bend[%d] in %s\n", |
| 880 |
< |
k, comp_stamps[i]->getID() ); |
| 881 |
< |
painCave.isFatal = 1; |
| 882 |
< |
simError(); |
| 883 |
< |
} |
| 884 |
< |
} |
| 807 |
> |
case 1: |
| 808 |
> |
theBends[j].ghost = |
| 809 |
> |
(int)current_extra->getDouble() + atomOffset; |
| 810 |
> |
theBends[j].isGhost = 1; |
| 811 |
> |
break; |
| 812 |
|
|
| 813 |
< |
else{ |
| 814 |
< |
|
| 815 |
< |
sprintf( painCave.errMsg, |
| 816 |
< |
"SimSetup Error: unhandled bend assignment:\n" |
| 817 |
< |
" -->%s in Bend[%d] in %s\n", |
| 818 |
< |
current_extra->getlhs(), |
| 819 |
< |
k, comp_stamps[i]->getID() ); |
| 820 |
< |
painCave.isFatal = 1; |
| 894 |
< |
simError(); |
| 895 |
< |
} |
| 896 |
< |
|
| 897 |
< |
current_extra = current_extra->getNext(); |
| 813 |
> |
default: |
| 814 |
> |
sprintf( painCave.errMsg, |
| 815 |
> |
"SimSetup Error: ghostVectorSource was neiter a " |
| 816 |
> |
"double nor an int.\n" |
| 817 |
> |
"-->Bend[%d] in %s\n", |
| 818 |
> |
j, comp_stamps[stampID]->getID() ); |
| 819 |
> |
painCave.isFatal = 1; |
| 820 |
> |
simError(); |
| 821 |
|
} |
| 822 |
|
} |
| 823 |
|
|
| 901 |
– |
if( !the_bends[index].isGhost ){ |
| 902 |
– |
|
| 903 |
– |
exI = the_bends[index].a; |
| 904 |
– |
exJ = the_bends[index].c; |
| 905 |
– |
} |
| 824 |
|
else{ |
| 825 |
|
|
| 826 |
< |
exI = the_bends[index].a; |
| 827 |
< |
exJ = the_bends[index].b; |
| 826 |
> |
sprintf( painCave.errMsg, |
| 827 |
> |
"SimSetup Error: unhandled bend assignment:\n" |
| 828 |
> |
" -->%s in Bend[%d] in %s\n", |
| 829 |
> |
current_extra->getlhs(), |
| 830 |
> |
j, comp_stamps[stampID]->getID() ); |
| 831 |
> |
painCave.isFatal = 1; |
| 832 |
> |
simError(); |
| 833 |
|
} |
| 834 |
|
|
| 835 |
< |
// exclude_I must always be the smaller of the pair |
| 913 |
< |
if( exI > exJ ){ |
| 914 |
< |
tempEx = exI; |
| 915 |
< |
exI = exJ; |
| 916 |
< |
exJ = tempEx; |
| 917 |
< |
} |
| 918 |
< |
|
| 919 |
< |
|
| 920 |
< |
#ifdef IS_MPI |
| 921 |
< |
|
| 922 |
< |
the_excludes[(index + tot_bonds)*2] = |
| 923 |
< |
the_atoms[exI]->getGlobalIndex() + 1; |
| 924 |
< |
the_excludes[(index + tot_bonds)*2 + 1] = |
| 925 |
< |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 926 |
< |
|
| 927 |
< |
#else // isn't MPI |
| 928 |
< |
|
| 929 |
< |
the_excludes[(index + tot_bonds)*2] = exI + 1; |
| 930 |
< |
the_excludes[(index + tot_bonds)*2 + 1] = exJ + 1; |
| 931 |
< |
// fortran index from 1 (hence the +1 in the indexing) |
| 932 |
< |
#endif //is_mpi |
| 933 |
< |
|
| 934 |
< |
|
| 935 |
< |
// increment the index and repeat; |
| 936 |
< |
index++; |
| 835 |
> |
current_extra = current_extra->getNext(); |
| 836 |
|
} |
| 837 |
< |
offset += comp_stamps[i]->getNAtoms(); |
| 837 |
> |
} |
| 838 |
> |
|
| 839 |
> |
if( !theBends[j].isGhost ){ |
| 840 |
> |
|
| 841 |
> |
exI = theBends[j].a; |
| 842 |
> |
exJ = theBends[j].c; |
| 843 |
> |
} |
| 844 |
> |
else{ |
| 845 |
|
|
| 846 |
< |
#ifdef IS_MPI |
| 846 |
> |
exI = theBends[j].a; |
| 847 |
> |
exJ = theBends[j].b; |
| 848 |
|
} |
| 849 |
< |
#endif //is_mpi |
| 850 |
< |
|
| 851 |
< |
molIndex++; |
| 852 |
< |
} |
| 853 |
< |
} |
| 854 |
< |
|
| 849 |
> |
|
| 850 |
> |
// exclude_I must always be the smaller of the pair |
| 851 |
> |
if( exI > exJ ){ |
| 852 |
> |
tempEx = exI; |
| 853 |
> |
exI = exJ; |
| 854 |
> |
exJ = tempEx; |
| 855 |
> |
} |
| 856 |
|
#ifdef IS_MPI |
| 857 |
< |
sprintf( checkPointMsg, |
| 858 |
< |
"Successfully created the bends list.\n" ); |
| 859 |
< |
MPIcheckPoint(); |
| 860 |
< |
#endif // is_mpi |
| 861 |
< |
|
| 857 |
> |
tempEx = exI; |
| 858 |
> |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
| 859 |
> |
tempEx = exJ; |
| 860 |
> |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
| 861 |
> |
|
| 862 |
> |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
| 863 |
> |
#else // isn't MPI |
| 864 |
> |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
| 865 |
> |
#endif //is_mpi |
| 866 |
> |
} |
| 867 |
> |
excludeOffset += info.nBends; |
| 868 |
|
|
| 869 |
< |
the_ff->initializeBends( the_bends ); |
| 870 |
< |
} |
| 869 |
> |
for(j=0; j<info.nTorsions; j++){ |
| 870 |
> |
|
| 871 |
> |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
| 872 |
> |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
| 873 |
> |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
| 874 |
> |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
| 875 |
> |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
| 876 |
> |
|
| 877 |
> |
exI = theTorsions[j].a; |
| 878 |
> |
exJ = theTorsions[j].d; |
| 879 |
|
|
| 880 |
< |
void SimSetup::makeTorsions( void ){ |
| 881 |
< |
|
| 882 |
< |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 883 |
< |
torsion_set* the_torsions; |
| 884 |
< |
TorsionStamp* current_torsion; |
| 885 |
< |
|
| 964 |
< |
the_torsions = new torsion_set[tot_torsions]; |
| 965 |
< |
index = 0; |
| 966 |
< |
offset = 0; |
| 967 |
< |
molIndex = 0; |
| 968 |
< |
for( i=0; i<n_components; i++ ){ |
| 969 |
< |
|
| 970 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
| 971 |
< |
|
| 880 |
> |
// exclude_I must always be the smaller of the pair |
| 881 |
> |
if( exI > exJ ){ |
| 882 |
> |
tempEx = exI; |
| 883 |
> |
exI = exJ; |
| 884 |
> |
exJ = tempEx; |
| 885 |
> |
} |
| 886 |
|
#ifdef IS_MPI |
| 887 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
| 888 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
| 889 |
< |
#endif // is_mpi |
| 890 |
< |
|
| 891 |
< |
for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ |
| 892 |
< |
|
| 979 |
< |
current_torsion = comp_stamps[i]->getTorsion( k ); |
| 980 |
< |
the_torsions[index].a = current_torsion->getA() + offset; |
| 981 |
< |
the_torsions[index].b = current_torsion->getB() + offset; |
| 982 |
< |
the_torsions[index].c = current_torsion->getC() + offset; |
| 983 |
< |
the_torsions[index].d = current_torsion->getD() + offset; |
| 984 |
< |
|
| 985 |
< |
exI = the_torsions[index].a; |
| 986 |
< |
exJ = the_torsions[index].d; |
| 987 |
< |
|
| 988 |
< |
|
| 989 |
< |
// exclude_I must always be the smaller of the pair |
| 990 |
< |
if( exI > exJ ){ |
| 991 |
< |
tempEx = exI; |
| 992 |
< |
exI = exJ; |
| 993 |
< |
exJ = tempEx; |
| 994 |
< |
} |
| 995 |
< |
|
| 996 |
< |
|
| 997 |
< |
#ifdef IS_MPI |
| 998 |
< |
|
| 999 |
< |
the_excludes[(index + tot_bonds + tot_bends)*2] = |
| 1000 |
< |
the_atoms[exI]->getGlobalIndex() + 1; |
| 1001 |
< |
the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = |
| 1002 |
< |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 1003 |
< |
|
| 887 |
> |
tempEx = exI; |
| 888 |
> |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
| 889 |
> |
tempEx = exJ; |
| 890 |
> |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
| 891 |
> |
|
| 892 |
> |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
| 893 |
|
#else // isn't MPI |
| 894 |
< |
|
| 1006 |
< |
the_excludes[(index + tot_bonds + tot_bends)*2] = exI + 1; |
| 1007 |
< |
the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = exJ + 1; |
| 1008 |
< |
// fortran indexes from 1 (hence the +1 in the indexing) |
| 894 |
> |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
| 895 |
|
#endif //is_mpi |
| 896 |
< |
|
| 896 |
> |
} |
| 897 |
> |
excludeOffset += info.nTorsions; |
| 898 |
|
|
| 899 |
< |
// increment the index and repeat; |
| 900 |
< |
index++; |
| 1014 |
< |
} |
| 1015 |
< |
offset += comp_stamps[i]->getNAtoms(); |
| 899 |
> |
|
| 900 |
> |
// send the arrays off to the forceField for init. |
| 901 |
|
|
| 902 |
< |
#ifdef IS_MPI |
| 903 |
< |
} |
| 904 |
< |
#endif //is_mpi |
| 902 |
> |
the_ff->initializeAtoms( info.nAtoms, info.myAtoms ); |
| 903 |
> |
the_ff->initializeBonds( info.nBonds, info.myBonds, theBonds ); |
| 904 |
> |
the_ff->initializeBends( info.nBends, info.myBends, theBends ); |
| 905 |
> |
the_ff->initializeTorsions( info.nTorsions, info.myTorsions, theTorsions ); |
| 906 |
|
|
| 907 |
< |
molIndex++; |
| 908 |
< |
} |
| 907 |
> |
|
| 908 |
> |
the_molecules[i].initialize( info ); |
| 909 |
> |
atomOffset += info.nAtoms; |
| 910 |
|
} |
| 911 |
|
|
| 912 |
< |
the_ff->initializeTorsions( the_torsions ); |
| 912 |
> |
// clean up the forcefield |
| 913 |
> |
the_ff->calcRcut(); |
| 914 |
> |
the_ff->cleanMe(); |
| 915 |
|
} |
| 916 |
|
|
| 917 |
|
void SimSetup::initFromBass( void ){ |