# | Line 63 | Line 63 | SimInfo::SimInfo(){ | |
---|---|---|
63 | useReactionField = 0; | |
64 | useGB = 0; | |
65 | useEAM = 0; | |
66 | + | useMolecularCutoffs = 0; |
67 | ||
68 | excludes = Exclude::Instance(); | |
69 | ||
# | Line 71 | Line 72 | SimInfo::SimInfo(){ | |
72 | has_minimizer = false; | |
73 | the_minimizer =NULL; | |
74 | ||
75 | + | ngroup = 0; |
76 | + | |
77 | wrapMeSimInfo( this ); | |
78 | } | |
79 | ||
# | Line 83 | Line 86 | SimInfo::~SimInfo(){ | |
86 | ||
87 | for(i = properties.begin(); i != properties.end(); i++) | |
88 | delete (*i).second; | |
89 | < | |
89 | > | |
90 | } | |
91 | ||
92 | void SimInfo::setBox(double newBox[3]) { | |
# | Line 439 | Line 442 | void SimInfo::refreshSim(){ | |
442 | ||
443 | n_exclude = excludes->getSize(); | |
444 | excl = excludes->getFortranArray(); | |
445 | < | |
445 | > | |
446 | #ifdef IS_MPI | |
447 | n_global = mpiSim->getTotAtoms(); | |
448 | #else | |
# | Line 447 | Line 450 | void SimInfo::refreshSim(){ | |
450 | #endif | |
451 | ||
452 | isError = 0; | |
453 | + | |
454 | + | getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); |
455 | ||
456 | setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, | |
457 | < | &nGlobalExcludes, globalExcludes, molMembershipArray, |
458 | < | &isError ); |
457 | > | &nGlobalExcludes, globalExcludes, molMembershipArray, |
458 | > | &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError ); |
459 | ||
460 | if( isError ){ | |
461 | ||
# | Line 588 | Line 593 | GenericData* SimInfo::getProperty(const string& propNa | |
593 | else | |
594 | return NULL; | |
595 | } | |
596 | + | |
597 | + | |
598 | + | void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup, |
599 | + | vector<int>& groupList, vector<int>& groupStart){ |
600 | + | Molecule* mol; |
601 | + | int numAtom; |
602 | + | int curIndex; |
603 | ||
604 | + | mfact.clear(); |
605 | + | groupList.clear(); |
606 | + | groupStart.clear(); |
607 | + | |
608 | + | //Be careful, fortran array begin at 1 |
609 | + | curIndex = 1; |
610 | + | |
611 | + | if(info->useMolecularCutoffs){ |
612 | + | //if using molecular cutoff |
613 | + | ngroup = info->n_mol; |
614 | + | |
615 | + | for(int i = 0; i < ngroup; i ++){ |
616 | + | mol = &(info->molecules[i]); |
617 | + | numAtom = mol->getNAtoms(); |
618 | + | |
619 | + | for(int j=0; j < numAtom; j++){ |
620 | + | #ifdef IS_MPI |
621 | + | groupList.push_back((info->atoms[i])->getGlobalIndex() + 1); |
622 | + | #else |
623 | + | groupList.push_back((info->atoms[i])->getIndex() + 1); |
624 | + | #endif |
625 | + | }//for(int j=0; j < numAtom; j++) |
626 | + | |
627 | + | groupStart.push_back(curIndex); |
628 | + | curIndex += numAtom; |
629 | + | |
630 | + | }//end for(int i =0 ; i < ngroup; i++) |
631 | + | } |
632 | + | else{ |
633 | + | //using atomic cutoff, every single atom is just a group |
634 | + | ngroup = info->n_atoms; |
635 | + | for(int i =0 ; i < ngroup; i++){ |
636 | + | groupStart.push_back(curIndex++); |
637 | + | |
638 | + | #ifdef IS_MPI |
639 | + | groupList.push_back((info->atoms[i])->getGlobalIndex() + 1); |
640 | + | #else |
641 | + | groupList.push_back((info->atoms[i])->getIndex() + 1); |
642 | + | #endif |
643 | + | |
644 | + | }//end for(int i =0 ; i < ngroup; i++) |
645 | + | |
646 | + | }//end if (info->useMolecularCutoffs) |
647 | + | |
648 | + | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |