Batched evaluation¤
One vmapped solve over a stack of geometries. Orbital-sized outputs are
opt-in; mesh= shards the batch axis across devices.
dftax.ks.batched.scf_batched(mol, coords_batch, xc, *, spin: int | None = None, grid: Becke | None = None, coulomb: ExactSpec | DFSpec | None = None, dispersion=None, forces: bool = False, return_orbitals: bool = False, mesh: MeshSpec | None = None, max_iter: int = 128, e_tol: float = 1e-08, d_tol: float = 1e-06, diis_space: int = 8, level_shift: float = 0.0, guess=None) -> BatchedResult
¤
SCF over many geometries of the same molecule in one compiled call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mol
|
Molecule
|
the molecule; gives the atoms, basis, charge and spin. |
required |
coords_batch
|
Array
|
nuclear coordinates (Bohr), |
required |
xc
|
XCFunctional
|
the exchange-correlation functional. |
required |
spin
|
int | None
|
as for :class: |
None
|
grid
|
Becke | None
|
a :func: |
None
|
coulomb
|
ExactSpec | DFSpec | None
|
:func: |
None
|
dispersion
|
D3BJSpec | D4Spec | None
|
a :func: |
None
|
forces
|
bool
|
also compute the forces. |
False
|
return_orbitals
|
bool
|
also return the orbitals and densities
( |
False
|
mesh
|
MeshSpec | None
|
a :func: |
None
|
max_iter
|
int
|
as for :func: |
128
|
e_tol
|
float
|
as for :func: |
1e-08
|
d_tol
|
float
|
as for :func: |
1e-06
|
diis_space
|
int
|
as for :func: |
8
|
level_shift
|
float
|
as for :func: |
0.0
|
guess
|
GuessSpec | None
|
a guess spec from :mod: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
BatchedResult
|
class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
TypeError
|
|
dftax.ks.batched.BatchedResult
¤
Results of :func:scf_batched, one entry per geometry along the
leading axis B.
Attributes:
| Name | Type | Description |
|---|---|---|
e_tot |
total energies (Ha), |
|
e_elec |
electronic energies (Ha), |
|
converged |
whether each solve converged, |
|
n_iter |
iterations of each solve, |
|
nocc |
occupied orbitals per spin channel. |
|
forces |
forces (Ha/Bohr), |
|
mo_energy |
orbital energies, |
|
mo_coeff |
orbital coefficients, |
|
P |
density matrices, |
__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)
__dataclass_fields__
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)
__dataclass_params__
class-attribute
¤
__dict__
class-attribute
¤
Read-only proxy of a mapping.
__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'.
__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.
__weakref__
property
¤
list of weak references to the object
__eq__(other)
¤
__init__(e_tot: Float[Array, B], e_elec: Float[Array, B], converged: Array, n_iter: Array, nocc: tuple[int, ...], forces: Float[Array, 'B n_atom 3'] | None = None, mo_energy: Float[Array, 'B nspin nmo'] | None = None, mo_coeff: Float[Array, 'B nspin nao nmo'] | None = None, P: Float[Array, 'B nspin nao nao'] | None = None) -> None
¤
__repr__()
¤
Batched direct minimization¤
Different molecules padded to common sizes and minimized in one compiled
program, closed and open shells, pure and hybrid. A system left unconverged
or in a non-aufbau state is re-solved alone by gdm
(BatchedGDMResult.fallback).
dftax.ks.batched_gdm.gdm_batched(kss: Sequence[KS], *, max_iter: int = 200, e_tol: float = 1e-08, d_tol: float = 1e-06, history: int = 20, max_step: float = 0.5, gap_floor: float = 0.05, guess: GuessSpec | jax.Array | None = None, bucket: Bucket | None = None, fallback: bool = True) -> BatchedGDMResult
¤
Direct minimization of many systems at once, padded to common sizes and solved in one compiled call.
The tolerances and step controls are those of :func:~dftax.ks.gdm.gdm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kss
|
Sequence[KS]
|
the systems, each a :class: |
required |
bucket
|
Bucket | None
|
fixed padded sizes for a batch of one spin type and one
functional, so batches of similar molecules reuse one compiled
program; |
None
|
guess
|
GuessSpec | Array | None
|
a guess, as for :func: |
None
|
fallback
|
bool
|
re-solve alone, with :func: |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
BatchedGDMResult
|
class: |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
a system with streamed density fitting or grid values, or with VV10. |
ValueError
|
a |
dftax.ks.batched_gdm.BatchedGDMResult
¤
Results of :func:gdm_batched, in the order of the input systems.
Attributes:
| Name | Type | Description |
|---|---|---|
e_tot |
total energies (Ha). |
|
converged |
whether each system converged. |
|
n_iter |
energy evaluations of each system. |
|
P |
density matrix of each system, |
|
fallback |
whether each system was re-solved alone with
:func: |
__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)
__dataclass_fields__
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)
__dataclass_params__
class-attribute
¤
__dict__
class-attribute
¤
Read-only proxy of a mapping.
__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'.
__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.
__weakref__
property
¤
list of weak references to the object