本文整理汇总了Python中alchemy.AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit方法的典型用法代码示例。如果您正苦于以下问题:Python AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit方法的具体用法?Python AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit怎么用?Python AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alchemy.AbsoluteAlchemicalFactory
的用法示例。
在下文中一共展示了AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from alchemy import AbsoluteAlchemicalFactory [as 别名]
# 或者: from alchemy.AbsoluteAlchemicalFactory import defaultComplexProtocolImplicit [as 别名]
def __init__(self, store_directory, verbose=False):
"""
Initialize YANK object with default parameters.
Parameters
----------
store_directory : str
The storage directory in which output NetCDF files are read or written.
verbose : bool, optional, default=False
If True, will turn on verbose output.
"""
# Record that we are not yet initialized.
self._initialized = False
# Store output directory.
self._store_directory = store_directory
# Public attributes.
self.verbose = verbose
self.restraint_type = 'flat-bottom' # default to a flat-bottom restraint between the ligand and receptor
self.randomize_ligand = True
self.randomize_ligand_sigma_multiplier = 2.0
self.randomize_ligand_close_cutoff = 1.5 * unit.angstrom # TODO: Allow this to be specified by user.
self.mc_displacement_sigma = 10.0 * unit.angstroms
# Set internal variables.
self._phases = list()
self._store_filenames = dict()
# Default alchemical protocols.
self.default_protocols = dict()
self.default_protocols['vacuum'] = AbsoluteAlchemicalFactory.defaultVacuumProtocol()
self.default_protocols['solvent-implicit'] = AbsoluteAlchemicalFactory.defaultSolventProtocolImplicit()
self.default_protocols['complex-implicit'] = AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit()
self.default_protocols['solvent-explicit'] = AbsoluteAlchemicalFactory.defaultSolventProtocolExplicit()
self.default_protocols['complex-explicit'] = AbsoluteAlchemicalFactory.defaultComplexProtocolExplicit()
# Default options for repex.
self.default_options = dict()
self.default_options['number_of_equilibration_iterations'] = 0
self.default_options['number_of_iterations'] = 100
self.default_options['verbose'] = self.verbose
self.default_options['timestep'] = 2.0 * unit.femtoseconds
self.default_options['collision_rate'] = 5.0 / unit.picoseconds
self.default_options['minimize'] = False
self.default_options['show_mixing_statistics'] = True # this causes slowdown with iteration and should not be used for production
self.default_options['platform_names'] = None
self.default_options['displacement_sigma'] = 1.0 * unit.nanometers # attempt to displace ligand by this stddev will be made each iteration
return
示例2: setup_binding_amber
# 需要导入模块: from alchemy import AbsoluteAlchemicalFactory [as 别名]
# 或者: from alchemy.AbsoluteAlchemicalFactory import defaultComplexProtocolImplicit [as 别名]
def setup_binding_amber(args):
"""
Set up ligand binding free energy calculation using AMBER prmtop/inpcrd files.
Parameters
----------
args : dict
Command-line arguments dict from docopt.
Returns
-------
alchemical_phases : list of AlchemicalPhase
Phases (thermodynamic legs) of the calculation.
"""
verbose = args['--verbose']
setup_directory = args['--setupdir'] # Directory where prmtop/inpcrd files are to be found
system_parameters = {} # parameters to pass to prmtop.createSystem
# Implicit solvent
if args['--gbsa']:
system_parameters['implicitSolvent'] = getattr(app, args['--gbsa'])
# Select nonbonded treatment
if args['--nbmethod']:
system_parameters['nonbondedMethod'] = getattr(app, args['--nbmethod'])
# Constraints
if args['--constraints']:
system_parameters['constraints'] = getattr(app, args['--constraints'])
# Cutoff
if args['--cutoff']:
system_parameters['nonbondedCutoff'] = process_unit_bearing_arg(args, '--cutoff', unit.nanometers)
# Determine if this will be an explicit or implicit solvent simulation
if ('nonbondedMethod' in system_parameters and
system_parameters['nonbondedMethod'] != app.NoCutoff):
phases_names = ['complex-explicit', 'solvent-explicit']
protocols = [AbsoluteAlchemicalFactory.defaultComplexProtocolExplicit(),
AbsoluteAlchemicalFactory.defaultSolventProtocolExplicit()]
else:
phases_names = ['complex-implicit', 'solvent-implicit']
protocols = [AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit(),
AbsoluteAlchemicalFactory.defaultSolventProtocolImplicit()]
# Prepare Yank arguments
alchemical_phases = [None, None]
setup_directory = os.path.join(setup_directory, '') # add final slash character
system_files_paths = [[setup_directory + 'complex.inpcrd', setup_directory + 'complex.prmtop'],
[setup_directory + 'solvent.inpcrd', setup_directory + 'solvent.prmtop']]
for i, phase_name in enumerate(phases_names):
positions_file_path = system_files_paths[i][0]
topology_file_path = system_files_paths[i][1]
logger.info("Reading phase {}".format(phase_name))
alchemical_phases[i] = pipeline.prepare_phase(positions_file_path, topology_file_path, args['--ligand'],
system_parameters, verbose=verbose)
alchemical_phases[i].name = phase_name
alchemical_phases[i].protocol = protocols[i]
return alchemical_phases
示例3: range
# 需要导入模块: from alchemy import AbsoluteAlchemicalFactory [as 别名]
# 或者: from alchemy.AbsoluteAlchemicalFactory import defaultComplexProtocolImplicit [as 别名]
#!/usr/bin/env python
"""
Create alchemical intermediates for default alchemical protocol for p-xylene in T4 lysozyme L99A in GBSA.
"""
from alchemy import AbsoluteAlchemicalFactory
from openmmtools import testsystems
# Create a reference system.
print "Creating a reference T4 lysozyme L99A system..."
complex = testsystems.LysozymeImplicit()
[reference_system, positions] = [complex.system, complex.positions]
# Create a factory to produce alchemical intermediates.
print "Creating an alchemical factory..."
receptor_atoms = range(0,2603) # T4 lysozyme L99A
ligand_atoms = range(2603,2621) # p-xylene
factory = AbsoluteAlchemicalFactory(reference_system, ligand_atoms=ligand_atoms)
# Get the default protocol for 'denihilating' in complex in explicit solvent.
protocol = factory.defaultComplexProtocolImplicit()
# Create the perturbed systems using this protocol.
print "Creating a perturbed system..."
systems = factory.createPerturbedSystems(protocol)
print "Done."
示例4: __init__
# 需要导入模块: from alchemy import AbsoluteAlchemicalFactory [as 别名]
# 或者: from alchemy.AbsoluteAlchemicalFactory import defaultComplexProtocolImplicit [as 别名]
def __init__(self, store_directory, mpicomm=None, **kwargs):
"""
Initialize YANK object with default parameters.
Parameters
----------
store_directory : str
The storage directory in which output NetCDF files are read or written.
mpicomm : MPI communicator, optional
If an MPI communicator is passed, an MPI simulation will be attempted.
restraint_type : str, optional
Restraint type to add between protein and ligand. Supported types are
'flat-bottom' and 'harmonic'. The second one is available only in
implicit solvent (default: 'flat-bottom').
randomize_ligand : bool, optional
Randomize ligand position when True. Not available in explicit solvent
(default: False).
randomize_ligand_close_cutoff : simtk.unit.Quantity (units: length), optional
Cutoff for ligand position randomization (default: 1.5*unit.angstrom).
randomize_ligand_sigma_multiplier : float, optional
Multiplier for ligand position randomization displacement (default: 2.0).
mc_displacement_sigma : simtk.unit.Quantity (units: length), optional
Maximum displacement for Monte Carlo moves that augment Langevin dynamics
(default: 10.0*unit.angstrom).
Other Parameters
----------------
**kwargs
More options to pass to the ReplicaExchange or AlchemicalFactory classes
on initialization.
See Also
--------
ReplicaExchange.default_parameters : extra parameters accepted.
"""
# Copy kwargs to avoid modifications
parameters = copy.deepcopy(kwargs)
# Record that we are not yet initialized.
self._initialized = False
# Store output directory.
self._store_directory = store_directory
# Save MPI communicator
self._mpicomm = mpicomm
# Set internal variables.
self._phases = list()
self._store_filenames = dict()
# Default alchemical protocols.
self.default_protocols = dict()
self.default_protocols['vacuum'] = AbsoluteAlchemicalFactory.defaultVacuumProtocol()
self.default_protocols['solvent-implicit'] = AbsoluteAlchemicalFactory.defaultSolventProtocolImplicit()
self.default_protocols['complex-implicit'] = AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit()
self.default_protocols['solvent-explicit'] = AbsoluteAlchemicalFactory.defaultSolventProtocolExplicit()
self.default_protocols['complex-explicit'] = AbsoluteAlchemicalFactory.defaultComplexProtocolExplicit()
# Store Yank parameters
for option_name, default_value in self.default_parameters.items():
setattr(self, '_' + option_name, parameters.pop(option_name, default_value))
# Store repex parameters
self._repex_parameters = {par: parameters.pop(par) for par in
ModifiedHamiltonianExchange.default_parameters
if par in parameters}
# Store AlchemicalFactory parameters
self._alchemy_parameters = {par: parameters.pop(par) for par in
inspect.getargspec(AbsoluteAlchemicalFactory.__init__).args
if par in parameters}
# Check for unknown parameters
if len(parameters) > 0:
raise TypeError('got an unexpected keyword arguments {}'.format(
', '.join(parameters.keys())))
示例5: phases
# 需要导入模块: from alchemy import AbsoluteAlchemicalFactory [as 别名]
# 或者: from alchemy.AbsoluteAlchemicalFactory import defaultComplexProtocolImplicit [as 别名]
options['restraint_type'] = None
if not is_periodic:
options['restraint_type'] = 'harmonic'
# Turn off MC ligand displacement.
options['mc_displacement_sigma'] = None
# Prepare phases of calculation.
phase_prefixes = ['solvent', 'complex'] # list of calculation phases (thermodynamic legs) to set up
components = ['ligand', 'receptor', 'solvent'] # components of the binding system
phase_prefixes = ['complex'] # DEBUG, since 'solvent' doesn't work yet
if is_periodic:
protocols = {'complex': AbsoluteAlchemicalFactory.defaultComplexProtocolExplicit(),
'solvent': AbsoluteAlchemicalFactory.defaultSolventProtocolExplicit()}
else:
protocols = {'complex': AbsoluteAlchemicalFactory.defaultComplexProtocolImplicit(),
'solvent': AbsoluteAlchemicalFactory.defaultSolventProtocolImplicit()}
alchemical_phases = [] # alchemical phases of the calculations
for phase_prefix in phase_prefixes:
# Retain the whole system
if is_periodic:
phase_suffix = 'explicit'
else:
phase_suffix = 'implicit'
# Form phase name.
phase = '%s-%s' % (phase_prefix, phase_suffix)
logger.info("phase %s: " % phase)
# Determine selection phrase for atom subset to be used in this phase.
if phase_prefix == 'solvent':