sponge.colvar.Torsion

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

Colvar for torsional (dihedral) angle.

Parameters
  • atoms (AtomsBase) – Atoms of shape (…, 4, D) to form a torsional 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 torsional angle of shape (…) or (…, 1). Must be used with atoms_b, atoms_c and atoms_d. Cannot be used with atoms. Default: None.

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

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

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

  • vector1 (Vector) – Vector 1 of shape (…, D) to form of a torsional 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 torsional angle with shape (…) or (…, 1). Must be used with vector1. Cannot be used with Atoms. Default: None.

  • axis_vector (Vector) – Axis vector of shape (…, D) to form of a torsional 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: 'torsion'.

Supported Platforms:

Ascend GPU

Examples

>>> from sponge import Sponge
>>> from sponge.colvar import Torsion
>>> from sponge.callback import RunInfo
>>> cv_dihedral = Torsion([0, 1, 2, 3])
>>> # 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={'dihedral': cv_dihedral})
>>> 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, dihedral: 2.1488183
[MindSPONGE] Step: 2000, E_pot: -131.60872, dihedral: 2.143513
[MindSPONGE] Finished simulation at 2024-02-19 15:44:03
[MindSPONGE] Simulation time: 51.27 seconds.