MM_engines.resp module

Description

This module defines the ParaMol.MM_engines.resp.RESP class which is the ParaMol RESP engine.

class ParaMol.MM_engines.resp.RESP(total_charge, include_regularization, method, scaling_factor, hyperbolic_beta, weighting_method, weighting_temperature, **kwargs)

Bases: object

ParaMol’s RESP engine.

Parameters
  • total_charge (int) – Total charge of the system

  • include_regulatization (bool) – Flag that signal whether or not to include regularization.

  • method (str) – Type of regularization. Options are ‘L2’ or ‘hyperbolic’.

  • scaling_factor (float) – Scaling factor of the regularization value.

  • hyperbolic_beta (float) – Hyperbolic beta value. Only used if regularization_type is hyperbolic.

  • weighting_method (str) – Method used to weight the conformations. Available methods are “uniform, “boltzmann” and “manual”.

  • weighting_temperature (unit.simtk.Quantity) – Temperature used in the weighting. Only relevant if weighting_method is “boltzmann”.

Variables
  • charges (list of floats) – List with system’s charges.

  • initial_charges (list of floats) – List with initial system’s charges.

  • inv_rij (list of np.array) – (nconformations, natoms, n_esp_values) Inverse distances (1/rij) between the atomic centre j and the electrostatic point i for every every conformation of every system.

  • include_regulatization (bool) – Flag that signal whether or not to include regularization.

  • regularization_type (str) – Type of regularization. Options are ‘L2’ or ‘hyperbolic’.

  • scaling_factor (float) – Scaling factor of the regularization value.

  • hyperbolic_beta (float) – Hyperbolic beta value. Only used if regularization_type is hyperbolic.

  • weighting_method (str) – Method used to weight the conformations. Available methods are “uniform, “boltzmann” and “manual”.

  • weighting_temperature (unit.simtk.Quantity) – Temperature used in the weighting. Only relevant if weighting_method is “boltzmann”.

_calculate_a(system, initialize=False)

Method that calculates the auxiliary A matrix.

Notes

This is only necessary for the explicit solution case.

Parameters
  • system (ParaMol.System.system.ParaMolSystem) – ParaMol System.

  • initialize (bool) – Whether or not A has been already initialized previously. It is only necessary to compute non-diagonal elements when A is initialized.

Returns

A (np.array) – Array of the A matrix.

_calculate_b(system, initialize=False)

Method that calculates the auxiliary B matrix.

Notes

This is only necessary for the explicit solution case. \(B_j = \sum_{i} V_{i} / r_{ij} + q_{0j} + dX^2_{rstr}/dq_{j}\) Weighting is done as in AMBER. AMBER uses weigth**2 * (A-Aref)^2, ParaMol uses weigth * (A-Aref)^2

Parameters
Returns

B (np.array) – Array of the B matrix.

_calculate_regularization_derivative(at_idx, a=None, b=None)

Method that wraps private regularization derivatives methods in order to calculate the derivative of regularization term.

Parameters
  • at_idx (int) – Atom index.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

  • b (float, default=`None`) – Hyperbolic beta parameter. If not None, instance attribute self._hyperbolic_beta is ignored.

Returns

float – Regularization value.

_regularization_derivative_hyperbolic(at_idx, a, b)

Method that calculates the derivative of the hyperbolic regularization.

Parameters
  • at_idx (int) – Atom index.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

  • b (float, default=`None`) – Hyperbolic beta parameter. If not None, instance attribute self._hyperbolic_beta is ignored.

Notes

This is only necessary for the explicit solution case.

Returns

reg_deriv (float) – Value of the regularization derivative.

_regularization_derivative_l2(at_idx, a)

Method that calculates the derivative of the L2 regularization.

Parameters
  • at_idx (int) – Atom index.

  • a (float, default=`None`) – a parameter (scaling factor). If not None, instance attribute self._scaling_factor is ignored.

Notes

This is only necessary for the explicit solution case. This term differs from the AMBER by a factor of 2.

Returns

reg_deriv (float) – Value of the regularization derivative.

calculate_inverse_distances(system)

Method that calculates the inverse distances (1/rij) between the atomic centre j and the electrostatic point i for every every conformation of every system.

Notes

This will be used in the fitting procedure and should be calculated only once before any optimization.

Parameters

system (ParaMol.System.system.ParaMolSystem) – ParaMol System.

Returns

inv_rij (list of np.array) – (nconformations, natoms, n_esp_values) distance matrix (ragged if more than one structure)

fit_resp_charges_explicitly(system, rmsd_tol, max_iter)

Method that explicitly solves RESP equations

Parameters
  • system (ParaMol.System.system.ParaMolSystem) – ParaMol System.

  • rmsd_tol (float) – RMSD convergence tolerance. Only used if solver is “explicit” (default is 1e-8).

  • max_iter (int) – Maximum number of iterations. Only used if solver is “explicit” (default is 10000).

Returns

charges (list of float) – List with system’s charges.

set_charges(force_field)

Method that sets the charges attribute by constructing a list with the current ParaMol Force Field charges.

Parameters

force_field (ParaMol.Force_field.force_field.ForceField) – ParaMol Force Field.

Returns

charges (list of float) – List with system’s charges.

set_initial_charges(force_field)

Method that sets the charges_initial attribute by constructing a list with the current ParaMol Force Field charges.

Parameters

force_field (ParaMol.Force_field.force_field.ForceField) – ParaMol Force Field.

Returns

charges (list of float) – List with system’s charges.

set_symmetry_constraints(system, symmetry_constrained)

Method that sets symmetry constraints.

Notes

This is only necessary for the explicit solution case.

Parameters
Returns

charges (list of list of int) – List of lists, wherein the inner lists contain symmetric-equivalent pairs of atoms.