quantity.targets#
This module creates DiffTRe targets, initializing the required observables and the computations of necessary snapshot quantities.
Intramolecular#
|
Initializes reference and compute function for a dihedral angle dist. |
Intermolecular#
|
Initializes a RDF target. |
|
Initializes an ADF target. |
Thermodynamic#
|
Initializes the computation of a relative entropy. |
Build Targets and Compute Functions#
- class TargetBuilder(system=None, strict=False)[source]#
Class to simplify the initialization of DiffTRe targets.
For each added target, the target builder will check whether compute functions for all required snapshots are provided. Additionally, the target builder delays the initialization of the compute functions until all information about the system is available.
- Parameters:
system (
InitArguments) – Dictionary containing properties of the system, e.g., the displacement between particles.strict (
bool) – If True, the target builder will check whether all required system properties are provided for each target. Otherwise, the properties of the system can be provided when building the targets.
Example
First, we add the RDF function to the target builder:
target_builder = TargetBuilder() target_builder["rdf"] = quantity.structure.init_radial_distribution_target( target, rdf_start=0.00, rdf_cut=1.0, nbins=50 )
Then, as soon as the box and displacement function of the system are known, the compute functions and observables can be initialized:
targets, compute_fns = target_builder.build({ 'displacement_fn': displacement_fn, 'reference_box': box })
- class InitArguments[source]#
Non-exhaustive dictionary of arguments to initialize the compute functions.
- Parameters:
displacement_fn – Function to compute the displacement from particles. Initialized via
jax_md.space.energy_fn_template – Template to build energy function from a set of parameters.
r_init – Initial positions of the system, e.g., to infer the number of particles in the system.
nbrs_init – Initial neighbor list of the system, e.g., to infer the number of close triplets in the system.
reference_box – Reference box of the system.
kT – Fixed temperature of the system.
pressure – Fixed pressure of the system
- split_target_dict(target_dict)[source]#
Splits the target dictionary into observable functions, loss functions, and target values.
- Parameters:
target_dict (
Dict[str,SingleTarget]) – Dictionary of targets.- Return type:
Tuple[Dict[str,Callable],Dict[str,Callable],Dict[str,Dict[str,Union[Array,ndarray,bool,number,bool,int,float,complex]]]]- Returns:
Returns a tuple of observable functions, loss functions, and target values.