| 240 |
|
|
| 241 |
|
// set up the local variables |
| 242 |
|
|
| 243 |
< |
int localMol; |
| 243 |
> |
int localMol, allMol; |
| 244 |
|
int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; |
| 245 |
|
|
| 246 |
+ |
allMol = 0; |
| 247 |
|
localMol = 0; |
| 248 |
|
local_atoms = 0; |
| 249 |
|
local_bonds = 0; |
| 253 |
|
|
| 254 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
| 255 |
|
|
| 256 |
< |
if( mpiSim->getMyMolStart() <= j && |
| 257 |
< |
j <= mpiSim->getMyMolEnd() ){ |
| 256 |
> |
if( mpiSim->getMyMolStart() <= allMol && |
| 257 |
> |
allMol <= mpiSim->getMyMolEnd() ){ |
| 258 |
|
|
| 259 |
|
local_atoms += comp_stamps[i]->getNAtoms(); |
| 260 |
|
local_bonds += comp_stamps[i]->getNBonds(); |
| 262 |
|
local_torsions += comp_stamps[i]->getNTorsions(); |
| 263 |
|
localMol++; |
| 264 |
|
} |
| 265 |
+ |
allMol++; |
| 266 |
|
} |
| 267 |
|
} |
| 268 |
< |
|
| 268 |
> |
local_SRI = local_bonds + local_bends + local_torsions; |
| 269 |
|
|
| 270 |
|
|
| 271 |
|
simnfo->n_atoms = mpiSim->getMyNlocal(); |
| 272 |
|
|
| 273 |
+ |
if( local_atoms != simnfo->n_atoms ){ |
| 274 |
+ |
sprintf( painCave.errMsg, |
| 275 |
+ |
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
| 276 |
+ |
" localAtom (%d) are note equal.\n", |
| 277 |
+ |
simnfo->n_atoms, |
| 278 |
+ |
local_atoms ); |
| 279 |
+ |
painCave.isFatal = 1; |
| 280 |
+ |
simError(); |
| 281 |
+ |
} |
| 282 |
|
|
| 283 |
+ |
simnfo->n_bonds = local_bonds; |
| 284 |
+ |
simnfo->n_bends = local_bends; |
| 285 |
+ |
simnfo->n_torsions = local_torsions; |
| 286 |
+ |
simnfo->n_SRI = local_SRI; |
| 287 |
+ |
simnfo->n_mol = localMol; |
| 288 |
+ |
|
| 289 |
+ |
strcpy( checkPointMsg, "Passed nlocal consistency check." ); |
| 290 |
+ |
MPIcheckPoint(); |
| 291 |
+ |
|
| 292 |
+ |
|
| 293 |
|
#endif // is_mpi |
| 294 |
|
|
| 295 |
|
|
| 565 |
|
double ux, uy, uz, uSqr, u; |
| 566 |
|
AtomStamp* current_atom; |
| 567 |
|
DirectionalAtom* dAtom; |
| 568 |
< |
int molIndex, molStart, molEnd, nMemb; |
| 568 |
> |
int molIndex, molStart, molEnd, nMemb, lMolIndex; |
| 569 |
|
|
| 570 |
< |
|
| 570 |
> |
lMolIndex = 0; |
| 571 |
|
molIndex = 0; |
| 572 |
|
index = 0; |
| 573 |
|
for( i=0; i<n_components; i++ ){ |
| 574 |
|
|
| 575 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
| 576 |
|
|
| 577 |
< |
molStart = index; |
| 578 |
< |
nMemb = comp_stamps[i]->getNAtoms(); |
| 579 |
< |
for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ |
| 580 |
< |
|
| 560 |
< |
current_atom = comp_stamps[i]->getAtom( k ); |
| 561 |
< |
if( current_atom->haveOrientation() ){ |
| 562 |
< |
|
| 563 |
< |
dAtom = new DirectionalAtom(index); |
| 564 |
< |
simnfo->n_oriented++; |
| 565 |
< |
the_atoms[index] = dAtom; |
| 566 |
< |
|
| 567 |
< |
ux = current_atom->getOrntX(); |
| 568 |
< |
uy = current_atom->getOrntY(); |
| 569 |
< |
uz = current_atom->getOrntZ(); |
| 570 |
< |
|
| 571 |
< |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
| 572 |
< |
|
| 573 |
< |
u = sqrt( uSqr ); |
| 574 |
< |
ux = ux / u; |
| 575 |
< |
uy = uy / u; |
| 576 |
< |
uz = uz / u; |
| 577 |
> |
#ifdef IS_MPI |
| 578 |
> |
if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
| 579 |
> |
molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
| 580 |
> |
#endif // is_mpi |
| 581 |
|
|
| 582 |
< |
dAtom->setSUx( ux ); |
| 583 |
< |
dAtom->setSUy( uy ); |
| 584 |
< |
dAtom->setSUz( uz ); |
| 582 |
> |
molStart = index; |
| 583 |
> |
nMemb = comp_stamps[i]->getNAtoms(); |
| 584 |
> |
for( k=0; k<comp_stamps[i]->getNAtoms(); k++ ){ |
| 585 |
> |
|
| 586 |
> |
current_atom = comp_stamps[i]->getAtom( k ); |
| 587 |
> |
if( current_atom->haveOrientation() ){ |
| 588 |
> |
|
| 589 |
> |
dAtom = new DirectionalAtom(index); |
| 590 |
> |
simnfo->n_oriented++; |
| 591 |
> |
the_atoms[index] = dAtom; |
| 592 |
> |
|
| 593 |
> |
ux = current_atom->getOrntX(); |
| 594 |
> |
uy = current_atom->getOrntY(); |
| 595 |
> |
uz = current_atom->getOrntZ(); |
| 596 |
> |
|
| 597 |
> |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
| 598 |
> |
|
| 599 |
> |
u = sqrt( uSqr ); |
| 600 |
> |
ux = ux / u; |
| 601 |
> |
uy = uy / u; |
| 602 |
> |
uz = uz / u; |
| 603 |
> |
|
| 604 |
> |
dAtom->setSUx( ux ); |
| 605 |
> |
dAtom->setSUy( uy ); |
| 606 |
> |
dAtom->setSUz( uz ); |
| 607 |
> |
} |
| 608 |
> |
else{ |
| 609 |
> |
the_atoms[index] = new GeneralAtom(index); |
| 610 |
> |
} |
| 611 |
> |
the_atoms[index]->setType( current_atom->getType() ); |
| 612 |
> |
the_atoms[index]->setIndex( index ); |
| 613 |
> |
|
| 614 |
> |
// increment the index and repeat; |
| 615 |
> |
index++; |
| 616 |
|
} |
| 617 |
< |
else{ |
| 618 |
< |
the_atoms[index] = new GeneralAtom(index); |
| 619 |
< |
} |
| 620 |
< |
the_atoms[index]->setType( current_atom->getType() ); |
| 621 |
< |
the_atoms[index]->setIndex( index ); |
| 617 |
> |
|
| 618 |
> |
molEnd = index -1; |
| 619 |
> |
the_molecules[lMolIndex].setNMembers( nMemb ); |
| 620 |
> |
the_molecules[lMolIndex].setStartAtom( molStart ); |
| 621 |
> |
the_molecules[lMolIndex].setEndAtom( molEnd ); |
| 622 |
> |
the_molecules[lMolIndex].setStampID( i ); |
| 623 |
> |
lMolIndex++; |
| 624 |
|
|
| 625 |
< |
// increment the index and repeat; |
| 589 |
< |
index++; |
| 625 |
> |
#ifdef IS_MPI |
| 626 |
|
} |
| 627 |
< |
|
| 628 |
< |
molEnd = index -1; |
| 593 |
< |
the_molecules[molIndex].setNMembers( nMemb ); |
| 594 |
< |
the_molecules[molIndex].setStartAtom( molStart ); |
| 595 |
< |
the_molecules[molIndex].setEndAtom( molEnd ); |
| 596 |
< |
the_molecules[molIndex].setStampID( i ); |
| 627 |
> |
#endif //is_mpi |
| 628 |
> |
|
| 629 |
|
molIndex++; |
| 598 |
– |
|
| 630 |
|
} |
| 631 |
|
} |
| 632 |
|
|
| 635 |
|
|
| 636 |
|
void SimSetup::makeBonds( void ){ |
| 637 |
|
|
| 638 |
< |
int i, j, k, index, offset; |
| 638 |
> |
int i, j, k, index, offset, molIndex; |
| 639 |
|
bond_pair* the_bonds; |
| 640 |
|
BondStamp* current_bond; |
| 641 |
|
|
| 642 |
|
the_bonds = new bond_pair[tot_bonds]; |
| 643 |
|
index = 0; |
| 644 |
|
offset = 0; |
| 645 |
+ |
molIndex = 0; |
| 646 |
|
for( i=0; i<n_components; i++ ){ |
| 647 |
|
|
| 648 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
| 649 |
|
|
| 650 |
< |
for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ |
| 651 |
< |
|
| 652 |
< |
current_bond = comp_stamps[i]->getBond( k ); |
| 653 |
< |
the_bonds[index].a = current_bond->getA() + offset; |
| 654 |
< |
the_bonds[index].b = current_bond->getB() + offset; |
| 655 |
< |
|
| 656 |
< |
the_excludes[index].i = the_bonds[index].a; |
| 657 |
< |
the_excludes[index].j = the_bonds[index].b; |
| 658 |
< |
|
| 659 |
< |
// increment the index and repeat; |
| 660 |
< |
index++; |
| 650 |
> |
#ifdef IS_MPI |
| 651 |
> |
if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
| 652 |
> |
molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
| 653 |
> |
#endif // is_mpi |
| 654 |
> |
|
| 655 |
> |
for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ |
| 656 |
> |
|
| 657 |
> |
current_bond = comp_stamps[i]->getBond( k ); |
| 658 |
> |
the_bonds[index].a = current_bond->getA() + offset; |
| 659 |
> |
the_bonds[index].b = current_bond->getB() + offset; |
| 660 |
> |
|
| 661 |
> |
the_excludes[index].i = the_bonds[index].a; |
| 662 |
> |
the_excludes[index].j = the_bonds[index].b; |
| 663 |
> |
|
| 664 |
> |
// increment the index and repeat; |
| 665 |
> |
index++; |
| 666 |
> |
} |
| 667 |
> |
offset += comp_stamps[i]->getNAtoms(); |
| 668 |
> |
|
| 669 |
> |
#ifdef IS_MPI |
| 670 |
|
} |
| 671 |
< |
offset += comp_stamps[i]->getNAtoms(); |
| 672 |
< |
} |
| 671 |
> |
#endif is_mpi |
| 672 |
> |
|
| 673 |
> |
molIndex++; |
| 674 |
> |
} |
| 675 |
|
} |
| 676 |
|
|
| 677 |
|
the_ff->initializeBonds( the_bonds ); |
| 679 |
|
|
| 680 |
|
void SimSetup::makeBends( void ){ |
| 681 |
|
|
| 682 |
< |
int i, j, k, index, offset; |
| 682 |
> |
int i, j, k, index, offset, molIndex; |
| 683 |
|
bend_set* the_bends; |
| 684 |
|
BendStamp* current_bend; |
| 685 |
|
|
| 686 |
|
the_bends = new bend_set[tot_bends]; |
| 687 |
|
index = 0; |
| 688 |
|
offset = 0; |
| 689 |
+ |
molIndex = 0; |
| 690 |
|
for( i=0; i<n_components; i++ ){ |
| 691 |
|
|
| 692 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
| 693 |
|
|
| 694 |
< |
for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ |
| 694 |
> |
#ifdef IS_MPI |
| 695 |
> |
if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
| 696 |
> |
molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
| 697 |
> |
#endif // is_mpi |
| 698 |
|
|
| 699 |
< |
current_bend = comp_stamps[i]->getBend( k ); |
| 700 |
< |
the_bends[index].a = current_bend->getA() + offset; |
| 701 |
< |
the_bends[index].b = current_bend->getB() + offset; |
| 702 |
< |
the_bends[index].c = current_bend->getC() + offset; |
| 703 |
< |
|
| 704 |
< |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
| 705 |
< |
the_excludes[index + tot_bonds].j = the_bends[index].c; |
| 706 |
< |
|
| 707 |
< |
// increment the index and repeat; |
| 708 |
< |
index++; |
| 699 |
> |
for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ |
| 700 |
> |
|
| 701 |
> |
current_bend = comp_stamps[i]->getBend( k ); |
| 702 |
> |
the_bends[index].a = current_bend->getA() + offset; |
| 703 |
> |
the_bends[index].b = current_bend->getB() + offset; |
| 704 |
> |
the_bends[index].c = current_bend->getC() + offset; |
| 705 |
> |
|
| 706 |
> |
the_excludes[index + tot_bonds].i = the_bends[index].a; |
| 707 |
> |
the_excludes[index + tot_bonds].j = the_bends[index].c; |
| 708 |
> |
|
| 709 |
> |
// increment the index and repeat; |
| 710 |
> |
index++; |
| 711 |
> |
} |
| 712 |
> |
offset += comp_stamps[i]->getNAtoms(); |
| 713 |
> |
|
| 714 |
> |
#ifdef IS_MPI |
| 715 |
|
} |
| 716 |
< |
offset += comp_stamps[i]->getNAtoms(); |
| 716 |
> |
#endif //is_mpi |
| 717 |
> |
|
| 718 |
> |
molIndex++; |
| 719 |
|
} |
| 720 |
|
} |
| 721 |
|
|
| 724 |
|
|
| 725 |
|
void SimSetup::makeTorsions( void ){ |
| 726 |
|
|
| 727 |
< |
int i, j, k, index, offset; |
| 727 |
> |
int i, j, k, index, offset, molIndex; |
| 728 |
|
torsion_set* the_torsions; |
| 729 |
|
TorsionStamp* current_torsion; |
| 730 |
|
|
| 731 |
|
the_torsions = new torsion_set[tot_torsions]; |
| 732 |
|
index = 0; |
| 733 |
|
offset = 0; |
| 734 |
+ |
molIndex = 0; |
| 735 |
|
for( i=0; i<n_components; i++ ){ |
| 736 |
|
|
| 737 |
|
for( j=0; j<components_nmol[i]; j++ ){ |
| 738 |
|
|
| 739 |
+ |
#ifdef IS_MPI |
| 740 |
+ |
if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
| 741 |
+ |
molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
| 742 |
+ |
#endif // is_mpi |
| 743 |
+ |
|
| 744 |
|
for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ |
| 745 |
|
|
| 746 |
|
current_torsion = comp_stamps[i]->getTorsion( k ); |
| 756 |
|
index++; |
| 757 |
|
} |
| 758 |
|
offset += comp_stamps[i]->getNAtoms(); |
| 759 |
+ |
|
| 760 |
+ |
#ifdef IS_MPI |
| 761 |
+ |
} |
| 762 |
+ |
#endif //is_mpi |
| 763 |
+ |
|
| 764 |
+ |
molIndex++; |
| 765 |
|
} |
| 766 |
|
} |
| 767 |
|
|