14 |
|
|
15 |
|
#include "MatVec3.h" |
16 |
|
|
17 |
+ |
#include "ConstraintManager.hpp" |
18 |
+ |
|
19 |
|
#ifdef IS_MPI |
20 |
|
#include "mpiSimulation.hpp" |
21 |
|
#endif |
78 |
|
|
79 |
|
ngroup = 0; |
80 |
|
|
81 |
+ |
consMan = NULL; |
82 |
+ |
|
83 |
|
wrapMeSimInfo( this ); |
84 |
|
} |
85 |
|
|
92 |
|
|
93 |
|
for(i = properties.begin(); i != properties.end(); i++) |
94 |
|
delete (*i).second; |
95 |
< |
|
95 |
> |
|
96 |
> |
if (!consMan) |
97 |
> |
delete consMan; |
98 |
|
} |
99 |
|
|
100 |
|
void SimInfo::setBox(double newBox[3]) { |
197 |
|
|
198 |
|
if( oldOrtho != orthoRhombic ){ |
199 |
|
|
200 |
< |
if( orthoRhombic ){ |
200 |
> |
if( orthoRhombic ) { |
201 |
|
sprintf( painCave.errMsg, |
202 |
|
"OOPSE is switching from the default Non-Orthorhombic\n" |
203 |
|
"\tto the faster Orthorhombic periodic boundary computations.\n" |
205 |
|
"\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
206 |
|
"\tvariable ( currently set to %G ) smaller.\n", |
207 |
|
orthoTolerance); |
208 |
+ |
painCave.severity = OOPSE_INFO; |
209 |
|
simError(); |
210 |
|
} |
211 |
|
else { |
217 |
|
"\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
218 |
|
"\tvariable ( currently set to %G ) larger.\n", |
219 |
|
orthoTolerance); |
220 |
+ |
painCave.severity = OOPSE_WARNING; |
221 |
|
simError(); |
222 |
|
} |
223 |
|
} |
461 |
|
|
462 |
|
isError = 0; |
463 |
|
|
464 |
< |
getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); |
464 |
> |
getFortranGroupArrays(this, FglobalGroupMembership, mfact); |
465 |
|
//it may not be a good idea to pass the address of first element in vector |
466 |
|
//since c++ standard does not require vector to be stored continuously in meomory |
467 |
|
//Most of the compilers will organize the memory of vector continuously |
468 |
|
setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, |
469 |
|
&nGlobalExcludes, globalExcludes, molMembershipArray, |
470 |
< |
&mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); |
471 |
< |
|
470 |
> |
&mfact[0], &ngroup, &FglobalGroupMembership[0], &isError); |
471 |
> |
|
472 |
|
if( isError ){ |
473 |
|
|
474 |
|
sprintf( painCave.errMsg, |
475 |
|
"There was an error setting the simulation information in fortran.\n" ); |
476 |
|
painCave.isFatal = 1; |
477 |
+ |
painCave.severity = OOPSE_ERROR; |
478 |
|
simError(); |
479 |
|
} |
480 |
|
|
525 |
|
Hmat[0][0], Hmat[0][1], Hmat[0][2], |
526 |
|
Hmat[1][0], Hmat[1][1], Hmat[1][2], |
527 |
|
Hmat[2][0], Hmat[2][1], Hmat[2][2]); |
528 |
+ |
painCave.severity = OOPSE_ERROR; |
529 |
|
painCave.isFatal = 1; |
530 |
|
simError(); |
531 |
|
} |
534 |
|
sprintf( painCave.errMsg, |
535 |
|
"Trying to check cutoffs without a box.\n" |
536 |
|
"\tOOPSE should have better programmers than that.\n" ); |
537 |
+ |
painCave.severity = OOPSE_ERROR; |
538 |
|
painCave.isFatal = 1; |
539 |
|
simError(); |
540 |
|
} |
578 |
|
} |
579 |
|
|
580 |
|
|
581 |
< |
void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup, |
582 |
< |
vector<int>& groupList, vector<int>& groupStart){ |
581 |
> |
void SimInfo::getFortranGroupArrays(SimInfo* info, |
582 |
> |
vector<int>& FglobalGroupMembership, |
583 |
> |
vector<double>& mfact){ |
584 |
> |
|
585 |
|
Molecule* myMols; |
586 |
|
Atom** myAtoms; |
587 |
|
int numAtom; |
575 |
– |
int curIndex; |
588 |
|
double mtot; |
589 |
|
int numMol; |
590 |
|
int numCutoffGroups; |
596 |
|
double totalMass; |
597 |
|
|
598 |
|
mfact.clear(); |
599 |
< |
groupList.clear(); |
588 |
< |
groupStart.clear(); |
599 |
> |
FglobalGroupMembership.clear(); |
600 |
|
|
601 |
< |
//Be careful, fortran array begin at 1 |
602 |
< |
curIndex = 1; |
601 |
> |
|
602 |
> |
// Fix the silly fortran indexing problem |
603 |
> |
#ifdef IS_MPI |
604 |
> |
numAtom = mpiSim->getNAtomsGlobal(); |
605 |
> |
#else |
606 |
> |
numAtom = n_atoms; |
607 |
> |
#endif |
608 |
> |
for (int i = 0; i < numAtom; i++) |
609 |
> |
FglobalGroupMembership.push_back(globalGroupMembership[i] + 1); |
610 |
> |
|
611 |
|
|
612 |
|
myMols = info->molecules; |
613 |
|
numMol = info->n_mol; |
614 |
|
for(int i = 0; i < numMol; i++){ |
615 |
|
numCutoffGroups = myMols[i].getNCutoffGroups(); |
616 |
< |
for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; |
617 |
< |
myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ |
616 |
> |
for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); |
617 |
> |
myCutoffGroup != NULL; |
618 |
> |
myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ |
619 |
|
|
620 |
|
totalMass = myCutoffGroup->getMass(); |
621 |
|
|
622 |
< |
for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; |
623 |
< |
cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ |
622 |
> |
for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); |
623 |
> |
cutoffAtom != NULL; |
624 |
> |
cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ |
625 |
|
mfact.push_back(cutoffAtom->getMass()/totalMass); |
605 |
– |
#ifdef IS_MPI |
606 |
– |
groupList.push_back(cutoffAtom->getGlobalIndex() + 1); |
607 |
– |
#else |
608 |
– |
groupList.push_back(cutoffAtom->getIndex() + 1); |
609 |
– |
#endif |
626 |
|
} |
627 |
< |
|
628 |
< |
groupStart.push_back(curIndex); |
613 |
< |
curIndex += myCutoffGroup->getNumAtom(); |
627 |
> |
} |
628 |
> |
} |
629 |
|
|
615 |
– |
}//end for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff)) |
616 |
– |
|
617 |
– |
}//end for(int i = 0; i < numMol; i++) |
618 |
– |
|
619 |
– |
|
620 |
– |
//The last cutoff group need more element to indicate the end of the cutoff |
621 |
– |
ngroup = groupStart.size(); |
630 |
|
} |