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 |
|
} |
585 |
|
if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo, the_ff ); |
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; |
842 |
|
|
843 |
|
if( !the_bends[index].isGhost ){ |
844 |
|
|
845 |
< |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
846 |
< |
the_excludes[index + tot_bonds].j = the_bends[index].c; |
845 |
> |
exI = the_bends[index].a; |
846 |
> |
exJ = the_bends[index].c; |
847 |
|
} |
848 |
|
else{ |
849 |
|
|
850 |
< |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
851 |
< |
the_excludes[index + tot_bonds].j = the_bends[index].b; |
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 |
|
} |
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 |
|
} |