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

Arrestin system #17

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions bgmol/data/termini.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ACE:
#- ["H1", "CH3", "C", "N"]
#- ["CH3", "C", "N", "CA"]
- ["C", "CH3", "H1", "H2"]
- ["H3", "CH3", "C", "H1"]
#- ["C", "N", "CA", "C"]
#- ["O", "C", "N", "CA"]

NME:
#- ["N", "C", "CA", "N"]
#- ["H", "N", "O", "C"]
#- ["C", "N", "C", "CA"]
#- ["H1", "C", "N", "C"]
- ["C", "N", "H1", "H2"]
- ["H3", "C", "N", "H1"]


HSE:
- ["HN", "N", "CA", "C"]
- ["O", "C", "CA", "N"]
- ["HA", "CA", "N", "C"]

HSD:
- ["HN", "N", "CA", "C"]
- ["O", "C", "CA", "N"]
- ["HA", "CA", "N", "C"]

HSP:
- ["HN", "N", "CA", "C"]
- ["O", "C", "CA", "N"]
- ["HA", "CA", "N", "C"]
1 change: 1 addition & 0 deletions bgmol/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from .ala2 import *
from .minipeptides import *
from .chignolin import *
from .arrestin import *
73 changes: 73 additions & 0 deletions bgmol/datasets/arrestin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import os
import numpy as np
from bgmol.datasets.base import DataSet
from bgmol.api import system_by_name
from mdtraj import load_dcd


__all__ = ["ArrestinActive"]


class ArrestinActive(DataSet):
"""ArrestinActive at 310 K.
1 ms Langevin dynamics with 1/ps friction coefficient and 2fs time step,
output spaced in 10 ps intervals.
"""
#url = "http://ftp.mi.fu-berlin.de/pub/cmb-data/bgmol/datasets/ala2/Ala2Implicit300.tgz"
#md5 = "ce9d6f6aa214f3eb773d52255aeaeacb"
#num_frames = 99999
#size = 49692000 # in bytes
selection = "all"
openmm_version = "7.4.1"
date = "2021/8/15"

def __init__(self, root=os.getcwd()):
super(ArrestinActive, self).__init__(root=root)
self._system = system_by_name("ArrestinActive")
self._temperature = 310
# name = 'arr2-active_coordinates'
# with open(name + '.pkl', 'rb') as f:
# coords = pickle.load(f)
# self._xyz = coords

@property
def trajectory_file(self):
return os.path.join(self.root, "openmm-arrestin/arr2-active_output.dcd")

def read(self):
self.trajectory = load_dcd(self.trajectory_file, top=self._system.mdtraj_topology)
#energy_logfile = 'arr2-active_log.txt'
#self._energies = np.loadtxt(energy_logfile, delimiter=',')[:,1]
# self._forces = np.loadtxt(force_logfile, delimiter=',')[:,1]




class ArrestinInactive(DataSet):
"""ArrestinInactive at 310 K.
1 ms Langevin dynamics with 1/ps friction coefficient and 2fs time step,
output spaced in 10 ps intervals.
"""
#url = "http://ftp.mi.fu-berlin.de/pub/cmb-data/bgmol/datasets/ala2/Ala2Implicit1000.tgz"
#md5 = "9a90965254dac7440976d0d62687caed"
#num_frames = 100000
#size = 51071715 # in bytes
selection = "all"
openmm_version = "7.4.1"
date = "2021/08/15"

def __init__(self, root=os.getcwd(), download: bool = False, read: bool = False):
super(ArrestinInactive, self).__init__(root=root, download=download, read=read)
self._system = system_by_name("ArrestinInactive")
self._temperature = 310
name = 'arr2-inactive_coordinates'
with open(name + '.pkl', 'rb') as f:
coords = pickle.load(f)
self._xyz = coords

def read(self):
# self.trajectory = load_dcd(self.trajectory_file)
energy_logfile = 'arr2-inactive_log.txt'
self._energies = np.loadtxt(energy_logfile, delimiter=',')[:,1]
# self._forces = np.loadtxt(force_logfile, delimiter=',')[:,1]

1 change: 1 addition & 0 deletions bgmol/systems/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
from .minipeptides import *
from .chignolin import *
from .fastfolders import *
from .arrestin import *
44 changes: 44 additions & 0 deletions bgmol/systems/arrestin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
import tempfile
from ..systems.base import OpenMMSystem
from torchvision.datasets.utils import download_url

from ..util.importing import import_openmm
mm, unit, app = import_openmm()


__all__ = ["ArrestinActive"]


class ArrestinActive(OpenMMSystem):
"""
"""
url = "http://ftp.mi.fu-berlin.de/pub/cmb-data/bgmol/systems/arrestin/"

def __init__(self, root=tempfile.gettempdir(), download=True):
super(ArrestinActive, self).__init__()

if download:
filename = self._download(root)
assert os.path.isfile(filename)

pdb = app.PDBFile(filename)
forcefield = app.ForceField("amber99sbildn.xml", "amber96_obc.xml")

self._system = forcefield.createSystem(
pdb.topology,
nonbondedMethod=app.PME,
nonbondedCutoff=1 * unit.nanometer,
constraints=app.HBonds
)

self._positions = pdb.getPositions(asNumpy=True).value_in_unit(unit.nanometer)
self._topology = pdb.getTopology()

def _download(self, root):
md5 = "c428fe87c0e888bc19e444eef05a9b3d"
filename = "arr2-active_start.pdb"
download_url(self.url+filename, root, filename, md5)
local_file = os.path.join(root, filename)
return local_file

6 changes: 6 additions & 0 deletions bgmol/tests/systems/test_arrestin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

from bgmol.systems import ArrestinActive


def test_arrestin_system():
arrestin = ArrestinActive()