Sync copies of pizza

This commit is contained in:
Richard Berger
2021-06-02 13:09:52 -04:00
parent 3f1bbf7c71
commit 249a2a6783
6 changed files with 424 additions and 505 deletions

View File

@ -3,7 +3,7 @@
#
# Copyright (2005) Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software. This software is distributed under
# certain rights in this software. This software is distributed under
# the GNU General Public License.
# for python3 compatibility
@ -25,7 +25,7 @@ p = pdbfile("3CRO",d) read in single PDB file with snapshot data
if only one 4-char file specified and it is not found,
it will be downloaded from http://www.rcsb.org as 3CRO.pdb
d arg is object with atom coordinates (dump, data)
p.one() write all output as one big PDB file to tmp.pdb
p.one("mine") write to mine.pdb
p.many() write one PDB file per snapshot: tmp0000.pdb, ...
@ -39,7 +39,7 @@ p.single(N,"new") write as new.pdb
if one file in str arg and d: one new PDB file per snapshot
using input PDB file as template
multiple input PDB files with a d is not allowed
index,time,flag = p.iterator(0)
index,time,flag = p.iterator(1)
@ -97,7 +97,7 @@ class pdbfile:
# flist = full list of all PDB input file names
# append .pdb if needed
if filestr:
list = filestr.split()
flist = []
@ -117,7 +117,7 @@ class pdbfile:
raise Exception("no input PDB file(s)")
# grab PDB file from http://rcsb.org if not a local file
if len(self.files) == 1 and len(self.files[0]) == 8:
try:
open(self.files[0],'r').close()
@ -127,7 +127,7 @@ class pdbfile:
urllib.urlretrieve(fetchstr,self.files[0])
if self.data and len(self.files): self.read_template(self.files[0])
# --------------------------------------------------------------------
# write a single large PDB file for concatenating all input data or files
# if data exists:
@ -145,7 +145,7 @@ class pdbfile:
f = open(file,'w')
# use template PDB file with each snapshot
if self.data:
n = flag = 0
while 1:
@ -163,7 +163,7 @@ class pdbfile:
print("END",file=f)
print(file,end='')
sys.stdout.flush()
f.close()
print("\nwrote %d datasets to %s in PDB format" % (n,file))
@ -199,7 +199,7 @@ class pdbfile:
f = open(file,'w')
self.convert(f,which)
f.close()
print(time,end='')
sys.stdout.flush()
n += 1
@ -216,13 +216,13 @@ class pdbfile:
else:
file = root + str(n)
file += ".pdb"
f = open(file,'w')
f.write(open(infile,'r').read())
f.close()
print(file,end='')
sys.stdout.flush()
n += 1
print("\nwrote %d datasets to %s*.pdb in PDB format" % (n,root))
@ -249,7 +249,7 @@ class pdbfile:
self.convert(f,which)
else:
f.write(open(self.files[time],'r').read())
f.close()
# --------------------------------------------------------------------
@ -268,8 +268,8 @@ class pdbfile:
# --------------------------------------------------------------------
# read a PDB file and store ATOM lines
def read_template(self,file):
def read_template(self,file):
lines = open(file,'r').readlines()
self.atomlines = {}
for line in lines: