sponge.colvar.Angle

View Source On Gitee
class sponge.colvar.Angle(atoms: AtomsBase = None, atoms_a: AtomsBase = None, atoms_b: AtomsBase = None, atoms_c: AtomsBase = None, vector1: Vector = None, vector2: Vector = None, use_pbc: bool = None, batched: bool = False, keepdims: bool = None, axis: int = - 2, name: str = 'angle')[source]

Colvar for angle.

Parameters
  • atoms (AtomsBase) – Atoms of shape (…, 3, D) to form a angle of shape (…) or (…, 1). Cannot be used with atoms_a or atoms_b. Default: None. D means spatial dimension of the simulation system. Usually is 3.

  • atoms_a (AtomsBase) – Atoms A with shape (…, D) to form a angle of shape (…) or (…, 1). Must be used with atoms_b and atoms_c. Cannot be used with atoms. Default: None.

  • atoms_b (AtomsBase) – Atoms B with shape (…, D) to form a angle of shape (…) or (…, 1). Must be used with atoms_a and atoms_c. Cannot be used with atoms. Default: None.

  • atoms_c (AtomsBase) – Atoms C with shape (…, D) to form a angle of shape (…) or (…, 1). Must be used with atoms_a and atoms_b. Cannot be used with atoms. Default: None.

  • vector1 (Vector) – Vector 1 of shape (…, D) to form of a angle with shape (…) or (…, 1). Must be used with vector2. Cannot be used with Atoms. Default: None.

  • vector2 (Vector) – Vector 2 of shape (…, D) to form of a angle with shape (…) or (…, 1). Must be used with vector1. Cannot be used with Atoms. Default: None.

  • use_pbc (bool) – Whether to calculate distance under periodic boundary condition. Default: None.

  • batched (bool) – Whether the first dimension of the input index in atoms is the batch size. Default: False.

  • keepdims (bool) – Whether to keep the dimension of the last dimension of vector. Default: False.

  • axis (int) – Axis to gather the points from coordinate of atoms. Default: -2

  • name (str) – Name of the Colvar. Default: 'angle'

Supported Platforms:

Ascend GPU

Examples

>>> from sponge import Sponge
>>> from sponge.colvar import Angle
>>> from sponge.callback import RunInfo
>>> cv_angle = Angle([0, 1, 2])
>>> # system is the Molecule object defined by user.
>>> # energy is the Energy object defined by user.
>>> # opt is the Optimizer object defined by user.
>>> md = Sponge(system, potential=energy, optimizer=opt, metrics={'angle': cv_angle})
>>> run_info = RunInfo(1000)
>>> md.run(2000, callbacks=[run_info])
[MindSPONGE] Started simulation at 2024-02-19 15:43:11
[MindSPONGE] Step: 1000, E_pot: -117.30916, angle: 1.9461793
[MindSPONGE] Step: 2000, E_pot: -131.60872, angle: 1.9336755
[MindSPONGE] Finished simulation at 2024-02-19 15:44:03
[MindSPONGE] Simulation time: 51.27 seconds.