Analysis scripts
================

Several analysis scripts are provided in the folder *./tools/*. In general, to obtain information about python scripts use the command 
```bash
python script.py --help
```

# Compute capacitance
The `compute_capacitance.py` script computes the integral and electrolyte differential capacitances -- respectively from the mean and the variance of the total charge distribution -- and related errors using correction for correlated data defined in [[Zwanzig1969][1]].

# Compute empty capacitance
The `compute_empty_capacitance.py` script computes the contribution to the differential capacitance corresponding to the empty capacitor as introduced in [[Scalfi2020][2]].
This scripts needs the [python interface](python-interface) to MW and [mpi4Py](https://mpi4py.readthedocs.io/en/stable/). 

# Compute electric potential
The `compute_electric_potential.py` script computes the electric field and electric potential profiles from charge density profiles by integrating the Poisson equation. Care should be taken if the profiles are truncated.

# Compute matrix condition number
The `compute_matrix_condition_number.py` script computes the condition number of the MaZe matrix as done in [[Coretti2020][3]].
This scripts needs the [python interface](python-interface) to MW and [mpi4Py](https://mpi4py.readthedocs.io/en/stable/).

# Compute charge-charge autocorelation function
The `compute_charge_charge_autocorrelation_function.py` script computes the normalized autocorrelation function of the total charge.

# Check MaZe initialization
The `check_maze_initialization.py` checks the input files for a MaZe simulation and runs a 2 steps simulation if necessary (see the [MaZe initialization procedure](maze-initialization).
This scripts needs the [python interface](python-interface) to MW and [mpi4Py](https://mpi4py.readthedocs.io/en/stable/).

# Charge visualization with VMD
The `charges.tcl` script is a TCL script used by running
```bash
vmd -e charges.tcl trajectories.lammpstrj
```
Then choosing in `Graphics>Representation` the `Coloring Method>Trajectory>User>User`. 

References
----------
[1]:https://doi.org/10.1103/PhysRev.182.280
[Zwanzig1969]
   R. Zwanzig and N. K. Ailawadi. 
   Statistical Error Due to Finite Time Averaging in Computer Experiments
   Phys. Rev. 182, 280–283 (1969).

[2]:https://doi.org/10.1039/C9CP06285H
[Scalfi2020]
   L. Scalfi, D. T. Limmer, A. Coretti, S. Bonella, P. A. Madden, M. Salanne, and B. Rotenberg. 
   Charge fluctuations from molecular simulations in the constant-potential ensemble.
   Phys. Chem. Chem. Phys. 22, 10480-10489 (2020).

[3]:https://doi.org/10.1063/5.0007192
[Coretti2020]
   A. Coretti, L. Scalfi, C. Bacon, B. Rotenberg, R. Vuilleumier, G. Ciccotti, M. Salanne, and S. Bonella. 
   Mass-zero constrained molecular dynamics for electrode charges in simulations of electrochemical systems.
   J. Chem. Phys. 152 (19), 194701 (2020).