sponge.metrics.MetricCV

View Source On Gitee
class sponge.metrics.MetricCV(colvar: Colvar)[source]

Metric for collective variables (CVs)

get_unit(units: Units = None)[source]

Return unit of the collective variables.

Parameters

units (Units, optional) – Units of the collective variables. Default: None.

update(coordinate: Tensor, pbc_box: Tensor = None, energy: Tensor = None, force: Tensor = None, potentials: Tensor = None, total_bias: Tensor = None, biases: Tensor = None)[source]

update the state information of the system.

Parameters
  • coordinate (Tensor) – Tensor of shape (B, A, D). Data type is float. Position coordinate of atoms in system.

  • pbc_box (Tensor, optional) – Tensor of shape (B, D). Data type is float. Tensor of PBC box. Default: None.

  • energy (Tensor, optional) – Tensor of shape (B, 1). Data type is float. Total potential energy of the simulation system. Default: None.

  • force (Tensor, optional) – Tensor of shape (B, A, D). Data type is float. Force on each atoms of the simulation system. Default: None.

  • potentials (Tensor, optional) – Tensor of shape (B, U). Data type is float. Original potential energies from force field. Default: None.

  • total_bias (Tensor, optional) – Tensor of shape (B, 1). Data type is float. Total bias energy for reweighting. Default: None.

  • biases (Tensor, optional) – Tensor of shape (B, V). Data type is float. Original bias potential energies from bias functions. Default: None.

Note

  • B: Batchsize, i.e. number of walkers in simulation.

  • A: Number of atoms of the simulation system.

  • D: Dimension of the space of the simulation system. Usually is 3.

  • U: Number of potential energies.

  • V: Number of bias potential energies.

Supported Platforms:

Ascend GPU

Examples

>>> from mindspore import Tensor
>>> from sponge.colvar import Distance
>>> from sponge.metrics import MetricCV
>>> cv = Distance([0,1])
>>> coordinate = Tensor([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]])
>>> metric = MetricCV(cv)
>>> metric.update(coordinate)
>>> print(metric.eval())
[1.]