Installation
py-electrostatic can be installed via pip. The package requires Python 3.8 or later.
Requirements
Python >= 3.8
NumPy
SciPy
ASE (Atomic Simulation Environment)
CellConstructor
Julia (optional but recommended for performance)
Basic Installation
Install from PyPI (when available):
pip install py-electrostatic
Or install from source:
git clone https://github.com/mesonepigreco/py-electrostatic.git
cd py-electrostatic
pip install -e .
Julia Installation (Recommended)
For optimal performance, especially for stress tensor calculations, install Julia:
Install Julia (version 1.8 or later):
Download from https://julialang.org/downloads/
Or use conda:
conda install -c conda-forge julia
Install PyJulia:
pip install julia
Configure PyJulia:
import julia julia.install()
Install required Julia packages:
using Pkg Pkg.add("FFTW") Pkg.add("DiffResults") Pkg.add("ForwardDiff")
Verification
Test your installation:
import pyelectrostatic
import pyelectrostatic.calculator as calc
# Check if Julia is available
print(calc.is_julia_available()) # Should print True if Julia is configured
Troubleshooting
Julia not found
If you get errors about Julia not being found:
Make sure Julia is in your system PATH
Try setting the
JULIA_HOMEenvironment variableRe-run
julia.install()
Import errors
If you get import errors for CellConstructor:
pip install cellconstructor
For compilation issues with CellConstructor, you may need a Fortran compiler:
# Ubuntu/Debian
sudo apt-get install gfortran libblas-dev liblapack-dev
# macOS
brew install gcc
# Then reinstall cellconstructor
pip install --no-build-isolation --force-reinstall cellconstructor