protex.system.ProtexSystem
- class protex.system.ProtexSystem(simulation: Simulation, templates: ProtexTemplates, simulation_for_parameters: Simulation | None = None, fast: bool = True)[source]
Bases:
object
Defines 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.
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.
Write a new psf file, which reflects the occured transfer events and changed residues to load the written psf create a new ionic_liquid instance and load the new psf via OpenMM.
Attributes
COVERED_FORCES
IGNORED_FORCES
UNCOVERED_FORCES
- dump(fname: str) None [source]
Pickle the current ProtexSystem object.
- Parameters:
fname (str) – The file name to store the object
- 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 = 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
- save_updates(file) None [source]
Save the current update values into a yaml file. Used to have the current probability values.
- Parameters:
file (string or file)
- update_context(name: str)[source]
Update the context for the given force.
- Parameters:
name (str) – The name of the force to update
- write_psf(old_psf_infname: str, new_psf_outfname: str, psf_for_parameters: str | None = None) None [source]
Write a new psf file, which reflects the occured transfer events and changed residues to load the written psf create a new ionic_liquid instance and load the new psf via OpenMM.
- Parameters:
old_psf_infname – Name of the old psf_file, which serves for the basic strucutre, same number of atoms, same bonds, angles, …
new_psf_outfname – Name of the new psf that will be written
psf_for_parameters – Optional psf file which contains all possible molecules/states, if they are not represented by the old_psf_infname. I.e. one species gets protonated and is not present anymore, this file can be used to have all potential states.
- Return type:
None