248 |
|
|
249 |
|
int localMol, allMol; |
250 |
|
int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; |
251 |
+ |
|
252 |
+ |
int* mol2proc = mpiSim->getMolToProcMap(); |
253 |
+ |
int* molCompType = mpiSim->getMolComponentType(); |
254 |
|
|
255 |
|
allMol = 0; |
256 |
|
localMol = 0; |
262 |
|
|
263 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
264 |
|
|
265 |
< |
if( mpiSim->getMyMolStart() <= allMol && |
263 |
< |
allMol <= mpiSim->getMyMolEnd() ){ |
265 |
> |
if( mol2proc[j] == worldRank ){ |
266 |
|
|
267 |
|
local_atoms += comp_stamps[i]->getNAtoms(); |
268 |
|
local_bonds += comp_stamps[i]->getNBonds(); |
281 |
|
if( local_atoms != simnfo->n_atoms ){ |
282 |
|
sprintf( painCave.errMsg, |
283 |
|
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
284 |
< |
" localAtom (%d) are note equal.\n", |
284 |
> |
" localAtom (%d) are not equal.\n", |
285 |
|
simnfo->n_atoms, |
286 |
|
local_atoms ); |
287 |
|
painCave.isFatal = 1; |
306 |
|
Atom::createArrays(simnfo->n_atoms); |
307 |
|
the_atoms = new Atom*[simnfo->n_atoms]; |
308 |
|
the_molecules = new Molecule[simnfo->n_mol]; |
309 |
+ |
int molIndex; |
310 |
+ |
|
311 |
+ |
// initialize the molecule's stampID's |
312 |
+ |
|
313 |
+ |
#ifdef IS_MPI |
314 |
+ |
|
315 |
+ |
|
316 |
+ |
molIndex = 0; |
317 |
+ |
for(i=0; i<mpiSim->getTotNmol(); i++){ |
318 |
+ |
|
319 |
+ |
if(mol2proc[i] == worldRank ){ |
320 |
+ |
the_molecules[molIndex].setStampID( molCompType[i] ); |
321 |
+ |
molIndex++; |
322 |
+ |
} |
323 |
+ |
} |
324 |
|
|
325 |
+ |
#else // is_mpi |
326 |
+ |
|
327 |
+ |
molIndex = 0; |
328 |
+ |
for(i=0; i<n_components; i++){ |
329 |
+ |
for(j=0; j<components_nmol[i]; j++ ){ |
330 |
+ |
the_molecules[molIndex].setStampID( i ); |
331 |
+ |
molIndex++; |
332 |
+ |
} |
333 |
+ |
} |
334 |
+ |
|
335 |
|
|
336 |
+ |
#endif // is_mpi |
337 |
+ |
|
338 |
+ |
|
339 |
|
if( simnfo->n_SRI ){ |
340 |
< |
the_sris = new SRI*[simnfo->n_SRI]; |
341 |
< |
the_excludes = new int[2 * simnfo->n_SRI]; |
340 |
> |
Exclude::createArray(simnfo->n_SRI); |
341 |
> |
the_excludes = new Exclude*[simnfo->n_SRI]; |
342 |
|
simnfo->globalExcludes = new int; |
343 |
|
simnfo->n_exclude = tot_SRI; |
344 |
|
} |
345 |
|
else{ |
346 |
|
|
347 |
< |
the_excludes = new int[2]; |
348 |
< |
the_excludes[0] = 0; |
349 |
< |
the_excludes[1] = 0; |
347 |
> |
Exclude::createArray( 1 ); |
348 |
> |
the_excludes = new Exclude*; |
349 |
> |
the_excludes[0] = new Exclude(0); |
350 |
> |
the_excludes[0]->setPair( 0,0 ); |
351 |
|
simnfo->globalExcludes = new int; |
352 |
|
simnfo->globalExcludes[0] = 0; |
353 |
< |
|
323 |
< |
simnfo->n_exclude = 1; |
353 |
> |
simnfo->n_exclude = 0; |
354 |
|
} |
355 |
|
|
356 |
|
// set the arrays into the SimInfo object |
357 |
|
|
358 |
|
simnfo->atoms = the_atoms; |
329 |
– |
simnfo->sr_interactions = the_sris; |
359 |
|
simnfo->nGlobalExcludes = 0; |
360 |
|
simnfo->excludes = the_excludes; |
361 |
|
|
412 |
|
|
413 |
|
the_ff->setSimInfo( simnfo ); |
414 |
|
|
415 |
< |
makeAtoms(); |
415 |
> |
makeMolecules(); |
416 |
|
simnfo->identArray = new int[simnfo->n_atoms]; |
417 |
|
for(i=0; i<simnfo->n_atoms; i++){ |
418 |
|
simnfo->identArray[i] = the_atoms[i]->getIdent(); |
419 |
|
} |
420 |
|
|
392 |
– |
if( tot_bonds ){ |
393 |
– |
makeBonds(); |
394 |
– |
} |
395 |
– |
|
396 |
– |
if( tot_bends ){ |
397 |
– |
makeBends(); |
398 |
– |
} |
399 |
– |
|
400 |
– |
if( tot_torsions ){ |
401 |
– |
makeTorsions(); |
402 |
– |
} |
403 |
– |
|
404 |
– |
|
421 |
|
if (the_globals->getUseRF() ) { |
422 |
|
simnfo->useReactionField = 1; |
423 |
|
|
687 |
|
#endif // is_mpi |
688 |
|
} |
689 |
|
|
674 |
– |
void SimSetup::makeAtoms( void ){ |
690 |
|
|
691 |
< |
int i, j, k, index; |
677 |
< |
double ux, uy, uz, uSqr, u; |
678 |
< |
AtomStamp* current_atom; |
691 |
> |
void SimSetup::makeMolecules( void ){ |
692 |
|
|
693 |
+ |
int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; |
694 |
+ |
molInit info; |
695 |
|
DirectionalAtom* dAtom; |
696 |
< |
int molIndex, molStart, molEnd, nMemb, lMolIndex; |
697 |
< |
|
698 |
< |
lMolIndex = 0; |
699 |
< |
molIndex = 0; |
700 |
< |
index = 0; |
701 |
< |
for( i=0; i<n_components; i++ ){ |
702 |
< |
|
703 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
696 |
> |
LinkedAssign* extras; |
697 |
> |
LinkedAssign* current_extra; |
698 |
> |
AtomStamp* currentAtom; |
699 |
> |
BondStamp* currentBond; |
700 |
> |
BendStamp* currentBend; |
701 |
> |
TorsionStamp* currentTorsion; |
702 |
> |
|
703 |
> |
//init the forceField paramters |
704 |
|
|
705 |
< |
#ifdef IS_MPI |
691 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
692 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
693 |
< |
#endif // is_mpi |
705 |
> |
the_ff->readParams(); |
706 |
|
|
707 |
< |
molStart = index; |
708 |
< |
nMemb = comp_stamps[i]->getNAtoms(); |
697 |
< |
for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ |
698 |
< |
|
699 |
< |
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++; |
707 |
> |
|
708 |
> |
// init the molecules |
709 |
|
|
710 |
< |
#ifdef IS_MPI |
711 |
< |
} |
712 |
< |
#endif //is_mpi |
713 |
< |
|
714 |
< |
molIndex++; |
715 |
< |
} |
716 |
< |
} |
710 |
> |
atomOffset = 0; |
711 |
> |
excludeOffset = 0; |
712 |
> |
for(i=0; i<simnfo->n_mol; i++){ |
713 |
> |
|
714 |
> |
stampID = the_molecules[i].getStampID(); |
715 |
> |
|
716 |
> |
info.nAtoms = comp_stamps[stampID]->getNAtoms(); |
717 |
> |
info.nBonds = comp_stamps[stampID]->getNBonds(); |
718 |
> |
info.nBends = comp_stamps[stampID]->getNBends(); |
719 |
> |
info.nTorsions = comp_stamps[stampID]->getNTorsions(); |
720 |
> |
info.nExcludes = info.nBonds + info.nBends + info.nTorsions; |
721 |
> |
|
722 |
> |
info.myAtoms = &the_atoms[atomOffset]; |
723 |
> |
info.myExcludes = &the_excludes[excludeOffset]; |
724 |
> |
info.myBonds = new Bond*[info.nBonds]; |
725 |
> |
info.myBends = new Bend*[info.nBends]; |
726 |
> |
info.myTorsions = new Torsions*[info.nTorsions]; |
727 |
|
|
728 |
< |
#ifdef IS_MPI |
729 |
< |
for( i=0; i<mpiSim->getMyNlocal(); i++ ) the_atoms[i]->setGlobalIndex( globalIndex[i] ); |
728 |
> |
theBonds = new bond_pair[info.nBonds]; |
729 |
> |
theBends = new bend_set[info.nBends]; |
730 |
> |
theTorsions = new torsion_set[info.nTorsions]; |
731 |
|
|
732 |
< |
delete[] globalIndex; |
733 |
< |
|
734 |
< |
mpiSim->mpiRefresh(); |
735 |
< |
#endif //IS_MPI |
736 |
< |
|
737 |
< |
the_ff->initializeAtoms(); |
755 |
< |
} |
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 |
732 |
> |
// make the Atoms |
733 |
> |
|
734 |
> |
for(j=0; j<info.nAtoms; j++){ |
735 |
> |
|
736 |
> |
currentAtom = theComponents[stampID]->getAtom( j ); |
737 |
> |
if( currentAtom->haveOrientation() ){ |
738 |
|
|
739 |
< |
for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ |
740 |
< |
|
741 |
< |
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(); |
739 |
> |
dAtom = new DirectionalAtom(j + atomOffset); |
740 |
> |
simnfo->n_oriented++; |
741 |
> |
info.myAtoms[j] = dAtom; |
742 |
|
|
743 |
< |
#ifdef IS_MPI |
743 |
> |
ux = currentAtom->getOrntX(); |
744 |
> |
uy = currentAtom->getOrntY(); |
745 |
> |
uz = currentAtom->getOrntZ(); |
746 |
> |
|
747 |
> |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
748 |
> |
|
749 |
> |
u = sqrt( uSqr ); |
750 |
> |
ux = ux / u; |
751 |
> |
uy = uy / u; |
752 |
> |
uz = uz / u; |
753 |
> |
|
754 |
> |
dAtom->setSUx( ux ); |
755 |
> |
dAtom->setSUy( uy ); |
756 |
> |
dAtom->setSUz( uz ); |
757 |
|
} |
758 |
< |
#endif //is_mpi |
758 |
> |
else{ |
759 |
> |
info.myAtoms[j] = new GeneralAtom(j + atomOffset); |
760 |
> |
} |
761 |
> |
info.myAtoms[j]->setType( currentAtom->getType() ); |
762 |
> |
|
763 |
> |
#ifdef IS_MPI |
764 |
|
|
765 |
< |
molIndex++; |
766 |
< |
} |
767 |
< |
} |
765 |
> |
info.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
766 |
> |
|
767 |
> |
#endif // is_mpi |
768 |
> |
} |
769 |
> |
|
770 |
> |
// make the bonds |
771 |
> |
for(j=0; j<info.nBonds; j++){ |
772 |
> |
|
773 |
> |
currentBond = comp_stamps[stampID]->getBond( j ); |
774 |
> |
theBonds[j].a = currentBond->getA() + atomOffset; |
775 |
> |
theBonds[j].b = currentBond->getB() + atomOffset; |
776 |
|
|
777 |
< |
the_ff->initializeBonds( the_bonds ); |
778 |
< |
} |
777 |
> |
exI = theBonds[i].a; |
778 |
> |
exJ = theBonds[i].b; |
779 |
|
|
780 |
< |
void SimSetup::makeBends( void ){ |
781 |
< |
|
782 |
< |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
783 |
< |
bend_set* the_bends; |
784 |
< |
BendStamp* current_bend; |
785 |
< |
LinkedAssign* extras; |
786 |
< |
LinkedAssign* current_extra; |
787 |
< |
|
788 |
< |
|
789 |
< |
the_bends = new bend_set[tot_bends]; |
790 |
< |
index = 0; |
791 |
< |
offset = 0; |
792 |
< |
molIndex = 0; |
793 |
< |
for( i=0; i<n_components; i++ ){ |
794 |
< |
|
795 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
796 |
< |
|
797 |
< |
#ifdef IS_MPI |
798 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
799 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
800 |
< |
#endif // is_mpi |
801 |
< |
|
802 |
< |
for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ |
780 |
> |
// exclude_I must always be the smaller of the pair |
781 |
> |
if( exI > exJ ){ |
782 |
> |
tempEx = exI; |
783 |
> |
exI = exJ; |
784 |
> |
exJ = tempEx; |
785 |
> |
} |
786 |
> |
#ifdef IS_MPI |
787 |
> |
tempEx = exI; |
788 |
> |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
789 |
> |
tempEx = exJ; |
790 |
> |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
791 |
> |
|
792 |
> |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
793 |
> |
#else // isn't MPI |
794 |
> |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
795 |
> |
#endif //is_mpi |
796 |
> |
} |
797 |
> |
excludeOffset += info.nBonds; |
798 |
> |
|
799 |
> |
//make the bends |
800 |
> |
for(j=0; j<info.nBends; j++){ |
801 |
> |
|
802 |
> |
currentBend = comp_stamps[stampID]->getBend( j ); |
803 |
> |
theBends[j].a = currentBend->getA() + atomOffset; |
804 |
> |
theBends[j].b = currentBend->getB() + atomOffset; |
805 |
> |
theBends[j].c = currentBend->getC() + atomOffset; |
806 |
|
|
807 |
< |
current_bend = comp_stamps[i]->getBend( k ); |
849 |
< |
the_bends[index].a = current_bend->getA() + offset; |
850 |
< |
the_bends[index].b = current_bend->getB() + offset; |
851 |
< |
the_bends[index].c = current_bend->getC() + offset; |
852 |
< |
|
853 |
< |
if( current_bend->haveExtras() ){ |
807 |
> |
if( currentBend->haveExtras() ){ |
808 |
|
|
809 |
< |
extras = current_bend->getExtras(); |
810 |
< |
current_extra = extras; |
809 |
> |
extras = current_bend->getExtras(); |
810 |
> |
current_extra = extras; |
811 |
|
|
812 |
< |
while( current_extra != NULL ){ |
813 |
< |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
812 |
> |
while( current_extra != NULL ){ |
813 |
> |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
814 |
|
|
815 |
< |
switch( current_extra->getType() ){ |
815 |
> |
switch( current_extra->getType() ){ |
816 |
> |
|
817 |
> |
case 0: |
818 |
> |
theBends[j].ghost = |
819 |
> |
current_extra->getInt() + atomOffset; |
820 |
> |
theBends[j].isGhost = 1; |
821 |
> |
break; |
822 |
|
|
823 |
< |
case 0: |
824 |
< |
the_bends[index].ghost = |
825 |
< |
current_extra->getInt() + offset; |
826 |
< |
the_bends[index].isGhost = 1; |
827 |
< |
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 |
< |
} |
823 |
> |
case 1: |
824 |
> |
theBends[j].ghost = |
825 |
> |
(int)current_extra->getDouble() + atomOffset; |
826 |
> |
theBends[j].isGhost = 1; |
827 |
> |
break; |
828 |
|
|
829 |
< |
else{ |
830 |
< |
|
831 |
< |
sprintf( painCave.errMsg, |
832 |
< |
"SimSetup Error: unhandled bend assignment:\n" |
833 |
< |
" -->%s in Bend[%d] in %s\n", |
834 |
< |
current_extra->getlhs(), |
835 |
< |
k, comp_stamps[i]->getID() ); |
836 |
< |
painCave.isFatal = 1; |
894 |
< |
simError(); |
895 |
< |
} |
896 |
< |
|
897 |
< |
current_extra = current_extra->getNext(); |
829 |
> |
default: |
830 |
> |
sprintf( painCave.errMsg, |
831 |
> |
"SimSetup Error: ghostVectorSource was neiter a " |
832 |
> |
"double nor an int.\n" |
833 |
> |
"-->Bend[%d] in %s\n", |
834 |
> |
j, comp_stamps[stampID]->getID() ); |
835 |
> |
painCave.isFatal = 1; |
836 |
> |
simError(); |
837 |
|
} |
838 |
|
} |
839 |
|
|
901 |
– |
if( !the_bends[index].isGhost ){ |
902 |
– |
|
903 |
– |
exI = the_bends[index].a; |
904 |
– |
exJ = the_bends[index].c; |
905 |
– |
} |
840 |
|
else{ |
841 |
|
|
842 |
< |
exI = the_bends[index].a; |
843 |
< |
exJ = the_bends[index].b; |
842 |
> |
sprintf( painCave.errMsg, |
843 |
> |
"SimSetup Error: unhandled bend assignment:\n" |
844 |
> |
" -->%s in Bend[%d] in %s\n", |
845 |
> |
current_extra->getlhs(), |
846 |
> |
j, comp_stamps[stampID]->getID() ); |
847 |
> |
painCave.isFatal = 1; |
848 |
> |
simError(); |
849 |
|
} |
850 |
|
|
851 |
< |
// 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++; |
851 |
> |
current_extra = current_extra->getNext(); |
852 |
|
} |
938 |
– |
offset += comp_stamps[i]->getNAtoms(); |
939 |
– |
|
940 |
– |
#ifdef IS_MPI |
853 |
|
} |
854 |
< |
#endif //is_mpi |
855 |
< |
|
856 |
< |
molIndex++; |
857 |
< |
} |
858 |
< |
} |
859 |
< |
|
854 |
> |
|
855 |
> |
if( !theBends[j].isGhost ){ |
856 |
> |
|
857 |
> |
exI = theBends[j].a; |
858 |
> |
exJ = theBends[j].c; |
859 |
> |
} |
860 |
> |
else{ |
861 |
> |
|
862 |
> |
exI = theBends[j].a; |
863 |
> |
exJ = theBends[j].b; |
864 |
> |
} |
865 |
> |
|
866 |
> |
// exclude_I must always be the smaller of the pair |
867 |
> |
if( exI > exJ ){ |
868 |
> |
tempEx = exI; |
869 |
> |
exI = exJ; |
870 |
> |
exJ = tempEx; |
871 |
> |
} |
872 |
|
#ifdef IS_MPI |
873 |
< |
sprintf( checkPointMsg, |
874 |
< |
"Successfully created the bends list.\n" ); |
875 |
< |
MPIcheckPoint(); |
876 |
< |
#endif // is_mpi |
877 |
< |
|
873 |
> |
tempEx = exI; |
874 |
> |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
875 |
> |
tempEx = exJ; |
876 |
> |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
877 |
> |
|
878 |
> |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
879 |
> |
#else // isn't MPI |
880 |
> |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
881 |
> |
#endif //is_mpi |
882 |
> |
} |
883 |
> |
excludeOffset += info.nBends; |
884 |
|
|
885 |
< |
the_ff->initializeBends( the_bends ); |
886 |
< |
} |
885 |
> |
for(j=0; j<info.nTorsions; j++){ |
886 |
> |
|
887 |
> |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
888 |
> |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
889 |
> |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
890 |
> |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
891 |
> |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
892 |
> |
|
893 |
> |
exI = theTorsions[j].a; |
894 |
> |
exJ = theTorsions[j].d; |
895 |
|
|
896 |
< |
void SimSetup::makeTorsions( void ){ |
897 |
< |
|
898 |
< |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
899 |
< |
torsion_set* the_torsions; |
900 |
< |
TorsionStamp* current_torsion; |
901 |
< |
|
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 |
< |
|
896 |
> |
// exclude_I must always be the smaller of the pair |
897 |
> |
if( exI > exJ ){ |
898 |
> |
tempEx = exI; |
899 |
> |
exI = exJ; |
900 |
> |
exJ = tempEx; |
901 |
> |
} |
902 |
|
#ifdef IS_MPI |
903 |
< |
if( mpiSim->getMyMolStart() <= molIndex && |
904 |
< |
molIndex <= mpiSim->getMyMolEnd() ){ |
905 |
< |
#endif // is_mpi |
906 |
< |
|
907 |
< |
for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ |
908 |
< |
|
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 |
< |
|
903 |
> |
tempEx = exI; |
904 |
> |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
905 |
> |
tempEx = exJ; |
906 |
> |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
907 |
> |
|
908 |
> |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
909 |
|
#else // isn't MPI |
910 |
< |
|
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) |
910 |
> |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
911 |
|
#endif //is_mpi |
912 |
< |
|
912 |
> |
} |
913 |
> |
excludeOffset += info.nTorsions; |
914 |
|
|
915 |
< |
// increment the index and repeat; |
916 |
< |
index++; |
1014 |
< |
} |
1015 |
< |
offset += comp_stamps[i]->getNAtoms(); |
915 |
> |
|
916 |
> |
// send the arrays off to the forceField for init. |
917 |
|
|
918 |
< |
#ifdef IS_MPI |
919 |
< |
} |
920 |
< |
#endif //is_mpi |
918 |
> |
the_ff->initializeAtoms( info.nAtoms, info.myAtoms ); |
919 |
> |
the_ff->initializeBonds( info.nBonds, info.myBonds, theBonds ); |
920 |
> |
the_ff->initializeBends( info.nBends, info.myBends, theBends ); |
921 |
> |
the_ff->initializeTorsions( info.nTorsions, info.myTorsions, theTorsions ); |
922 |
|
|
923 |
< |
molIndex++; |
924 |
< |
} |
923 |
> |
|
924 |
> |
the_molecules[i].initialize( info ); |
925 |
> |
atomOffset += info.nAtoms; |
926 |
|
} |
927 |
|
|
928 |
< |
the_ff->initializeTorsions( the_torsions ); |
928 |
> |
// clean up the forcefield |
929 |
> |
the_ff->calcRcut(); |
930 |
> |
the_ff->cleanMe(); |
931 |
|
} |
932 |
|
|
933 |
|
void SimSetup::initFromBass( void ){ |