DP5 Analysis

class dp5.analysis.dp5.DP5(output_folder: Path, use_dft_shifts: bool)

Performs DP5 analysis

__init__(output_folder: Path, use_dft_shifts: bool)

Initialise the settings.

Parameters:
  • output_folder (Path) – path for saved DP5 data

  • use_dft_shifts (bool) – if set, analyses errors of DFT calculations, compares shifts againt their environments otherwise.

__call__(mols)

Runs DP5 calculations.

Parameters:

mols – Molecule objects

class dp5.analysis.dp5.DP5ProbabilityCalculator(atom_type)
__init__(atom_type)

Initialises DP5 Probability calculator for one atom.

Parameters:
  • atom_type (str) – atom symbol. Can be ‘C’ or ‘H’

  • model_file (str) – path for representation generating model to load.

  • batch_size (int) – batch size for the model.

  • transform_file (str) – Path to the Scikit-learn PCA file relative to dp5/analysis folder. Reduces dimensionality of the representation.

  • kde_file (str) – Path to scipy.stats.gaussian_kde or sklearn.neighbors.KernelDensity object. Estimates DP5 probabilities

  • dp5_correct_scaling (str). Path to scipy.stats.gaussian_kde or sklearn.neighbors.KernelDensity object. Estimates \(P(correct|structure)\) for rescaling. Default is None (no scaling)

  • dp5_incorrect_scaling (str). Path to scipy.stats.gaussian_kde or sklearn.neighbors.KernelDensity object. Estimates \(P(incorrect|structure)\) for rescaling. Default is None (no scaling)

__call__(mols)

Carries out DP5 analysis.

Parameters:

mols (list of Molecule) – dp5.run.data_structures.Molecule objects used in the calculation. Must contain shifts and labels for the provided atom.

Returns:

A tuple containing lists of labels of atoms used in the analysis, their calculated shifts, their experimental shifts, scaled errors, DP5 probabilities for each atom in each conformer, Boltzmann-weighted atom DP5 probabilites, and total molecular DP5 probabilities.

get_shifts_and_labels(mol)

Returns calculated and experimental shifts for nuclei in the molecule.

Parameters:
  • self.atom_type (str) – nuclei being analysed

  • mols (Molecule) – dp5.run.data_structures.Molecule. Must contain shifts and labels for the provided atom.

Returns:

calculated conformer shifts assigned experimental shifts 0-based indices of relevant atoms

Notes

DP5 analysis generates vector-based representations for each atom and compares them with reference representations using Kernel Density Estimation. It runs in two modes, denoted as Error and Experimental.

In the Error mode, for each conformer, the scaled errors of calculation shifts are concatenated with condensed atom representations and compared with scaled errors for Exp5K NMR data set. In the Experimental mode, the Boltzmann-weighted calculated shifts are compared directly with experimental data.