energy
#
Train against relative energies and forces.
Classes:
-
Entry
–Represents a set of reference energies and forces.
Functions:
-
create_dataset
–Create a dataset from a list of existing entries.
-
extract_smiles
–Return a list of unique SMILES strings in the dataset.
-
predict
–Predict the relative energies [kcal/mol] and forces [kcal/mol/Å] of a dataset.
Entry
#
Bases: TypedDict
Represents a set of reference energies and forces.
Attributes:
-
smiles
(str
) –The indexed SMILES description of the molecule the energies and forces were
-
coords
(Tensor
) –The coordinates [Å] the energies and forces were evaluated at with
-
energy
(Tensor
) –The reference energies [kcal/mol] with
shape=(n_confs,)
. -
forces
(Tensor
) –The reference forces [kcal/mol/Å] with
shape=(n_confs, n_particles, 3)
.
smiles
instance-attribute
#
The indexed SMILES description of the molecule the energies and forces were computed for.
coords
instance-attribute
#
The coordinates [Å] the energies and forces were evaluated at with
shape=(n_confs, n_particles, 3)
.
forces
instance-attribute
#
The reference forces [kcal/mol/Å] with shape=(n_confs, n_particles, 3)
.
create_dataset
#
create_dataset(entries: list[Entry]) -> Dataset
Create a dataset from a list of existing entries.
Parameters:
-
entries
(list[Entry]
) –The entries to create the dataset from.
Returns:
-
Dataset
–The created dataset.
Source code in descent/targets/energy.py
extract_smiles
#
Return a list of unique SMILES strings in the dataset.
Parameters:
-
dataset
(Dataset
) –The dataset to extract the SMILES strings from.
Returns:
-
list[str]
–The list of unique SMILES strings.
Source code in descent/targets/energy.py
predict
#
predict(
dataset: Dataset,
force_field: TensorForceField,
topologies: dict[str, TensorTopology],
reference: Literal["mean", "min"] = "mean",
normalize: bool = True,
) -> tuple[Tensor, Tensor, Tensor, Tensor]
Predict the relative energies [kcal/mol] and forces [kcal/mol/Å] of a dataset.
Parameters:
-
dataset
(Dataset
) –The dataset to predict the energies and forces of.
-
force_field
(TensorForceField
) –The force field to use to predict the energies and forces.
-
topologies
(dict[str, TensorTopology]
) –The topologies of the molecules in the dataset. Each key should be a fully indexed SMILES string.
-
reference
(Literal['mean', 'min']
, default:'mean'
) –The reference energy to compute the relative energies with respect to. This should be either the "mean" energy of all conformers, or the energy of the conformer with the lowest reference energy ("min").
-
normalize
(bool
, default:True
) –Whether to scale the relative energies by
1/sqrt(n_confs_i)
and the forces by1/sqrt(n_confs_i * n_atoms_per_conf_i * 3)
This is useful when wanting to compute the MSE per entry.
Returns:
-
tuple[Tensor, Tensor, Tensor, Tensor]
–The predicted and reference relative energies [kcal/mol] with
shape=(n_confs,)
, and predicted and reference forces [kcal/mol/Å] withshape=(n_confs * n_atoms_per_conf, 3)
.
Source code in descent/targets/energy.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|