Source code for metafalcon.cvs.cv_template

# -*- coding: utf-8 -*-

"""Contains a class for using TEMPLATE as a CV."""

import numpy as np

from .cv import cv

[docs]class cv_template(cv): """ TEMPLATE as collective variable, inherits from `metafalcon.cvs.cv.cv`. Parameters ---------- idx : int index of collective variable in the input file symbols : list of str atomic symbols of the molecule **kwargs : See below Keyword Arguments ----------------- arg : int argument corresponding to TEMPLATE CV """ def __init__(self, idx, symbols, **kwargs): """Construct bond length CV object.""" cv.__init__(self, idx, symbols, **kwargs) # standard plotting options self.x = np.linspace(0.5, 2.5, 200) self.ticks = None # unit conversion self.au2unit = 1.0 self.reset_width() # arguments should be saved in the following way self.arg = self.get_kwargs("arg")
[docs] def set_s_and_ds(self, coords): """ Calculate TEMPLATE value and its gradient for the current set of coordinates. Parameters ---------- coords : np.2darray cartesian coordinates of the molecule (shape: (N, 3)) """ template = 1.0 dtemplate = np.zeros_like(coords) self.s = template self.ds_dr = dtemplate