MDFactoryMDFactory

solvation

Solvation and ionization routines for MD simulation systems.

funcget_water_boxes(wbox, nx, ny, nz)

Generate a list of translated water box atom groups to form a larger box. The wbox universe should have its left bottom corner in [0, 0, 0].

Notes

  • Residue IDs are incremented to ensure uniqueness across copies.
paramwboxmda.Universe

The input water box as an MDAnalysis Universe object.

paramnxint

Number of repetitions along the x-axis.

paramnyint

Number of repetitions along the y-axis.

paramnzint

Number of repetitions along the z-axis.

Returns

list of mda.AtomGroup

List of AtomGroups, each corresponding to a translated copy of the water box.

funcsolvate(system, prune_in_z=False, remove_sphere=None)mda.Universe

Fill a rectangular simulation box with water and remove clashing molecules.

paramsystemmda.Universe

The solute system with box dimensions set. Must have a rectangular box (90-degree angles).

paramprune_in_zbool
= False

If True, remove water molecules whose z-coordinates fall between the lipid layer boundaries (offset by 10 A inward). Default is False.

paramremove_spheretuple of float or None
= None

If provided, a tuple (cx, cy, cz, r) specifying the center and radius of a sphere within which water molecules are removed.

Returns

MDAnalysis.Universe

Solvated system with clashing and out-of-bounds waters removed. Also written to solvated.pdb.

funcremove_clashes(in_box, selection='water')

Remove residues involved in inter-residue atomic clashes.

Find atom pairs within 0.5 A that belong to different residues in the given selection and remove both entire residues for each clashing pair.

paramin_boxmda.Universe

The system to check for clashes.

paramselectionstr
= 'water'

MDAnalysis selection string identifying atoms to check. Default is "water".

Returns

MDAnalysis.Universe

System with clashing residues removed, preserving box dimensions.

funcionize(u, num_na, num_cl, seed=None, min_distance=5.0)

Replace water molecules in a Universe with Na+ and Cl- ions.

This function randomly selects water molecules in the given MDAnalysis Universe and replaces them with sodium (Na+) and chloride (Cl-) ions, ensuring a minimum distance from non-water atoms. The replacement is performed by renaming the oxygen atom of the selected water residue and removing the hydrogen atoms. The resulting Universe contains the original atoms (except the removed hydrogens) and the newly created ions.

Notes

  • The function assumes that the Universe contains standard water residues and atom naming conventions.
paramumda.Universe

The MDAnalysis Universe containing the system to be ionized.

paramnum_naint

Number of sodium (Na+) ions to introduce.

paramnum_clint

Number of chloride (Cl-) ions to introduce.

paramseedint
= None

Random seed for reproducibility.

parammin_distancefloat
= 5.0

Minimum distance (in Å) from non-water atoms for water molecules to be considered for replacement. Default is 5.0 Å.

Returns

MDAnalysis.Universe

A new Universe object with the specified number of water molecules replaced by Na+ and Cl- ions.