Angles

class Angle(atom_a: Atom, atom_b: Atom, atom_c: Atom, angle_type: int, angle_value: float, force_constant: float, format: str = 'gromos')[source]

Bases: object

Represents an angle between three atoms in a molecular system.

Parameters:
  • atom_a (Atom) – The first atom involved in the angle.

  • atom_b (Atom) – The central atom in the angle.

  • atom_c (Atom) – The third atom involved in the angle.

  • angle_type (int) – The type of the angle.

  • angle_value (float) – The value of the angle in degrees.

  • force_constant (float) – The force constant associated with the angle.

Raises:

ValueError – If there are not bonds present between atoms A and B and atoms B and C

clone_angle_changing(from_atom: Atom, to_atom: Atom) Angle[source]

Clone the angle, changing the atom that is being replaced. Used during the polymer.extend() algorithm to copy and modify angles where a new Monomer is joined to the Polymer.

Parameters:
  • from_atom (Atom) – the outgoing Atom, to be replaced

  • to_atom (Atom) – the incoming Atom, will replace the position of the outgoing Atom in this Angle

Raises:

ValueError – if ‘from_atom’ is not in the Angle

Returns:

the new, modified Angle

Return type:

Angle

contains_atom(atom: Atom) bool[source]

Check if this Angle contains a given atom.

Parameters:

atom (Atom) – the Atom you wish to check if it is in this Angle or not

Returns:

True if the Angle contains the given Atom, or False if not.

Return type:

bool

static find_bonds(atom_a: Atom, atom_b: Atom, atom_c: Atom)[source]
static from_atoms(atom_a: Atom, atom_b: Atom, atom_c: Atom)[source]
classmethod from_dict(data, atoms) Angle[source]

Create a new Angle from a dictionary (such as that created with Angle.to_dict()) and list of Atoms. Will retrieve an existing Angle if it already exists between these Atoms.

The structure of the dictionary is as below: {‘atom_a’: self.atom_a.atom_id, ‘atom_b’: self.atom_b.atom_id, ‘atom_c’: self.atom_c.atom_id, ‘angle_type’: self.angle_type, ‘angle_value’: self.angle_value, ‘force_constant’: self.force_constant}

Parameters:
  • data (dict) – dictionary containing data to make an Angle, generate with ‘to_dict()’.

  • atoms (List[Atom]) – list of Atoms. The list may contain more than 3 atoms, as long as the id’s of the three atoms specified in the data dict are present.

Returns:

a new Angle

Return type:

Angle

classmethod from_line(line: str, atoms, format: str = 'gromos') Angle[source]

Class method to construct Angle from the line of an ITP file and a list of all Atom’s present in the topology.

Parameters:
  • line (str) – the ITP file line

  • atoms (List[Atom]) – list of all Atoms in the Topology

  • format (str, defaults to "gromos" for GROMOS forcefields.) – The forcefield the ITP file is formatted as, options are “gromos”, “amber”, “opls” and “charmm”

Returns:

the new Angle

Return type:

Angle

other_atom(atom: Atom) List[Atom][source]

Check if the given Atom is in this Angle and return a list of the other atoms present in this Angle (i.e. discluding ‘atom’).

Parameters:

atom (Atom) – the Atom you wish to check if it is in this Angle or not

Raises:

ValueError – if ‘atom’ is not in this Angle

Returns:

a list of the Atoms in this Angle, not including the Atom provided ‘atom’. None if ‘atom’ is not in this Angle.

Return type:

List[Atom]

remove()[source]

Delete self from all related Dihedrals and Bonds. Used to cleanup and remove attributes during Polymer.extend().

to_dict()[source]