Commit c3cb9ecb authored by New Tbgl User's avatar New Tbgl User
Browse files

Fixed minor pdb/psf writing issues

parent 1ef1c11e
......@@ -440,7 +440,7 @@ class PdbModel(Transformable, Parent):
beta = 0
# x,y,z = [x for x in p.collapsedPosition()]
pos = p.collapsedPosition()
dig = [max(int(np.log10(np.abs(x))//1),0)+1 for x in pos]
dig = [max(int(np.log10(np.abs(x)+1e-6)//1),0)+1 for x in pos]
for d in dig: assert( d <= 7 )
# assert( np.all(dig <= 7) )
fs = ["{: %d.%df}" % (8,7-d) for d in dig]
......@@ -501,9 +501,9 @@ class PdbModel(Transformable, Parent):
fh.write("{:>8d} !NBOND\n".format(len(bonds)))
counter = 0
for p1,p2,b,ex in bonds:
fh.write( "{:d} {:d} ".format(p1.idx+1,p2.idx+1) )
fh.write( "{:>8d}{:>8d}".format(p1.idx+1,p2.idx+1) )
counter += 1
if counter == 3:
if counter == 4:
fh.write("\n")
counter = 0
fh.write("\n")
......@@ -513,9 +513,9 @@ class PdbModel(Transformable, Parent):
fh.write("{:>8d} !NTHETA\n".format(len(angles)))
counter = 0
for p1,p2,p3,a in angles:
fh.write( "{:d} {:d} {:d}".format(p1.idx+1,p2.idx+1,p3.idx+1) )
fh.write( "{:>8d}{:>8d}{:>8d}".format(p1.idx+1,p2.idx+1,p3.idx+1) )
counter += 1
if counter == 2:
if counter == 3:
fh.write("\n")
counter = 0
fh.write("\n")
......@@ -525,7 +525,7 @@ class PdbModel(Transformable, Parent):
fh.write("{:>8d} !NPHI\n".format(len(dihedrals)))
counter = 0
for p1,p2,p3,p4,a in dihedrals:
fh.write( "{:d} {:d} {:d} {:d}".format(p1.idx+1,p2.idx+1,p3.idx+1,p4.idx+1) )
fh.write( "{:>8d}{:>8d}{:>8d}{:>8d}".format(p1.idx+1,p2.idx+1,p3.idx+1,p4.idx+1) )
counter += 1
if counter == 2:
fh.write("\n")
......@@ -537,7 +537,7 @@ class PdbModel(Transformable, Parent):
fh.write("{:>8d} !NIMPHI\n".format(len(impropers)))
counter = 0
for p1,p2,p3,p4,a in impropers:
fh.write( "{:d} {:d} {:d} {:d}".format(p1.idx+1,p2.idx+1,p3.idx+1,p4.idx+1) )
fh.write( "{:>8d}{:>8d}{:>8d}{:>8d}".format(p1.idx+1,p2.idx+1,p3.idx+1,p4.idx+1) )
counter += 1
if counter == 2:
fh.write("\n")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment