tqchem.batframe =============== .. py:module:: tqchem.batframe Classes ------- .. autoapisummary:: tqchem.batframe.Bond tqchem.batframe.Angle tqchem.batframe.Dihedral tqchem.batframe.InversionDihedral tqchem.batframe.BATFrame Functions --------- .. autoapisummary:: tqchem.batframe.bond_mask tqchem.batframe.angle_mask tqchem.batframe.dihedral_mask tqchem.batframe.masked_coordinate tqchem.batframe.is_proper_dihedral tqchem.batframe.is_improper_dihedral tqchem.batframe.torsion_from_bond tqchem.batframe.rotatable_bonds tqchem.batframe.xyz_to_bat tqchem.batframe.bat_to_xyz tqchem.batframe.improper_dihedral_path_ring tqchem.batframe.get_dihedral_path tqchem.batframe.bat_component tqchem.batframe.nitrogen_inversion Module Contents --------------- .. py:class:: Bond Bases: :py:obj:`tuple` Class representing a bond between two atoms based on the tuple class a bond is described by the uid of the 2 atoms involved .. attribute:: tuple containing uid of atom 0 and atom 1 .. py:function:: bond_mask(bond: Bond, open_graph: networkx.Graph) -> list[int] List of atom indices that should be changed together with the given bond The mask should contain the last atom of the bond (the one moved) and the connected atoms that rotate with it. This mask is passed to set_bond of ase.Atoms .. py:class:: Angle Bases: :py:obj:`tuple` Class representing an angle between three atoms based on the tuple class an angle is described by the indices of the 3 atoms involved .. attribute:: tuple containing uids of atom0 to atom2 .. py:function:: angle_mask(angle: Angle, open_graph: networkx.Graph) -> list[int] List of atom indices that should change together with the given angle The mask should contain the last atom of the angle (the one moved) and the connected atoms that should move with it. This mask is passed to set_angle of ase.Atoms .. py:class:: Dihedral Bases: :py:obj:`tuple` Class representing an dihedral/torsion angle between four atoms based on the tuple class a dihedral is described by the indices of the 4 atoms involved .. attribute:: tuple containing uids of atom0 to atom3 .. py:class:: InversionDihedral Bases: :py:obj:`Dihedral` Class representing a dihedral used for Nitrogen inversion Dummy class to make Dihedrals used for nitrogen inversion distinguishable and to save the 2 dihedral values defining the "normal" and "inverted" state .. py:function:: dihedral_mask(dih: Dihedral, open_graph: networkx.Graph) -> list[int] Get a list of atom indices that should rotate together with the given dihedral The mask should contain the atom that is rotated around which we rotate and the connected atoms that rotate with it. This mask is passed to set_dihedral of ase.Atoms .. py:function:: masked_coordinate(coordinate: Bond | Angle | Dihedral, open_graph: networkx.Graph) -> Bond | Angle | Dihedral Return copy of coordinate containing its appropriate mask .. py:class:: BATFrame Bases: :py:obj:`dict` Class/Dictionary storing the bonds, angles and dihedrals and their values For a given set of atoms this class contains the information required construct a conformer or a frame of an MD trajectory. Torsions are implemented as Dihedrals with a mask rotating all atoms attached to the end of a given bond. .. method:: angles(self): return dictionary relating the angles of the frame to their size .. method:: bonds(self): return dictionary relating the bonds of the frame to their lengths .. method:: dihedrals(self): return dictionary relating the dihedrals of the frame to their size .. method:: copy(self): return a copy of the BATFrame .. py:method:: angles() -> BATFrame Return dictionary of all angles and their sizes .. py:method:: bonds() -> BATFrame Return dictionary of all bonds and their lengths .. py:method:: dihedrals() -> BATFrame Return dictionary of all dihedrals and their sizes .. py:method:: copy() -> BATFrame Return copy of the BATFrame .. py:method:: torsions_from_bonds(bonds: list[tuple[int, int]], molecule: tqchem.molgraph.MolecularSystem, component: list[int]) -> BATFrame Find torsions from list of bonds .. py:method:: variable_coordinates(molecule: tqchem.molgraph.MolecularSystem, atom_order: list[int], component: list[int]) -> BATFrame Determine rotatable bonds and collect torsions .. py:method:: constant_coordinates(molecule: tqchem.molgraph.MolecularSystem) -> BATFrame Determine constant coordinates These coordinates have to be reset after changing variable bonds. This includes for example bond lengths and angles .. py:attribute:: grid :type: _typeshed.Incomplete .. py:method:: make_grid(graph: networkx.Graph, shift_by_reference: bool = False) -> None Discretize all torsions in the frame .. py:method:: evaluate_grid(indices: list[int]) -> BATFrame Evaluate the frame at a given grid index .. py:method:: grid_range() -> list[range] Return the grid range for all torsions in the frame .. py:method:: closest_gridpoint(molecule: tqchem.molgraph.MolecularSystem) -> list[int] Return the gridpoint most similar to the provided molecule .. py:method:: __add__(value: float) -> BATFrame .. py:method:: __sub__(value: float) -> BATFrame .. py:function:: is_proper_dihedral(dihedral: Dihedral, graph: networkx.Graph) -> bool Does a dihedral represent a rotation around an actual bond .. py:function:: is_improper_dihedral(dihedral: Dihedral, graph: networkx.Graph) -> bool Does a dihedral represent a rotation around an actual bond .. py:function:: torsion_from_bond(bond: Bond, frame: BATFrame, graph: networkx.Graph) -> dict[Dihedral, float] Get a Dihedral that rotates the subsituents of an entire bond The rotation around a bond is achieved by adding all substituents of the second atom of the bond to a mask such that they are rotated together :param bond: Bond for which dihedrals should be found :type bond: Bond :param frame: Dictionary mapping Bonds, Angles, Dihedrals to values :type frame: BATFrame :param graph: Open graph representing the molecule :type graph: nx.Graph :rtype: dict[Dihedral, float] .. py:function:: rotatable_bonds(graph: networkx.Graph) -> list[tuple[int, int]] Determine rotatable bonds from graph representation of molecule .. py:function:: xyz_to_bat(mol: tqchem.molgraph.MolecularSystem, frame: BATFrame) -> BATFrame Transform XYZ to BAT coordinates :param mol: Molecule as represented in tqchem :type mol: MolecularSystem :param frame: BATFrame specifying the atoms involved in the BATcoordinates :type frame: BATFrame :returns: **frame** -- frame with overwritten values for the BATCoordinates :rtype: BATFrame .. py:function:: bat_to_xyz(mol: tqchem.molgraph.MolecularSystem, frame: BATFrame) -> tqchem.molgraph.MolecularSystem Transform BAT to XYZ coordinates :param mol: Molecule as represented in tqchem :type mol: MolecularSystem :param frame: Internal coordinates (defined by atom indices) and their values :type frame: BATFrame :returns: **new_molecule** -- Molecule with geometry updated based on the BATFrame :rtype: MolecularSystem .. py:function:: improper_dihedral_path_ring(cycle: tuple[int, Ellipsis], connecting_atom: int) -> list[int] Get path for improper dihedral angle in a ring .. py:function:: get_dihedral_path(component: tuple[int, Ellipsis], component_sweep: list[tuple[int, Ellipsis]], molgraph: tqchem.molgraph.MolecularSystem, atom: int, root: int, improper_ring_dihedral: bool = True) -> list[int] Get path to create dihedral angle for a given atom from MolGraph Based on a tree graph, the path to create a dihedral angle for a given atom is determined. :param component: atoms for the component of the whole molecule :type component: tuple[int, ...] :param component_sweep: list of components :type component_sweep: list[tuple[int, ...] :param molgraph: Molecular graph and ase.Atoms object :type molgraph: MolecularSystem :param atom: atom to which the dihedral path leads :type atom: int :param root: root of the path :type root: int :param improper_ring_dihedral: if True, the dihedral path for a ring uses improper dihedral :type improper_ring_dihedral: bool :returns: * *list[int]* -- path to create dihedral angles for a given atom * **@todo** (*component and atom only used as component[atom] so we could maybe avoid both arguments?*) -- is atom an index of the atom in the component? .. py:function:: bat_component(mol: tqchem.molgraph.MolecularSystem, component: list[int] = None) -> BATFrame Constructor for a BATFrame with values set to None mol: MolecularSystem Molecular graph and ase.Atoms object component: list[int] atoms for which bat system will be constructed .. py:function:: nitrogen_inversion(nitrogen: int, normal_torsion: dict[Dihedral, float], molecule: tqchem.molgraph.MolecularSystem) -> None | dict[InversionDihedral, float] Return dihedral describing nitrogen inversion Assuming we have the following molecule: OCN(C)CC The normal torsion is the rotation around this bond: OC-NCC We can describe nitrogen inversion by rotating the methyl group at the nitrogen atom (OC-N(C)) separately. This function returns the Torsion (i.e. {Dihedral: value}) that describes this nitrogen inversion. Note, that the inversion dihedral needs to be set before the "normal" dihedral because otherwise we would overwrite the methyl group set by the normal dihedral so that we would rotate both residues of the Nitrogen atom independently. None is returned if the nitrogen atom is symmetrically coordinated, as for example in -NH2, or only participates in 1 or 2 bonds.