IMLCV.implementations package

Contents

IMLCV.implementations package#

Subpackages#

Submodules#

IMLCV.implementations.CV module#

IMLCV.implementations.CV.NoneCV()#
Return type:

CollectiveVariable

IMLCV.implementations.CV.affine_2d(old, new)#

old: set of coordinates in the original space, new: set of coordinates in the new space

IMLCV.implementations.CV.append_trans(v)#
IMLCV.implementations.CV.dihedral(numbers)#

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

Parameters:

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

IMLCV.implementations.CV.distance_descriptor()#
IMLCV.implementations.CV.get_feature_cov(c_0, c_tau, nl=None, nl_tau=None, w=None, trans=None, epsilon=0.1, smallest_correlation=1e-12, max_functions=None)#
Return type:

CvTrans

IMLCV.implementations.CV.get_inv_sigma_weighing(cv_0, nli, remove_mean=True)#
IMLCV.implementations.CV.get_non_constant_trans(c, c_t=None, nl=None, nl_t=None, w=None, epsilon=1e-14, max_functions=None, tr=None)#
IMLCV.implementations.CV.get_normalize_trans(c, remove_mu=True, range=Ellipsis)#
IMLCV.implementations.CV.get_remove_mean_trans(c, range=Ellipsis)#
IMLCV.implementations.CV.get_sinkhorn_divergence_2(nli, pi, alpha_rematch=0.1, jacobian=True, scale_z=False)#

Get a function that computes the sinkhorn divergence between two point clouds. p_i and nli are the points to match against.

Return type:

CvTrans

IMLCV.implementations.CV.kernel_dist(p1, p2, xi=2.0)#
IMLCV.implementations.CV.position_index(indices, sp)#
IMLCV.implementations.CV.project_distances(a)#
IMLCV.implementations.CV.rotate_2d(alpha)#
IMLCV.implementations.CV.sb_descriptor(r_cut, n_max, l_max, reduce=True, reshape=True, chunk_size_atoms=None, chunk_size_neigbourgs=None, bessel_fun='jax', mul_Z=True)#
Return type:

CvTrans

IMLCV.implementations.CV.scale_cv_trans(array, lower=0.0, upper=1.0)#

axis 0 is batch axis

IMLCV.implementations.CV.sinkhorn_divergence_2(x1, x2, nl1, nl2, z_scale, alpha=0.01, jacobian=False, lse=True, exp_factor=None, mass_weight=True, dist_fun=<function kernel_dist>, scale_std=True, xi=2.0)#

caluculates the sinkhorn divergence between two CVs. If x2 is batched, the resulting divergences are stacked

Return type:

CV

IMLCV.implementations.CV.soap_descriptor(r_cut, n_max, l_max, sigma_a, r_delta, reduce=True, reshape=True, num=50, basis='cos', mul_Z=True)#
Return type:

CvTrans

IMLCV.implementations.CV.stack_reduce(op=<function mean>)#
IMLCV.implementations.CV.trunc_svd(m, range=Ellipsis)#
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)#

Bases: Module

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

Bases: Module

dim: int#
latents: int#
layers: int#
name: Optional[str] = None#
nunits: int#
parent: Union[Module, Scope, _Sentinel, None] = None#
scope: Scope | None = None#
class IMLCV.implementations.CvDiscovery.TranformerAutoEncoder(*, outdim, descriptor=None, pre_scale=True, post_scale=True, nunits=250, nlayers=3, lr=0.0001, num_epochs=100, batch_size=32)#

Bases: Transformer

batch_size: int = 32#
lr: float = 0.0001#
nlayers: int = 3#
num_epochs: int = 100#
nunits: int = 250#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

class IMLCV.implementations.CvDiscovery.TransformerMAF(*, outdim, descriptor=None, pre_scale=True, post_scale=True, eps=1e-05, eps_pre=1e-05, max_features=500, max_features_pre=500, sym=True, use_w=True, min_t_frac=0.1, trans=None, T_scale=1.0)#

Bases: Transformer

T_scale: float = 1.0#
eps: float = 1e-05#
eps_pre: float = 1e-05#
max_features: int = 500#
max_features_pre: int = 500#
min_t_frac: float = 0.1#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

sym: bool = True#
trans: CvTrans | None = None#
use_w: bool = True#
class IMLCV.implementations.CvDiscovery.TransoformerLDA(*, outdim, descriptor=None, pre_scale=True, post_scale=True, solver='eigen', method='pymanopt', min_gradient_norm=0.001, min_step_size=0.001, max_iterations=25)#

Bases: Transformer

harmonic = True#
kernel = False#
max_iterations: int = 25#
method: str = 'pymanopt'#
min_gradient_norm: float = 0.001#
min_step_size: float = 0.001#
optimizer = None#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

solver: str = 'eigen'#
class IMLCV.implementations.CvDiscovery.VAE(latents, layers, nunits, dim, parent=<flax.linen.module._Sentinel object>, name=None)#

Bases: Module

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

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 = nn.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#

IMLCV.implementations.bias module#

class IMLCV.implementations.bias.BiasMTD(*, collective_variable, start=0, step=1, finalized=False, slice_exponent=1.0, log_exp_slice=True, slice_mean=False, q0s, sigmas, K, Ks, tempering=0.0)#

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.

K: Array#
Ks: Array#
classmethod create(cvs, K, sigmas, tempering=0.0, start=None, step=None, finalized=False)#

_summary_

Parameters:
  • cvs (CollectiveVariable) – _description_

  • K – _description_

  • sigmas – _description_

  • start – _description_. Defaults to None.

  • step – _description_. Defaults to None.

  • tempering – _description_. Defaults to 0.0.

Return type:

Self

q0s: Array#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

sigmas: Array#
tempering: float = 0.0#
update_bias(md)#

update the bias.

Can only change the properties from _get_args

class IMLCV.implementations.bias.GridBias(*, collective_variable, start=0, step=1, finalized=False, slice_exponent=1.0, log_exp_slice=True, slice_mean=False, n, bounds, vals, order=1)#

Bases: Bias

Bias interpolated from lookup table on uniform grid.

values are caluclated in bin centers

bounds: Array#
classmethod create(cvs, bias, n=30, bounds=None, margin=0.1, order=1)#
Return type:

GridBias

n: int#
order: int = 1#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

vals: Array#
class IMLCV.implementations.bias.HarmonicBias(*, collective_variable, start=0, step=1, finalized=False, slice_exponent=1.0, log_exp_slice=True, slice_mean=False, q0, k, k_max=None, y0=None, r0=None)#

Bases: Bias

Harmonic bias potential centered arround q0 with force constant k.

static create(cvs, q0, k, k_max=None, start=None, step=None, finalized=True)#

generate harmonic potentia;

Parameters:
Return type:

HarmonicBias

k: Array#
k_max: Array | None = None#
q0: CV#
r0: Array | None = None#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

y0: Array | None = None#
class IMLCV.implementations.bias.MinBias(*, collective_variable, start=0, step=1, finalized=False, slice_exponent=1.0, log_exp_slice=True, slice_mean=False, biases, fun)#

Bases: CompositeBias

classmethod create(biases)#
Return type:

CompositeBias

replace(**updates)#

Returns a new object replacing the specified fields with new values.

class IMLCV.implementations.bias.RbfBias(*, collective_variable, start=0, step=1, finalized=False, slice_exponent=1.0, log_exp_slice=True, slice_mean=False, rbf, offset=0.0)#

Bases: Bias

Bias interpolated from lookup table on uniform grid.

values are caluclated in bin centers

classmethod create(cvs, vals, cv, start=None, step=None, kernel='gaussian', epsilon=None, smoothing=0.0, degree=None, finalized=True, slice_exponent=1, log_exp_slice=True, slice_mean=False)#
Return type:

RbfBias

offset: float | Array = 0.0#
rbf: RBFInterpolator#
replace(**updates)#

Returns a new object replacing the specified fields with new values.

IMLCV.implementations.energy module#

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

Bases: Energy

Conversion to ASE energy

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

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}#
class IMLCV.implementations.energy.MACEASE(atoms, calculator=None)#

Bases: AseEnergy

class IMLCV.implementations.energy.OpenMmEnergy(pdb, forcefield_name='amber14-all.xml', _simul=None)#

Bases: Energy

forcefield_name: str = 'amber14-all.xml'#
get_info()#
pdb: Path#
static to_jax_vec(thing)#

Module contents#