tqchem.internal_coordinates¶
Classes¶
Collection of internal coordinates for components of a system. |
|
Grid representation of the conformers of a system |
Functions¶
|
Converts dictionary values (Iterables) into a one-dimensional list |
|
Assign list of indices to the variables of the components |
|
Transform internal coordinates to xyz coordinates. |
|
Transform xyz coordinates to internal coordinates. |
Module Contents¶
- class tqchem.internal_coordinates.InternalCoordinates¶
Bases:
dict
Collection of internal coordinates for components of a system.
Dictionary mapping tuples of atom indices to a representation of internal coordinates, i.e. BATFrames or PuckeringFrames.
For conformer search we do not want to alter all coordinates, so Internal coordinates can be filtered for relevant ones (filter_subset) and there are coordinates that we don’t want to alter, but we need to make sure that they are correctly set (constant_coordinates)
- update(coords: dict) None ¶
Update internal coordinates with (subset of) internal coordinates
- combine(coords: dict) None ¶
Combine internal coordinates with (subset of) internal coordinates
- variable_coordinates(molecule: tqchem.molgraph.MolecularSystem, atom_order: list[int]) InternalCoordinates ¶
Get subset of coordinates which are relevant/varied during conformer search
atom_order is a list of atom ids in the graph and determines the order in which the variables will be listed in the subset
- constant_coordinates(molecule: tqchem.molgraph.MolecularSystem) InternalCoordinates ¶
Get subset of coordinates which need to stay constant during conformer search
This entails for example improper dihedrals for bonds going into and out of a ring, as well as bond lengths and bond angles
- make_grid(**kwargs) None ¶
Make a discrete grid for each coordinate of each component.
- evaluate_grid(indices: dict[tuple[int, Ellipsis], list[int]]) InternalCoordinates ¶
Evaluate indices on the grids and update the internal coordinates with the new values
- indices: dict[tuple[int, …], list[int]
Maps atom indices of the components to a list of indices for each coordinate in the component
- grid_range() dict[tuple[int, Ellipsis], list[range]] ¶
Return grid ranges for each component
- class tqchem.internal_coordinates.MolecularGrid(molecule: tqchem.molgraph.MolecularSystem, shift_by_reference: bool = False, **bond_grids)¶
Grid representation of the conformers of a system
- molecule¶
Graph representation of the molcule and interface to ase to modify the atom positions
- Type:
Molecular System
- variables¶
Subset of the InternalCoordinates of the system (mainly Dihedrals and puckering coordinates) which are represented on the grid, to perform Conformer Search.
- Type:
- constant_coordinates¶
Subset of InternalCoordinates (Bonds, Angles, improper Dihedrals used for the connection of Rings) which should not change during the Conformer Search, but need to be set to make sure they remain the same.
- Type:
- __call__:
Return new molecule based on the gridpoints received on input
- shape:
Return range of indices for each element of the Molecular Grid
- n_variables:
Return number of variable elements in the Molecular Grid
- variable_atom_indices:
Return list of the variable elements in the Molecular Grid
- closest_gridpoint:
Get grid point closest to the geometry/molecule system provided on input
- molecule: _typeshed.Incomplete¶
- variables: _typeshed.Incomplete¶
- constant_coordinates: _typeshed.Incomplete¶
- __call__(superidx: list[int]) tqchem.molgraph.MolecularSystem ¶
Construct new molecular system based on the incoming indices
Indices are delinearized to match the structure of the internal coordinates. The variables are updated (e.g. with new dihedral values), combined with the constants, and converted to a new MolecularSystem with xyz coordinates.
- Parameters:
superidx (list[int]) – List of indices, one for each variable coordinate
- shape() list[int] ¶
- n_variables()¶
- variable_atom_indices() list[str] ¶
Convenient way to get string representation of the variables of the grid
- closest_gridpoint(molecule: tqchem.molgraph.MolecularSystem) list[int] ¶
Return the gridpoint most similar to the provided molecule
- tqchem.internal_coordinates.linearize(dictionary: dict[Any, Iterable]) list[Any] ¶
Converts dictionary values (Iterables) into a one-dimensional list
Used to convert a dictionary relating components to a list of ranges for the component’s variables to a list which only contains the ranges
Example: Three components with 2, 1 and 0 dihedrals
>>> dictionary = { (0, 1, 2, 3, 4, 5): [range(0, 12), range(0, 10)], (6, 7, 8, 9): [range(0, 8)], (10): [], } >>> linearize(dictionary) [range(0, 12), range(0, 10), range(0, 8)]
- tqchem.internal_coordinates.indices_to_components(indices: list[int], component_ranges: dict[tuple[int], list[range]])¶
Assign list of indices to the variables of the components
component_ranges is a dict mapping each component to a list containing as many ranges as there are variables in the component. This function returns an equivalent dict, but the ranges are replaced with the indices.
- tqchem.internal_coordinates.internal_to_xyz(molecule: tqchem.molgraph.MolecularSystem, coordinates: InternalCoordinates) tqchem.molgraph.MolecularSystem ¶
Transform internal coordinates to xyz coordinates.
Internal Coordinates can consist of multiple components (BAT, puckering, BAT, …)
- tqchem.internal_coordinates.xyz_to_internal(molecule: tqchem.molgraph.MolecularSystem) InternalCoordinates ¶
Transform xyz coordinates to internal coordinates.
Internal Coordinates can consist of multiple components (BAT, puckering, BAT, …)