A short recipe for calculating and rescaling ligand charges.


get_lig_charge(ligand, desired_charge[, ...])

Calculate and rescale the ligand charges using MATCH.

API, desired_charge, ligand_idx=None, invert_idx=False, settings=None, path=None, folder=None)[source]

Calculate and rescale the ligand charges using MATCH.

The atomic charges in ligand_idx wil be altered such that the molecular charge of ligand is equal to desired_charge.


>>> import pandas as pd
>>> from scm.plams import Molecule

>>> from import get_lig_charge

>>> ligand = Molecule(...)
>>> desired_charge = 0.66
>>> ligand_idx = 0, 1, 2, 3, 4

>>> charge_series: pd.Series = get_lig_charge(
...     ligand, desired_charge, ligand_idx
... )

>>> charge_series.sum() == desired_charge
  • ligand (Molecule) – The input ligand.

  • desired_charge (float) – The desired molecular charge of the ligand.

  • ligand_idx (int or Iterable [int], optional) – An integer or iterable of integers representing atomic indices. The charges of these atoms will be rescaled; all others will be frozen with respect to the MATCH output. Setting this value to None means that all atomic charges are considered variable. Indices should be 0-based.

  • invert_idx (bool) – If True invert ligand_idx, i.e. all atoms specified therein are now threated as constants and the rest as variables, rather than the other way around.

  • settings (Settings, optional) – The input settings for MatchJob. Will default to the "top_all36_cgenff_new" forcefield if not specified.

  • path (str or PathLike, optional) – The path to the PLAMS workdir as passed to init(). Will default to the current working directory if None.

  • folder (str or PathLike, optional) – The name of the to-be created to the PLAMS working directory as passed to init(). Will default to "plams_workdir" if None.


A Series with the atom types of ligand as keys and atomic charges as values.

Return type:

pd.Series [str, float]

See also



class:~scm.plams.core.basejob.Job subclass for interfacing with MATCH: Multipurpose Atom-Typer for CHARMM.