IMLCV.base package#
Submodules#
IMLCV.base.CV module#
- class IMLCV.base.CV.CV(cv, mapped=False, atomic=False, _combine_dims=None, _stack_dims=None)[source]#
Bases:
object- static combine(*cvs, flatten=False)[source]#
merges a list of CVs into a single CV. The dimenisions are stored such that it can later be split into separated CVs. The CVs are combined over the last dimension
- Return type:
- class IMLCV.base.CV.CollectiveVariable(f, metric, jac=<function jacrev>)[source]#
Bases:
object
- class IMLCV.base.CV.CvFlow(func, trans=None)[source]#
Bases:
object
- class IMLCV.base.CV.CvFunDistrax(parent=<flax.linen.module._Sentinel object>, name=None, *, cv_input=None)[source]#
Bases:
Module,CvFunBasecreates 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)
- scope: Optional[Scope] = None#
- class IMLCV.base.CV.CvFunNn(parent=<flax.linen.module._Sentinel object>, name=None, *, cv_input=None)[source]#
Bases:
Module,CvFunBaseused to instantiate flax linen CvTrans
- scope: Optional[Scope] = None#
- abstract setup()[source]#
Initializes a Module lazily (similar to a lazy
__init__).setupis called once lazily on a module instance when a module is bound, immediately before any other methods like__call__are invoked, or before asetup-defined attribute on self is accessed.This can happen in three cases:
Immediately when invoking
apply(),init()orinit_and_output().Once the module is given a name by being assigned to an attribute of another module inside the other module’s
setupmethod (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.
Once a module is constructed inside a method wrapped with
compact(), immediately before another method is called orsetupdefined attribute is accessed.
- class IMLCV.base.CV.CvMetric(periodicities, bounding_box=None)[source]#
Bases:
objectclass to keep track of topology of given CV. Identifies the periodicitie of CVs and maps to unit square with correct peridicities
- grid(n, endpoints=None, margin=None)[source]#
forms regular grid in mapped space. If coordinate is periodic, last rows are ommited.
- Parameters:
n – number of points in each dim
map – boolean. True: work in mapped space (default), False: calculate grid in space without metric
endpoints – if
- Returns:
meshgrid and vector with distances between points
- class IMLCV.base.CV.CvTrans(*, trans)[source]#
Bases:
objectf can either be a single CV tranformation or a list of transformations
- class IMLCV.base.CV.CvTransNN(trans, parent=<flax.linen.module._Sentinel object>, name=None)[source]#
Bases:
Module,CvTrans- scope: Optional[Scope] = None#
- setup()[source]#
Initializes a Module lazily (similar to a lazy
__init__).setupis called once lazily on a module instance when a module is bound, immediately before any other methods like__call__are invoked, or before asetup-defined attribute on self is accessed.This can happen in three cases: :rtype:
NoneImmediately when invoking
apply(),init()orinit_and_output().Once the module is given a name by being assigned to an attribute of another module inside the other module’s
setupmethod (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.
Once a module is constructed inside a method wrapped with
compact(), immediately before another method is called orsetupdefined attribute is accessed.
- class IMLCV.base.CV.NeighbourList(r_cut, atom_indices, op_cell, op_coor, op_center, r_skin, sp_orig=None, ijk_indices=None, nxyz=None, z_array=None, z_unique=None, num_z_unique=None)[source]#
Bases:
object- apply_fun_neighbour(sp, func, r_cut=None, fill_value=0, reduce='full', split_z=False, exclude_self=False)[source]#
- apply_fun_neighbour_pair(sp, func_double, func_single=None, r_cut=None, fill_value=0, reduce='full', split_z=False, exclude_self=True, unique=True)[source]#
Args:#
func_single=lambda r_ij, atom_index_j: (1,), func_double=lambda r_ij, atom_index_j, data_j, r_ik, atom_index_k, data_k: (
r_ij, atom_index_j, r_ik, atom_index_k,
),
- static match_kernel(p1, p2, nl1, nl2, matching='REMatch', alpha=0.01, mode='divergence', jit=True)[source]#
-
sp_orig:
Optional[SystemParams] = None[source]#
- class IMLCV.base.CV.NormalizingFlow(flow, parent=<flax.linen.module._Sentinel object>, name=None)[source]#
Bases:
Modulenormalizing flow. _ProtoCvTransNN are stored separately because they need to be initialized by this module in setup
- scope: Optional[Scope] = None#
- setup()[source]#
Initializes a Module lazily (similar to a lazy
__init__).setupis called once lazily on a module instance when a module is bound, immediately before any other methods like__call__are invoked, or before asetup-defined attribute on self is accessed.This can happen in three cases: :rtype:
NoneImmediately when invoking
apply(),init()orinit_and_output().Once the module is given a name by being assigned to an attribute of another module inside the other module’s
setupmethod (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.
Once a module is constructed inside a method wrapped with
compact(), immediately before another method is called orsetupdefined attribute is accessed.
- class IMLCV.base.CV.SystemParams(coordinates, cell=None)[source]#
Bases:
object- minkowski_reduce()[source]#
base on code from ASE: https://wiki.fysik.dtu.dk/ase/_modules/ase/geometry/minkowski_reductsp.cellion.html#minkowski_reduce
- Return type:
IMLCV.base.CVDiscovery module#
- class IMLCV.base.CVDiscovery.CVDiscovery(transformer)[source]#
Bases:
objectconvert set of coordinates to good collective variables.
- compute(rounds, num_rounds=4, samples=3000.0, plot=True, new_r_cut=None, chunk_size=None, split_data=False, name=None, **kwargs)[source]#
- Return type:
- data_loader(rounds, num=4, out=-1, split_data=False, new_r_cut=None)[source]#
- Return type:
tuple[list[SystemParams],Optional[list[NeighbourList]],CollectiveVariable,StaticTrajectoryInfo]
IMLCV.base.MdEngine module#
MD engine class peforms MD simulations in a given NVT/NPT ensemble.
Currently, the MD is done with YAFF/OpenMM
- class IMLCV.base.MdEngine.MDEngine(bias, energy, static_trajectory_info, trajectory_file=None, sp=None)[source]#
Bases:
ABCBase class for MD engine.
- property nl: NeighbourList | None[source]#
- run(steps)[source]#
run the integrator for a given number of steps.
- Parameters:
steps – number of MD steps
- property sp: SystemParams[source]#
- class IMLCV.base.MdEngine.StaticTrajectoryInfo(timestep, T, timecon_thermo, atomic_numbers, r_cut=None, P=None, timecon_baro=None, write_step=100, equilibration=None, screen_log=1000, max_grad=0.04031059429903557)[source]#
Bases:
object
- class IMLCV.base.MdEngine.TrajectoryInfo(_positions, _cell=None, _charges=None, _e_pot=None, _e_pot_gpos=None, _e_pot_vtens=None, _e_bias=None, _e_bias_gpos=None, _e_bias_vtens=None, _cv=None, _T=None, _P=None, _err=None, _t=None, _capacity=-1, _size=-1)[source]#
Bases:
object- property sp: SystemParams[source]#
IMLCV.base.Observable module#
- class IMLCV.base.Observable.ThermoLIB(rounds, rnd=None)[source]#
Bases:
objectclass to convert data and CVs to different thermodynamic/ kinetic observables.
- fes_bias(plot=True, max_bias=None, fs=None, choice='gridbias', n=None, start_r=0, rbf_kernel='thin_plate_spline', rbf_degree=None, smoothing_threshold=0.0019043995880196139, samples_per_bin=500, **plot_kwargs)[source]#
IMLCV.base.bias module#
- class IMLCV.base.bias.Bias(collective_variable, start=None, step=None)[source]#
-
base class for biased MD runs.
- compute_from_cv(cvs, diff=False, jit=True)[source]#
compute the energy and derivative.
If map==False, the cvs are assumed to be already mapped
- Return type:
- compute_from_system_params(sp, gpos=False, vir=False, nl=None, jit=True)[source]#
Computes the bias, the gradient of the bias wrt the coordinates and the virial.
- Return type:
- class IMLCV.base.bias.CompositeBias(biases, fun=<function sum>)[source]#
Bases:
BiasClass that combines several biases in one single bias.
- class IMLCV.base.bias.Energy[source]#
Bases:
BC- property sp: SystemParams[source]#
IMLCV.base.rounds module#
- class IMLCV.base.rounds.RoundInformation(round, valid, num, num_vals, tic, folder, name_bias=None, name_md=None)[source]#
Bases:
object
- class IMLCV.base.rounds.Rounds(folder='output', copy=True, new_folder=True)[source]#
Bases:
ABC