| 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 |
> |
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; |
| 320 |
> |
simnfo->globalExcludes = new int; |
| 321 |
> |
simnfo->globalExcludes[0] = 0; |
| 322 |
> |
|
| 323 |
> |
simnfo->n_exclude = 1; |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
// set the arrays into the SimInfo object |
| 327 |
|
|
| 328 |
|
simnfo->atoms = the_atoms; |
| 329 |
|
simnfo->sr_interactions = the_sris; |
| 330 |
< |
simnfo->n_exclude = tot_SRI; |
| 330 |
> |
simnfo->nGlobalExcludes = 0; |
| 331 |
|
simnfo->excludes = the_excludes; |
| 332 |
|
|
| 333 |
|
|
| 408 |
|
the_ff->setSimInfo( simnfo ); |
| 409 |
|
|
| 410 |
|
makeAtoms(); |
| 411 |
< |
// |
| 411 |
> |
simnfo->identArray = new int[simnfo->n_atoms]; |
| 412 |
> |
for(i=0; i<simnfo->n_atoms; i++){ |
| 413 |
> |
simnfo->identArray[i] = the_atoms[i]->getIdent(); |
| 414 |
> |
} |
| 415 |
> |
|
| 416 |
|
if( tot_bonds ){ |
| 417 |
|
makeBonds(); |
| 418 |
|
} |
| 592 |
|
if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff ); |
| 593 |
|
if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff ); |
| 594 |
|
|
| 595 |
+ |
|
| 596 |
+ |
|
| 597 |
+ |
// initialize the Fortran |
| 598 |
+ |
|
| 599 |
+ |
simnfo->refreshSim(); |
| 600 |
+ |
|
| 601 |
+ |
if( !strcmp( simnfo->mixingRule, "standard") ){ |
| 602 |
+ |
the_ff->initForceField( LB_MIXING_RULE ); |
| 603 |
+ |
} |
| 604 |
+ |
else if( !strcmp( simnfo->mixingRule, "explicit") ){ |
| 605 |
+ |
the_ff->initForceField( EXPLICIT_MIXING_RULE ); |
| 606 |
+ |
} |
| 607 |
+ |
else{ |
| 608 |
+ |
sprintf( painCave.errMsg, |
| 609 |
+ |
"SimSetup Error: unknown mixing rule -> \"%s\"\n", |
| 610 |
+ |
simnfo->mixingRule ); |
| 611 |
+ |
painCave.isFatal = 1; |
| 612 |
+ |
simError(); |
| 613 |
+ |
} |
| 614 |
+ |
|
| 615 |
+ |
|
| 616 |
+ |
#ifdef IS_MPI |
| 617 |
+ |
strcpy( checkPointMsg, |
| 618 |
+ |
"Successfully intialized the mixingRule for Fortran." ); |
| 619 |
+ |
MPIcheckPoint(); |
| 620 |
+ |
#endif // is_mpi |
| 621 |
|
} |
| 622 |
|
|
| 623 |
|
void SimSetup::makeAtoms( void ){ |
| 625 |
|
int i, j, k, index; |
| 626 |
|
double ux, uy, uz, uSqr, u; |
| 627 |
|
AtomStamp* current_atom; |
| 628 |
+ |
|
| 629 |
|
DirectionalAtom* dAtom; |
| 630 |
|
int molIndex, molStart, molEnd, nMemb, lMolIndex; |
| 631 |
|
|
| 705 |
|
|
| 706 |
|
void SimSetup::makeBonds( void ){ |
| 707 |
|
|
| 708 |
< |
int i, j, k, index, offset, molIndex; |
| 708 |
> |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 709 |
|
bond_pair* the_bonds; |
| 710 |
|
BondStamp* current_bond; |
| 711 |
|
|
| 728 |
|
current_bond = comp_stamps[i]->getBond( k ); |
| 729 |
|
the_bonds[index].a = current_bond->getA() + offset; |
| 730 |
|
the_bonds[index].b = current_bond->getB() + offset; |
| 731 |
+ |
|
| 732 |
+ |
exI = the_bonds[index].a; |
| 733 |
+ |
exJ = the_bonds[index].b; |
| 734 |
+ |
|
| 735 |
+ |
// exclude_I must always be the smaller of the pair |
| 736 |
+ |
if( exI > exJ ){ |
| 737 |
+ |
tempEx = exI; |
| 738 |
+ |
exI = exJ; |
| 739 |
+ |
exJ = tempEx; |
| 740 |
+ |
} |
| 741 |
+ |
|
| 742 |
|
|
| 743 |
< |
the_excludes[index].i = the_bonds[index].a; |
| 744 |
< |
the_excludes[index].j = the_bonds[index].b; |
| 743 |
> |
#ifdef IS_MPI |
| 744 |
> |
|
| 745 |
> |
the_excludes[index*2] = |
| 746 |
> |
the_atoms[exI]->getGlobalIndex() + 1; |
| 747 |
> |
the_excludes[index*2 + 1] = |
| 748 |
> |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 749 |
> |
|
| 750 |
> |
#else // isn't MPI |
| 751 |
> |
|
| 752 |
> |
the_excludes[index*2] = exI + 1; |
| 753 |
> |
the_excludes[index*2 + 1] = exJ + 1; |
| 754 |
> |
// fortran index from 1 (hence the +1 in the indexing) |
| 755 |
> |
#endif //is_mpi |
| 756 |
|
|
| 757 |
|
// increment the index and repeat; |
| 758 |
|
index++; |
| 772 |
|
|
| 773 |
|
void SimSetup::makeBends( void ){ |
| 774 |
|
|
| 775 |
< |
int i, j, k, index, offset, molIndex; |
| 775 |
> |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 776 |
|
bend_set* the_bends; |
| 777 |
|
BendStamp* current_bend; |
| 778 |
|
LinkedAssign* extras; |
| 799 |
|
the_bends[index].b = current_bend->getB() + offset; |
| 800 |
|
the_bends[index].c = current_bend->getC() + offset; |
| 801 |
|
|
| 802 |
< |
if( current_bend->haveExtras ){ |
| 802 |
> |
if( current_bend->haveExtras() ){ |
| 803 |
|
|
| 804 |
|
extras = current_bend->getExtras(); |
| 805 |
|
current_extra = extras; |
| 843 |
|
simError(); |
| 844 |
|
} |
| 845 |
|
|
| 846 |
< |
current_extra = current_extra->next; |
| 846 |
> |
current_extra = current_extra->getNext(); |
| 847 |
|
} |
| 848 |
|
} |
| 849 |
|
|
| 850 |
|
if( !the_bends[index].isGhost ){ |
| 851 |
|
|
| 852 |
< |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
| 853 |
< |
the_excludes[index + tot_bonds].j = the_bends[index].c; |
| 852 |
> |
exI = the_bends[index].a; |
| 853 |
> |
exJ = the_bends[index].c; |
| 854 |
|
} |
| 855 |
|
else{ |
| 856 |
|
|
| 857 |
< |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
| 858 |
< |
the_excludes[index + tot_bonds].j = the_bends[index].b; |
| 857 |
> |
exI = the_bends[index].a; |
| 858 |
> |
exJ = the_bends[index].b; |
| 859 |
|
} |
| 860 |
+ |
|
| 861 |
+ |
// exclude_I must always be the smaller of the pair |
| 862 |
+ |
if( exI > exJ ){ |
| 863 |
+ |
tempEx = exI; |
| 864 |
+ |
exI = exJ; |
| 865 |
+ |
exJ = tempEx; |
| 866 |
+ |
} |
| 867 |
+ |
|
| 868 |
+ |
|
| 869 |
+ |
#ifdef IS_MPI |
| 870 |
+ |
|
| 871 |
+ |
the_excludes[(index + tot_bonds)*2] = |
| 872 |
+ |
the_atoms[exI]->getGlobalIndex() + 1; |
| 873 |
+ |
the_excludes[(index + tot_bonds)*2 + 1] = |
| 874 |
+ |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 875 |
+ |
|
| 876 |
+ |
#else // isn't MPI |
| 877 |
+ |
|
| 878 |
+ |
the_excludes[(index + tot_bonds)*2] = exI + 1; |
| 879 |
+ |
the_excludes[(index + tot_bonds)*2 + 1] = exJ + 1; |
| 880 |
+ |
// fortran index from 1 (hence the +1 in the indexing) |
| 881 |
+ |
#endif //is_mpi |
| 882 |
|
|
| 883 |
+ |
|
| 884 |
|
// increment the index and repeat; |
| 885 |
|
index++; |
| 886 |
|
} |
| 906 |
|
|
| 907 |
|
void SimSetup::makeTorsions( void ){ |
| 908 |
|
|
| 909 |
< |
int i, j, k, index, offset, molIndex; |
| 909 |
> |
int i, j, k, index, offset, molIndex, exI, exJ, tempEx; |
| 910 |
|
torsion_set* the_torsions; |
| 911 |
|
TorsionStamp* current_torsion; |
| 912 |
|
|
| 931 |
|
the_torsions[index].c = current_torsion->getC() + offset; |
| 932 |
|
the_torsions[index].d = current_torsion->getD() + offset; |
| 933 |
|
|
| 934 |
< |
the_excludes[index + tot_bonds + tot_bends].i = the_torsions[index].a; |
| 935 |
< |
the_excludes[index + tot_bonds + tot_bends].j = the_torsions[index].d; |
| 934 |
> |
exI = the_torsions[index].a; |
| 935 |
> |
exJ = the_torsions[index].d; |
| 936 |
> |
|
| 937 |
> |
|
| 938 |
> |
// exclude_I must always be the smaller of the pair |
| 939 |
> |
if( exI > exJ ){ |
| 940 |
> |
tempEx = exI; |
| 941 |
> |
exI = exJ; |
| 942 |
> |
exJ = tempEx; |
| 943 |
> |
} |
| 944 |
|
|
| 945 |
+ |
|
| 946 |
+ |
#ifdef IS_MPI |
| 947 |
+ |
|
| 948 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2] = |
| 949 |
+ |
the_atoms[exI]->getGlobalIndex() + 1; |
| 950 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = |
| 951 |
+ |
the_atoms[exJ]->getGlobalIndex() + 1; |
| 952 |
+ |
|
| 953 |
+ |
#else // isn't MPI |
| 954 |
+ |
|
| 955 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2] = exI + 1; |
| 956 |
+ |
the_excludes[(index + tot_bonds + tot_bends)*2 + 1] = exJ + 1; |
| 957 |
+ |
// fortran indexes from 1 (hence the +1 in the indexing) |
| 958 |
+ |
#endif //is_mpi |
| 959 |
+ |
|
| 960 |
+ |
|
| 961 |
|
// increment the index and repeat; |
| 962 |
|
index++; |
| 963 |
|
} |