openff.recharge.charges.library.LibraryChargeParameter

model openff.recharge.charges.library.LibraryChargeParameter[source]

Bases: BaseModel

An object which encodes the values of a set of charges applied to each atom in a molecule.

Fields
field smiles: openff.recharge.charges.library.ConstrainedStrValue [Required]

An indexed SMILES pattern that encodes and labels the full molecule that the charges should be applied to. Each index should correspond to a value in the value field. Multiple atoms can be assigned the same index in order to indicate that they should have equivalent charges.

Constraints
  • minLength = 1

field value: List[float] [Required]

The values [e] of the charges.

field provenance: Optional[Dict[str, Any]] = None

Provenance information about this parameter.

copy_value_from_other(other: LibraryChargeParameter)[source]

Assigns this parameters value from another library charge parameter.

Notes

  • This function requires that both parameters should be applied to the exact same molecule.

  • If multiple values in the other parameter map to a single value in this parameter than the average value will be used.

generate_constraint_matrix(trainable_indices: Optional[List[int]] = None) Tuple[ndarray, ndarray][source]

Returns a matrix that when applied to value will yield the total charge on the molecule, as well as the value of the expected total charge.

Parameters

trainable_indices – An optional list of indices into value that describe which parameters are currently being trained.

Returns

  • The constraint matrix with shape=(1, n_values) as well as an array

  • containing the expected total charge (or the total charge minus the sum of

  • any fixed charges if trainable_indices is specified``). n_values will

  • be equal to the length of trainable_indices if provided, or otherwise to

  • the length of self.value.