"csrc/vscode:/vscode.git/clone" did not exist on "1fc40d50f3b199758b57b775e85c1d01080482d9"
Commit 808504df authored by peastman's avatar peastman
Browse files

Minor enhancements/fixes to PDBFile

parent d0f8db59
...@@ -70,7 +70,10 @@ class PDBFile(object): ...@@ -70,7 +70,10 @@ class PDBFile(object):
# Load the PDB file # Load the PDB file
pdb = PdbStructure(open(file), load_all_models=True) inputfile = file
if isinstance(file, str):
inputfile = open(file)
pdb = PdbStructure(inputfile, load_all_models=True)
PDBFile._loadNameReplacementTables() PDBFile._loadNameReplacementTables()
# Build the topology # Build the topology
...@@ -140,7 +143,8 @@ class PDBFile(object): ...@@ -140,7 +143,8 @@ class PDBFile(object):
for connect in pdb.models[0].connects: for connect in pdb.models[0].connects:
i = connect[0] i = connect[0]
for j in connect[1:]: for j in connect[1:]:
connectBonds.append((atomByNumber[i], atomByNumber[j])) if i in atomByNumber and j in atomByNumber:
connectBonds.append((atomByNumber[i], atomByNumber[j]))
if len(connectBonds) > 0: if len(connectBonds) > 0:
# Only add bonds that don't already exist. # Only add bonds that don't already exist.
existingBonds = set(top.bonds()) existingBonds = set(top.bonds())
......
Markdown is supported
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