Public API¶
- class sire.system.System(system=None)[source]¶
This class holds a complete system of molecules. This is normally created by reading in molecules from an input file.
This provides a “MoleculeView”-style interface to the molecules, acting very similarly to a sire.mol.SelectorMol object.
You can convert this to a sire.mol.SelectorMol object by calling the System.molecules() function.
- add(molecules)[source]¶
Add the passed molecules to this system. This will only add molecules that don’t already exist in this system.
Add the shared System property called ‘name’ to this system. If ‘value’ is supplied, then this also sets the property too.
- angles(*args, **kwargs)[source]¶
Return all angles in this System (or those that match the passed index, if supplied)
- apply(*args, **kwargs)[source]¶
Apply (perform / map) the passed function (with associated arguments) on all of the molecules in this System
- apply_reduce(*args, **kwargs)[source]¶
Apply (perform / map) the passed function (with associated arguments) on all of the molecules in this System, reducing the result using the passed reduction function
- atoms(*args, **kwargs)[source]¶
Return all atoms in this System (or those that match the passed index, if supplied)
- bonds(*args, **kwargs)[source]¶
Return all bonds in this System (or those that match the passed index, if supplied)
- chains(*args, **kwargs)[source]¶
Return all chains in this System (or those that match the passed index, if supplied)
- charge(*args, **kwargs)[source]¶
Return the total charge of this System (or of the matching index/search subset of this System)
- coordinates(*args, **kwargs)[source]¶
Return the center of geometry of this System (or of the matching index/search subset of this System)
- dihedrals(*args, **kwargs)[source]¶
Return all dihedrals in this System (or those that match the passed index, if supplied)
- dynamics(*args, **kwargs)[source]¶
Return a Dynamics object that can be used to perform dynamics on the molecule(s) in this System
- cutoff: Length
The size of the non-bonded cutoff
- cutoff_type: str
The type of cutoff to use, e.g. “PME”, “RF” etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options
- timestep: time
The size of the dynamics timestep
- save_frequency: time
The amount of simulation time between saving energies and frames. This can be overridden using energy_frequency or frame_frequency, or by these options in individual dynamics runs. Set this to zero if you don’t want any saves.
- energy_frequency: time
The amount of time between saving energies. This overrides the value in save_frequency. Set this to zero if you don’t want to save energies during the trajectory. This can be overridden by setting energy_frequency during an individual run.
- frame_frequency: time
The amount of time between saving frames. This overrides the value in save_frequency. Set this to zero if you don’t want to save frames during the trajectory. This can be overridden by setting frame_frequency during an individual run.
- save_velocities: bool
Whether or not to save velocities when saving trajectory frames during the simulation. This defaults to False, as velocity trajectories aren’t often needed, and they double the amount of space that is required for a trajectory.
- constraint: str
The type of constraint to use for bonds and/or angles, e.g. h-bonds,
bonds
etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options. This will be automatically guessed from the timestep if it isn’t set.- perturbable_constraint: str
The type of constraint to use for perturbable bonds and/or angles, e.g. h-bonds,
bonds
etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options. This equal the value ofconstraint
if it isn’t set.- include_constrained_energies: bool
Whether or not to include the energies of the perturbable bonds and angles. If this is False, then the internal bond or angle energy of the perturbable degrees of freedom are not included in the total energy, and their forces are not evaluated.
- schedule: sire.cas.LambdaSchedule
The schedule used to control how perturbable forcefield parameters should be morphed as a function of lambda. If this is not set then a sire.cas.LambdaSchedule.standard_morph() is used.
- lambda_value: float
The value of lambda at which to run dynamics. This only impacts perturbable molecules, whose forcefield parameters will be scaled according to the lambda schedule for the specified value of lambda.
- swap_end_states: bool
Whether or not to swap the end states. If this is True, then the perturbation will run from the perturbed back to the reference molecule (the perturbed molecule will be at lambda=0, while the reference molecule will be at lambda=1). This will use the coordinates of the perturbed molecule as the starting point.
- ignore_perturbations: bool
Whether or not to ignore perturbations. If this is True, then the perturbation will be ignored, and the simulation will be run using the properties of the reference molecule (or the perturbed molecule if swap_end_states is True). This is useful if you just want to run standard molecular dynamics of the reference or perturbed states.
- integrator: str
The type of integrator to use, e.g. langevin, verlet etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options. This will be automatically set to langevin_middle (NVT/NPT) or verlet (NVE) depending on the ensemble if this is not set (or is set to auto)
- temperature: temperature
The temperature at which to run the simulation. A microcanonical (NVE) simulation will be run if you don’t specify the temperature.
- pressure: pressure
The pressure at which to run the simulation. A microcanonical (NVE) or canonical (NVT) simulation will be run if the pressure is not set.
- vacuum: bool
Whether or not to run the simulation in vacuum. If this is set to True, then the simulation space automatically be replaced by a
sire.vol.Cartesian
space, and the simulation run in vacuum.- shift_coulomb: length
The shift_coulomb parameter that controls the electrostatic softening potential that smooths the creation and deletion of ghost atoms during a potential. This defaults to 1.0 A.
- shift_delta: length
The shift_delta parameter that controls the electrostatic and van der Waals softening potential that smooths the creation and deletion of ghost atoms during a potential. This defaults to 2.0 A.
- coulomb_power: int
The coulomb power parmeter that controls the electrostatic softening potential that smooths the creation and deletion of ghost atoms during a potential. This defaults to 0.
- restraints: sire.mm.Restraints or list[sire.mm.Restraints]
A single set of restraints, or a list of sets of restraints that will be applied to the atoms during the simulation.
- fixed: molecule(s) view, search string, int, list[int] etc
Anything that can be used to identify the atom or atoms that should be fixed in place during the simulation. These atoms will not be moved by dynamics.
- qm_engine:
A sire.qm.QMMMEngine object to used to compute QM/MM forces and energies on a subset of the atoms in the system.
- lambda_interpolate: float
The lambda value at which to interpolate the QM/MM forces and energies, which can be used to perform end-state correction simulations. A value of 1.0 is full QM, whereas a value of 0.0 is full MM. If two values are specified, then lambda will be linearly interpolated between the two values over the course of the simulation, which lambda updated at the energy_frequency.
- platform: str
The name of the OpenMM platform on which to run the dynamics, e.g. “CUDA”, “OpenCL”, “Metal” etc.
- device: str or int
The ID of the GPU (or accelerator) used to accelerate the simulation. This would be CUDA_DEVICE_ID or similar if CUDA was used. This can be any valid OpenMM device string
- precision: str
The desired precision for the simulation (e.g. single, mixed or double)
- com_reset_frequency:
Either the number of steps between center-of-mass resets, or the time between resets. If this is unset, then the center-of-mass is not reset during the simulation.
- barostat_frequency:
Either the number of steps between MC moves to apply the barostat, of the time between moves. If this is unset, then the default of every 25 steps is used.
- dynamic_constraints: bool
Whether or not to update the length of constraints of perturbable bonds with lambda. This defaults to True, meaning that changing lambda will change any constraint on a perturbable bond to equal to the value of r0 at that lambda value. If this is false, then the constraint is set based on the current length.
- map: dict
A dictionary of additional options. Note that any options set in this dictionary that are also specified via one of the arguments above will be overridden by the argument value
- energies(*args, **kwargs)[source]¶
Calculate and return the individual energies of the contents of this System (or of the matching index/search subset of this System)
- energy(*args, **kwargs)[source]¶
Calculate and return the energy of this System (or of the matching index/search subset of this System)
- energy_trajectory(to_pandas: bool = False, to_alchemlyb: bool = False, energy_unit: str = 'kcal/mol', map=None)[source]¶
Return the energy trajectory for this System. This is the history of energies evaluate during any dynamics runs. It could include energies calculated at different values of lambda.
- Parameters:
to_pandas (bool) – Whether or not to return the energy trajectory as a pandas DataFrame.
to_alchemlyb (bool) – Whether or not to return the energy trajectory as a pandas DataFrame that is formatted to usable in alchemlyb
energy_unit (str) – Whichever of the alchemlyb energy units you want the output DataFrame to use. This is in alchemlyb format, e.g. kcal/mol, kJ/mol, or kT. This is only used if to_alchemlyb is True.
- ensemble(map=None)[source]¶
Return the last ensemble that was used to simulate this system. This returns a microcanonical ensemble if None was used
- evaluate(*args, **kwargs)[source]¶
Return an evaluator for this Systme (or of the matching index/search subset of this System)
- has_metadata(key)[source]¶
Return whether or not this System has metadata associated with the requested key
- impropers(*args, **kwargs)[source]¶
Return all impropers in this System (or those that match the passed index, if supplied)
- static is_system(obj)[source]¶
Return whether the passed object is a System class (either a new or legacy System)
- make_whole(center=None, map=None)[source]¶
Make all of the molecules in this system whole. This maps each molecule into the current space, such that no molecule is broken across a periodic box boundary
- mass(*args, **kwargs)[source]¶
Return the total mass of this System (or of the matching index/search subset of this System)
- metadata(key: str = None)[source]¶
Return the metadata associated with the passed ‘key’, or all metadata if ‘key’ is None. This returns None if there is no metadata associated with this key, or no metadata has been set
- metadata_keys()[source]¶
Return the keys of all metadata set in this System This returns an empty list if no metadata has been set
- minimisation(*args, **kwargs)[source]¶
Return a Minimisation object that can be used to perform minimisation of the molecule(s) in this System
- cutoff: Length
The size of the non-bonded cutoff
- cutoff_type: str
The type of cutoff to use, e.g. “PME”, “RF” etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options
- constraint: str
The type of constraint to use for bonds and/or angles, e.g. h-bonds,
bonds
etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options. This will be none if it hasn’t been set.- perturbable_constraint: str
The type of constraint to use for perturbable bonds and/or angles, e.g. h-bonds,
bonds
etc. See https://sire.openbiosim.org/cheatsheet/openmm.html#choosing-options for the full list of options. This equal the value ofconstraint
if it isn’t set.- include_constrained_energies: bool
Whether or not to include the energies of the perturbable bonds and angles. If this is False, then the internal bond or angle energy of the perturbable degrees of freedom are not included in the total energy, and their forces are not evaluated.
- schedule: sire.cas.LambdaSchedule
The schedule used to control how perturbable forcefield parameters should be morphed as a function of lambda. If this is not set then a sire.cas.LambdaSchedule.standard_morph() is used.
- lambda_value: float
The value of lambda at which to run minimisation. This only impacts perturbable molecules, whose forcefield parameters will be scaled according to the lambda schedule for the specified value of lambda.
- swap_end_states: bool
Whether or not to swap the end states. If this is True, then the perturbation will run from the perturbed back to the reference molecule (the perturbed molecule will be at lambda=0, while the reference molecule will be at lambda=1). This will use the coordinates of the perturbed molecule as the starting point.
- ignore_perturbations: bool
Whether or not to ignore perturbations. If this is True, then the perturbation will be ignored, and the simulation will be run using the properties of the reference molecule (or the perturbed molecule if swap_end_states is True). This is useful if you just want to run standard molecular dynamics of the reference or perturbed states.
- shift_coulomb: length
The shift_coulomb parameter that controls the electrostatic softening potential that smooths the creation and deletion of ghost atoms during a potential. This defaults to 1.0 A.
- shift_delta: length
The shift_delta parameter that controls the electrostatic and van der Waals softening potential that smooths the creation and deletion of ghost atoms during a potential. This defaults to 2.0 A.
- coulomb_power: int
The coulomb power parmeter that controls the electrostatic softening potential that smooths the creation and deletion of ghost atoms during a potential. This defaults to 0.
- vacuum: bool
Whether or not to run the simulation in vacuum. If this is set to True, then the simulation space automatically be replaced by a
sire.vol.Cartesian
space, and the simulation run in vacuum.- restraints: sire.mm.Restraints or list[sire.mm.Restraints]
A single set of restraints, or a list of sets of restraints that will be applied to the atoms during the simulation.
- fixed: molecule(s) view, search string, int, list[int] etc
Anything that can be used to identify the atom or atoms that should be fixed in place during the simulation. These atoms will not be moved by minimisation.
- platform: str
The name of the OpenMM platform on which to run the dynamics, e.g. “CUDA”, “OpenCL”, “Metal” etc.
- device: str or int
The ID of the GPU (or accelerator) used to accelerate minimisation. This would be CUDA_DEVICE_ID or similar if CUDA was used. This can be any valid OpenMM device string
- dynamic_constraints: bool
Whether or not to update the length of constraints of perturbable bonds with lambda. This defaults to True, meaning that changing lambda will change any constraint on a perturbable bond to equal to the value of r0 at that lambda value. If this is false, then the constraint is set based on the current length.
- map: dict
A dictionary of additional options. Note that any options set in this dictionary that are also specified via one of the arguments above will be overridden by the argument value
- molecules(*args, **kwargs)[source]¶
Return this System converted to a sire.mol.SelectorMol. You can pass in arguments to search or index so that you limit the number of molecules returned.
Completely remove all shared properties, and set no properties as being shared from this system
Completely remove the specified shared property, and set this as a non-shared property for the future
- residues(*args, **kwargs)[source]¶
Return all residues in this System (or those that match the passed index, if supplied)
- save_frame(i=None, map=None)[source]¶
Save the current coordinates to the ith frame of this System. If i is not specfied then this adds the frame onto the end of the trajectory
- segments(*args, **kwargs)[source]¶
Return all segments in this System (or those that match the passed index, if supplied)
- set_ensemble(ensemble, map=None)[source]¶
Set the ensemble that was last used to simulate this system. This is copied into the map[“ensemble”] property
- set_metadata(key, value)[source]¶
Set the metadata for this System so that the metadata associated with the key ‘key’ is equal to ‘value’
Set the shared System property according to the passed arguments
- set_space(space, map=None)[source]¶
Set the space to be used to hold all of the molecules in this system
Return all of the System properties that are being shared (copied) to all contained molecules
- smarts(*args, **kwargs)[source]¶
Return the molecule views in this container as smarts strings. Include hydrogens in ‘include_hydrogens’ is True. This returns a list of smarts strings, in the same order as the views in the container
- smiles(*args, **kwargs)[source]¶
Return the molecule views in this container as smiles strings. Include hydrogens in ‘include_hydrogens’ is True. This returns a list of smiles strings, in the same order as the views in the container
- trajectory(*args, **kwargs)[source]¶
Return an iterator over the trajectory of frames of this view.
- align:
Pass in a selection string to select atoms against which every frame will be aligned. These atoms will be moved to the center of the periodic box (if a periodic box is used). If “True” is passed, then this will attempt to align ALL of the coordinates in the view.
You can also choose to pass in a molecular container, and it will align against the atoms in that container, assuming they are contained in this view. If not, then you need to supply a mapping that maps from the atoms in the align container, to the atoms in this view.
- frame:
The frame of the trajectory against which the alignment should be based. For example, frame=3 would align based on the coordinates of the aligned atoms in frame 3 of the trajectory. If this is None (the default) then the first frame will be used.
- mapping: AtomMapping
An AtomMapping object that maps from atoms in the alignment container to atoms in this view. You only need to supply this if all of the alignment atoms are not contained in this view.
- smooth:
Pass in the number of frames to smooth (average) the view over. If ‘True’ is passed, then the recommended number of frames will be averaged over
- wrap: bool
Whether or not to wrap the coordinates into the periodic box
- update(molecules)[source]¶
Update the molecules in this system so that they have the same versions and data as the new molecules contained in ‘value’