Modified:
/trunk/lammpsScripts/lammpstrj2pdb.py
=======================================
--- /trunk/lammpsScripts/lammpstrj2pdb.py Fri Jul 8 09:15:59 2011
+++ /trunk/lammpsScripts/lammpstrj2pdb.py Fri Aug 19 10:38:38 2011
@@ -26,6 +26,7 @@
s=2; # scaling factor
#s=s/30; # rescale for reduced units - comment this line for real units
nLine=0; # line counter
+nExtra=0; # extra atoms used to represent dipoles
print "Start scanning coordinates and orientations..."
for line in lines:
@@ -35,9 +36,10 @@
if words[1]=="TIMESTEP":
if nLine!=1:
outFile.write('ENDMDL\n')
+ nExtra=0;
outFile.write('MODEL\n')
if len(words) == 9:
- n=int(words[0]) # atom identifier
+ n=int(words[0]) + nExtra # atom identifier
t=int(words[1]) # type identifier
m=float(words[2]) # molecule identifier
x=float(words[3])
@@ -52,9 +54,9 @@
if t == 1: # water type
outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
%(n,"OW WAT",m,x,y,z ))
- nPlus=n+nSites # index of added hydrogen ('+' end of dipole)
outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
- %(nPlus,"HW WAT",m,xh,yh,zh ))
+ %(n+1,"HW WAT",m,xh,yh,zh ))
+ nExtra=nExtra+1
elif t == 2: # choline type
outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
%(n,"NC3 LIP",m,x,y,z ))
@@ -64,14 +66,11 @@
elif t == 4 or t == 5: # glycerol or ester type
outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
%(n,"O LIP",m,x,y,z ))
-# nPlus=n+nSites # index of added carbon ('+' end of dipole)
-# outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
-# %(nPlus,"C LIP",m,xh,yh,zh ))
+ outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
+ %(n+1,"F LIP",m,xh,yh,zh ))
+ nExtra=nExtra+1
elif t == 6: # tail type
outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
%(n,"CH2 LIP",m,x,y,z ))
- elif t == 7: # charge type
- outFile.write('ATOM%7d%9s%6d%12.3f%8.3f%8.3f\n'
- %(n,"C LIP",m,x,y,z ))
print "Done scanning - end of script."