pympfit.optimize

class pympfit.optimize._optimize.MPFITObjective[source]

Bases: Objective

Compute contributions to the MPFIT least squares objective function.

Contains helper functions for capturing the deviation of multipole moments computed using molecular partial charges from GDMA calculations.

classmethod compute_objective_terms(gdma_records: list[MoleculeGDMARecord], vsite_collection: VirtualSiteCollection | None = None, _vsite_charge_parameter_keys: list[Tuple[str, str, str, int]] | None = None, _vsite_coordinate_parameter_keys: list[Tuple[str, str, str, Literal['distance', 'in_plane_angle', 'out_of_plane_angle']]] | None = None, return_quse_masks: bool = False) Generator[tuple[MPFITObjectiveTerm, dict] | MPFITObjectiveTerm, None, None][source]

Pre-calculates the terms that contribute to the total objective function.

classmethod extract_arrays(gdma_record: MoleculeGDMARecord) dict[source]

Extract numerical arrays from a single GDMA record.

class pympfit.optimize._optimize.MPFITObjectiveTerm(atom_charge_design_matrix: ndarray | torch.Tensor | None, vsite_charge_assignment_matrix: ndarray | torch.Tensor | None, vsite_fixed_charges: ndarray | torch.Tensor | None, vsite_coord_assignment_matrix: ndarray | torch.Tensor | None, vsite_fixed_coords: ndarray | torch.Tensor | None, vsite_local_coordinate_frame: ndarray | torch.Tensor | None, grid_coordinates: ndarray | torch.Tensor | None, reference_values: ndarray | torch.Tensor)[source]

Bases: ObjectiveTerm

Store precalculated values for multipole moment fitting.

Computes the difference between a reference set of distributed multipole moments and a set computed using fixed partial charges. See the predict and loss functions for more details.