"platforms/cuda/vscode:/vscode.git/clone" did not exist on "c2cb6421e113f0a0c082018940ce56c0c272f40e"
Commit 10b9e98a authored by Rafal P. Wiewiora's avatar Rafal P. Wiewiora
Browse files

PDBFile change metal bond behavior to that of PDBxFile

parent 4d32047c
...@@ -69,6 +69,10 @@ class PDBFile(object): ...@@ -69,6 +69,10 @@ class PDBFile(object):
file : string file : string
the name of the file to load the name of the file to load
""" """
metalElements = ['Al','As','Ba','Ca','Cd','Ce','Co','Cs','Cu','Dy','Fe','Gd','Hg','Ho','In','Ir','K','Li','Mg',
'Mn','Mo','Na','Ni','Pb','Pd','Pt','Rb','Rh','Ru','Sm','Sr','Te','Tl','V','W','Yb','Zn']
top = Topology() top = Topology()
## The Topology read from the PDB file ## The Topology read from the PDB file
self.topology = top self.topology = top
...@@ -151,13 +155,20 @@ class PDBFile(object): ...@@ -151,13 +155,20 @@ class PDBFile(object):
self.topology.createDisulfideBonds(self.positions) self.topology.createDisulfideBonds(self.positions)
self._numpyPositions = None self._numpyPositions = None
# Add bonds based on CONECT records. # Add bonds based on CONECT records. Bonds are not added for elements in metalElements, unless in the same residue.
connectBonds = [] connectBonds = []
for connect in pdb.models[-1].connects: for connect in pdb.models[-1].connects:
i = connect[0] i = connect[0]
for j in connect[1:]: for j in connect[1:]:
if i in atomByNumber and j in atomByNumber: if i in atomByNumber and j in atomByNumber:
if atomByNumber[i].element != None and atomByNumber[j].element != None:
if atomByNumber[i].element.symbol in metalElements or atomByNumber[j].element.symbol in metalElements:
if atomByNumber[i].residue == atomByNumber[j].residue:
connectBonds.append((atomByNumber[i], atomByNumber[j]))
else:
connectBonds.append((atomByNumber[i], atomByNumber[j]))
else:
connectBonds.append((atomByNumber[i], atomByNumber[j])) 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.
......
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