xnn.common.models.charge_solve.fragment_targets#

xnn.common.models.charge_solve.fragment_targets(fragments, atomic_numbers, ions, label=None, total_charge=None)[source]#

The net charge of every fragment in e, (F,).

From the per-atom label (fragment_charges: the charge of the fragment each atom belongs to, which must agree within a fragment) when given, otherwise from the formal ion charges. The targets must add up to total_charge when that is known.

Raises:

ValueError – When the label disagrees within a fragment, or the fragment charges do not add up to the structure’s net charge.

Parameters:
Return type:

Tensor