- class sire.morph.Perturbation(mol, map=None)#
This class provides lots of convenience functions that make it easier to work with an visualise perturbations
Return the modified molecule
Link all of the properties of the molecule to their values in the perturbed molecule (lambda=1).
If a list of properties is passed then only those properties will be linked to the perturbed molecule
properties (list[str]) – The list of properties to link to the perturbed molecule
Link all of the properties of the molecule to their values in the reference molecule (lambda=0).
If a list of properties is passed then only those properties will be linked to the reference molecule
properties (list[str]) – The list of properties to link to the reference molecule
- set_lambda(lam_val: float)#
Set the lambda value to the passed value
- view(*args, **kwargs)#
View the perturbation
- sire.morph.repartition_hydrogen_masses(mols, mass_factor=1.5, ignore_water: bool = False, ignore_non_water: bool = False, include_end_states: bool = True, map=None)#
Increase the mass of hydrogen atoms to hmass times * amu, and subtract the mass increase from the heavy atom the hydrogen is bonded to.
- (based heavily on the repartitionMasses function in
mass_factor (float) – The factor to multiply the mass of hydrogen atoms by. Using the default of 1.5 is known to be a good value to use to achieve a 4 fs timestep with the (default) LangevinMiddle integrator
ignore_water (bool) – Whether or not to ignore water molecules (default False)
ignore_non_water (bool) – Whether or not to ignore non-water molecules (default False)
include_end_states (bool) – Whether or not to repartition the masses of the end states of perturbable molecules (default True) (i.e. this will automatically repartition mass0 and mass1 in addition to mass)
map (dict) – The property map used to identify molecular properties
The repartitioned molecule(s)
- Return type:
- sire.morph.replica_exchange(replica0, replica1, rangenerator=None, rescale_velocities: bool = True)#
Perform a replica exchange move between the passed two replicas. This will be a Hamiltonian Replica Exchange, where the energies at the two λ-values of the replicas will be evaluated for both, and a Monte Carlo test applied to the difference of the difference of those energies to decide if the exchange should be accepted.
replica0 (sire.mol.Dynamics) – The dynamics object holding the first replica to exchange
replica1 (sire.mol.Dynamics) – The dynamics object holding the second replica to exchange
rangenerator (sire.maths.RanGenerator, optional) – A random number generator to use for the Monte Carlo test. This should return uniformly distributed random numbers between 0 and 1. If this is not specified, then the global random number generator will be used.
rescale_velocities (bool, optional) – If True, then the velocities of the replicas will be rescaled to the new temperature after the exchange.
The replicas, either swapped if the move was accepted, or in the same order if the move was rejected. Plus, a boolean to say if the move was or was not accepted.
- Return type:
(replica0, replica1, bool)
>>> from sire.morph import replica_exchange >>> replica0 = mols.dynamics(lambda_value=0.0, ...) >>> replica1 = mols.dynamics(lambda_value=0.2, ...) >>> replica0, replica1, accepted = replica_exchange(replica0, replica1)
- sire.morph.shrink_ghost_atoms(mols, length=None, map=None)#
Update all of the molecules (or single molecule) in ‘mols’ so that the bond lengths involving ghost atoms at one or other end state (but not both) are shrunk to length. This is 0.6 A by default (this seems to be a value that causes fewest NaNs).
- sire.morph.to_alchemlyb(energy_trajectories, temperature=None)#
Convert the passed list of energy trajectories into a single alchemlyb-compatible DataFrame, ready for free energy analysis via alchemlyb.
energy_trajectories (list of sire.maths.EnergyTrajectory objects,) –
- list of filenames of s3 files,
globbed expression for list of filenames etc.
A list of EnergyTrajectory objects, each containing the energy trajectory for a single simulation at a single lambda value.
temperature (temperature, optional) – The temperature of the simulation. If not provided, the temperature will be taken from the values in each EnergyTrajectory
A single DataFrame containing the energy trajectories from all simulations, ready for free energy analysis via alchemlyb.
- Return type: