ic
#
Compute internal coordinate representations of molecules.
Notes
- This module is heavily based off of the
internalmodule ofgeomeTRIC. See the LICENSE-3RD-PARTY for license information.
Classes:
-
ICType–The supported primitive internal coordinate types.
-
IC–A base class for internal coordinate representations.
-
RIC–A redundant internal coordinate representation.
-
DLC–A delocalized internal coordinates representation
Attributes:
-
ICDict–A dictionary of tensors partitioned by internal coordinate type.
-
IC_ORDER–The order that internal coordinate types appear in a flattened representation.
-
ConstraintDict–A dictionary of constraints for each type of internal coordinate. It is of the form
ICDict
module-attribute
#
ICDict = dict[ICType, Tensor]
A dictionary of tensors partitioned by internal coordinate type.
IC_ORDER
module-attribute
#
The order that internal coordinate types appear in a flattened representation.
ConstraintDict
module-attribute
#
ConstraintDict = dict[ICType, tuple[Tensor, Tensor]]
A dictionary of constraints for each type of internal coordinate. It is of the form
{ic_type: (idxs, values)} where idxs is a tensor of the indices of the atoms
involved in the internal coordinates to constrain and values is a tensor of the
values of that the internal coordinate should be constrained at.
ICType
#
Bases: Enum
The supported primitive internal coordinate types.
IC
dataclass
#
Bases: ABC
A base class for internal coordinate representations.
Methods:
-
compute_b–Computes jacobian of the internal coordinates with respect to the cartesian
-
compute_q–Maps a set of cartesian coordinates to a set of internal coordinates.
-
compute_dq–Compute the difference between two sets of coordinates in terms of internal
-
guess_hess_q–Build an approximate Hessian that roughly follows Schlegel's guidelines.
-
dq_to_x–Perturb a set of cartesian coordinates by a set of internal coordinate
Attributes:
idxs
instance-attribute
#
idxs: ICDict
The indices of the atoms involved in each type of internal coordinate.
compute_b
abstractmethod
#
Computes jacobian of the internal coordinates with respect to the cartesian coordinates.
This is the B matrix in the Pulay-Fogarasi-Pulay approach.
Parameters:
-
coords_x(Tensor) –The coordinates with
shape=(n_atoms, 3).
Returns:
-
Tensor–The jacobian, with
shape=(n_ic, n_atoms * 3).
Source code in tico/ic.py
compute_q
abstractmethod
#
Maps a set of cartesian coordinates to a set of internal coordinates.
Parameters:
-
coords_x(Tensor) –The coordinates with
shape=(n_atoms, 3).
Returns:
-
Tensor–The flattened internal coordinate values with
shape=(n_ic,).
Source code in tico/ic.py
compute_dq
abstractmethod
#
Compute the difference between two sets of coordinates in terms of internal coordinates.
Parameters:
-
coords_x_a(Tensor) –The first coordinates with
shape=(n_atoms, 3). -
coords_x_b(Tensor) –The second coordinates with
shape=(n_atoms, 3).
Returns:
-
Tensor–The internal coordinate displacements with
shape=(n_ic,).
Source code in tico/ic.py
guess_hess_q
abstractmethod
#
Build an approximate Hessian that roughly follows Schlegel's guidelines.
Parameters:
-
coords_x(Tensor) –The coordinates with
shape=(n_atoms, 3). -
atomic_nums(Tensor) –The atomic number of each atom with
shape=(n_atoms,).
Returns:
-
Tensor–The approximate Hessian with
shape=(n_ic, n_ic).
Source code in tico/ic.py
dq_to_x
abstractmethod
#
Perturb a set of cartesian coordinates by a set of internal coordinate displacements.
Parameters:
-
coords_x(Tensor) –The coordinates with
shape=(n_atoms, 3). -
dq(Tensor) –The internal coordinate displacements with
shape=(n_ic,).
Returns:
-
tuple[Tensor, Tensor, bool]–The perturbed cartesian (with
shape=(n_atoms, 3)) and internal coordinates (withshape=(n_ic,)), and a boolean indicating whether the perturbation was successful.
Source code in tico/ic.py
RIC
dataclass
#
Bases: IC
A redundant internal coordinate representation.
Methods:
-
from_coords–Projects a set of cartesian coordinates onto a reduced set of delocalized
Attributes:
idxs
instance-attribute
#
idxs: ICDict
The indices of the atoms involved in each type of internal coordinate.
from_coords
classmethod
#
from_coords(coords_x: Tensor, bond_idxs: Tensor) -> RIC
Projects a set of cartesian coordinates onto a reduced set of delocalized internal coordinates.
Parameters:
-
coords_x(Tensor) –The coordinates with
shape=(n_atoms, 3). -
bond_idxs(Tensor) –The atoms involved in each bond with
shape=(n_bonds, 2).
Returns:
-
RIC–The internal coordinate representation.
Source code in tico/ic.py
DLC
dataclass
#
Bases: IC
A delocalized internal coordinates representation
Methods:
-
from_coords–Projects a set of cartesian coordinates onto a reduced set of delocalized
-
compute_constr_delta–Compute the difference between the current internal coordinate values and the
-
augment_hess_q–Augment a hessian with extra dimensions corresponding to the constrained
-
project_grad_x–Project out the components of the gradient along the constrained degrees of
Attributes:
-
idxs(ICDict) –The indices of the atoms involved in each type of internal coordinate.
-
v(Tensor) –The projection of RIC onto the non-redundant basis.
-
constr(ConstraintDict | None) –Constraints on the internal coordinates.
idxs
instance-attribute
#
idxs: ICDict
The indices of the atoms involved in each type of internal coordinate.
constr
class-attribute
instance-attribute
#
constr: ConstraintDict | None = None
Constraints on the internal coordinates.
from_coords
classmethod
#
from_coords(
coords_x: Tensor,
bond_idxs: Tensor,
constr: ConstraintDict | None = None,
) -> DLC
Projects a set of cartesian coordinates onto a reduced set of delocalized internal coordinates.
Parameters:
-
coords_x(Tensor) –The coordinates with shape=(n_atoms, 3).
-
bond_idxs(Tensor) –The atoms involved in each bond with shape=(n_bonds, 2).
-
constr(ConstraintDict | None, default:None) –A dictionary of constraints on the internal coordinates. This dictionary should be of the form
constr[ic_type] = (idxs, values)whereidxsis a tensor of the indices of the atoms involved in the internal coordinate andvaluesis a tensor of the values to constrain the internal coordinate at.
Returns:
-
DLC–The internal coordinate representation.
Source code in tico/ic.py
compute_constr_delta
#
Compute the difference between the current internal coordinate values and the constrained values.
Source code in tico/ic.py
augment_hess_q
#
Augment a hessian with extra dimensions corresponding to the constrained DoF.
Parameters:
-
coords_x(Tensor) –The coordinates with
shape=(n_atoms, 3). -
grad_q(Tensor) –The gradient of the internal coordinates with
shape=(n_ic,). -
hess_q(Tensor) –The hessian of the internal coordinates with
shape=(n_ic, n_ic).
Source code in tico/ic.py
project_grad_x
#
Project out the components of the gradient along the constrained degrees of freedom.