Tasks.parametrization module¶
Description¶
This module defines the ParaMol.Tasks.parametrization.Parametrization class, which is a ParaMol task that performs force field parametrization.
-
class
ParaMol.Tasks.parametrization.Parametrization¶ Bases:
ParaMol.Tasks.task.TaskParaMol parametrization task.
-
_apply_charge_correction(system)¶ Method that applies charge correction to the system.
- Parameters
system (
ParaMol.System.system.ParaMolSystem) – Instance of ParaMol System.
Notes
Due to numerical errors, the numerical total charge of the system may not be equal to the real total charge of the system. Hence, in order to overcome this problem, which causes unexpected behaviour specially when constraints are being applied, the excess or deficiency of charge is shared equally amongst all atoms. This usually changes the charge in each atom by a very small (negligible) amount. Note that this method only changes the charges in the ParaMol ForceField of the ParaMolSystem. Therefore, it is required to update the OpenMM systems after this method is called.
- Returns
total_charge (float) – Final total charge of the system.
-
static
_get_constraints(scipy_method, parameter_space, total_charge=0.0, threshold=1e-08)¶ Method that gets the constraints to be passed into the SciPy optimizer.
- Parameters
scipy_method (str) – SciPy method. Should be “COBYLA”, SLSQP” or “trust-consr”.
parameter_space (
ParaMol.Parameter_space.parameter_space.ParameterSpace) – Instance of parameter space.total_charge (float) – System’s total charge
threshold (float) – Constraint’s threshold.
- Returns
list – List with constraints.
-
static
_get_total_charge(system)¶ Method that gets the system’s total charge as in the ParaMol ForceField of the ParaMolSystem.
- Parameters
system (
ParaMol.System.system.ParaMolSystem) – Instance of ParaMol System.- Returns
total_charge (float) – Final total charge of the system.
-
static
_perform_assertions(settings, system)¶ Method that asserts if the parametrization asked by the user contains the necessary data (coordinates, forces, energies, esp).
- Parameters
settings (dict) – Dictionary containing global ParaMol settings.
system (
ParaMol.System.system.ParaMolSystem) – Instance of ParaMol System.
- Returns
True
-
_perform_optimization(settings, optimizer, objective_function, parameter_space)¶ Method that wraps the functions used to perform the optimization of the parameters.
- Parameters
settings (dict) – Dictionary containing global ParaMol settings.
parameter_space (
ParaMol.Parameter_space.parameter_space.ParameterSpace) – Instance of parameter space.objective_function (
ParaMol.Objective_function.objective_function.ObjectiveFunction) – Instance of objective function.optimizer (
ParaMol.Optimizers.optimizer.Optimizer) – Instance of optimizer.
- Returns
parameters_values (list) – List of optimized parameters
-
run_task(settings, systems, parameter_space=None, objective_function=None, optimizer=None, interface=None, adaptive_parametrization=False, apply_charge_correction=False, restart=False)¶ Method that performs the standard ParaMol parametrization.
- Parameters
settings (dict) – Dictionary containing global ParaMol settings.
systems (list of
ParaMol.System.system.ParaMolSystem) – List containing instances of ParaMol systems.parameter_space (
ParaMol.Parameter_space.parameter_space.ParameterSpace) – Instances of ParameterSpace.objective_function (
ParaMol.Objective_function.objective_function.ObjectiveFunction) – Instance of the objective function.optimizer (one of the optimizers defined in the subpackage
ParaMol.Optimizers) – Instance of the optimizer.interface (
ParaMol.Utils.interface.ParaMolInterface) – ParaMol system instance.adaptive_parametrization (bool) – Flag that signals if this parametrization is being done inside a an adaptive parametrization loop. If False the sytem xml file is not written in this method (default is False).
apply_charge_correction (bool) – Whether or not to apply charge correction. Important if charges are being optimized.
restart (bool) – Flag that controls whether or not to perform a restart.
- Returns
systems, parameter_space, objective_function, optimizer
-