molsysmt.build.solvate#

molsysmt.build.solvate(molecular_system, box_shape='truncated octahedral', clearance='14.0 angstroms', anion='Cl-', n_anions='neutralize', cation='Na+', n_cations='neutralize', ionic_strength='0.0 molar', water_model='TIP3P', engine='OpenMM', to_form=None, verbose=False)[source]#

Solvate a molecular system by surrounding it with explicit water molecules and ions.

This function places the molecular system inside a solvent box of the chosen geometry, fills it with explicit water molecules of the selected model, and optionally adds counterions to neutralise the system charge and/or reach a target ionic strength.

Parameters:
  • molecular_system (molecular system) – Molecular system in any supported MolSysMT format. The system must contain exactly one structure. Select one structure first with structure_indices when the input is an ensemble or trajectory.

  • box_shape (object, default='truncated octahedral') – Argument box_shape.

  • clearance (object, default='14.0 angstroms') – Argument clearance.

  • anion (object, default='Cl-') – Argument anion.

  • n_anions (object, default='neutralize') – Argument n_anions.

  • cation (object, default='Na+') – Argument cation.

  • n_cations (object, default='neutralize') – Argument n_cations.

  • ionic_strength (object, default='0.0 molar') – Argument ionic_strength.

  • water_model (str, default='TIP3P') – Water model parameter identifier (e.g., ‘TIP3P’).

  • engine (object, default='OpenMM') – Argument engine.

  • to_form (object, default=None) – Argument to_form.

  • verbose (object, default=False) – Argument verbose.

Returns:

A new solvated molecular system in the form specified by to_form (or in the same form as the input). Component, molecule, and chain metadata from the original system are preserved and entity labels are rebuilt.

Return type:

molecular system

Raises:
  • ArgumentError – Raised if molecular_system contains more than one structure.

  • NotImplementedError – Raised if the requested engine or water_model is not supported.

Examples

Selecting one structure from an ensemble before solvation:

>>> import molsysmt as msm
>>> ensemble = msm.systems['Trp-Cage']['1l2y.h5msm']
>>> molsys = msm.convert(
...     ensemble, to_form='molsysmt.MolSys', structure_indices=0
... )
>>> msm.get(molsys, n_structures=True)
1

Notes

After solvation, water molecules and ions are automatically assigned to a new chain by assign_selection_to_new_chain. Atom and residue IDs in the output topology are renumbered sequentially to work around a known OpenMM bug.

The forcefield used for solvation is read from the molecular system when available; otherwise the MolSysMT default forcefield is used.

Added in version 1.0.0.