# Partial Charges

## Introduction

Classical electronegativity equilibration (EEQ) partial charges are determined by minimising the following energy expression of the isotropic electrostatic interaction, which is dependent on atomic charges *q*

$$
E\_{IES} = \sum\limits\_{i=1}^N\left( \chi\_iq\_i + \frac{1}{2}\left(J\_{ii} + \frac{2\gamma\_{ii}}{\sqrt{\pi}}\right)q\_i^2\right) + \frac{1}{2}\sum\limits\_{i=1}^N\sum\limits\_{j\ne i}^Nq\_iq\_j\frac{\text{erf}(\gamma\_{ij}R\_{ij})}{R\_{ij}} \\\[1em]\quad \text{with}\quad \chi\_i = EN\_i - \kappa\_i\sqrt{CN\_i}.
$$

The first part of the equation above describes the on-side interaction of atom `i` in terms of a Taylor expansion expressed in atomic partial charges. Within `chii` , we apply the Pauling electronegativity (`EN`) and the atomic coordination number (`CN`) scaled by a parameter `kappai`to introduce an environment dependency into the partial-charge approach.The second part of the equation describes the (pairwise) interactions between the atom `i` and all `j`particles as obtained for interacting charge densities (for a deeper understanding check the references, [Goedecker et al.](https://doi.org/10.1103/PhysRevB.92.045131) and [Caldeweyher et al.](https://doi.org/10.26434/chemrxiv.7430216.v2); **Note**: Eq. 12 in [Caldeweyher et al.](https://doi.org/10.26434/chemrxiv.7430216.v2) is *erroneous* while the definition above is correct as it is also given in the [JCP publication](https://doi.org/10.1063/1.5090222)).

To obtain EEQ partial charges under the constraint that the partial charges conserve the total charge of the system, the method of constrained [Lagrangian optimisation](https://en.wikipedia.org/wiki/Lagrange_multiplier) is used

$$
\mathcal{L} = E\_{IES} + \lambda\left(\sum\limits\_{k=1}^Nq\_k - q\_{total}\right) \ \quad \text{with}\quad \frac{\partial\mathcal{L}}{\partial q} = \mathbf{0} \quad\text{and} \quad \frac{\partial\mathcal{L}}{\partial \lambda}= \sum\limits\_{k=1}^N q\_k-q\_{total} =0,
$$

which leads to a set of (N + 1) linear equations that can be rewritten in matrix form as

$$
\begin{pmatrix}
\mathcal{A} & \mathbf{1}\\
\mathbf{1} & \mathbf{0}
\end{pmatrix}
\begin{pmatrix}
\mathbf{q} \\
\mathbf{\lambda}
\end{pmatrix} =
\begin{pmatrix}
\mathcal{X} \\
q\_{total}
\end{pmatrix}  \quad \text{with}\quad \mathcal{X}\_i = -\chi\_i
$$

Let's define the interaction matrix (the definition of the right-hand side is given [above](/kallisto/features/eeq.md#introduction))

$$
\mathcal{A}*{ij} =     \begin{cases}
J*{ii} + \frac{2\gamma\_{ii}}{\sqrt{\pi}}, &         \text{if } i=j\\
\frac{\text{erf}(\gamma\_{ij}R\_{ij})}{R\_{ij}}, &         \text{if } i\neq j
\end{cases},
$$

Overall five parameter exist per element (fitted against PBE0/def2-TZVP Hirshfeld charges):

| Parameter | Meaning for atom i                                                                                     |
| --------- | ------------------------------------------------------------------------------------------------------ |
| `Jii`     | [Chemical Hardness](https://doi.org/10.1021/j100023a006)                                               |
| `gammaii` | Atomic radii dependent term                                                                            |
| `ENi`     | [Pauling electronegativity](https://en.wikipedia.org/wiki/Electronegativity#Pauling_electronegativity) |
| `Rcovi`   | [Covalent atomic radius](https://doi.org/10.1002/chem.200800987)                                       |
| `Kappai`  | Scaling factor for `chii`                                                                              |

## Define the Subcommand

{% tabs %}
{% tab title="eeq" %}

```bash
> kallisto eeq options arguments
```

{% endtab %}

{% tab title="options" %}

```markup
--chrg <int>
(optional, default: 0)
description:
 absolute charge (qtotal) of the input structure (Lagrangian constraint)
 
--out <string> 
(optional)
description: 
 write output to file
```

{% endtab %}

{% tab title="arguments" %}

```
input file is given as (positional) argument
```

{% endtab %}
{% endtabs %}

## Application

To calculate atomic EEQ charges for a neutral charged Alanine-Glycine molecule, we call the subcommand `eeq`

```bash
> kallisto eeq alanine-glycine.xyz
0.059704461728256275
0.2626494653657499
-0.4965512448739412
0.047991263003576215
0.2744196871227069
-0.38881537388038867
-0.6402141334784498
-0.3928319273751289
-0.47582669447302023
0.2790624116759344
0.2891096702066603
-0.1845935570451514
0.12417598515268524
0.27028773655342087
0.14722120980685544
0.14502596136754614
0.2992214711225029
0.13031907222773667
0.1342346682463232
0.11540986754612566
# Save output to file 'eeq'
> kallisto eeq --out eeq alanine-glycine.xyz
> cat eeq
0.059704461728256275
0.2626494653657499
-0.4965512448739412
0.047991263003576215
0.2744196871227069
-0.38881537388038867
-0.6402141334784498
-0.3928319273751289
-0.47582669447302023
0.2790624116759344
0.2891096702066603
-0.1845935570451514
0.12417598515268524
0.27028773655342087
0.14722120980685544
0.14502596136754614
0.2992214711225029
0.13031907222773667
0.1342346682463232
0.11540986754612566
```

Now we obtain a list of atomic EEQ charges, which sum up to a total charge of zero. However, we can furthermore calculate atomic EEQ charges for the cationic (or anionic) Alanine-Glycine molecule by incorporating the `chrg` option as described in the subcommand definition.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ehjc.gitbook.io/kallisto/features/eeq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
