# Module MMTK.ChargeFit

This module implements a numerically stable method (based on Singular Value Decomposition) to fit point charges to values of an electrostatic potential surface. Two types of constraints are avaiable: a constraint on the total charge of the system or a subset of the system, and constraints that force the charges of several atoms to be equal. There is also a utility function that selects suitable evaluation points for the electrostatic potential surface. For the potential evaluation itself, some quantum chemistry program is needed.

The charge fitting method is described in [Hinsen1997]. See also Miscellaneous/charge_fit.py.

## Functions

- evaluationPoints()

  Returns a list of n points suitable for the evaluation of the electrostatic potential around object. The points are chosen at random and uniformly in a shell around the object such that no point has a distance larger than largest from any atom or smaller than smallest from any non-hydrogen atom.

## Class ChargeFit: Fit of point charges to an electrostatic potential surface

Constructor: ChargeFit(system, points, constraints=None)

system

  any chemical object, usually a molecule

points

  a list of point/potential pairs (a vector for the evaluation point, a number for the potential), or a dictionary whose keys are Configuration objects and whose values are lists of point/potential pairs. The latter case permits combined fits for several conformations of the system.

constraints

  a list of constraint objects (TotalChargeConstraint and/or EqualityConstraint objects). If the constraints are inconsistent, a warning is printed and the result will satisfy the constraints only in a least-squares sense.

A ChargeFit object acts like a dictionary that stores the fitted charge value for each atom in the system.

## Class TotalChargeConstraint: Constraint on the total system charge

To be used with MMTK.ChargeFit.ChargeFit.

Constructor: TotalChargeConstraint(object, charge)

object

  any object whose total charge is to be constrained

charge

  the total charge value

## Class EqualityConstraint: Constraint forcing two charges to be equal

To be used with MMTK.ChargeFit.ChargeFit.

Constructor: EqualityConstraint(atom1, atom2), where atom1 and atom2 are the two atoms whose charges should be equal.

Any atom may occur in more than one EqualityConstraint object, in order to keep the charges of more than two atoms equal.