Simulation utilities

It is convinient to define various prior models for many types of interactions which leads to a large number of priors. While this is convinient when difining these priors, it results in a clear slowdown of the simulation. Below are defined Prior models that are specialized to a specific simulation.

The prior models for which such specialization is available using the function

mlcg.simulation.specialize_prior.condense_all_priors_for_simulation(priors, data_list)[source]

Specilize the priors for all the prior types registered in

mlcg.simulation.specialize_prior.to_reduce = {'Dihedral': <class 'mlcg.nn.prior.fourier_series.Dihedral'>, 'GeneralAngles': <class 'mlcg.nn.prior.harmonic.GeneralAngles'>, 'GeneralBonds': <class 'mlcg.nn.prior.harmonic.GeneralBonds'>, 'HarmonicAngles': <class 'mlcg.nn.prior.harmonic.HarmonicAngles'>, 'HarmonicBonds': <class 'mlcg.nn.prior.harmonic.HarmonicBonds'>, 'HarmonicImpropers': <class 'mlcg.nn.prior.harmonic.HarmonicImpropers'>}

register the types of prior that can be reduced

The particular list of atomic structures contained in data_list and adapt the neighbor lists in data_list accordingly. The specialized priors can only be used on a collated version of the returned list of atomic structures so this function is only meant to speedup simulations.

Parameters:
  • TargetPrior – A prior class that will be condensed into one prior

  • priors (SumOut) – dictionary of prior models

  • data_list (List[AtomicData]) – list of configuration for which the condensed prior should be produced

Return type:

Tuple[SumOut, List[AtomicData]]

Returns:

  • Condensed priors and the list of configuration with adapted neighborlists.

are listed in the to_reduce dictionary:

mlcg.simulation.specialize_prior.to_reduce = {'Dihedral': <class 'mlcg.nn.prior.fourier_series.Dihedral'>, 'GeneralAngles': <class 'mlcg.nn.prior.harmonic.GeneralAngles'>, 'GeneralBonds': <class 'mlcg.nn.prior.harmonic.GeneralBonds'>, 'HarmonicAngles': <class 'mlcg.nn.prior.harmonic.HarmonicAngles'>, 'HarmonicBonds': <class 'mlcg.nn.prior.harmonic.HarmonicBonds'>, 'HarmonicImpropers': <class 'mlcg.nn.prior.harmonic.HarmonicImpropers'>}

register the types of prior that can be reduced

The names of the specialized prior classes have the name of their original class with Static prepended and they are inherit from StaticPrior.