besmarts.mechanics.fits module¶
besmarts.mechanics.fits
- besmarts.mechanics.fits.calc_tier_distributed(S, Sj, operation, edits, oid, verbose=False, wq=None, shm=None)[source]¶
- besmarts.mechanics.fits.chemical_objective(csys, P0=1.0, C0=1.0, A=1.0, B=1.0, C=1.0, c=None)[source]¶
- besmarts.mechanics.fits.chemical_system_cluster_angles(csys: chemical_system, gdb, sep=0.01)[source]¶
- besmarts.mechanics.fits.chemical_system_cluster_bonds(csys: chemical_system, gdb, sep=0.001)[source]¶
- besmarts.mechanics.fits.chemical_system_cluster_data(csys, m, sag, objective, strategy=None)[source]¶
- class besmarts.mechanics.fits.compute_config(addr)[source]¶
Bases:
objectConfiguration for computing some property of an entry in a graph_db. The addr is the address of the entry in the graph_db. Keys are from a chemical system, and are used to temporarility update the parameters. This is generally used to computer numerical gradients and hessians.
- run() List[Dict[int, graph_db_table]][source]¶
- class besmarts.mechanics.fits.compute_config_energy_sapt(addr)[source]¶
Bases:
compute_config- run() List[Dict[int, graph_db_entry]][source]¶
Compute the energy of the entries and store them in graph_db tables.
- class besmarts.mechanics.fits.compute_config_energy_total(addr)[source]¶
Bases:
compute_config- run() List[Dict[int, graph_db_entry]][source]¶
Compute the energy of the entries and store them in graph_db tables.
- class besmarts.mechanics.fits.compute_config_gradient(addr)[source]¶
Bases:
compute_configConfiguration for computing the MM gradient
- run() List[Dict[int, graph_db_entry]][source]¶
Compute the gradient of the entries and store them in graph_db tables. compute_config_gradient::run
- class besmarts.mechanics.fits.compute_config_hessian(addr)[source]¶
Bases:
compute_config- run() List[Dict[int, graph_db_entry]][source]¶
Compute the hessian of the entries and store them in graph_db tables. compute_config_hessian::run
- class besmarts.mechanics.fits.compute_config_penalty(targets)[source]¶
Bases:
compute_config
- class besmarts.mechanics.fits.compute_config_position(addr)[source]¶
Bases:
compute_config- run() List[Dict[int, graph_db_table]][source]¶
Compute the positions that minimize the energy of the entries and store them in graph_db tables. compute_config_position::run
- besmarts.mechanics.fits.ff_optimize(csys0: chemical_system, gdb: graph_db, psystems: Dict[int, physical_system], strategy: forcefield_optimization_strategy, chemical_objective, initial_objective: objective_tier, tiers: List[objective_tier], final_objective: objective_tier) chemical_system[source]¶
The toplevel function to run a full BESMARTS force field fit.
- Parameters:
csys0 (The initial chemical system to fit)
gdb (The graph_db with all data)
psystems (The initial parameterized systems)
strategy (The fitting strategy)
chemical_objective (The function that will compute the chemical objective)
initial_objective (The objective_tier that will perform the initial fit)
tiers (The tiers that will score each parameter candidate)
final_objective (The objective_tier that will score the remaining)
candidates passed by the tiers
- besmarts.mechanics.fits.fit(csys, gdb, objective, psystems, nodes, wq=None, verbose=False)[source]¶
Helper function to easily run a force field fit
- Parameters:
csys (The reference chemical system to fit)
gdb (The graph_db)
objective (The objective tier to run)
psystems (The parameterized systems)
nodes (unused)
wq (The workqueue_local to use for distributing computing)
- class besmarts.mechanics.fits.forcefield_optimization_strategy(bounds)[source]¶
Bases:
optimization_strategyConfiguration for fitting a force field using BESMARTS (this package).
- macro_iteration(clusters: List[tree_node]) optimization_iteration[source]¶
Return a list of iterations that form a macro iteration, where we may want to analyze a group of candidates before proceeding to the next level of searching
- Parameters:
clusters (List[trees.tree_node]) – The nodes of a trees.tree_index to consider in the step
- Return type:
- besmarts.mechanics.fits.forcefield_optimization_strategy_build_macro_iterations(strat: forcefield_optimization_strategy)[source]¶
Build the macro iterations of a strategy, which define each step in the optimization. Each macro step will be a list of micro steps, where each micro step represents e.g. a parameter in the hierarchy.
- besmarts.mechanics.fits.forcefield_optimization_strategy_default(csys, models=None)[source]¶
Configure a force field optimiation strategy with default settings. The strategy determines how to step the optimization forward, choosing which hyperparameter to try next in the search, such as bit depth and which model to focus on.
- besmarts.mechanics.fits.gdb_to_physical_systems(gdb, csys, ref=None, reuse=None)[source]¶
Build a physical system for each entry in the graph_db
- besmarts.mechanics.fits.generate_candidates(csys, psystems, gdb, G0, macro, strategy, union_cache, wq)[source]¶
- besmarts.mechanics.fits.insert_candidates(candidates, Sj_sma, strategy, step, step_tracker, csys, psystems, gdb, assigned_nodes, reuse0, reset_config, chemical_objective, initial_objective, tiers, C0, P0, X0, CX0, G0, union_cache, visited, wq)[source]¶
- class besmarts.mechanics.fits.objective_config(addr, include=True, scale=1, coordinate_system='C')[source]¶
Bases:
objectConfiguration of an objective function for force field fitting. The objective has two parts. The first part is how the properties are calculated and is configured with a compute_config. The next is how the objective is computed from the properties and is configured here.
- compute_diff(GDB: graph_db, D: List[Dict[int, graph_db_table]], verbose=False)[source]¶
Compute the difference of the computed properties versus a reference
- get_task(GDB, csys, keys=None, psys=None, reuse=None) compute_config[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_config_energy_sapt(*args, **kwds)[source]¶
Bases:
objective_config- compute_diff(GDB: graph_db, D: List[Dict[int, graph_db_table]], verbose=False)[source]¶
Compute the difference of the computed properties versus a reference
- get_task(GDB: graph_db, csys, keys=None, psys=None, reuse=None) compute_config[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_config_energy_total(*args, **kwds)[source]¶
Bases:
objective_config- compute_diff(GDB: graph_db, D: List[Dict[int, graph_db_table]], verbose=False)[source]¶
Compute the difference of the computed properties versus a reference
- get_task(GDB: graph_db, csys, keys=None, psys=None, reuse=None) compute_config[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_config_gradient(*args, **kwds)[source]¶
Bases:
objective_config- compute_diff(GDB: graph_db, D: List[Dict[int, graph_db_table]], verbose=False)[source]¶
- get_task(GDB: graph_db, csys, keys=None, psys=None, reuse=None) compute_config_gradient[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_config_hessian(*args, **kwds)[source]¶
Bases:
objective_config- compute_diff(GDB: graph_db, D: List[Dict[int, graph_db_table]], verbose=False)[source]¶
- get_task(GDB: graph_db, csys, keys=None, psys=None, reuse=None) compute_config_hessian[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_config_penalty(keys=None, scale=1, polynomial={2: 1.0})[source]¶
Bases:
objective_config- get_task() compute_config[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_config_position(addr, include=True, scale=1, coordinate_system='C')[source]¶
Bases:
objective_config- get_task(GDB, csys, keys=None, psys=None, reuse=None) compute_config[source]¶
Build and return a compute_config that will compute the needed properties.
- class besmarts.mechanics.fits.objective_tier[source]¶
Bases:
objectA configuration for how to compute a total objective over a list of objectives. A tier is meant to be calculated for 1 or more force fields, which is what happens during parameter searching. Tiers have a fitting aspect that is configured here. For example, an objective might only perform 1 or 2 fitting steps for each force field, and the top N force fields would be accepted (and passed to the next tier.
- besmarts.mechanics.fits.objective_tier_run(ot, gdb: graph_db, csys: chemical_system, keys, oid=None, psysref=None, reuse=None, wq=None, verbose=False)[source]¶
Run the given objective and return the resulting parameters, and the initial and final objective and gradients.
- Parameters:
ot (The objective_tier object)
gdb (The complete graph_db)
csys (The initial chemical system)
keys (The keys in the chemical_system that are going to be fit)
oid (The objective IDs to use in the computation)
psysref (The reference physical systems to use when applied parameters) – should be reused (charges etc)
reuse (Models that be reused during parameterization)
wq (The wq to use for distributing computing)
verbose (Whether to make a lot of noise)
- besmarts.mechanics.fits.perform_operations(csys: chemical_system, candidates, keys, Sj_sma)[source]¶
- besmarts.mechanics.fits.process_accepted_candidates(candidates, cnd_keys, work, csys, strategy, Sj_sma, chemical_objective, C0, P0, X0, CX0, cscale, visited, ignore, kept)[source]¶
- besmarts.mechanics.fits.process_tiers(tiers, candidates, gdb, csys, psystems, chemical_objective, P00, CX0, X0, C0, P0, Sj_sma, strategy, step, reset_config, wq)[source]¶
- besmarts.mechanics.fits.reset(reset_config, csys, gdb, psystems=None, use_min_gradients=True, verbose=False, ws=None, shm=None)[source]¶
- besmarts.mechanics.fits.reset_project_dihedrals(csys, psystems, psys_hess, vals, psys_grad, eid_grad, gvals, m, lbl, guess_periodicity=True, max_n=3, max_k=10, alpha=-0.5, min_k=0.001, verbose=False)[source]¶
- besmarts.mechanics.fits.reset_project_torsions(csys, gdb, psystems, max_n=6, alpha=-0.25, m=2, verbose=False, ws=None)[source]¶
- besmarts.mechanics.fits.reset_unique_dihedral(psystem, hic, m, guess_periodicity, alpha, max_n, min_k, max_k, gradients=None, verbose=False)[source]¶