espaloma.nn.readout.charge_equilibrium.get_charges
- espaloma.nn.readout.charge_equilibrium.get_charges(node)[source]
- Solve the function to get the absolute charges of atoms in a
molecule from parameters. Parameters ———- e : tf.Tensor, dtype = tf.float32,
electronegativity.
- stf.Tensor, dtype = tf.float32,
hardness.
- Qtf.Tensor, dtype = tf.float32, shape=(),
total charge of a molecule.
We use Lagrange multipliers to analytically give the solution. $$ U({f q}) &= sum_{i=1}^N left[ e_i q_i +
rac{1}{2} s_i q_i^2 ight]
lambda , left( sum_{j=1}^N q_j - Q
- ight)
- &= sum_{i=1}^N left[
(e_i - lambda) q_i +
rac{1}{2} s_i q_i^2 ight
] + Q
$$ This gives us: $$ q_i^* &= - e_i s_i^{-1} + lambda s_i^{-1} &= - e_i s_i^{-1} + s_i^{-1}
- rac{
- Q +
sumlimits_{i=1}^N e_i , s_i^{-1}
}{sumlimits_{j=1}^N s_j^{-1}}
$$