BioSimSpace.Solvent.addIons¶
- BioSimSpace.Solvent.addIons(system, ion, num_ions=0, ion_conc=0, is_neutral=True, preserved_waters=None, counter_ion=None, work_dir=None, property_map={})[source]¶
Add ions to a pre-solvated molecular system using ‘gmx genion’.
Ions are added by replacing randomly selected water molecules (residue name SOL). The system must therefore already contain water.
- Parameters:
system (
System) – A pre-solvated molecular system.ion (str) – The name of the ion to add. Case-insensitive. Use
ions()for a list of supported values, e.g."mg","ca","cl".num_ions (int) – The number of ions to add. Mutually exclusive with
ion_conc.ion_conc (float) – The concentration of the requested ion in mol/litre. The number of ions to add is calculated from the box volume. This correctly accounts for the volume of all molecules already present in the system. Mutually exclusive with
num_ions. Note that any counter-ions added byis_neutral=Trueare not included in this concentration — their count is determined solely by the net system charge.is_neutral (bool) – Whether to neutralise the system charge. When
True, genion adds Na+ or Cl- (as appropriate) in addition to the requested ion to bring the total system charge to zero. Note that existing ions are never removed; neutralisation is achieved by adding counter-ions only. The number of counter-ions depends on the net system charge and is independent ofion_conc.preserved_waters ([int] or [
Molecule]) – A list of water molecules to preserve from replacement by genion. Each entry is either an integer (system-level molecule index) or aMoleculeobject. These molecules are temporarily removed from the system before genion runs and re-added to the result afterwards, guaranteeing that genion cannot select them for replacement. Useful for protecting crystallographic or binding-site water molecules.counter_ion (str) – The name of the ion to use for the opposite charge slot in the genion call. By default genion uses Na+ as the counter cation and Cl- as the counter anion. Use this parameter to override the counter-ion species, e.g.
"br"when adding a cation. The counter-ion must have the opposite charge sign toion. Requiresis_neutral=True(otherwise no counter-ions are added and the parameter has no effect).work_dir (str) – The working directory for the process.
property_map (dict) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g.
{ "charge" : "my-charge" }.
- Returns:
system – The molecular system with ions added.
- Return type: