Chemistry tools tutorials/scripts

Tutorials and scripts for several computational chemistry tools

KBS - Home
Chem. tools tutorials
File conversion


Charge equilibration method for crystal structures. Available from here.


The source code in this program demonstrates the charge equilibration method described in the accompanying paper. The purpose of the source code provided is to be minimalistic and do “just the job” described. In practice, you may wish to add various features to the source code to fit the particular needs of your project.

Major highlights of program:

Features not implemented but that you may want to consider adding:

Running the program:

Program expects two input files ionization.dat and chargecenters.dat. Please look at source code to see what the other optional inputs are for (should be mostly self-explanatory). Compile with something like:

g++ main.cpp -O3 -o eqeq

and run with

./eqeq my_file.cif

Python bindings

To facilitate automation and scaling, this version of EQeq can be operated via Python. To enable, you must build EQeq as a shared library:

g++ -c -fPIC main.cpp -O3 -o eqeq.o
g++ -shared -Wl,-soname, -O3 -o eqeq.o
sudo cp /usr/lib

(for Macs, replace -soname with -install_name) (if you don’t have sudo access, mkdir ~/lib; cp ~/lib, then change the path at the top of

From the command line, you can run

python --help
python IRMOF-1.cif --output-type mol --method ewald

This includes extensive help documentation on running EQeq, and an easy interface to change individual parameters.

To use globally with Python scripts, you must put the EQeq directory on your PYTHONPATH:

export PYTHONPATH:/path/above/EQeq:$PYTHONPATH

Then, you can call EQeq from Python with

import EQeq"IRMOF-1.cif")

The input takes both filenames and actual data, and outputs either files or strings. This change allows for streaming data, which enables EQeq to be used as part of a broader code pipeline.

import EQeq
# Load a file. In practice, this can come from any source, such as a database
with open("IRMOF-1.cif") as in_file:
    data =
charges =, output_type="list", method="ewald")


EQeq: An Extended Charge Equilibration Method

EQeq+C: An Empirical Bond-Order-Corrected Extended Charge Equilibration Method