IMLCV.implementations.CV#

Module Contents#

Classes#

RealNVP

use in combination with swaplink

DistraxRealNVP

creates bijective CV function based on a distrax flow. The seup function should initialize the bijector

MetricUMAP

class to keep track of topology of given CV. Identifies the periodicitie of CVs and maps to unit square with correct peridicities

hyperTorus

class to keep track of topology of given CV. Identifies the periodicitie of CVs and maps to unit square with correct peridicities

Functions#

Volume(sp, _)

distance_descriptor()

dihedral(numbers)

from https://stackoverflow.com/questions/20305272/dihedral-torsion-

sb_descriptor(r_cut, n_max, l_max[, references, ...])

NoneCV(→ IMLCV.base.CV.CollectiveVariable)

rotate_2d(alpha)

project_distances(a)

scale_cv_trans(array)

axis 0 is batch axis

trunc_svd(→ tuple[IMLCV.base.CV.CV, IMLCV.base.CV.CvTrans])

get_sinkhorn_divergence(nli, pi[, sort, alpha_rematch])

un_atomize(x, nl, _)

IMLCV.implementations.CV.Volume(sp: IMLCV.base.CV.SystemParams, _)[source]#
IMLCV.implementations.CV.distance_descriptor()[source]#
IMLCV.implementations.CV.dihedral(numbers: list[int] | Array)[source]#

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

Parameters:

numbers – list with index of 4 atoms that form dihedral

IMLCV.implementations.CV.sb_descriptor(r_cut, n_max: int, l_max: int, references: SystemParams | None = None, references_nl: NeighbourList | None = None, reduce=True, reshape=False)[source]#
IMLCV.implementations.CV.NoneCV() IMLCV.base.CV.CollectiveVariable[source]#
IMLCV.implementations.CV.rotate_2d(alpha)[source]#
IMLCV.implementations.CV.project_distances(a)[source]#
IMLCV.implementations.CV.scale_cv_trans(array: IMLCV.base.CV.CV)[source]#

axis 0 is batch axis

IMLCV.implementations.CV.trunc_svd(m: IMLCV.base.CV.CV) tuple[IMLCV.base.CV.CV, IMLCV.base.CV.CvTrans][source]#
IMLCV.implementations.CV.get_sinkhorn_divergence(nli: NeighbourList | None, pi: Array | None, sort='rematch', alpha_rematch=0.1)[source]#
IMLCV.implementations.CV.un_atomize(x: IMLCV.base.CV.CV, nl, _)[source]#
class IMLCV.implementations.CV.RealNVP[source]#

Bases: IMLCV.base.CV.CvFunNn

use in combination with swaplink

_: dataclasses.KW_ONLY[source]#
features: int[source]#
cv_input: IMLCV.base.CV.CvFunInput[source]#
setup() None[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.

forward(x: IMLCV.base.CV.CV, nl: NeighbourList | None, conditioners: list[CV] | None = None)[source]#
backward(z: IMLCV.base.CV.CV, nl: NeighbourList | None, conditioners: list[CV] | None = None)[source]#
class IMLCV.implementations.CV.DistraxRealNVP[source]#

Bases: IMLCV.base.CV.CvFunDistrax

creates bijective CV function based on a distrax flow. The seup function should initialize the bijector

class RealNVP(CvFunDistrax):

_: dataclasses.KW_ONLY latent_dim: int

def setup(self):

self.s = Dense(features=self.latent_dim) self.t = Dense(features=self.latent_dim)

# Alternating binary mask. self.bijector = distrax.as_bijector(

tfp.bijectors.RealNVP(

fraction_masked=0.5, shift_and_log_scale_fn=self.shift_and_scale,

)

)

def shift_and_scale(self, x0, input_depth, **condition_kwargs):

return self.s(x0), self.t(x0)

_: dataclasses.KW_ONLY[source]#
latent_dim: int[source]#
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: IMLCV.base.CV.CvMetric

class to keep track of topology of given CV. Identifies the periodicitie of CVs and maps to unit square with correct peridicities

class IMLCV.implementations.CV.hyperTorus(n)[source]#

Bases: IMLCV.base.CV.CvMetric

class to keep track of topology of given CV. Identifies the periodicitie of CVs and maps to unit square with correct peridicities