ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/utilities/affineScale
(Generate patch)

Comparing trunk/src/applications/utilities/affineScale (file contents):
Revision 1918 by gezelter, Wed Aug 22 02:28:28 2012 UTC vs.
Revision 1919 by jmarr, Wed Jul 31 18:03:35 2013 UTC

# Line 41 | Line 41 | p = []
41   indices = []
42   pvqj = []
43   p = []
44 + wrap = []
45   v = []
46   q = []
47   j = []
# Line 123 | Line 124 | def readFile(mdFileName):
124                          y = float(L[3])
125                          z = float(L[4])
126                          p.append([x, y, z])
127 +                        wrap.append([0,0,0])
128                          vx = float(L[5])
129                          vy = float(L[6])
130                          vz = float(L[7])
# Line 217 | Line 219 | def wrapVector(myVect):
219  
220   def wrapVector(myVect):
221      scaled = [0.0, 0.0, 0.0]
222 +    wrappingNumber = [0,0,0]
223      for i in range(3):
224          scaled[i] = myVect[i] * BoxInv[i]
225 <        scaled[i] = scaled[i] - roundMe(scaled[i])
225 >        wrappingNumber[i] = roundMe(scaled[i])
226 >        scaled[i] = scaled[i] - wrappingNumber[i]
227          myVect[i] = scaled[i] * Hmat[i][i]
228 <    return myVect
228 >    return myVect, wrappingNumber
229  
230   def dot(L1, L2):
231      myDot = 0.0
# Line 251 | Line 255 | def mapToBox():
255          dpos.append(p[i][0])
256          dpos.append(p[i][1])
257          dpos.append(p[i][2])
258 <        p[i] = wrapVector(dpos)
258 >        p[i], wrap[i] = wrapVector(dpos)
259  
260   def scaleBox(scaleX, scaleY, scaleZ):
261      for i in range(3):
# Line 265 | Line 269 | def scaleCoordinates(scaleX, scaleY, scaleZ):
269  
270   def scaleCoordinates(scaleX, scaleY, scaleZ):
271      for i in range(len(indices)):
272 <        p[i][0] = p[i][0]*scaleX
273 <        p[i][1] = p[i][1]*scaleY
274 <        p[i][2] = p[i][2]*scaleZ
272 >        p[i][0] = p[i][0]*scaleX + wrap[i][0] * Hmat[0][0]
273 >        p[i][1] = p[i][1]*scaleY + wrap[i][1] * Hmat[1][1]
274 >        p[i][2] = p[i][2]*scaleZ + wrap[i][2] * Hmat[2][2]
275  
276   def main(argv):
277      _haveMDFileName = 0

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines