xnn.common.models.charge_solve.solve_charges#
- xnn.common.models.charge_solve.solve_charges(chi, hardness, gamma, target, fragments=None)[source]#
The constrained minimum of
chi.q + 1/2 sum J q^2 + 1/2 q^T gamma q.- Parameters:
chi (Tensor) – Electronegativities
(n,)(eV per latent charge).hardness (Tensor) –
J > 0,(n,)(eV per latent charge squared).gamma (Tensor) – The Coulomb matrix
(n, n)ofcoulomb_matrix()(zero for the coupling-free limit).target (Tensor) – The net latent charge of the structure (scalar), or of every fragment
(F,)whenfragmentsis given.fragments (Tensor, optional) – Fragment index of every atom
(n,), values0 .. F-1: one constraint row per fragment instead of one for the structure.
- Returns:
The charges
q(n,)and the chemical potentialsmu, one per constraint row ((1,)or(F,)), withdE/dq_i = muof its row for every atom at the solution. Both carry gradients with respect to every input, through the residual of the detached factor (first and second derivatives).- Return type:
(Tensor, Tensor)