Skip to content

Commit aa82085

Browse files
Meg OsatoMeg Osato
authored andcommitted
fixes merge conflicts
2 parents 1a967fb + fc570a5 commit aa82085

18 files changed

+173516
-37
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ Latest release:
1313
## Citations
1414
#### Publication
1515
- [Gill, S; Lim, N. M.; Grinaway, P.; Rustenburg, A. S.; Fass, J.; Ross, G.; Chodera, J. D.; Mobley, D. L. “Binding Modes of Ligands Using Enhanced Sampling (BLUES): Rapid Decorrelation of Ligand Binding Modes Using Nonequilibrium Candidate Monte Carlo”](https://pubs.acs.org/doi/abs/10.1021/acs.jpcb.7b11820) - Journal of Physical Chemistry B. February 27, 2018
16+
- [Burley, K. H., Gill, S. C., Lim, N. M., & Mobley, D. L. "Enhancing Sidechain Rotamer Sampling Using Non-Equilibrium Candidate Monte Carlo"](https://pubs.acs.org/doi/abs/10.1021/acs.jctc.8b01018) - Journal of Chemical Theory and Computation. January 24, 2019
1617

1718
#### Preprints
1819
- [BLUES v1](https://chemrxiv.org/articles/Binding_Modes_of_Ligands_Using_Enhanced_Sampling_BLUES_Rapid_Decorrelation_of_Ligand_Binding_Modes_Using_Nonequilibrium_Candidate_Monte_Carlo/5406907) - ChemRxiv September 19, 2017
1920
- [BLUES v2](https://doi.org/10.26434/chemrxiv.5406907.v2) - ChemRxiv September 25, 2017
21+
- [Sampling alternate conformations of bound ligands](https://chemrxiv.org/articles/Sampling_Conformational_Changes_of_Bound_Ligands_Using_Nonequilibrium_Candidate_Monte_Carlo/10003412) - ChemRxiv October 23, 2019
2022

2123
## Manifest
2224
* `blues/` - Source code and example scripts for BLUES toolkit

blues/example.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,65 @@ def sidechain_example(yaml_file):
6161
for value in dihedraldata:
6262
output.write("%s\n" % str(value)[1:-1])
6363

64+
def rotbondmove_example(yaml_file):
65+
# Parse a YAML configuration, return as Dict
66+
cfg = Settings(yaml_file).asDict()
67+
structure = cfg['Structure']
68+
69+
#Select move type
70+
prmtop = cfg['structure']['filename']
71+
inpcrd = cfg['structure']['xyz']
72+
dihedral_atoms = cfg['rotbond_info']['dihedral_atoms']
73+
alch_list = cfg['rotbond_info']['alch_list']
74+
ligand = RandomRotatableBondMove(structure, prmtop, inpcrd, dihedral_atoms, alch_list, 'LIG')
75+
76+
#Iniitialize object that selects movestep
77+
ligand_mover = MoveEngine(ligand)
78+
79+
#Generate the openmm.Systems outside SimulationFactory to allow modifications
80+
systems = SystemFactory(structure, ligand.atom_indices, cfg['system'])
81+
82+
#Freeze atoms in the alchemical system to speed up alchemical calculation
83+
systems.alch = systems.freeze_radius(structure, systems.alch, **cfg['freeze'])
84+
85+
#Generate the OpenMM Simulations
86+
simulations = SimulationFactory(systems, ligand_mover, cfg['simulation'], cfg['md_reporters'],
87+
cfg['ncmc_reporters'])
88+
89+
# Run BLUES Simulation
90+
blues = BLUESSimulation(simulations, cfg['simulation'])
91+
blues.run()
92+
93+
def rotbondlfipmove_cuda(yaml_file):
94+
# Parse a YAML configuration, return as Dict
95+
cfg = Settings(yaml_file).asDict()
96+
structure = cfg['Structure']
97+
98+
#Select move type
99+
prmtop = cfg['structure']['filename']
100+
inpcrd = cfg['structure']['xyz']
101+
dihedral_atoms = cfg['rotbond_info']['dihedral_atoms']
102+
alch_list = cfg['rotbond_info']['alch_list']
103+
ligand = RandomRotatableBondFlipMove(structure, prmtop, inpcrd, dihedral_atoms, alch_list, 'LIG')
104+
105+
#Iniitialize object that selects movestep
106+
ligand_mover = MoveEngine(ligand)
107+
108+
#Generate the openmm.Systems outside SimulationFactory to allow modifications
109+
systems = SystemFactory(structure, ligand.atom_indices, cfg['system'])
110+
111+
#Freeze atoms in the alchemical system to speed up alchemical calculation
112+
systems.alch = systems.freeze_radius(structure, systems.alch, **cfg['freeze'])
113+
114+
#Generate the OpenMM Simulations
115+
simulations = SimulationFactory(systems, ligand_mover, cfg['simulation'], cfg['md_reporters'],
116+
cfg['ncmc_reporters'])
117+
118+
# Run BLUES Simulation
119+
blues = BLUESSimulation(simulations, cfg['simulation'])
120+
blues.run()
64121

65122
ligrot_example(get_data_filename('blues', '../examples/rotmove_cuda.yml'))
66123
#sidechain_example(get_data_filename('blues', '../examples/sidechain_cuda.yml'))
124+
#rotbondmove_example(get_data_filename('blues', '../examples/rotbondmove_cuda.yaml'))
125+
#rotbondflipmove_example(get_data_filename('blues', '../examples/rotbondmove_cuda.yaml'))

blues/integrators.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ class AlchemicalExternalLangevinIntegrator(AlchemicalNonequilibriumLangevinInteg
1111
"""Allows nonequilibrium switching based on force parameters specified in alchemical_functions.
1212
A variable named lambda is switched from 0 to 1 linearly throughout the nsteps of the protocol.
1313
The functions can use this to create more complex protocols for other global parameters.
14-
1514
As opposed to `openmmtools.integrators.AlchemicalNonequilibriumLangevinIntegrator`,
1615
which this inherits from, the AlchemicalExternalLangevinIntegrator integrator also takes
1716
into account work done outside the nonequilibrium switching portion(between integration steps).
1817
For example if a molecule is rotated between integration steps, this integrator would
1918
correctly account for the work caused by that rotation.
20-
2119
Propagator is based on Langevin splitting, as described below.
2220
One way to divide the Langevin system is into three parts which can each be solved "exactly:"
23-
2421
- R: Linear "drift" / Constrained "drift"
2522
Deterministic update of *positions*, using current velocities
2623
``x <- x + v dt``
@@ -30,18 +27,15 @@ class AlchemicalExternalLangevinIntegrator(AlchemicalNonequilibriumLangevinInteg
3027
- O: Ornstein-Uhlenbeck
3128
Stochastic update of velocities, simulating interaction with a heat bath
3229
``v <- av + b sqrt(kT/m) R`` where:
33-
3430
- a = e^(-gamma dt)
3531
- b = sqrt(1 - e^(-2gamma dt))
3632
- R is i.i.d. standard normal
37-
3833
We can then construct integrators by solving each part for a certain timestep in sequence.
3934
(We can further split up the V step by force group, evaluating cheap but fast-fluctuating
4035
forces more frequently than expensive but slow-fluctuating forces. Since forces are only
4136
evaluated in the V step, we represent this by including in our "alphabet" V0, V1, ...)
4237
When the system contains holonomic constraints, these steps are confined to the constraint
4338
manifold.
44-
4539
Parameters
4640
----------
4741
alchemical_functions : dict of strings
@@ -71,12 +65,10 @@ class AlchemicalExternalLangevinIntegrator(AlchemicalNonequilibriumLangevinInteg
7165
nprop : int (Default: 1)
7266
Controls the number of propagation steps to add in the lambda
7367
region defined by `prop_lambda`.
74-
7568
Attributes
7669
----------
7770
_kinetic_energy : str
7871
This is 0.5*m*v*v by default, and is the expression used for the kinetic energy
79-
8072
Examples
8173
--------
8274
- g-BAOAB:
@@ -87,14 +79,10 @@ class AlchemicalExternalLangevinIntegrator(AlchemicalNonequilibriumLangevinInteg
8779
splitting="V R H R V"
8880
- An NCMC algorithm with Metropolized integrator:
8981
splitting="O { V R H R V } O"
90-
91-
9282
References
9383
----------
9484
[Nilmeier, et al. 2011] Nonequilibrium candidate Monte Carlo is an efficient tool for equilibrium simulation
95-
9685
[Leimkuhler and Matthews, 2015] Molecular dynamics: with deterministic and stochastic numerical methods, Chapter 7
97-
9886
"""
9987

10088
def __init__(self,
@@ -124,6 +112,10 @@ def __init__(self,
124112
nsteps_neq=nsteps_neq)
125113

126114
self._prop_lambda = self._get_prop_lambda(prop_lambda)
115+
frame = inspect.currentframe()
116+
args, _, _, values = inspect.getargvalues(frame)
117+
inputs = dict([(i, values[i]) for i in args if i is not 'self'])
118+
self.int_kwargs = inputs
127119

128120
# add some global variables relevant to the integrator
129121
kB = openmm.unit.BOLTZMANN_CONSTANT_kB * openmm.unit.AVOGADRO_CONSTANT_NA
@@ -206,4 +198,6 @@ def reset(self):
206198
self.setGlobalVariableByName("perturbed_pe", 0.0)
207199
self.setGlobalVariableByName("unperturbed_pe", 0.0)
208200
self.setGlobalVariableByName("prop", 1)
209-
super(AlchemicalExternalLangevinIntegrator, self).reset()
201+
#super(AlchemicalExternalLangevinIntegrator, self).reset()
202+
203+

0 commit comments

Comments
 (0)