CoulombGalore
CoulombGalore Documentation

# Coulomb Galore

This is a C++ library for calculating the potential, field, forces, and interactions from and between electric multipoles. Focus is on approximate truncation schemes that offer fast alternatives to Ewald summation. All implemented methods are unit tested.

## Usage

### Requirements

• C++14 compiler
• The Eigen matrix library
• nlohmann::json (optional)
• doctest (optional)
• doxygen (optional, for building API manual)

### Building

cmake .
make
make test (optional)
doxygen (optional)

### Use in your own code

Simply copy the coulombgalore.h file to your project. All functions and classes are encapsulated in the CoulombGalore namespace. Vectors are currently handled by the Eigen library, but it is straightforward to change to another library.

### Example

#include "coulombgalore.h"
int main() {
Eigen::Vector3d R = {0,0,10}; // distance vector
CoulombGalore::Plain pot(14.0); // cutoff distance as constructor argument
double u = pot.ion_ion_energy(1.0, 1.0, R.norm()); // potential energy = 1.0*1.0/10
Eigen::Vector3d mu = {2,5,2}; // dipole moment
Eigen::Vector3d E = pot.dipole_field(mu, R); // field from dipole at 𝐑
}

### Available Truncation Schemes

Class name S(q)
Plain 1
ReactionField
Poisson
qPotential
Fanourgakis
Fennell
ZeroDipole
Zahn
Wolf
Ewald
Splined Splined version of any of the above

Here

### Units

It is vital that the units of the input parameters and function input values are consistent, such that correct output units are retrieved. In terms of the charge unit Z, and length unit L, the input parameters and function outputs are listed in tables below. All charges must have units Z, dipoles Z*L, distances L, volumes L^3, and fields Z/L^2. Also note that the input M2V for function calc_dielectric has to be unitless.

Input parameter Unit
cutoff L
debye_length L
alpha L^-1
order positive integer
C positive integer
D integer
epss unitless
epsRF unitless
epsr unitless
shifted boolean
Function Output unit
ion_potential Z / L
dipole_potential Z / L
ion_field Z / L^2
dipole_field Z / L^2
multipole_field Z / L^2
ion_ion_energy Z^2 / L
ion_dipole_energy Z^2 / L
dipole_dipole_energy Z^2 / L
multipole_multipole_energyZ^2 / L
ion_ion_force Z^2 / L^2
ion_dipole_force Z^2 / L^2
dipole_dipole_force Z^2 / L^2
multipole_multipole_force Z^2 / L^2
dipole_torque Z^2 / L
self_energy Z^2 / L
neutralization_energy Z^2 / L