Application for computing partial atomic charges using selected empirical methods. ChargeFW2 is the computational core of Atomic Charge Calculator II.
See the short description of implemented methods.
To compile ChargeFW2, several requirements have to be installed first. The compilation was tested on Ubuntu 23.10 with these versions of libraries:
- CMake 3.27
- GCC 13
- Boost 1.74
- Eigen 3.4
- fmt 9.1
- nanoflann 1.5
- JSON for Modern C++ 3.11
- GEMMI 0.6.2
- pybind11 2.11
Other version of the libraries might work too but these were not tested.
After downloading and unpacking the sources, run the following in the ChargeFW2 directory:
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=<WHERE-TO-INSTALL>
$ make
$ make install
Rather than installing all dependencies, you can run ChargeFW2 directly inside a Docker container.
# Build docker image
$ docker build -t chargefw2 .
# Run docker container
$ docker run -it --rm --entrypoint bash chargefw2
A prebuild Linux image is available on Docker Hub. However, it is not actively maintained and therefore it should only be used as a demo. It's highly recommended to build and manage your own Docker images.
$ docker run -it --rm --entrypoint bash docker.io/frimen/chargefw2
The Docker container can be used in CLI workflows. However, since containers are run in isolated environments and don't have access to your local host files by default, you will need to create a volume or a bind-mount, which will allow sharing host files with the container.
In this example we bind-mount the current working directory into the container. This allows us to specify input files and output directories using relative paths. This is the most similar to running ChargeFW2 natively.
$ docker run -it --rm -v $PWD:$PWD chargefw2 --mode charges \
--input-file $PWD/doc/molecules.sdf --chg-out-dir $PWD/
However, it is good practise to only bind-mount necessary directories. In the folowing example we bind-mount two directories: one directory that contains our input files and the other directory for ChargeFW2 output.
$ INPUT_DIRECTORY="/path/to/input/directory/"
$ OUTPUT_DIRECTORY="/path/to/output/directory/"
$ docker run -it --rm \
-v $INPUT_DIRECTORY:$INPUT_DIRECTORY \
-v $OUTPUT_DIRECTORY:$OUTPUT_DIRECTORY \
chargefw2 --mode charges \
--input-file $INPUT_DIRECTORY/path/to/file \
--chg-out-dir $OUTPUT_DIRECTORY
The previous examples used a container which was destroyed once ChargeFW2 finished running. If you don't want to keep recreating the container for each use of ChargeFW2, you can create a detached container that will keep running in the background. You can then use docker exec
to run commands inside the container.
# Create detached container
$ CONTAINER_ID=$(docker run -dt --rm --entrypoint bash -v $PWD:$PWD chargefw2)
# Run ChargeFW2 in detached container (can run multiple commands)
$ docker exec -it $CONTAINER_ID chargefw2 --mode charges \
--input-file $PWD/doc/molecules.sdf --chg-out-dir $PWD/
# Remove container
$ docker rm -f $CONTAINER_ID
The documentation for the application and its Python bindings is located in the doc folder.
If you found ChargeFW2 or Atomic Charge Calculator II helpful, please cite: Raček, T., Schindler, O., Toušek, D., Horský, V., Berka, K., Koča, J., & Svobodová, R. (2020). Atomic Charge Calculator II: web-based tool for the calculation of partial atomic charges. Nucleic Acids Research.