Parameter_space.parameter_space module¶
Description¶
This module defines the ParaMol.Parameter_space.parameter_space.ParameterSpace class, which is a ParaMol representation of the parameter space used in the optimization.
-
class
ParaMol.Parameter_space.parameter_space.ParameterSpace(parameters_magnitudes={'angle_eq': 0.19634954084936207, 'angle_k': 100.0, 'bond_eq': 0.05, 'bond_k': 100000, 'charge': 0.5, 'lj_eps': 0.2, 'lj_sigma': 0.3, 'scee': 1.0, 'scnb': 1.0, 'torsion_k': 16.736, 'torsion_phase': 3.141592653589793}, prior_widths_method='default', scaling_constants_method='default')¶ Bases:
objectParaMol representation of the set of mathematical parameters that are used in the optimization. This class aggregates information about the ParameterSubSpaces of all systems.
- Parameters
parameters_magnitudes (dict) – Dictionary containing the default parameter’s magnitudes.
prior_widths_method (str) – Method used to calculate the scaling constants. Available methods are ‘default’, ‘arithmetic’ and ‘geometric’.
scaling_constants_method (str) – Method used to calculate the scaling constants. Available methods are ‘default’, ‘arithmetic’ and ‘geometric’.
- Variables
optimizable_parameters_values_scaled (list or np.array) – Array containing the scaled optimizable parameters values.
optimizable_parameters_values (list or np.array) – Array containing the unscaled optimizable parameters values.
optimizable_parameters (list or np.array) – Array that contains instances of
ParaMol.Force_field.force_field_term_parameter.Parameterthat are optimizable,optimizable_parameters_by_system (list of list of :obj:`ParaMol.Force_field.force_field_term_parameter.Parameter) – Array containing the optimizable ParaMol parameters separated by system.
optimizable_parameters_values_by_system (list of list of float) – Array containing the unscaled optimizable parameters values separated by system.
optimizable_parameters_by_symmetry (list of list of :obj:`ParaMol.Force_field.force_field_term_parameter.Parameter) – Array that contains instances of
ParaMol.Force_field.force_field_term_parameter.Parameterseparated by symmetry and term type.initial_optimizable_parameters_values_scaled (list or np.array) – Array containing the initial scaled optimizable parameters values.
initial_optimizable_parameters_values (list or np.array) – Array containing the initial unscaled optimizable parameters values.
prior_widths (list or np.array) – Array containing the prior wdiths for all parameters.
prior_widths_dict (dict) – Dictionary that maps a param_key to the correspondent prior width.
scaling_constants (list or np.array) – Array containing the scaling constants used to perform the Jacobi preconditioning for all parameters.
scaling_constants_dict (dict) – Dictionary that maps a param_key to the correspondent scaling constants used to perform the Jacobi preconditioning.
-
calculate_parameters_magnitudes(method=None)¶ Method that calculates the widths of the prior distributions or the scalings constants of the parameters according to different recipes.
- Parameters
method (str) – Recipe used to calculate the prior widths. Options are “default”, “geometric” or “default”.
- Returns
prior_widths (np.array(n_parameters)) – Array containing the prior widths for each parameter.
-
calculate_prior_widths(method=None)¶ Method that calculates the prior widths and sets the class attribute self.prior_widths.
- Parameters
method (str) – Available methods are ‘default’, ‘arithmetic’ and ‘geometric’.
- Returns
prior_widths_dict (dict) – Dictionary containing the prior widths for each parameter class.
prior_widths (np.array, shape=(n_params)) – Numpy array containing the scaling constants for each parameter.
-
calculate_scaling_constants(method=None)¶ Method that calculates the scaling constants and sets the class attribute self.scaling_constants.
- Parameters
method (str) – Available methods are ‘default’, ‘arithmetic’ and ‘geometric’.
- Returns
scaling_constants_dict (dict) – Dictionary containing the scaling constants for each parameter class.
scaling_constants (np.array, shape=(n_params)) – Numpy array containing the scaling constants for each parameter.
-
get_optimizable_parameters(systems, symmetry_constrained=True)¶ Method that returns a list with the optimizable parameters to be passed to the optimization.
- Parameters
systems (list of ParaMol.System.system.ParaMolSystem) – List of ParaMol System instance.
symmetry_constrained (bool) – Flag that signal if there are any symmetry constraints.
- Returns
optimizable_parameters, optimizable_parameters_values (np.array(n_parameters), np.array(n_parameters)) – array that contains instances of
ParaMol.Force_field.force_field_term_parameter.Parameterthat are optimizable, array containing the optimizable parameters values.
-
jacobi_preconditioning()¶ Method that applies Jacobi (diagonal) preconditioning to the parameters that will enter in the optimization.
Notes
This method should be called before any optimization and after the prior widths were calculated.
- Returns
optimizable_parameters_values_scaled (np.array(n_parameters)) – Array containing the scaled optimizable parameters values.
-
symmetry_group_default= 'X'¶
-
update_systems(systems, parameters_values, symmetry_constrained=True)¶ Method that defines defines the point of contact with the external world.
- Parameters
parameters_values (list of floats) – 1D list with the adimensional mathematical parameters used in the optimization.
systems (list of ParaMol.System.system.ParaMolSystem) – List of ParaMol System instance.
symmetry_constrained (bool) – Whether or not the optimization is constrained by symmetries.
Notes
Firstly, it converts the adimensional mathematical parameters used in the optimization to parameters with physical units. Then, it updates the ParaMol ForceField instance associated with every system in system and updates the parameters in the OpenMM system.
- Returns
optimizable_parameters_values (np.array(n_parameters)) – Array containing the scaled optimizable parameters values.