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 841 by mmeineke, Wed Oct 29 17:55:28 2003 UTC vs.
Revision 1136 by tim, Tue Apr 27 16:26:44 2004 UTC

# Line 10 | Line 10 | using namespace std;
10   #endif // is_mpi
11  
12  
13 + #ifdef PROFILE
14 + #include "mdProfile.hpp"
15 + #endif
16 +
17   #include "simError.h"
18   #include "ForceFields.hpp"
19   #include "Atom.hpp"
# Line 30 | 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;
# Line 37 | Line 78 | void ForceFields::doForces( int calcPot, int calcStres
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    short int passedCalcPot = (short int)calcPot;
# Line 50 | Line 93 | void ForceFields::doForces( int calcPot, int calcStres
93      entry_plug->atoms[i]->zeroForces();    
94    }
95  
96 + #ifdef PROFILE
97 +  startProfile(pro7);
98 + #endif
99 +  
100    for(i=0; i<entry_plug->n_mol; i++ ){
101 +    // CalcForces in molecules takes care of mapping rigid body coordinates
102 +    // into atomic coordinates
103      entry_plug->molecules[i].calcForces();
104    }
105  
106 + #ifdef PROFILE
107 +  endProfile( pro7 );
108 + #endif
109 +
110    config = entry_plug->getConfiguration();
111    
112    frc = config->getFrcArray();
# Line 61 | Line 114 | void ForceFields::doForces( int calcPot, int calcStres
114    trq = config->getTrqArray();
115    A   = config->getAmatArray();
116    u_l = config->getUlArray();
117 +  rc = config->getRcArray();
118 +  massRatio = config->getMassRatioArray();
119  
120    isError = 0;
121    entry_plug->lrPot = 0.0;
# Line 69 | Line 124 | void ForceFields::doForces( int calcPot, int calcStres
124      entry_plug->tau[i] = 0.0;
125    }
126  
72  std::cerr << "before\n"
73            << "  force[0] = " << frc[0] << "\n"
74            << "  pos[0]   = " << pos[0] << "\n"
75            << "  trq[0]   = " << trq[0] << "\n"
76            << "  A[0]     = " << A[0] << "\n"
77            << "  tau      = " << entry_plug->tau[0] << ", " << entry_plug->tau[1] << ", " << entry_plug->tau[2] << "\n"
78            << "             " << entry_plug->tau[3] << ", " << entry_plug->tau[4] << ", " << entry_plug->tau[5] << "\n"
79            << "             " << entry_plug->tau[6] << ", " << entry_plug->tau[7] << ", " << entry_plug->tau[8] << "\n\n";
127  
128 + #ifdef PROFILE
129 +  startProfile(pro8);
130 + #endif
131 +
132    fortranForceLoop( pos,
133                      A,
134                      u_l,
135                      frc,
136                      trq,
137 +                    rc,
138 +                    massRatio,
139                      entry_plug->tau,
140                      &(entry_plug->lrPot),
141                      &passedCalcPot,
# Line 90 | Line 143 | void ForceFields::doForces( int calcPot, int calcStres
143                      &isError );
144  
145  
146 <  std::cerr << "after\n"
147 <            << "  force[0] = " << frc[0] << "\n"
148 <            << "  pos[0]   = " << pos[0] << "\n"
96 <            << "  trq[0]   = " << trq[0] << "\n"
97 <            << "  A[0]     = " << A[0] << "\n"
98 <            << "  tau      = " << entry_plug->tau[0] << ", " << entry_plug->tau[1] << ", " << entry_plug->tau[2] << "\n"
99 <            << "             " << entry_plug->tau[3] << ", " << entry_plug->tau[4] << ", " << entry_plug->tau[5] << "\n"
100 <            << "             " << entry_plug->tau[6] << ", " << entry_plug->tau[7] << ", " << entry_plug->tau[8] << "\n\n";
146 > #ifdef PROFILE
147 >  endProfile(pro8);
148 > #endif
149  
150 +
151    if( isError ){
152      sprintf( painCave.errMsg,
153               "Error returned from the fortran force calculation.\n" );
# Line 106 | Line 155 | void ForceFields::doForces( int calcPot, int calcStres
155      simError();
156    }
157  
158 +  for(i=0; i<entry_plug->n_mol; i++ ){
159 +    entry_plug->molecules[i].atoms2rigidBodies();
160 +  }
161 +
162 +
163   #ifdef IS_MPI
164    sprintf( checkPointMsg,
165             "returned from the force calculation.\n" );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines