PyTorch#
Integral Driver: PyTorch#
Pytorch-based integral implementations.
Drivers#
Driver: PyTorch#
Collection of PyTorch-based integral drivers.
- class dxtb._src.integral.driver.pytorch.driver.BaseIntDriverPytorch(*args, **kwargs)[source]#
Bases:
PytorchImplementation,IntDriverPyTorch-based integral driver.
Note
Currently, only the overlap integral is implemented.
- abstract setup_eval_funcs()[source]#
Specification of the overlap (gradient) evaluation functions (eval_ovlp and eval_ovlp_grad).
- Return type:
- eval_ovlp: OverlapFunction#
Function for overlap calculation.
- eval_ovlp_grad: OverlapFunction#
Function for overlap gradient calculation.
- family: Literal['PyTorch']#
Label for integral implementation family.
- ihelp: IndexHelper#
Helper class for indexing.
- numbers: Tensor#
Atomic numbers of the atoms in the system.
- par: ParamModule#
Representation of parametrization of xTB method.
- class dxtb._src.integral.driver.pytorch.driver.IntDriverPytorch(*args, **kwargs)[source]#
Bases:
BaseIntDriverPytorchPyTorch-based integral driver.
The overlap evaluation function implements a custom backward function containing the analytical overlap derivative.
Note
Currently, only the overlap integral is implemented.
- setup_eval_funcs()[source]#
Specification of the overlap (gradient) evaluation functions (eval_ovlp and eval_ovlp_grad).
- Return type:
- eval_ovlp: OverlapFunction#
Function for overlap calculation.
- eval_ovlp_grad: OverlapFunction#
Function for overlap gradient calculation.
- family: Literal['PyTorch']#
Label for integral implementation family.
- ihelp: IndexHelper#
Helper class for indexing.
- numbers: Tensor#
Atomic numbers of the atoms in the system.
- par: ParamModule#
Representation of parametrization of xTB method.
- class dxtb._src.integral.driver.pytorch.driver.IntDriverPytorchLegacy(*args, **kwargs)[source]#
Bases:
BaseIntDriverPytorchPyTorch-based integral driver with old loop-based version of the full matrix build. The newer version partially vectorizes over the centers of the orbitals (unique pair algorithm).
Note
Currently, only the overlap integral is implemented.
- setup_eval_funcs()[source]#
Specification of the overlap (gradient) evaluation functions (eval_ovlp and eval_ovlp_grad).
- Return type:
- family: Literal['PyTorch']#
Label for integral implementation family.
- ihelp: IndexHelper#
Helper class for indexing.
- numbers: Tensor#
Atomic numbers of the atoms in the system.
- par: ParamModule#
Representation of parametrization of xTB method.
- class dxtb._src.integral.driver.pytorch.driver.IntDriverPytorchNoAnalytical(*args, **kwargs)[source]#
Bases:
BaseIntDriverPytorchPyTorch-based integral driver without analytical derivatives.
Note
Currently, only the overlap integral is implemented.
- setup_eval_funcs()[source]#
Specification of the overlap (gradient) evaluation functions (eval_ovlp and eval_ovlp_grad).
- Return type:
- family: Literal['PyTorch']#
Label for integral implementation family.
- ihelp: IndexHelper#
Helper class for indexing.
- numbers: Tensor#
Atomic numbers of the atoms in the system.
- par: ParamModule#
Representation of parametrization of xTB method.
Implementations#
Implementation: Overlap#
PyTorch-based overlap implementations.
- class dxtb._src.integral.driver.pytorch.overlap.OverlapPytorch(device=None, dtype=None, uplo='l', cutoff=50.0)[source]#
Bases:
OverlapIntegral,IntegralPytorchOverlap integral from atomic orbitals.
Use the
build()method to calculate the overlap integral. The returned matrix uses a custom autograd function to calculate the backward pass with the analytical gradient. For the full gradient, i.e., a matrix of shape(..., norb, norb, 3), theget_gradient()method should be used.- Parameters:
device (torch.device | None)
dtype (torch.dtype | None)
uplo (Literal['n', 'u', 'l'])
- build(driver)[source]#
Overlap calculation of unique shells pairs, using the McMurchie-Davidson algorithm.
- Return type:
- Parameters:
driver (BaseIntDriverPytorch) – The integral driver for the calculation.
- Returns:
Overlap integral matrix of shape
(..., norb, norb).- Return type:
Tensor
- Parameters:
driver (BaseIntDriverPytorch)
- get_gradient(driver)[source]#
Overlap gradient calculation of unique shells pairs, using the McMurchie-Davidson algorithm.
- Return type:
- Parameters:
driver (BaseIntDriverPytorch) – Integral driver for the calculation.
- Returns:
Overlap gradient of shape
(..., norb, norb, 3).- Return type:
Tensor
- Parameters:
driver (BaseIntDriverPytorch)
- cutoff: Tensor | float | int | None#
Real-space cutoff for integral calculation in Bohr. Defaults to constants.defaults.INTCUTOFF.
- family: Literal['PyTorch']#
Label for integral implementation family.
- uplo: Literal['n', 'u', 'l']#
Whether the matrix of unique shell pairs should be create as a triangular matrix (l: lower, u: upper) or full matrix (n). Defaults to l (lower triangular matrix).