htmd.builder.ionize module#

htmd.builder.ionize.ionize(mol, netcharge, nwater, neutralize=True, saltconc=None, cation=None, anion=None, ff=None)#
htmd.builder.ionize.ionizePlace(solvent_mol, solute_mol, anion_resname, cation_resname, anion_name, cation_name, nanion, ncation, dfrom=5, dbetween=5, segname=None)#

Place a given number of negative and positive ions in the solvent.

Uses farthest point sampling to produce well-spaced ion positions and randomly assigns ion types for uniform spatial mixing. Replaces water molecules as long as they respect the given distance criteria.

Parameters:
  • solvent_mol (Molecule object) – The solvent (water) molecule

  • solute_mol (Molecule object or None) – The solute molecule used for minimum-distance filtering. If None or empty, no minimum distance from solute is enforced.

  • anion_resname (str) – Resname of the added anions

  • cation_resname (str) – Resname of the added cations

  • anion_name (str) – Name of the added anions

  • cation_name (str) – Name of the added cations

  • nanion (int) – Number of anions to add

  • ncation (int) – Number of cations to add

  • dfrom (float) – Min distance of ions from solute molecule

  • dbetween (float) – Min distance between ions

  • segname (str) – Segment name to add

Returns:

mol – The solvent molecule with ions replacing some water molecules

Return type:

Molecule object