LibraryChargeGenerator

class openff.recharge.charges.library.LibraryChargeGenerator[source]

Bases: object

A class for generating the library charges which should be applied to a molecule.

Methods

__init__()

apply_assignment_matrix(assignment_matrix, ...)

Applies an assignment matrix to a list of bond charge corrections yield the final bond-charge corrections for a molecule.

build_assignment_matrix(molecule, ...)

Generates a matrix that specifies which library charge have been applied to which atoms in the molecule.

generate(molecule, charge_collection)

Generate a set of charge increments for a molecule.

__init__()
classmethod apply_assignment_matrix(assignment_matrix: ndarray, charge_collection: LibraryChargeCollection) ndarray[source]

Applies an assignment matrix to a list of bond charge corrections yield the final bond-charge corrections for a molecule.

Parameters
  • assignment_matrix – The library charge assignment matrix constructed using build_assignment_matrix which describes how the library charges should be applied. This should have shape=(n_atoms, n_library_charges)

  • charge_collection – The library charge parameters which may be assigned.

Return type

The library charges with shape=(n_atoms, 1).

classmethod build_assignment_matrix(molecule: Molecule, charge_collection: LibraryChargeCollection) ndarray[source]

Generates a matrix that specifies which library charge have been applied to which atoms in the molecule.

The matrix takes the form [atom_index, charge_index] where atom_index is the index of an atom in the molecule and charge_index is an index into a fully vectorized view of the charge collection.

Parameters
  • molecule – The molecule to assign the bond charge corrections to.

  • charge_collection – The library charge parameters that may be assigned.

Returns

  • The assignment matrix with shape=(n_atoms, n_library_charges)

  • where n_atoms is the number of atoms in the molecule and

  • n_library_charges is the total number of library charges.

classmethod generate(molecule: Molecule, charge_collection: LibraryChargeCollection) ndarray[source]

Generate a set of charge increments for a molecule.

Parameters
  • molecule – The molecule to generate the bond-charge corrections for.

  • charge_collection – The set of library charge parameters which may be assigned.

Returns

  • The library charges [e] that should be applied to the molecule with

  • shape=(n_atoms, 1).

classmethod build_assignment_matrix(molecule: Molecule, charge_collection: LibraryChargeCollection) ndarray[source]

Generates a matrix that specifies which library charge have been applied to which atoms in the molecule.

The matrix takes the form [atom_index, charge_index] where atom_index is the index of an atom in the molecule and charge_index is an index into a fully vectorized view of the charge collection.

Parameters
  • molecule – The molecule to assign the bond charge corrections to.

  • charge_collection – The library charge parameters that may be assigned.

Returns

  • The assignment matrix with shape=(n_atoms, n_library_charges)

  • where n_atoms is the number of atoms in the molecule and

  • n_library_charges is the total number of library charges.

classmethod apply_assignment_matrix(assignment_matrix: ndarray, charge_collection: LibraryChargeCollection) ndarray[source]

Applies an assignment matrix to a list of bond charge corrections yield the final bond-charge corrections for a molecule.

Parameters
  • assignment_matrix – The library charge assignment matrix constructed using build_assignment_matrix which describes how the library charges should be applied. This should have shape=(n_atoms, n_library_charges)

  • charge_collection – The library charge parameters which may be assigned.

Return type

The library charges with shape=(n_atoms, 1).

classmethod generate(molecule: Molecule, charge_collection: LibraryChargeCollection) ndarray[source]

Generate a set of charge increments for a molecule.

Parameters
  • molecule – The molecule to generate the bond-charge corrections for.

  • charge_collection – The set of library charge parameters which may be assigned.

Returns

  • The library charges [e] that should be applied to the molecule with

  • shape=(n_atoms, 1).