ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ForceFields.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/ForceFields.cpp (file contents):
Revision 892 by chuckv, Mon Dec 22 21:27:04 2003 UTC vs.
Revision 1167 by tim, Wed May 12 16:38:45 2004 UTC

# Line 34 | Line 34 | void ForceFields::doForces( int calcPot, int calcStres
34      
35   }
36  
37 + void ForceFields::setRcut( double LJrcut ) {
38 +  
39 + #ifdef IS_MPI
40 +  double tempBig = bigSigma;
41 +  MPI_Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX,
42 +                 MPI_COMM_WORLD);
43 + #endif  //is_mpi
44 +  
45 +  if (LJrcut < 2.5 * bigSigma) {
46 +    sprintf( painCave.errMsg,
47 +             "Setting Lennard-Jones cutoff radius to %lf.\n"
48 +             "\tThis value is smaller than %lf, which is\n"
49 +             "\t2.5 * bigSigma, where bigSigma is the largest\n"
50 +             "\tvalue of sigma present in the simulation.\n"
51 +             "\tThis is potentially a problem since the LJ potential may\n"
52 +             "\tbe appreciable at this distance.  If you don't want the\n"
53 +             "\tsmaller cutoff, change the LJrcut variable.\n",
54 +             LJrcut, 2.5*bigSigma);
55 +    painCave.isFatal = 0;
56 +    simError();
57 +  } else {
58 +    sprintf( painCave.errMsg,
59 +             "Setting Lennard-Jones cutoff radius to %lf.\n"
60 +             "\tThis value is larger than %lf, which is\n"
61 +             "\t2.5 * bigSigma, where bigSigma is the largest\n"
62 +             "\tvalue of sigma present in the simulation. This should\n"
63 +             "\tnot be a problem, but could adversely effect performance.\n",
64 +             LJrcut, 2.5*bigSigma);
65 +    painCave.isFatal = 0;
66 +    simError();
67 +  }
68 +  
69 +  //calc rCut and rList
70 +  
71 +  entry_plug->setDefaultRcut( LJrcut );
72 + }
73 +
74   void ForceFields::doForces( int calcPot, int calcStress ){
75  
76 <  int i, isError;
76 >  int i, j, isError;
77    double* frc;
78    double* pos;
79    double* trq;
80    double* A;
81 <  double* u_l;;
81 >  double* u_l;
82 >  double* rc;
83 >  double* massRatio;
84    SimState* config;
85  
86 +  Molecule* myMols;
87 +  Atom** myAtoms;
88 +  int numAtom;
89 +  int curIndex;
90 +  double mtot;
91 +  int numMol;
92 +  int numCutoffGroups;
93 +  CutoffGroup* myCutoffGroup;
94 +  vector<CutoffGroup*>::iterator iterCutoff;
95 +  double com[3];
96 +  vector<double> rcGroup;
97 +  
98    short int passedCalcPot = (short int)calcPot;
99    short int passedCalcStress = (short int)calcStress;
100  
# Line 59 | Line 110 | void ForceFields::doForces( int calcPot, int calcStres
110   #endif
111    
112    for(i=0; i<entry_plug->n_mol; i++ ){
113 <    entry_plug->molecules[i].calcForces();
113 >    // CalcForces in molecules takes care of mapping rigid body coordinates
114 >    // into atomic coordinates
115 >    entry_plug->molecules[i].calcForces();    
116    }
117  
118   #ifdef PROFILE
# Line 74 | Line 127 | void ForceFields::doForces( int calcPot, int calcStres
127    A   = config->getAmatArray();
128    u_l = config->getUlArray();
129  
130 +  if(entry_plug->haveCutoffGroups){
131 +    myMols = entry_plug->molecules;
132 +    numMol = entry_plug->n_mol;
133 +    for(int i  = 0; i < numMol; i++){
134 +        
135 +      numCutoffGroups = myMols[i].getNCutoffGroups();
136 +      for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL;
137 +                                                    myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){
138 +        //get center of mass of the cutoff group
139 +        myCutoffGroup->getCOM(com);
140 +
141 +        rcGroup.push_back(com[0]);
142 +        rcGroup.push_back(com[1]);
143 +        rcGroup.push_back(com[2]);
144 +        
145 +      }// end for(myCutoffGroup)
146 +      
147 +    }//end for(int i = 0)
148 +
149 +    rc = &rcGroup[0];
150 +  }
151 +  else{
152 +    // center of mass of the group is the same as position of the atom  if cutoff group does not exist
153 +    rc = pos;
154 +  }
155 +  
156 +
157 +
158    isError = 0;
159    entry_plug->lrPot = 0.0;
160  
# Line 87 | Line 168 | void ForceFields::doForces( int calcPot, int calcStres
168   #endif
169  
170    fortranForceLoop( pos,
171 +                    rc,
172                      A,
173                      u_l,
174                      frc,
# Line 97 | Line 179 | void ForceFields::doForces( int calcPot, int calcStres
179                      &passedCalcStress,
180                      &isError );
181  
182 +
183   #ifdef PROFILE
184    endProfile(pro8);
185   #endif
# Line 109 | Line 192 | void ForceFields::doForces( int calcPot, int calcStres
192      simError();
193    }
194  
195 +  for(i=0; i<entry_plug->n_mol; i++ ){
196 +    entry_plug->molecules[i].atoms2rigidBodies();
197 +  }
198 +
199 +
200   #ifdef IS_MPI
201    sprintf( checkPointMsg,
202             "returned from the force calculation.\n" );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines