| 42 |
|
thermalTime = 0.0; |
| 43 |
|
currentTime = 0.0; |
| 44 |
|
rCut = 0.0; |
| 45 |
< |
ecr = 0.0; |
| 46 |
< |
est = 0.0; |
| 45 |
> |
rSw = 0.0; |
| 46 |
|
|
| 47 |
|
haveRcut = 0; |
| 48 |
< |
haveEcr = 0; |
| 48 |
> |
haveRsw = 0; |
| 49 |
|
boxIsInit = 0; |
| 50 |
|
|
| 51 |
|
resetTime = 1e99; |
| 70 |
|
has_minimizer = false; |
| 71 |
|
the_minimizer =NULL; |
| 72 |
|
|
| 73 |
+ |
ngroup = 0; |
| 74 |
+ |
|
| 75 |
|
wrapMeSimInfo( this ); |
| 76 |
|
} |
| 77 |
|
|
| 84 |
|
|
| 85 |
|
for(i = properties.begin(); i != properties.end(); i++) |
| 86 |
|
delete (*i).second; |
| 87 |
< |
|
| 87 |
> |
|
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
void SimInfo::setBox(double newBox[3]) { |
| 327 |
|
|
| 328 |
|
for(int i = 0; i < integrableObjects.size(); i++){ |
| 329 |
|
ndf_local += 3; |
| 330 |
< |
if (integrableObjects[i]->isDirectional()) |
| 331 |
< |
ndf_local += 3; |
| 330 |
> |
if (integrableObjects[i]->isDirectional()) { |
| 331 |
> |
if (integrableObjects[i]->isLinear()) |
| 332 |
> |
ndf_local += 2; |
| 333 |
> |
else |
| 334 |
> |
ndf_local += 3; |
| 335 |
> |
} |
| 336 |
|
} |
| 337 |
|
|
| 338 |
|
// n_constraints is local, so subtract them on each processor: |
| 361 |
|
|
| 362 |
|
for(int i = 0; i < integrableObjects.size(); i++){ |
| 363 |
|
ndfRaw_local += 3; |
| 364 |
< |
if (integrableObjects[i]->isDirectional()) |
| 365 |
< |
ndfRaw_local += 3; |
| 364 |
> |
if (integrableObjects[i]->isDirectional()) { |
| 365 |
> |
if (integrableObjects[i]->isLinear()) |
| 366 |
> |
ndfRaw_local += 2; |
| 367 |
> |
else |
| 368 |
> |
ndfRaw_local += 3; |
| 369 |
> |
} |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
#ifdef IS_MPI |
| 440 |
|
|
| 441 |
|
n_exclude = excludes->getSize(); |
| 442 |
|
excl = excludes->getFortranArray(); |
| 443 |
< |
|
| 443 |
> |
|
| 444 |
|
#ifdef IS_MPI |
| 445 |
|
n_global = mpiSim->getTotAtoms(); |
| 446 |
|
#else |
| 447 |
|
n_global = n_atoms; |
| 448 |
|
#endif |
| 449 |
< |
|
| 449 |
> |
|
| 450 |
|
isError = 0; |
| 451 |
< |
|
| 451 |
> |
|
| 452 |
> |
getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); |
| 453 |
> |
|
| 454 |
|
setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, |
| 455 |
< |
&nGlobalExcludes, globalExcludes, molMembershipArray, |
| 456 |
< |
&isError ); |
| 457 |
< |
|
| 455 |
> |
&nGlobalExcludes, globalExcludes, molMembershipArray, |
| 456 |
> |
&mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); |
| 457 |
> |
|
| 458 |
|
if( isError ){ |
| 459 |
< |
|
| 459 |
> |
|
| 460 |
|
sprintf( painCave.errMsg, |
| 461 |
< |
"There was an error setting the simulation information in fortran.\n" ); |
| 461 |
> |
"There was an error setting the simulation information in fortran.\n" ); |
| 462 |
|
painCave.isFatal = 1; |
| 463 |
|
simError(); |
| 464 |
|
} |
| 465 |
< |
|
| 465 |
> |
|
| 466 |
|
#ifdef IS_MPI |
| 467 |
|
sprintf( checkPointMsg, |
| 468 |
|
"succesfully sent the simulation information to fortran.\n"); |
| 469 |
|
MPIcheckPoint(); |
| 470 |
|
#endif // is_mpi |
| 471 |
< |
|
| 471 |
> |
|
| 472 |
|
this->ndf = this->getNDF(); |
| 473 |
|
this->ndfRaw = this->getNDFraw(); |
| 474 |
|
this->ndfTrans = this->getNDFtranslational(); |
| 475 |
|
} |
| 476 |
|
|
| 477 |
|
void SimInfo::setDefaultRcut( double theRcut ){ |
| 478 |
< |
|
| 478 |
> |
|
| 479 |
|
haveRcut = 1; |
| 480 |
|
rCut = theRcut; |
| 481 |
< |
|
| 471 |
< |
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
| 472 |
< |
|
| 473 |
< |
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
| 474 |
< |
} |
| 475 |
< |
|
| 476 |
< |
void SimInfo::setDefaultEcr( double theEcr ){ |
| 477 |
< |
|
| 478 |
< |
haveEcr = 1; |
| 479 |
< |
ecr = theEcr; |
| 481 |
> |
rList = rCut + 1.0; |
| 482 |
|
|
| 483 |
< |
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
| 482 |
< |
|
| 483 |
< |
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
| 483 |
> |
notifyFortranCutOffs( &rCut, &rSw, &rList ); |
| 484 |
|
} |
| 485 |
|
|
| 486 |
< |
void SimInfo::setDefaultEcr( double theEcr, double theEst ){ |
| 486 |
> |
void SimInfo::setDefaultRcut( double theRcut, double theRsw ){ |
| 487 |
|
|
| 488 |
< |
est = theEst; |
| 489 |
< |
setDefaultEcr( theEcr ); |
| 488 |
> |
rSw = theRsw; |
| 489 |
> |
setDefaultRcut( theRcut ); |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
|
| 498 |
|
|
| 499 |
|
if( rCut > maxCutoff ){ |
| 500 |
|
sprintf( painCave.errMsg, |
| 501 |
< |
"LJrcut is too large for the current periodic box.\n" |
| 502 |
< |
"\tCurrent Value of LJrcut = %G at time %G\n " |
| 501 |
> |
"cutoffRadius is too large for the current periodic box.\n" |
| 502 |
> |
"\tCurrent Value of cutoffRadius = %G at time %G\n " |
| 503 |
|
"\tThis is larger than half of at least one of the\n" |
| 504 |
|
"\tperiodic box vectors. Right now, the Box matrix is:\n" |
| 505 |
< |
"\n, %G" |
| 505 |
> |
"\n" |
| 506 |
|
"\t[ %G %G %G ]\n" |
| 507 |
|
"\t[ %G %G %G ]\n" |
| 508 |
|
"\t[ %G %G %G ]\n", |
| 509 |
< |
rCut, currentTime, maxCutoff, |
| 509 |
> |
rCut, currentTime, |
| 510 |
|
Hmat[0][0], Hmat[0][1], Hmat[0][2], |
| 511 |
|
Hmat[1][0], Hmat[1][1], Hmat[1][2], |
| 512 |
|
Hmat[2][0], Hmat[2][1], Hmat[2][2]); |
| 513 |
|
painCave.isFatal = 1; |
| 514 |
|
simError(); |
| 515 |
< |
} |
| 516 |
< |
|
| 517 |
< |
if( haveEcr ){ |
| 518 |
< |
if( ecr > maxCutoff ){ |
| 519 |
< |
sprintf( painCave.errMsg, |
| 520 |
< |
"electrostaticCutoffRadius is too large for the current\n" |
| 521 |
< |
"\tperiodic box.\n\n" |
| 522 |
< |
"\tCurrent Value of ECR = %G at time %G\n " |
| 523 |
< |
"\tThis is larger than half of at least one of the\n" |
| 524 |
< |
"\tperiodic box vectors. Right now, the Box matrix is:\n" |
| 525 |
< |
"\n" |
| 526 |
< |
"\t[ %G %G %G ]\n" |
| 527 |
< |
"\t[ %G %G %G ]\n" |
| 528 |
< |
"\t[ %G %G %G ]\n", |
| 529 |
< |
ecr, currentTime, |
| 530 |
< |
Hmat[0][0], Hmat[0][1], Hmat[0][2], |
| 531 |
< |
Hmat[1][0], Hmat[1][1], Hmat[1][2], |
| 532 |
< |
Hmat[2][0], Hmat[2][1], Hmat[2][2]); |
| 533 |
< |
painCave.isFatal = 1; |
| 534 |
< |
simError(); |
| 535 |
< |
} |
| 536 |
< |
} |
| 515 |
> |
} |
| 516 |
|
} else { |
| 517 |
|
// initialize this stuff before using it, OK? |
| 518 |
|
sprintf( painCave.errMsg, |
| 560 |
|
return NULL; |
| 561 |
|
} |
| 562 |
|
|
| 584 |
– |
vector<GenericData*> SimInfo::getProperties(){ |
| 563 |
|
|
| 564 |
< |
vector<GenericData*> result; |
| 565 |
< |
map<string, GenericData*>::iterator i; |
| 564 |
> |
void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup, |
| 565 |
> |
vector<int>& groupList, vector<int>& groupStart){ |
| 566 |
> |
Molecule* mol; |
| 567 |
> |
Atom** myAtoms; |
| 568 |
> |
int numAtom; |
| 569 |
> |
int curIndex; |
| 570 |
> |
double mtot; |
| 571 |
> |
|
| 572 |
> |
mfact.clear(); |
| 573 |
> |
groupList.clear(); |
| 574 |
> |
groupStart.clear(); |
| 575 |
|
|
| 576 |
< |
for(i = properties.begin(); i != properties.end(); i++) |
| 577 |
< |
result.push_back((*i).second); |
| 576 |
> |
//Be careful, fortran array begin at 1 |
| 577 |
> |
curIndex = 1; |
| 578 |
> |
|
| 579 |
> |
if(info->useMolecularCutoffs){ |
| 580 |
|
|
| 581 |
< |
return result; |
| 581 |
> |
#ifdef IS_MPI |
| 582 |
> |
ngroup = mpiSim->getMyNMol(); |
| 583 |
> |
#else |
| 584 |
> |
ngroup = info->n_mol; |
| 585 |
> |
#endif |
| 586 |
> |
|
| 587 |
> |
for(int i = 0; i < ngroup; i ++){ |
| 588 |
> |
mol = &(info->molecules[i]); |
| 589 |
> |
numAtom = mol->getNAtoms(); |
| 590 |
> |
myAtoms = mol->getMyAtoms(); |
| 591 |
> |
mtot = 0.0; |
| 592 |
> |
|
| 593 |
> |
for(int j=0; j < numAtom; j++) |
| 594 |
> |
mtot += myAtoms[j]->getMass(); |
| 595 |
> |
|
| 596 |
> |
for(int j=0; j < numAtom; j++){ |
| 597 |
> |
|
| 598 |
> |
// We want the local Index: |
| 599 |
> |
groupList.push_back(myAtoms[j]->getIndex() + 1); |
| 600 |
> |
mfact.push_back(myAtoms[j]->getMass() / mtot); |
| 601 |
> |
|
| 602 |
> |
} |
| 603 |
> |
|
| 604 |
> |
groupStart.push_back(curIndex); |
| 605 |
> |
curIndex += numAtom; |
| 606 |
> |
|
| 607 |
> |
} //end for(int i =0 ; i < ngroup; i++) |
| 608 |
> |
} |
| 609 |
> |
else{ |
| 610 |
> |
//using atomic cutoff, every single atom is just a group |
| 611 |
> |
|
| 612 |
> |
#ifdef IS_MPI |
| 613 |
> |
ngroup = mpiSim->getMyNlocal(); |
| 614 |
> |
#else |
| 615 |
> |
ngroup = info->n_atoms; |
| 616 |
> |
#endif |
| 617 |
> |
|
| 618 |
> |
for(int i =0 ; i < ngroup; i++){ |
| 619 |
> |
groupStart.push_back(curIndex++); |
| 620 |
> |
groupList.push_back((info->atoms[i])->getIndex() + 1); |
| 621 |
> |
mfact.push_back(1.0); |
| 622 |
> |
|
| 623 |
> |
}//end for(int i =0 ; i < ngroup; i++) |
| 624 |
> |
|
| 625 |
> |
}//end if (info->useMolecularCutoffs) |
| 626 |
> |
|
| 627 |
|
} |