protex.system.ProtexSystem
- class protex.system.ProtexSystem(simulation: Simulation, templates: ProtexTemplates, simulation_for_parameters: Simulation = None, fast: bool = True)[source]
Bases:
objectDefines the full system, performs the MD steps and offers an interface for protonation state updates.
- Parameters:
simulation – the OpenMM simulation object
templates – An instance of the IonicLiquidTemplates class
simulation_for_parameters – another OpenMM simulation object, set up with a psf that contains all possible forms (protonated and deprotonated) of all species, needed for finding the parameters of the other form during an update
fast – If True indices list for all forces for each residue will be made once at initilaizaiton of ProtexSystem, and then used for finding the indices during an update. If False, the whole forces.getNumExceptions and similar calls will be used for each update and each residue, which is way slower
Methods
Pickle the current ProtexSystem object.
Check if the given force name is covered (or ignored by design) by protex.
Get a dictionary with the resname and the current number of residues belonging to that name.
Load pickled protex system.
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
Load the current update values from a yaml file, which was generated using "save_updates".
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
Save the current update values into a yaml file.
Update the context for the given force.
Attributes
COVERED_FORCESIGNORED_FORCESUNCOVERED_FORCES- dump(fname: str) None[source]
Pickle the current ProtexSystem object.
- Parameters:
fname (str) – The file name to store the object
- classmethod force_is_valid(name: str) bool[source]
Check if the given force name is covered (or ignored by design) by protex.
- Parameters:
name (str) – The name of the force.
- Returns:
True if force is in COVERED_FORCES, IGNORED_FORCES or UNCOVERED_FORCES.
- Return type:
bool
- Raises:
warning – If force is in UNCOVERED_FORCES.
ProtexException – If force is neither in COVERED_FORCES, IGNORED_FORCES nor UNCOVERED_FORCES.
- get_current_number_of_each_residue_type() dict[str, int][source]
Get a dictionary with the resname and the current number of residues belonging to that name.
- Returns:
resname: number of residues
- Return type:
dict[str, int]
- static load(fname: str, simulation: Simulation, simulation_for_parameters: Simulation = None) ProtexSystem[source]
Load pickled protex system.
- Parameters:
fname (str) – The file name to load
simulation (openmm.app.simulation.Simulation) – An already generated OpenMM simulation object, needed to initialize the ProtesSystem instance
simulation_for_parameters (openmm.app.simulation.Simulation, optional) – An OpenMM simulation object, which contains all possible residues needed if the simulation object does not contain all possible residues, by default None
- Returns:
A new instance of the ProtexSystem
- Return type:
- loadCheckpoint(file) None[source]
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
- Parameters:
file (string or file) – a File-like object to load the checkpoint from, or alternatively a filename
- loadState(file) None[source]
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
- Parameters:
file (string or file) – a File-like object to load the state from, or alternatively a filename
- load_updates(file) None[source]
Load the current update values from a yaml file, which was generated using “save_updates”.
- Parameters:
file (string or file)
- saveCheckpoint(file) None[source]
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
- Parameters:
file (string or file) – a File-like object to write the checkpoint to, or alternatively a filename
- saveState(file) None[source]
Wrapper method which just calls the underlying same function on the simulation object of the ionic liquid object.
- Parameters:
file (string or file) – a File-like object to write the state to, or alternatively a filename