IMLCV.implementations package#

Subpackages#

Submodules#

IMLCV.implementations.CV module#

class IMLCV.implementations.CV.DistraxRealNVP(*, cv_input=None, latent_dim, parent=<flax.linen.module._Sentinel object>, name=None)[source]#

Bases: CvFunDistrax

latent_dim: int[source]#
name: Optional[str] = None#
parent: Union[Type[Module], Type[Scope], Type[_Sentinel], None] = None#
scope: Optional[Scope] = None#
setup()[source]#

Creates the flow model.

shift_and_scale(x0, input_depth, **condition_kwargs)[source]#
class IMLCV.implementations.CV.MetricUMAP(periodicities, bounding_box=None)[source]#

Bases: CvMetric

IMLCV.implementations.CV.NoneCV()[source]#
Return type:

CollectiveVariable

class IMLCV.implementations.CV.RealNVP(*, cv_input=None, features, parent=<flax.linen.module._Sentinel object>, name=None)[source]#

Bases: CvFunNn

use in combination with swaplink

backward(z, nl, conditioners=None)[source]#
features: int[source]#
forward(x, nl, conditioners=None)[source]#
name: Optional[str] = None#
parent: Union[Type[Module], Type[Scope], Type[_Sentinel], None] = None#
scope: Optional[Scope] = None#
setup()[source]#

Initializes a Module lazily (similar to a lazy __init__).

setup is called once lazily on a module instance when a module is bound, immediately before any other methods like __call__ are invoked, or before a setup-defined attribute on self is accessed.

This can happen in three cases: :rtype: None

  1. Immediately when invoking apply(), init() or init_and_output().

  2. Once the module is given a name by being assigned to an attribute of another module inside the other module’s setup method (see __setattr__()):

    class MyModule(nn.Module):
      def setup(self):
        submodule = Conv(...)
    
        # Accessing `submodule` attributes does not yet work here.
    
        # The following line invokes `self.__setattr__`, which gives
        # `submodule` the name "conv1".
        self.conv1 = submodule
    
        # Accessing `submodule` attributes or methods is now safe and
        # either causes setup() to be called once.
    
  3. Once a module is constructed inside a method wrapped with compact(), immediately before another method is called or setup defined attribute is accessed.

IMLCV.implementations.CV.dihedral(numbers)[source]#

from https://stackoverflow.com/questions/20305272/dihedral-torsion- angle-from-four-points-in-cartesian- coordinates-in-python.

Parameters:

numbers (list[int] | Array) – list with index of 4 atoms that form dihedral

IMLCV.implementations.CV.distance_descriptor()[source]#
IMLCV.implementations.CV.get_sinkhorn_divergence(nli, pi, sort='rematch', alpha_rematch=0.1)[source]#
class IMLCV.implementations.CV.hyperTorus(n)[source]#

Bases: CvMetric

IMLCV.implementations.CV.project_distances(a)[source]#
IMLCV.implementations.CV.rotate_2d(alpha)[source]#
IMLCV.implementations.CV.sb_descriptor(r_cut, n_max, l_max, references=None, references_nl=None, reduce=True, reshape=False)[source]#
IMLCV.implementations.CV.scale_cv_trans(array)[source]#

axis 0 is batch axis

IMLCV.implementations.CV.trunc_svd(m)[source]#
Return type:

tuple[CV, CvTrans]

IMLCV.implementations.CvDiscovery module#

class IMLCV.implementations.CvDiscovery.Decoder(latents, layers, nunits, dim, parent=<flax.linen.module._Sentinel object>, name=None)[source]#

Bases: Module

dim: int[source]#
latents: int[source]#
layers: int[source]#
name: Optional[str] = None#
nunits: int[source]#
parent: Union[Type[Module], Type[Scope], Type[_Sentinel], None] = None#
scope: Optional[Scope] = None#
class IMLCV.implementations.CvDiscovery.Encoder(latents, layers, nunits, dim, parent=<flax.linen.module._Sentinel object>, name=None)[source]#

Bases: Module

dim: int[source]#
latents: int[source]#
layers: int[source]#
name: Optional[str] = None#
nunits: int[source]#
parent: Union[Type[Module], Type[Scope], Type[_Sentinel], None] = None#
scope: Optional[Scope] = None#
class IMLCV.implementations.CvDiscovery.TranformerAutoEncoder(outdim, periodicity=None, bounding_box=None, descriptor='sb', descriptor_kwargs={})[source]#

Bases: Transformer

class IMLCV.implementations.CvDiscovery.TransoformerLDA(outdim, periodicity=None, bounding_box=None, descriptor='sb', descriptor_kwargs={})[source]#

Bases: Transformer

class IMLCV.implementations.CvDiscovery.VAE(latents, layers, nunits, dim, parent=<flax.linen.module._Sentinel object>, name=None)[source]#

Bases: Module

dim: int[source]#
encode(x)[source]#
latents: int[source]#
layers: int[source]#
name: Optional[str] = None#
nunits: int[source]#
parent: Union[Type[Module], Type[Scope], Type[_Sentinel], None] = None#
classmethod reparameterize(rng, mean, logvar)[source]#
scope: Optional[Scope] = None#
setup()[source]#

Initializes a Module lazily (similar to a lazy __init__).

setup is called once lazily on a module instance when a module is bound, immediately before any other methods like __call__ are invoked, or before a setup-defined attribute on self is accessed.

This can happen in three cases:

  1. Immediately when invoking apply(), init() or init_and_output().

  2. Once the module is given a name by being assigned to an attribute of another module inside the other module’s setup method (see __setattr__()):

    class MyModule(nn.Module):
      def setup(self):
        submodule = Conv(...)
    
        # Accessing `submodule` attributes does not yet work here.
    
        # The following line invokes `self.__setattr__`, which gives
        # `submodule` the name "conv1".
        self.conv1 = submodule
    
        # Accessing `submodule` attributes or methods is now safe and
        # either causes setup() to be called once.
    
  3. Once a module is constructed inside a method wrapped with compact(), immediately before another method is called or setup defined attribute is accessed.

IMLCV.implementations.MdEngine module#

MD engine class peforms MD simulations in a given NVT/NPT ensemble.

Currently, the MD is done with YAFF/OpenMM

class IMLCV.implementations.MdEngine.PlumedEngine(bias, static_trajectory_info, energy, trajectory_file=None, sp=None)[source]#

Bases: YaffEngine

plumed_dat = '\n    LOAD FILE=libpybias.so\n\n    dist: DISTANCE ATOMS=1,2\n\n\n    rc: PYTHONCV ATOMS=1,4,3 IMPORT=curvature FUNCTION=r\n\n    # Creat a PyBias action, which executes "bias.py"\n    PYBIAS ARG=rc\n\n\n    RESTRAINT ARG=rc AT=0 KAPPA=0 SLOPE=1\n    '[source]#
class IMLCV.implementations.MdEngine.YaffEngine(bias, static_trajectory_info, energy, trajectory_file=None, sp=None, additional_parts=[])[source]#

Bases: MDEngine, Hook

MD engine with YAFF as backend.

Parameters:

ff (yaff.pes.ForceField) –

class YaffFF(md_engine, name='IMLCV_YAFF_forcepart', additional_parts=[])[source]#

Bases: ForceField

property sp[source]#
property system[source]#
update_pos(pos)[source]#

See yaff.pes.ff.ForcePart.update_pos()

update_rvecs(rvecs)[source]#

See yaff.pes.ff.ForcePart.update_rvecs()

static load(file, **kwargs)[source]#
Return type:

MDEngine

IMLCV.implementations.bias module#

class IMLCV.implementations.bias.BiasMTD(cvs, K, sigmas, tempering=0.0, start=None, step=None)[source]#

Bases: Bias

A sum of Gaussian hills, for instance used in metadynamics: Adapted from Yaff.

V = sum_{\alpha} K_{\alpha}} exp{-sum_{i} \frac{(q_i-q_{i,\alpha}^0)^2}{2sigma^2}}

where \alpha loops over deposited hills and i loops over collective variables.

get_args()[source]#

function that return dictionary with kwargs of _compute.

update_bias(md)[source]#

update the bias.

Can only change the properties from _get_args

class IMLCV.implementations.bias.GridBias(cvs, vals, bounds, start=None, step=None, centers=True)[source]#

Bases: Bias

Bias interpolated from lookup table on uniform grid.

values are caluclated in bin centers

get_args()[source]#

function that return dictionary with kwargs of _compute.

class IMLCV.implementations.bias.HarmonicBias(cvs, q0, k, k_max=None)[source]#

Bases: Bias

Harmonic bias potential centered arround q0 with force constant k.

get_args()[source]#

function that return dictionary with kwargs of _compute.

class IMLCV.implementations.bias.MinBias(biases)[source]#

Bases: CompositeBias

class IMLCV.implementations.bias.PlumedBias(collective_variable, timestep, kernel=None, fn='plumed.dat', fn_log='plumed.log')[source]#

Bases: Bias

setup_plumed(timestep, restart)[source]#

Send commands to PLUMED to make it computation-ready.

Arguments:

timestep

The timestep (in au) of the integrator

restart

Set to an integer value different from 0 to let PLUMED know that this is a restarted run

update_bias(md)[source]#

When this point is reached, a complete time integration step was finished and PLUMED should be notified about this.

class IMLCV.implementations.bias.RbfBias(cvs, vals, cv, start=None, step=None, kernel='linear', epsilon=None, smoothing=0.0, degree=None)[source]#

Bases: Bias

Bias interpolated from lookup table on uniform grid.

values are caluclated in bin centers

get_args()[source]#

function that return dictionary with kwargs of _compute.

IMLCV.implementations.energy module#

class IMLCV.implementations.energy.AseEnergy(atoms, calculator=None)[source]#

Bases: Energy

Conversion to ASE energy

property cell[source]#
property coordinates[source]#
class IMLCV.implementations.energy.Cp2kEnergy(atoms, input_file, input_kwargs, cp2k_path=None, **kwargs)[source]#

Bases: AseEnergy

default_parameters = {'auto_write': False, 'basis_set': None, 'basis_set_file': None, 'charge': None, 'cutoff': None, 'force_eval_method': None, 'inp': '', 'max_scf': None, 'poisson_solver': None, 'potential_file': None, 'print_level': 'LOW', 'pseudo_potential': None, 'stress_tensor': True, 'uks': False, 'xc': None}[source]#
class IMLCV.implementations.energy.YaffEnergy(f)[source]#

Bases: Energy

property cell[source]#
property coordinates[source]#

Module contents#