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 443 by mmeineke, Wed Apr 2 22:19:03 2003 UTC vs.
Revision 892 by chuckv, Mon Dec 22 21:27:04 2003 UTC

# Line 1 | Line 1
1 < #include <cstdlib>
1 > #include <iostream>
2  
3 + using namespace std;
4 +
5 +
6 + #include <stdlib.h>
7 +
8   #ifdef IS_MPI
9   #include <mpi.h>
5 #include <mpi++.h>
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 16 | Line 24 | void ForceFields::calcRcut( void ){
24  
25   #ifdef IS_MPI
26    double tempBig = bigSigma;
27 <  MPI::COMM_WORLD.Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX );
27 >  MPI_Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX,
28 >                 MPI_COMM_WORLD);
29   #endif  //is_mpi
30  
31    //calc rCut and rList
32  
33 <  entry_plug->rCut = 2.5 * bigSigma;
34 <  if(entry_plug->rCut > (entry_plug->box_x / 2.0))
26 <    entry_plug->rCut = entry_plug->box_x / 2.0;
27 <  if(entry_plug->rCut > (entry_plug->box_y / 2.0))
28 <    entry_plug->rCut = entry_plug->box_y / 2.0;
29 <  if(entry_plug->rCut > (entry_plug->box_z / 2.0))
30 <    entry_plug->rCut = entry_plug->box_z / 2.0;
31 <  
32 <  entry_plug->rList = entry_plug->rCut + 1.0;
33 <  
33 >  entry_plug->setDefaultRcut( 2.5 * bigSigma );  
34 >    
35   }
36  
37   void ForceFields::doForces( int calcPot, int calcStress ){
# Line 39 | Line 40 | void ForceFields::doForces( int calcPot, int calcStres
40    double* frc;
41    double* pos;
42    double* trq;
42  double* tau;
43    double* A;
44    double* u_l;;
45 <  DirectionalAtom* dAtom;
45 >  SimState* config;
46  
47  double ut[3];
48
49  //u_l = new double[entry_plug->n_atoms];
50
47    short int passedCalcPot = (short int)calcPot;
48    short int passedCalcStress = (short int)calcStress;
49  
50 <  // forces are zeroed here, before any are acumulated.
50 >  // forces are zeroed here, before any are accumulated.
51    // NOTE: do not rezero the forces in Fortran.
52  
57
53    for(i=0; i<entry_plug->n_atoms; i++){
54 <    entry_plug->atoms[i]->zeroForces();
60 <
61 <    if( entry_plug->atoms[i]->isDirectional() ){
62 <      dAtom = (DirectionalAtom *)entry_plug->atoms[i];
63 <      dAtom->getU(ut);
64 <    
65 <
66 <      if(dAtom->getIndex()== 1){
67 <        std::cerr << "atom 2's u_l = " << ut[0] << ", " << ut[1]
68 <                  << ", " << ut[2] << "\n";
69 <      }
70 <    }
71 <    
54 >    entry_plug->atoms[i]->zeroForces();    
55    }
56  
57 + #ifdef PROFILE
58 +  startProfile(pro7);
59 + #endif
60 +  
61    for(i=0; i<entry_plug->n_mol; i++ ){
62      entry_plug->molecules[i].calcForces();
63    }
64  
65 <  frc = Atom::getFrcArray();
66 <  pos = Atom::getPosArray();
67 <  trq = Atom::getTrqArray();
81 <  A   = Atom::getAmatArray();
82 <  u_l = Atom::getUlArray();
83 <  tau = entry_plug->tau;
65 > #ifdef PROFILE
66 >  endProfile( pro7 );
67 > #endif
68  
69 +  config = entry_plug->getConfiguration();
70    
71 +  frc = config->getFrcArray();
72 +  pos = config->getPosArray();
73 +  trq = config->getTrqArray();
74 +  A   = config->getAmatArray();
75 +  u_l = config->getUlArray();
76 +
77    isError = 0;
78    entry_plug->lrPot = 0.0;
79  
80 +  for (i=0; i<9; i++) {
81 +    entry_plug->tau[i] = 0.0;
82 +  }
83  
84 <  
84 >
85 > #ifdef PROFILE
86 >  startProfile(pro8);
87 > #endif
88 >
89    fortranForceLoop( pos,
90                      A,
91                      u_l,
92                      frc,
93                      trq,
94 <                    tau,
94 >                    entry_plug->tau,
95                      &(entry_plug->lrPot),
96                      &passedCalcPot,
97                      &passedCalcStress,
98                      &isError );
99  
100 + #ifdef PROFILE
101 +  endProfile(pro8);
102 + #endif
103  
103  //  delete[] u_l;
104  
105    if( isError ){
106      sprintf( painCave.errMsg,
# Line 114 | Line 114 | void ForceFields::doForces( int calcPot, int calcStres
114             "returned from the force calculation.\n" );
115    MPIcheckPoint();
116   #endif // is_mpi
117 +  
118  
119   }
120  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines