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; |
62 |
|
useReactionField = 0; |
63 |
|
useGB = 0; |
64 |
|
useEAM = 0; |
66 |
– |
useMolecularCutoffs = 0; |
65 |
|
|
66 |
|
excludes = Exclude::Instance(); |
67 |
|
|
446 |
|
#else |
447 |
|
n_global = n_atoms; |
448 |
|
#endif |
449 |
< |
|
449 |
> |
|
450 |
|
isError = 0; |
451 |
< |
|
452 |
< |
getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); |
453 |
< |
|
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 |
< |
&mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError ); |
457 |
< |
|
458 |
< |
if( isError ){ |
459 |
< |
|
455 |
> |
&nGlobalExcludes, globalExcludes, molMembershipArray, |
456 |
> |
&mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); |
457 |
> |
|
458 |
> |
if( isError ){ |
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 |
< |
|
482 |
< |
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
483 |
< |
|
486 |
< |
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
481 |
> |
rList = rCut + 1.0; |
482 |
> |
|
483 |
> |
notifyFortranCutOffs( &rCut, &rSw, &rList ); |
484 |
|
} |
485 |
|
|
486 |
< |
void SimInfo::setDefaultEcr( double theEcr ){ |
486 |
> |
void SimInfo::setDefaultRcut( double theRcut, double theRsw ){ |
487 |
|
|
488 |
< |
haveEcr = 1; |
489 |
< |
ecr = theEcr; |
493 |
< |
|
494 |
< |
( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; |
495 |
< |
|
496 |
< |
notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); |
488 |
> |
rSw = theRsw; |
489 |
> |
setDefaultRcut( theRcut ); |
490 |
|
} |
491 |
|
|
499 |
– |
void SimInfo::setDefaultEcr( double theEcr, double theEst ){ |
492 |
|
|
501 |
– |
est = theEst; |
502 |
– |
setDefaultEcr( theEcr ); |
503 |
– |
} |
504 |
– |
|
505 |
– |
|
493 |
|
void SimInfo::checkCutOffs( void ){ |
494 |
|
|
495 |
|
if( boxIsInit ){ |
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" |
512 |
|
Hmat[2][0], Hmat[2][1], Hmat[2][2]); |
513 |
|
painCave.isFatal = 1; |
514 |
|
simError(); |
515 |
< |
} |
529 |
< |
|
530 |
< |
if( haveEcr ){ |
531 |
< |
if( ecr > maxCutoff ){ |
532 |
< |
sprintf( painCave.errMsg, |
533 |
< |
"electrostaticCutoffRadius is too large for the current\n" |
534 |
< |
"\tperiodic box.\n\n" |
535 |
< |
"\tCurrent Value of ECR = %G at time %G\n " |
536 |
< |
"\tThis is larger than half of at least one of the\n" |
537 |
< |
"\tperiodic box vectors. Right now, the Box matrix is:\n" |
538 |
< |
"\n" |
539 |
< |
"\t[ %G %G %G ]\n" |
540 |
< |
"\t[ %G %G %G ]\n" |
541 |
< |
"\t[ %G %G %G ]\n", |
542 |
< |
ecr, currentTime, |
543 |
< |
Hmat[0][0], Hmat[0][1], Hmat[0][2], |
544 |
< |
Hmat[1][0], Hmat[1][1], Hmat[1][2], |
545 |
< |
Hmat[2][0], Hmat[2][1], Hmat[2][2]); |
546 |
< |
painCave.isFatal = 1; |
547 |
< |
simError(); |
548 |
< |
} |
549 |
< |
} |
515 |
> |
} |
516 |
|
} else { |
517 |
|
// initialize this stuff before using it, OK? |
518 |
|
sprintf( painCave.errMsg, |
562 |
|
|
563 |
|
|
564 |
|
void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup, |
565 |
< |
vector<int>& groupList, vector<int>& groupStart){ |
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 |
< |
|
575 |
> |
|
576 |
|
//Be careful, fortran array begin at 1 |
577 |
|
curIndex = 1; |
578 |
< |
|
578 |
> |
|
579 |
|
if(info->useMolecularCutoffs){ |
580 |
< |
//if using molecular cutoff |
580 |
> |
|
581 |
> |
#ifdef IS_MPI |
582 |
> |
ngroup = mpiSim->getMyNMol(); |
583 |
> |
#else |
584 |
|
ngroup = info->n_mol; |
585 |
< |
|
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 |
< |
#ifdef IS_MPI |
598 |
< |
groupList.push_back((info->atoms[i])->getGlobalIndex() + 1); |
599 |
< |
#else |
600 |
< |
groupList.push_back((info->atoms[i])->getIndex() + 1); |
601 |
< |
#endif |
602 |
< |
}//for(int j=0; j < numAtom; j++) |
603 |
< |
|
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++) |
607 |
> |
} //end for(int i =0 ; i < ngroup; i++) |
608 |
|
} |
609 |
|
else{ |
610 |
|
//using atomic cutoff, every single atom is just a group |
611 |
< |
ngroup = info->n_atoms; |
635 |
< |
for(int i =0 ; i < ngroup; i++){ |
636 |
< |
groupStart.push_back(curIndex++); |
637 |
< |
|
611 |
> |
|
612 |
|
#ifdef IS_MPI |
613 |
< |
groupList.push_back((info->atoms[i])->getGlobalIndex() + 1); |
613 |
> |
ngroup = mpiSim->getMyNlocal(); |
614 |
|
#else |
615 |
< |
groupList.push_back((info->atoms[i])->getIndex() + 1); |
615 |
> |
ngroup = info->n_atoms; |
616 |
|
#endif |
617 |
< |
|
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 |
< |
|
624 |
> |
|
625 |
|
}//end if (info->useMolecularCutoffs) |
626 |
< |
|
626 |
> |
|
627 |
|
} |