191 |
|
|
192 |
|
if( oldOrtho != orthoRhombic ){ |
193 |
|
|
194 |
< |
if( orthoRhombic ){ |
194 |
> |
if( orthoRhombic ) { |
195 |
|
sprintf( painCave.errMsg, |
196 |
|
"OOPSE is switching from the default Non-Orthorhombic\n" |
197 |
|
"\tto the faster Orthorhombic periodic boundary computations.\n" |
199 |
|
"\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" |
200 |
|
"\tvariable ( currently set to %G ) smaller.\n", |
201 |
|
orthoTolerance); |
202 |
+ |
painCave.severity = OOPSE_INFO; |
203 |
|
simError(); |
204 |
|
} |
205 |
|
else { |
211 |
|
"\tthe Orthorhombic computations, make the orthoBoxTolerance\n" |
212 |
|
"\tvariable ( currently set to %G ) larger.\n", |
213 |
|
orthoTolerance); |
214 |
+ |
painCave.severity = OOPSE_WARNING; |
215 |
|
simError(); |
216 |
|
} |
217 |
|
} |
455 |
|
|
456 |
|
isError = 0; |
457 |
|
|
458 |
< |
getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); |
458 |
> |
getFortranGroupArrays(this, FglobalGroupMembership, mfact); |
459 |
|
//it may not be a good idea to pass the address of first element in vector |
460 |
|
//since c++ standard does not require vector to be stored continuously in meomory |
461 |
|
//Most of the compilers will organize the memory of vector continuously |
462 |
|
setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, |
463 |
|
&nGlobalExcludes, globalExcludes, molMembershipArray, |
464 |
< |
&mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); |
465 |
< |
|
464 |
> |
&mfact[0], &ngroup, &FglobalGroupMembership[0], &isError); |
465 |
> |
|
466 |
|
if( isError ){ |
467 |
|
|
468 |
|
sprintf( painCave.errMsg, |
469 |
|
"There was an error setting the simulation information in fortran.\n" ); |
470 |
|
painCave.isFatal = 1; |
471 |
+ |
painCave.severity = OOPSE_ERROR; |
472 |
|
simError(); |
473 |
|
} |
474 |
|
|
519 |
|
Hmat[0][0], Hmat[0][1], Hmat[0][2], |
520 |
|
Hmat[1][0], Hmat[1][1], Hmat[1][2], |
521 |
|
Hmat[2][0], Hmat[2][1], Hmat[2][2]); |
522 |
+ |
painCave.severity = OOPSE_ERROR; |
523 |
|
painCave.isFatal = 1; |
524 |
|
simError(); |
525 |
|
} |
528 |
|
sprintf( painCave.errMsg, |
529 |
|
"Trying to check cutoffs without a box.\n" |
530 |
|
"\tOOPSE should have better programmers than that.\n" ); |
531 |
+ |
painCave.severity = OOPSE_ERROR; |
532 |
|
painCave.isFatal = 1; |
533 |
|
simError(); |
534 |
|
} |
572 |
|
} |
573 |
|
|
574 |
|
|
575 |
< |
void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup, |
576 |
< |
vector<int>& groupList, vector<int>& groupStart){ |
575 |
> |
void SimInfo::getFortranGroupArrays(SimInfo* info, |
576 |
> |
vector<int>& FglobalGroupMembership, |
577 |
> |
vector<double>& mfact){ |
578 |
> |
|
579 |
|
Molecule* myMols; |
580 |
|
Atom** myAtoms; |
581 |
|
int numAtom; |
575 |
– |
int curIndex; |
582 |
|
double mtot; |
583 |
|
int numMol; |
584 |
|
int numCutoffGroups; |
590 |
|
double totalMass; |
591 |
|
|
592 |
|
mfact.clear(); |
593 |
< |
groupList.clear(); |
588 |
< |
groupStart.clear(); |
593 |
> |
FglobalGroupMembership.clear(); |
594 |
|
|
595 |
< |
//Be careful, fortran array begin at 1 |
596 |
< |
curIndex = 1; |
595 |
> |
|
596 |
> |
// Fix the silly fortran indexing problem |
597 |
> |
#ifdef IS_MPI |
598 |
> |
numAtom = mpiSim->getNAtomsGlobal(); |
599 |
> |
#else |
600 |
> |
numAtom = n_atoms; |
601 |
> |
#endif |
602 |
> |
for (int i = 0; i < numAtom; i++) |
603 |
> |
FglobalGroupMembership.push_back(globalGroupMembership[i] + 1); |
604 |
> |
|
605 |
|
|
606 |
|
myMols = info->molecules; |
607 |
|
numMol = info->n_mol; |
608 |
|
for(int i = 0; i < numMol; i++){ |
609 |
|
numCutoffGroups = myMols[i].getNCutoffGroups(); |
610 |
< |
for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; |
611 |
< |
myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ |
610 |
> |
for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); |
611 |
> |
myCutoffGroup != NULL; |
612 |
> |
myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ |
613 |
|
|
614 |
|
totalMass = myCutoffGroup->getMass(); |
615 |
|
|
616 |
< |
for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; |
617 |
< |
cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ |
616 |
> |
for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); |
617 |
> |
cutoffAtom != NULL; |
618 |
> |
cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ |
619 |
|
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 |
620 |
|
} |
621 |
< |
|
622 |
< |
groupStart.push_back(curIndex); |
613 |
< |
curIndex += myCutoffGroup->getNumAtom(); |
621 |
> |
} |
622 |
> |
} |
623 |
|
|
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(); |
624 |
|
} |