| 62 |  | useReactionField = 0; | 
| 63 |  | useGB = 0; | 
| 64 |  | useEAM = 0; | 
| 65 | + | useThermInt = 0; | 
| 66 |  |  | 
| 67 | + | haveCutoffGroups = false; | 
| 68 | + |  | 
| 69 |  | excludes = Exclude::Instance(); | 
| 70 |  |  | 
| 71 |  | myConfiguration = new SimState(); | 
| 453 |  | isError = 0; | 
| 454 |  |  | 
| 455 |  | getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); | 
| 456 | < |  | 
| 456 | > | //it may not be a good idea to pass the address of first element in vector | 
| 457 | > | //since c++ standard does not require vector to be stored continuously in meomory | 
| 458 | > | //Most of the compilers will organize the memory of vector continuously | 
| 459 |  | setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, | 
| 460 |  | &nGlobalExcludes, globalExcludes, molMembershipArray, | 
| 461 |  | &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); | 
| 568 |  |  | 
| 569 |  | void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup, | 
| 570 |  | vector<int>& groupList, vector<int>& groupStart){ | 
| 571 | < | Molecule* mol; | 
| 571 | > | Molecule* myMols; | 
| 572 |  | Atom** myAtoms; | 
| 573 |  | int numAtom; | 
| 574 |  | int curIndex; | 
| 575 |  | double mtot; | 
| 576 | < |  | 
| 576 | > | int numMol; | 
| 577 | > | int numCutoffGroups; | 
| 578 | > | CutoffGroup* myCutoffGroup; | 
| 579 | > | vector<CutoffGroup*>::iterator iterCutoff; | 
| 580 | > | Atom* cutoffAtom; | 
| 581 | > | vector<Atom*>::iterator iterAtom; | 
| 582 | > | int atomIndex; | 
| 583 | > | double totalMass; | 
| 584 | > |  | 
| 585 |  | mfact.clear(); | 
| 586 |  | groupList.clear(); | 
| 587 |  | groupStart.clear(); | 
| 588 |  |  | 
| 589 |  | //Be careful, fortran array begin at 1 | 
| 590 |  | curIndex = 1; | 
| 591 | < |  | 
| 592 | < | if(info->useMolecularCutoffs){ | 
| 593 | < |  | 
| 594 | < | #ifdef IS_MPI | 
| 595 | < | ngroup = mpiSim->getMyNMol(); | 
| 596 | < | #else | 
| 597 | < | 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); | 
| 591 | > |  | 
| 592 | > | myMols = info->molecules; | 
| 593 | > | numMol = info->n_mol; | 
| 594 | > | for(int i  = 0; i < numMol; i++){ | 
| 595 | > | numCutoffGroups = myMols[i].getNCutoffGroups(); | 
| 596 | > | for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; | 
| 597 | > | myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ | 
| 598 |  |  | 
| 599 | < | } | 
| 599 | > | totalMass = myCutoffGroup->getMass(); | 
| 600 |  |  | 
| 601 | + | for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; | 
| 602 | + | cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ | 
| 603 | + | mfact.push_back(cutoffAtom->getMass()/totalMass); | 
| 604 | + | groupList.push_back(cutoffAtom->getIndex() + 1); | 
| 605 | + | } | 
| 606 | + |  | 
| 607 |  | groupStart.push_back(curIndex); | 
| 608 | < | curIndex += numAtom; | 
| 609 | < |  | 
| 610 | < | } //end for(int i =0 ; i < ngroup; i++) | 
| 611 | < | } | 
| 612 | < | 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) | 
| 608 | > | curIndex += myCutoffGroup->getNumAtom(); | 
| 609 | > |  | 
| 610 | > | }//end for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff)) | 
| 611 | > |  | 
| 612 | > | }//end for(int i  = 0; i < numMol; i++) | 
| 613 |  |  | 
| 614 | + | ngroup = groupStart.size(); | 
| 615 |  | } |