This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openforcefield version: 0.7.0 | |
rdkit version: 2020.03.4 | |
openeye version: 2019.Oct.2 | |
[... suppressing stereochem warnings ...] | |
CN(=O)=O | |
[#1:1]-[#6X4]~[*+1,*+2] (3 in RDKit, 0 in OpenEye) | |
[*:1]-[#6X4:2]-[#7X3:3]-[*:4] (3 in RDKit, 0 in OpenEye) | |
[*:1]-[#7X4,#7X3,#7X2-1:2]-[*:3] (2 in RDKit, 0 in OpenEye) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##geometric functions | |
using LinearAlgebra:dot, norm, atan, acos, ×, ⋅ | |
distance(x, y) = norm(x - y) | |
∠(a, b, c) = acos(-dot((b-a)/norm(b-a), (c-b)/norm(c-b))) | |
function dihedral_angle(a, b, c, d) | |
b1 = b - a | |
# b2 = c - b # mdtraj convention | |
b2 = b - c # openmm convention | |
b3 = d - c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""parse subset of smirks that covers "self-contained" patterns | |
like [<atom>:1] <bond> [<atom>:2] | |
but not like [<atom>:1] <bond> [<atom>:2]=[<atom>] | |
or [<atom>:1] <bond> [<atom>$(*~[#6]):2] | |
later, it's straightforward to extend to handle recursive smarts (like "$(*~[#6])") | |
but less straightforward to handle extended chemical environments |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implementation of balanced locally informed proposals, following: | |
# [Zanella, 2017] "Informed proposals for local MCMC in discrete spaces" | |
# https://arxiv.org/abs/1711.07424 | |
# Usage: define a neighborhood_fxn(x) that returns an iterable of x's neighbors. | |
# Where you would have made uninformed proposals using this neighborhood, you | |
# can now make target-informed proposals using this neighborhood. | |
# Assumption: neighborhood_fxn is deterministic | |
# Assumption: if y is in neighborhood_fxn(x), then x is in neighborhood_fxn(y) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openmmtools.testsystems import HostGuestVacuum | |
from simtk import openmm as mm | |
testsystem = HostGuestVacuum(constraints=None) | |
ligand_residue = list(testsystem.topology.residues())[1] | |
atoms_in_ligand = [atom.index for atom in ligand_residue.atoms()] | |
def filter_from_subset(atom_subset=None): | |
if type(atom_subset) == type(None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from numba import jit | |
AND = np.bitwise_and | |
def off_mol_to_arrays(mol): | |
"""accept an openforcefield.topology.Molecule | |
return | |
* an (n_atoms, 2) integer array containing (atomic_number, formal_charge) for each atom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from simtk.openmm import app | |
import simtk.openmm as mm | |
from simtk import unit | |
import mbpol | |
import numpy as np | |
import mdtraj as md | |
import matplotlib.pyplot as plt | |
# create simulation | |
pdb = app.PDBFile("water14_cluster.pdb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simplified from GP structure learning example, section 7.2 | |
# https://github.com/probcomp/pldi2019-gen-experiments/tree/master/gp -- `cov_tree.jl` and `lightweight.jl` | |
using Gen | |
# abstract types for binary expression tree | |
abstract type Node end | |
abstract type LeafNode <: Node end | |
abstract type BinaryOpNode <: Node end | |
num_children(node::LeafNode) = 0 |