https://github.com/mlund/coulombgalore
C++ Library for Electrostatics
https://github.com/mlund/coulombgalore
chemistry cpp14 dipole electrostatics intermolecular-interactions molecular-dynamics molecular-simulation monte-carlo multipole physics
Last synced: 2 months ago
JSON representation
C++ Library for Electrostatics
- Host: GitHub
- URL: https://github.com/mlund/coulombgalore
- Owner: mlund
- License: mit
- Created: 2019-06-01T09:58:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T07:31:37.000Z (12 months ago)
- Last Synced: 2024-11-01T08:23:48.410Z (12 months ago)
- Topics: chemistry, cpp14, dipole, electrostatics, intermolecular-interactions, molecular-dynamics, molecular-simulation, monte-carlo, multipole, physics
- Language: C++
- Size: 549 KB
- Stars: 14
- Watchers: 6
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://codedocs.xyz/mlund/coulombgalore/)
[](https://doi.org/10.5281/zenodo.3522058)# 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
The CMake build will automatically download Eigen, json, and doctest.
~~~ bash
cmake .
make
make test (optional)
doxygen (optional)
~~~### Use in your own code
Simply copy the `include/coulombgalore` directory to your project. All functions and classes are encapsulated in the `CoulombGalore` namespace.
Vectors are currently handled by the Eigen library, but it should be possible to change to another library.
You can import everything with `#include "coulombgalore/all.h"`, or only what you need:### Example
~~~{.cpp}
#include "coulombgalore/plain.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 x 1.0 / 10Eigen::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`](http://doi.org/ctnnsj) | 1
[`ReactionField`](http://doi.org/10/dscmwg) | 
[`Poisson`](http://doi.org/10/c5fr) | 
[`qPotential`](http://doi.org/10/dc89) | 
[`Fanourgakis`](http://doi.org/f639q5) | 
[`Fennell`](http://doi.org/10.1063/1.2206581) | 
[`ZeroDipole`](http://doi.org/10.1063/1.3582791)| 
[`Zahn`](http://doi.org/10.1021/jp025949h) | 
[`Wolf`](http://doi.org/cfcxdk) | 
[`Ewald`](http://doi.org/dgpdmc) | 
[`EwaldT`](http://doi.org/dsd6) | 
`Splined` | Splined version of any of the aboveHere

### 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.http://doi.org/10.1021/acs.jpca.0c01684Input 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_energy`| `Z^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`