Skip to content

Commit

Permalink
Merge pull request #725 from choderalab/fixing-tests
Browse files Browse the repository at this point in the history
[WIP] writing tests for FAH suite
  • Loading branch information
hannahbrucemacdonald authored Aug 27, 2020
2 parents 35c0b21 + c6576f8 commit 5c57c2a
Show file tree
Hide file tree
Showing 39 changed files with 3,546 additions and 285 deletions.
1 change: 0 additions & 1 deletion basesetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys
import imp
import json
import string
import shutil
import subprocess
import tempfile
Expand Down
3 changes: 2 additions & 1 deletion perses/analysis/analyse_sams_convergence.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import matplotlib.pyplot as plt
import os, sys
import os
import sys
from glob import glob
from perses.analysis import utils

Expand Down
9 changes: 1 addition & 8 deletions perses/analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,15 @@
# IMPORTS
################################################################################

import os, os.path
import sys, math
import numpy as np
import copy
import time
import netCDF4 as netcdf
from openeye import oeiupac, oechem
import pickle
import json
import itertools
import pymbar
from perses import storage
import seaborn as sns

import matplotlib as mpl
mpl.use('Agg')
import seaborn as sns

from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
Expand Down
3 changes: 0 additions & 3 deletions perses/analysis/fah_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
from pymbar import BAR
import matplotlib.pyplot as plt
import seaborn
import pickle
from simtk.openmm import unit
import bz2
import json
from tqdm.auto import tqdm
from openmmtools.constants import kB
import random
import joblib
import logging
import os
Expand Down
6 changes: 0 additions & 6 deletions perses/analysis/load_simulations.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import numpy as np
import matplotlib.pyplot as plt
import sys
from openeye import oechem, oegraphsim
from openmmtools.constants import kB

import logging
_logger = logging.getLogger()
_logger.setLevel(logging.INFO)
Expand Down
19 changes: 9 additions & 10 deletions perses/annihilation/lambda_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import numpy as np
import logging
import copy
import traceback
from openmmtools.alchemy import AlchemicalState

logging.basicConfig(level=logging.NOTSET)
_logger = logging.getLogger("lambda_protocol")
_logger.setLevel(logging.DEBUG)
_logger.setLevel(logging.INFO)


class LambdaProtocol(object):
Expand Down Expand Up @@ -49,16 +48,16 @@ def __init__(self, functions='default'):
default : ele and LJ terms of the old system are turned off between 0.0 -> 0.5
ele and LJ terms of the new system are turned on between 0.5 -> 1.0
core terms treated linearly
quarters : 0.25 of the protocol is used in turn to individually change the
(a) off old ele, (b) off old sterics, (c) on new sterics (d) on new ele
core terms treated linearly
namd : follows the protocol outlined here: https://pubs.acs.org/doi/full/10.1021/acs.jcim.9b00362#
Jiang, Wei, Christophe Chipot, and Benoît Roux. "Computing Relative Binding Affinity of Ligands
to Receptor: An Effective Hybrid Single-Dual-Topology Free-Energy Perturbation Approach in NAMD."
Jiang, Wei, Christophe Chipot, and Benoît Roux. "Computing Relative Binding Affinity of Ligands
to Receptor: An Effective Hybrid Single-Dual-Topology Free-Energy Perturbation Approach in NAMD."
Journal of chemical information and modeling 59.9 (2019): 3794-3802.
ele-scaled : all terms are treated as in default, except for the old and new ele
these are scaled with lambda^0.5, so as to be linear in energy, rather than lambda
Expand Down Expand Up @@ -120,17 +119,17 @@ def __init__(self, functions='default'):
'lambda_torsions':
lambda x: x}
elif self.type == 'ele-scaled':
self.functions = {'lambda_electrostatics_insert':
self.functions = {'lambda_electrostatics_insert':
lambda x: 0.0 if x < 0.5 else ((2*(x-0.5))**0.5),
'lambda_electrostatics_delete':
'lambda_electrostatics_delete':
lambda x: (2*x)**2 if x < 0.5 else 1.0
}
elif self.type == 'user-defined':
self.functions = functions
else:
_logger.warning(f"""LambdaProtocol type : {self.type} not
recognised. Allowed values are 'default',
'namd' and 'quarters' and 'user-defined'.
'namd' and 'quarters' and 'user-defined'.
Setting LambdaProtocol functions to default. """)
self.functions = LambdaProtocol.default_functions

Expand Down
6 changes: 2 additions & 4 deletions perses/annihilation/ncmc_switching.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
import numpy as np
import copy
import logging
import traceback
from simtk import openmm, unit
from perses.dispersed.feptasks import Particle, compute_reduced_potential
from perses.dispersed.feptasks import compute_reduced_potential
from perses.storage import NetCDFStorageView
from perses.annihilation.relative import HybridTopologyFactory
from perses.tests.utils import quantity_is_finite
from openmmtools.constants import kB
from openmmtools.cache import LRUCache, global_context_cache
from openmmtools.states import ThermodynamicState, SamplerState, CompoundThermodynamicState
from perses.annihilation.lambda_protocol import RelativeAlchemicalState, LambdaProtocol
from simtk import unit

default_temperature = 300.0*unit.kelvin
default_nsteps = 1
Expand Down
5 changes: 0 additions & 5 deletions perses/annihilation/relative.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import sys
import simtk.openmm as openmm
import simtk.openmm.app as app
import simtk.unit as unit
import mdtraj as md
import numpy as np
import copy
import enum
from io import StringIO
import lxml.etree as etree
from openmmtools.constants import ONE_4PI_EPS0

InteractionGroup = enum.Enum("InteractionGroup", ['unique_old', 'unique_new', 'core', 'environment'])

Expand Down
Loading

0 comments on commit 5c57c2a

Please sign in to comment.