From fb34a0cb62e02c9e3ae238ee7013b61915d79b78 Mon Sep 17 00:00:00 2001 From: Jennifer Date: Tue, 17 Oct 2023 17:10:24 -0400 Subject: [PATCH] Remove openmm patches --- lib/openmm.patch | 42 ----------------------------- openfold/np/relax/amber_minimize.py | 16 +++-------- openfold/np/relax/cleanup.py | 10 ++----- openfold/np/relax/utils.py | 10 ++----- 4 files changed, 8 insertions(+), 70 deletions(-) delete mode 100644 lib/openmm.patch diff --git a/lib/openmm.patch b/lib/openmm.patch deleted file mode 100644 index cc09e9c..0000000 --- a/lib/openmm.patch +++ /dev/null @@ -1,42 +0,0 @@ -Index: simtk/openmm/app/topology.py -=================================================================== ---- simtk.orig/openmm/app/topology.py -+++ simtk/openmm/app/topology.py -@@ -356,19 +356,35 @@ - def isCyx(res): - names = [atom.name for atom in res._atoms] - return 'SG' in names and 'HG' not in names -+ # This function is used to prevent multiple di-sulfide bonds from being -+ # assigned to a given atom. This is a DeepMind modification. -+ def isDisulfideBonded(atom): -+ for b in self._bonds: -+ if (atom in b and b[0].name == 'SG' and -+ b[1].name == 'SG'): -+ return True -+ -+ return False - - cyx = [res for res in self.residues() if res.name == 'CYS' and isCyx(res)] - atomNames = [[atom.name for atom in res._atoms] for res in cyx] - for i in range(len(cyx)): - sg1 = cyx[i]._atoms[atomNames[i].index('SG')] - pos1 = positions[sg1.index] -+ candidate_distance, candidate_atom = 0.3*nanometers, None - for j in range(i): - sg2 = cyx[j]._atoms[atomNames[j].index('SG')] - pos2 = positions[sg2.index] - delta = [x-y for (x,y) in zip(pos1, pos2)] - distance = sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2]) -- if distance < 0.3*nanometers: -- self.addBond(sg1, sg2) -+ if distance < candidate_distance and not isDisulfideBonded(sg2): -+ candidate_distance = distance -+ candidate_atom = sg2 -+ # Assign bond to closest pair. -+ if candidate_atom: -+ self.addBond(sg1, candidate_atom) -+ -+ - - class Chain(object): - """A Chain object represents a chain within a Topology.""" diff --git a/openfold/np/relax/amber_minimize.py b/openfold/np/relax/amber_minimize.py index 6448e15..3cfbf22 100644 --- a/openfold/np/relax/amber_minimize.py +++ b/openfold/np/relax/amber_minimize.py @@ -28,18 +28,10 @@ import openfold.utils.loss as loss from openfold.np.relax import cleanup, utils import ml_collections import numpy as np -try: - # openmm >= 7.6 - import openmm - from openmm import unit - from openmm import app as openmm_app - from openmm.app.internal.pdbstructure import PdbStructure -except ImportError: - # openmm < 7.6 (requires DeepMind patch) - from simtk import openmm - from simtk import unit - from simtk.openmm import app as openmm_app - from simtk.openmm.app.internal.pdbstructure import PdbStructure +import openmm +from openmm import unit +from openmm import app as openmm_app +from openmm.app.internal.pdbstructure import PdbStructure ENERGY = unit.kilocalories_per_mole LENGTH = unit.angstroms diff --git a/openfold/np/relax/cleanup.py b/openfold/np/relax/cleanup.py index 472068b..a435692 100644 --- a/openfold/np/relax/cleanup.py +++ b/openfold/np/relax/cleanup.py @@ -20,14 +20,8 @@ cases like removing chains of length one (see clean_structure). import io import pdbfixer -try: - # openmm >= 7.6 - from openmm import app - from openmm.app import element -except ImportError: - # openmm < 7.6 (requires DeepMind patch) - from simtk.openmm import app - from simtk.openmm.app import element +from openmm import app +from openmm.app import element def fix_pdb(pdbfile, alterations_info): diff --git a/openfold/np/relax/utils.py b/openfold/np/relax/utils.py index b844953..fc19a91 100644 --- a/openfold/np/relax/utils.py +++ b/openfold/np/relax/utils.py @@ -18,14 +18,8 @@ import io from openfold.np import residue_constants from Bio import PDB import numpy as np -try: - # openmm >= 7.6 - from openmm import app as openmm_app - from openmm.app.internal.pdbstructure import PdbStructure -except ImportError: - # openmm < 7.6 (requires DeepMind patch) - from simtk.openmm import app as openmm_app - from simtk.openmm.app.internal.pdbstructure import PdbStructure +from openmm import app as openmm_app +from openmm.app.internal.pdbstructure import PdbStructure def overwrite_pdb_coordinates(pdb_str: str, pos) -> str: