schrodinger.application.epik.phlash.phlash module

Epik pHlash protonation backend.

A lightweight, hot (load-once) predictor for the single best pH 7.4 protonation (n_labile_H) model. The EpikX pKa featurizer and the GNN are loaded once when a Protonator instance is constructed and kept resident, so repeated batch calls pay the model-loading cost only once.

Typical use:

from schrodinger.application.epik.phlash import phlash

predictor = phlash.Protonator()      # loads pKa model + GNN once
out = predictor.protonate([...])  # SMILES or Mol in -> same type out

Inputs are protonated at pH 7.4 and returned as heavy-atom RDKit Mol objects (protonation encoded as formal charges and explicit hydrogen counts) or as canonical SMILES. A molecule with no ionizable sites, or one that fails featurization/prediction, is returned unchanged.

Importing this module is cheap: the heavy dependencies (torch, ligand_ml, torch_geometric) and the EpikX pKa predictor are imported lazily when a Protonator is constructed, not at module import, so the pure-RDKit helpers stay importable without those packages.

class schrodinger.application.epik.phlash.phlash.Protonator(*, batch_size=128, pka_model_path=None, mesomerize=False)

Bases: object

Hot protonation predictor for the single best pH 7.4 model.

Constructing an instance loads the EpikX pKa featurizer and the GNN once and keeps them resident. Call protonate repeatedly to amortize that cost.

__init__(*, batch_size=128, pka_model_path=None, mesomerize=False)
Parameters:
  • batch_size – molecules per GNN forward pass (e.g. 128 or 256)

  • pka_model_path – path to the EpikX pKa model package; defaults to the one shipped with the epik installation

  • mesomerize – when True, replace each protonated molecule with a canonical mesomer (Lewis structure) via schrodinger.rdkit.mesomerizer before returning it

protonate(molecules, output_type=None)

Protonate a collection of molecules at pH 7.4.

The input representation is auto-detected: a collection of SMILES strings or a collection of RDKit Mol objects (None entries allowed, passing through as None). By default the output is returned in the same representation as the input (SMILES -> SMILES, Mol -> Mol); pass output_type to force a representation, e.g. output_type="SMILES" returns SMILES regardless of the input type.

Parameters:
  • molecules – collection of SMILES strings or RDKit Mol objects (None entries allowed); the non-None entries must all be the same type

  • output_type – "SMILES" or "Mol" (case-insensitive) to force the output representation; None (default) matches the input

Returns:

parallel list of results in the requested representation

Raises:
  • TypeError – if the entries are neither str nor Mol, or mix the two

  • ValueError – if output_type is not "SMILES" or "Mol"

schrodinger.application.epik.phlash.phlash.protonate(molecules, output_type=None)

Protonate SMILES strings or RDKit Mol objects using a cached default Protonator instance. See Protonator.protonate.