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

Comparing trunk/OOPSE/libmdtools/SimInfo.cpp (file contents):
Revision 393 by mmeineke, Mon Mar 24 18:33:51 2003 UTC vs.
Revision 474 by gezelter, Mon Apr 7 21:42:19 2003 UTC

# Line 16 | Line 16 | SimInfo::SimInfo(){
16    n_constraints = 0;
17    n_oriented = 0;
18    n_dipoles = 0;
19 +  ndf = 0;
20 +  ndfRaw = 0;
21    the_integrator = NULL;
22    setTemp = 0;
23    thermalTime = 0.0;
24 +  rCut = 0.0;
25  
26    usePBC = 0;
27    useLJ = 0;
# Line 28 | Line 31 | SimInfo::SimInfo(){
31    useGB = 0;
32    useEAM = 0;
33  
34 +  wrapMeSimInfo( this );
35 + }
36  
37 + void SimInfo::setBox(double newBox[3]) {
38 +  double smallestBox, maxCutoff;
39 +  int status;
40 +  box_x = newBox[0];
41 +  box_y = newBox[1];
42 +  box_z = newBox[2];
43 +  setFortranBoxSize(newBox);
44  
45 <  wrapMeSimInfo( this );
45 >  smallestBox = box_x;
46 >  if (box_y < smallestBox) smallestBox = box_y;
47 >  if (box_z < smallestBox) smallestBox = box_z;
48 >
49 >  maxCutoff = smallestBox / 2.0;
50 >
51 >  if (rList > maxCutoff) {
52 >    sprintf( painCave.errMsg,
53 >             "New Box size is forcing neighborlist radius down to %lf\n",
54 >             maxCutoff );
55 >    painCave.isFatal = 0;
56 >    simError();
57 >
58 >    rList = maxCutoff;
59 >
60 >    sprintf( painCave.errMsg,
61 >             "New Box size is forcing cutoff radius down to %lf\n",
62 >             maxCutoff - 1.0 );
63 >    painCave.isFatal = 0;
64 >    simError();
65 >
66 >    rCut = rList - 1.0;
67 >
68 >    // list radius changed so we have to refresh the simulation structure.
69 >    refreshSim();
70 >  }
71 >
72 >  if (rCut > maxCutoff) {
73 >    sprintf( painCave.errMsg,
74 >             "New Box size is forcing cutoff radius down to %lf\n",
75 >             maxCutoff );
76 >    painCave.isFatal = 0;
77 >    simError();
78 >
79 >    status = 0;
80 >    LJ_new_rcut(&rCut, &status);
81 >    if (status != 0) {
82 >      sprintf( painCave.errMsg,
83 >               "Error in recomputing LJ shifts based on new rcut\n");
84 >      painCave.isFatal = 1;
85 >      simError();
86 >    }
87 >  }
88   }
89  
90 + void SimInfo::getBox(double theBox[3]) {
91 +  theBox[0] = box_x;
92 +  theBox[1] = box_y;
93 +  theBox[2] = box_z;
94 + }
95 +
96 + int SimInfo::getNDF(){
97 +  int ndf_local, ndf;
98 +  
99 +  ndf_local = 3 * n_atoms + 3 * n_oriented - n_constraints;
100 +
101 + #ifdef IS_MPI
102 +  MPI_Allreduce(&ndf_local,&ndf,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
103 + #else
104 +  ndf = ndf_local;
105 + #endif
106 +
107 +  ndf = ndf - 3;
108 +
109 +  return ndf;
110 + }
111 +
112 + int SimInfo::getNDFraw() {
113 +  int ndfRaw_local, ndfRaw;
114 +
115 +  // Raw degrees of freedom that we have to set
116 +  ndfRaw_local = 3 * n_atoms + 3 * n_oriented;
117 +  
118 + #ifdef IS_MPI
119 +  MPI_Allreduce(&ndfRaw_local,&ndfRaw,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
120 + #else
121 +  ndfRaw = ndfRaw_local;
122 + #endif
123 +
124 +  return ndfRaw;
125 + }
126 +
127   void SimInfo::refreshSim(){
128  
129    simtype fInfo;
130    int isError;
131 +  int* excl;
132 +  
133 +  fInfo.rrf = 0.0;
134 +  fInfo.rt = 0.0;
135 +  fInfo.dielect = 0.0;
136  
137    fInfo.box[0] = box_x;
138    fInfo.box[1] = box_y;
# Line 44 | Line 140 | void SimInfo::refreshSim(){
140  
141    fInfo.rlist = rList;
142    fInfo.rcut = rCut;
47  fInfo.rrf = rRF;
48  fInfo.rt = 0.95 * rRF;
49  fInfo.dielect = dielectric;
50
143  
144 +  if( useDipole ){
145 +    fInfo.rrf = ecr;
146 +    fInfo.rt = ecr - est;
147 +    if( useReactionField )fInfo.dielect = dielectric;
148 +  }
149 +
150    fInfo.SIM_uses_PBC = usePBC;
151 +  //fInfo.SIM_uses_LJ = 0;
152    fInfo.SIM_uses_LJ = useLJ;
153    fInfo.SIM_uses_sticky = useSticky;
154 +  //fInfo.SIM_uses_sticky = 0;
155 +  //fInfo.SIM_uses_dipoles = useDipole;
156    fInfo.SIM_uses_dipoles = 0;
157 <  //  fInfo.SIM_uses_dipoles = useDipole;
157 >  //fInfo.SIM_uses_RF = useReactionField;
158    fInfo.SIM_uses_RF = 0;
58  //  fInfo.SIM_uses_RF = useReactionField;
159    fInfo.SIM_uses_GB = useGB;
160    fInfo.SIM_uses_EAM = useEAM;
161  
162 +  excl = Exclude::getArray();
163  
164    isError = 0;
165  
166 <  fInfo;
167 <  n_atoms;
168 <  identArray;
169 <  n_exclude;
170 <  excludes;
171 <  nGlobalExcludes;
172 <  globalExcludes;
173 <  isError;
166 > //   fInfo;
167 > //   n_atoms;
168 > //   identArray;
169 > //   n_exclude;
170 > //   excludes;
171 > //   nGlobalExcludes;
172 > //   globalExcludes;
173 > //   isError;
174  
175 <  setFsimulation( &fInfo, &n_atoms, identArray, &n_exclude, excludes, &nGlobalExcludes, globalExcludes, &isError );
175 >  setFsimulation( &fInfo, &n_atoms, identArray, &n_exclude, excl,
176 >                  &nGlobalExcludes, globalExcludes, &isError );
177  
178    if( isError ){
179  
# Line 86 | Line 188 | void SimInfo::refreshSim(){
188             "succesfully sent the simulation information to fortran.\n");
189    MPIcheckPoint();
190   #endif // is_mpi
191 +
192 +  this->ndf = this->getNDF();
193 +  this->ndfRaw = this->getNDFraw();
194 +
195   }
196  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines