Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Updates for current dependencies #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions 02_calc/minimize_ffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,36 @@
from openeye import oechem, oequacpac, oeszybki
import simtk.openmm as mm
from simtk.openmm import app
from simtk import unit
import numpy as np

import openmoltools
import parmed
from parmed import unit as u

from openforcefield.typing.engines.smirnoff import ForceField
from openforcefield.topology import Molecule, Topology
from openforcefield.utils import structure


def extractPositionsFromOEMol(oemol):
"""Get the positions from an OEMol and return in a position array with units via simtk.unit, i.e. foramtted for OpenMM.
Adapted from choderalab/openmoltools test function extractPositionsFromOEMOL
Arguments:
----------
oemol : OEMol
OpenEye molecule
Returns:
--------
positions : Nx3 array
Unit-bearing via simtk.unit Nx3 array of coordinates
"""
#warnings.warn(DEPRECATION_WARNING_TEXT, PendingDeprecationWarning)

positions = unit.Quantity(np.zeros([oemol.NumAtoms(), 3], np.float32), unit.angstroms)
coords = oemol.GetCoords()
for index in range(oemol.NumAtoms()):
positions[index,:] = unit.Quantity(coords[index], unit.angstroms)
return positions


def run_openmm(topology, system, positions):
Expand Down Expand Up @@ -288,7 +310,7 @@ def min_ffxml(mol, ofs, ffxml):
f'{oe_mol.GetTitle()} {smilabel}: {e}')
return

positions = structure.extractPositionsFromOEMol(oe_mol)
positions = extractPositionsFromOEMol(oe_mol)

# minimize structure with ffxml
newpos, energy = run_openmm(topology, system, positions)
Expand Down