Skip to content

Forces and properties¤

Analytic nuclear gradients and the response-property layer. Properties run their own SCF from (mol, xc) and take a grid=becke(...) spec.

dftax.ks.forces.forces(mol: Molecule, xc: XCFunctional, result: KSResult | tuple | Array, *, grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, dispersion=None) -> Float[Array, 'n_atom 3'] ¤

Nuclear forces F = -dE/dR (Ha/Bohr), (natom, 3).

The derivative of the energy at the converged density, by automatic differentiation; it includes the grid weight and basis function (Pulay) terms.

Parameters:

Name Type Description Default
mol Molecule

a :class:~dftax.system.molecule.Molecule (a PySCF Mole is not accepted), or a periodic :class:~dftax.pbc.cell.Cell.

required
xc XCFunctional

the exchange-correlation functional of the calculation.

required
result KSResult | tuple | Array

the converged :class:~dftax.ks.scf.KSResult, or the occupied orbital coefficients per spin channel.

required
grid Becke | None

the :func:~dftax.grid.becke spec of the calculation (explicit point grids cannot move with the nuclei); for a Cell, its :func:~dftax.pbc.build.uniform grid.

None
coulomb ExactSpec | DFSpec | None

the backend of the calculation: :func:~dftax.ks.terms.df (the default) or :func:~dftax.ks.terms.exact without stream or screen. df(chunk="auto") stores the 3-center tensor when it fits and streams otherwise; chunk=None always stores it, an int always streams. Hybrids with fractional occupations (smearing) need chunk=None. A Cell takes no coulomb.

None
dispersion D3BJSpec | D4Spec | None

the :func:~dftax.energy.d3.d3bj or :func:~dftax.energy.d4.d4 spec of the calculation.

None
Example
res = scf(KS(mol, PBE0(), grid=becke(75, 302)))
F = forces(mol, PBE0(), res, grid=becke(75, 302))

dftax.ks.properties.dipole(mol, xc: XCFunctional, *, origin=(0.0, 0.0, 0.0), debye: bool = False, grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, **scf_kw) -> Float[Array, 3] ¤

Permanent electric dipole moment μ (atomic units, or Debye if debye).

μ = Σ_A Z_A (R_A − origin) − Tr(P · r) from the converged density. For a neutral molecule the result is independent of origin.

dftax.ks.properties.polarizability(mol, xc: XCFunctional, *, method: str = 'fd', field: float = 0.002, origin=(0.0, 0.0, 0.0), grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, **scf_kw) -> Float[Array, '3 3'] ¤

Static dipole polarizability tensor α_ij = ∂μ_i/∂E_j (atomic units).

method="fd" (default): central finite difference of the dipole under a uniform field of strength field (robust; one SCF per ±component). method="analytic": exact coupled-perturbed KS response via implicit differentiation of the SCF fixed point (:func:~dftax.ks.implicit.implicit_density), a single jax.jacobian through the converged density, no field stepping. Returned symmetrized.

dftax.ks.properties.hessian(mol, xc, *, method: str = 'fd', step: float = 0.001, origin=(0.0, 0.0, 0.0), grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, cg_iters: int = 64, **scf_kw) -> Float[Array, 'n n'] ¤

Nuclear Hessian ∂²E/∂R_A∂R_B (Ha/Bohr², shape (3N, 3N)).

method="fd" (default): central finite differences of the analytic forces with displacement step (6N SCF solves). method="analytic": coupled-perturbed response at one tightly converged density (3N conjugate-gradient solves of up to cg_iters iterations); restricted and unrestricted, with stored Coulomb integrals (exact() or df(chunk=None)).

dftax.ks.properties.vibrations(mol, xc, *, hess=None, step: float = 0.001, grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, **scf_kw) -> Vibrations ¤

Harmonic vibrational analysis (see :class:Vibrations).

dftax.ks.properties.ir_spectrum(mol, xc, *, step: float = 0.001, origin=(0.0, 0.0, 0.0), grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, **scf_kw) -> IRSpectrum ¤

Harmonic IR spectrum from A_k ∝ |dμ/dQ_k|² (see :class:IRSpectrum).

dftax.ks.properties.raman_spectrum(mol, xc, *, step: float = 0.01, field: float = 0.002, origin=(0.0, 0.0, 0.0), grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, **scf_kw) -> RamanSpectrum ¤

Harmonic Raman activities (Å⁴/amu) from the polarizability derivatives dα/dQ. Expensive: a polarizability (field FD) at every ±Cartesian displacement (O(N) Hessians' worth of work).

dftax.ks.properties.alchemical_deriv(mol, xc: XCFunctional, *, grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, **scf_kw) -> Float[Array, n_atom] ¤

Alchemical gradient ∂E/∂Z_A at fixed electron count (Ha per unit nuclear charge), from the converged density (Hellmann-Feynman).

coulomb=None uses :func:~dftax.ks.terms.exact, not the density fitting default; df(...) is also accepted.

dftax.ks.properties.Vibrations ¤

Harmonic analysis: frequencies (cm⁻¹, negative = imaginary), mass-weighted modes (columns), Cartesian displacement modes (columns).

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__firstlineno__ class-attribute ¤

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer iteral.

int('0b100', base=0) 4

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__orig_bases__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__slots__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__static_attributes__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

cart_modes class-attribute ¤

Alias for field number 2

frequencies class-attribute ¤

Alias for field number 0

modes class-attribute ¤

Alias for field number 1

dftax.ks.properties.IRSpectrum ¤

Harmonic IR spectrum: frequencies (cm⁻¹) and intensities (km/mol).

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__firstlineno__ class-attribute ¤

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer iteral.

int('0b100', base=0) 4

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__orig_bases__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__slots__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__static_attributes__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

frequencies class-attribute ¤

Alias for field number 0

intensities class-attribute ¤

Alias for field number 1

dftax.ks.properties.RamanSpectrum ¤

Harmonic Raman spectrum: frequencies (cm⁻¹) and activities (Å⁴/amu).

__annotations__ class-attribute ¤

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__firstlineno__ class-attribute ¤

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer iteral.

int('0b100', base=0) 4

__match_args__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ class-attribute ¤

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__orig_bases__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__slots__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__static_attributes__ class-attribute ¤

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

activities class-attribute ¤

Alias for field number 1

frequencies class-attribute ¤

Alias for field number 0