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 569 by mmeineke, Tue Jul 1 21:33:45 2003 UTC vs.
Revision 574 by gezelter, Tue Jul 8 20:56:10 2003 UTC

# Line 2 | Line 2
2   #include <cstring>
3   #include <cmath>
4  
5 + #include <iostream>
6 + using namespace std;
7  
8   #include "SimInfo.hpp"
9   #define __C
# Line 14 | Line 16 | SimInfo* currentInfo;
16   #include "mpiSimulation.hpp"
17   #endif
18  
19 + inline double roundMe( double x ){
20 +  return ( x >= 0 ) ? floor( x + 0.5 ) : ceil( x - 0.5 );
21 + }
22 +          
23 +
24   SimInfo* currentInfo;
25  
26   SimInfo::SimInfo(){
# Line 158 | Line 165 | void SimInfo::getBox(double theBox[9]) {
165   }
166  
167  
168 < void SimInfo::getBox(double theBox[9]) {
168 > void SimInfo::getBoxM (double theBox[9]) {
169  
170    int i;
171    for(i=0; i<9; i++) theBox[i] = Hmat[i];
172   }
166
173  
174 +
175 + void SimInfo::scaleBox(double scale) {
176 +  double theBox[9];
177 +  int i;
178 +
179 +  for(i=0; i<9; i++) theBox[i] = Hmat[i]*scale;
180 +
181 +  setBoxM(theBox);
182 +
183 + }
184 +
185   void SimInfo::calcHmatI( void ) {
186  
187    double C[3][3];
# Line 289 | Line 306 | void SimInfo::wrapVector( double thePos[3] ){
306      // wrap the scaled coordinates
307      
308      for(i=0; i<3; i++)
309 <      scaled[i] -= round(scaled[i]);
309 >      scaled[i] -= roundMe(scaled[i]);
310      
311      // calc the wrapped real coordinates from the wrapped scaled coordinates
312      
313      for(i=0; i<3; i++)
314        thePos[i] =
315 <        scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[3]*Hmat[i+6];
315 >        scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[2]*Hmat[i+6];
316    }
317    else{
318      // calc the scaled coordinates.
# Line 306 | Line 323 | void SimInfo::wrapVector( double thePos[3] ){
323      // wrap the scaled coordinates
324      
325      for(i=0; i<3; i++)
326 <      scaled[i] -= round(scaled[i]);
326 >      scaled[i] -= roundMe(scaled[i]);
327      
328      // calc the wrapped real coordinates from the wrapped scaled coordinates
329      
# Line 360 | Line 377 | void SimInfo::refreshSim(){
377    fInfo.rt = 0.0;
378    fInfo.dielect = 0.0;
379  
363  fInfo.box[0] = box_x;
364  fInfo.box[1] = box_y;
365  fInfo.box[2] = box_z;
366
380    fInfo.rlist = rList;
381    fInfo.rcut = rCut;
382  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines