EZFF - Easy forcefield fitting

class ezff.FFParam(error_function=None, num_errors=None)[source]

Class for EZFF Forcefield Parametrization

__init__(error_function=None, num_errors=None)[source]
Parameters:
  • num_errors (int) – Number of errors to be minimized for forcefield optimization
  • error_function (function) – User-defined function that takes-in a dictionary of variable-value pairs and outputs a list of computed errors
read_variable_bounds(filename)[source]

Read permissible lower and upper bounds for decision variables used in forcefields optimization

Parameters:filename (str) – Name of text file listing bounds for each decision variable that must be optimized
read_forcefield_template(template_filename)[source]

Read-in the forcefield template. The template is constructed from a functional forcefield file by replacing all optimizable numerical values with variable names enclosed within dual angled brackets << and >>.

Parameters:template_filename (str) – Name of the forcefield template file to be read-in
set_algorithm(algo_string, population_size=None)[source]

Set optimization algorithm. Initialize interfaces to external optimizers and return the algorithm object

Parameters:
  • algo_string (int) – Type of algorithm to parameterize the forcefield
  • population_size – Number of candidate forcefields evaluated every epoch
ask()[source]

Ask the optimization algorithm the next candidate variables for evaluation

parameterize(num_epochs=None, pool=None)[source]

The optimize function provides a uniform wrapper to solve the EZFF problem using the algorithm(s) provided.

Parameters:
  • num_epochs (int) – Number of epochs to perform the optimization for. If multiple algorithms are specified, one iteration value should be provided for each algorithm
  • pool (Multiprocessing or MPI Pool object) – Multiprocessing or MPI Pool for forcefield parameterization
get_best_recommendation()[source]

Return the best variables evaluated so far

generate_pool(pool_type)[source]

Return a parallel pool object

Parameters:pool_type (str) – Type of parallel pool
save_evaluated(filename)[source]

Save all variables evaluated so far as a zipped numpy array

Parameters:filename (str) – File to which variables are saved
load_evaluated(filename)[source]

Load all variables evaluated from a zipped numpy array

Parameters:filename (str) – File to load variables from
normalize_errors(scale=2.0)[source]
ask()[source]

Ask the optimization algorithm the next candidate variables for evaluation

generate_pool(pool_type)[source]

Return a parallel pool object

Parameters:pool_type (str) – Type of parallel pool
get_best_recommendation()[source]

Return the best variables evaluated so far

load_evaluated(filename)[source]

Load all variables evaluated from a zipped numpy array

Parameters:filename (str) – File to load variables from
parameterize(num_epochs=None, pool=None)[source]

The optimize function provides a uniform wrapper to solve the EZFF problem using the algorithm(s) provided.

Parameters:
  • num_epochs (int) – Number of epochs to perform the optimization for. If multiple algorithms are specified, one iteration value should be provided for each algorithm
  • pool (Multiprocessing or MPI Pool object) – Multiprocessing or MPI Pool for forcefield parameterization
read_forcefield_template(template_filename)[source]

Read-in the forcefield template. The template is constructed from a functional forcefield file by replacing all optimizable numerical values with variable names enclosed within dual angled brackets << and >>.

Parameters:template_filename (str) – Name of the forcefield template file to be read-in
read_variable_bounds(filename)[source]

Read permissible lower and upper bounds for decision variables used in forcefields optimization

Parameters:filename (str) – Name of text file listing bounds for each decision variable that must be optimized
save_evaluated(filename)[source]

Save all variables evaluated so far as a zipped numpy array

Parameters:filename (str) – File to which variables are saved
set_algorithm(algo_string, population_size=None)[source]

Set optimization algorithm. Initialize interfaces to external optimizers and return the algorithm object

Parameters:
  • algo_string (int) – Type of algorithm to parameterize the forcefield
  • population_size – Number of candidate forcefields evaluated every epoch

This module provide general functions for EZFF

ezff.get_pool_rank()[source]

Return the rank of the current process in a parallel setting