ai2_kit.algorithm.reweighting module#

class ai2_kit.algorithm.reweighting.ReweightingTool[source]#

Bases: object

load_colvar(*path_or_glob: str)[source]#

load PLUMED COLVAR files and concatenate into a single DataFrame you have to ensure the COLVAR data is aligned with energies

Parameters:

path_or_glob – path or glob pattern to locate data path

load_energy(*path_or_glob: str, tag: str)[source]#

read baseline data as dpdata.LabeledSystem

Parameters:
  • path_or_glob – path or glob pattern to locate data path

  • tag – a string tag to distinguish data, it is suggested to use baseline and target

reweighting(cv: str, bias: str, temp: float, grid_size=0.01, save_fig_to: str | None = None, save_json_to: str | None = None, baseline_tag='baseline', target_tag='target')[source]#

run reweighting against loaded data

Parameters:
  • cv – name of collective variable columns, for example d1

  • bias – name of bias column, for example opes.bias

  • temp – temperature

  • save_to – save th

ai2_kit.algorithm.reweighting.compute_fes(cvs: ndarray, bias: ndarray, temp: float, grid=None, w=1, kB=0.0083144621, grid_size=100j)[source]#

Compute free energy surface from biased sampling data using Gaussian KDE Support 1D and 2D collective variables

Parameters:
  • cv – collective variable

  • bias – bias potential

  • temp – temperature

  • grid – grid points, if None, will use grid_size to generate automatically

  • w – weights

  • kB – Boltzmann constant

  • grid_size – grid size in np.mgrid style

Returns:

free energy

ai2_kit.algorithm.reweighting.compute_kde_weight(baseline_energy: ndarray, target_energy: ndarray, temp: float, kB=0.0083144621, ev_to_kjmol=96.4853365)[source]#

Compute KDE weights for reweighting

Parameters:
  • baseline_energy – baseline energy in eV, it’s the output of DeepMD evaluation

  • target_energy – target energy in eV, it’s the output of DeepMD evaluation

ai2_kit.algorithm.reweighting.load_dp_energy(*path_or_glob: str)[source]#

load dpdata energy data from npy files

Parameters:

path_or_glob – path or glob pattern to locate data path, for example dpdata/**/energy.npy