sponge.colvar.Colvar

View Source On Gitee
class sponge.colvar.Colvar(shape: Tuple[int] = (), periodic: Union[bool, List[bool]] = False, use_pbc: bool = None, name: str = 'colvar', unit: str = None, dtype: type = ms.float32)[source]

Base class for generalized collective variables (CVs) s(R).

In mathematics, CVs s(R) are defined as a low dimensional function of the atomistic coordinate R of the simulation system, which should refer to the variable describing the slow motion in the process of interest.

In MindSPONGE, Colvar Cell is the base class for "generalized" CVs. A narrow CV is generally a vector, i.e., its rank (ndim) is 1. For example, a CV of shape (S). Whereas a Colvar Cell can be of higher rank (ndim), for example, a Colvar of shape (S_1, S_2, …, S_n)

For a Colvar, multiple values can be calculated using multiple sets of coordinates. Therefore, for a Colvar Cell of shape (S_1, S_2, … , S_n), a calculation using the B set of atomic coordinates represented by a tensor with shape (B, A, D) yields a Tensor with shape (B, S_1, S_2, … , S_n). B means Batchsize, i.e. number of walkers in simulation. A means Number of colvar in system. D means Dimension of the simulation system. Usually is 3. {S_i} means Dimensions of the collective variables.

Reference:

Yang, Y. I.; Shao, Q.; Zhang, J.; Yang, L.; Gao, Y. Q. Enhanced Sampling in Molecular Dynamics [J]. The Journal of Chemical Physics, 2019, 151(7): 070902.

Parameters
  • shape (Tuple) – Shape of collective variables. Default: ()

  • periodic (bool) – Whether the collective variables is periodic. Default: False.

  • use_pbc (bool) – Whether to use periodic boundary condition. If None is given, it will determine whether to use periodic boundary conditions based on whether the pbc_box is provided. Default: None.

  • name (str) – Name of the collective variables. Default: 'colvar'

  • unit (str) – Unit of the collective variables. NOTE: This is not the Units Cell that wraps length and energy. Default: None.

  • dtype (type) – Data type of the collective variables. Default: float32

Supported Platforms:

Ascend GPU

property all_periodic: bool

whether all dimensions are periodic

property any_periodic: bool

whether any dimension is periodic

property dtype: type

data type of the collective variables.

Returns

type, data type of the Colvar

get_unit(units: Units = None)[source]

return unit of the collective variables

property name: str

name of the collective variables

Returns

str, name of the CV

property ndim: int

rank (number of dimensions) of the collective variables

Returns

int, rank of the CV

property periodic: mindspore.common.tensor.Tensor

return a Tensor of data type bool to indicate whether the CV is periodic or not

reshape(input_shape: tuple)[source]

rearranges the shape

set_name(name: str)[source]

set the name of the collective variables

set_pbc(use_pbc: bool)[source]

set whether to use periodic boundary condition

property shape: tuple

shape of the collective variables (S_1, S_2, …, S_n)

Returns

shape (tuple), Shape of the Colvar

property use_pbc: bool

whether to use periodic boundary condition

Returns

bool, whether to use periodic boundary condition.

classmethod vector_in_pbc(vector: Tensor, pbc_box: Tensor)[source]

Make the difference of vectors at the range from -0.5 box to 0.5 box