Tutorials

These tutorials will guide you through using py-electrostatic, from basic calculations to advanced applications with machine learning potentials.

Prerequisites

Before starting the tutorials, ensure you have:

  1. Installed py-electrostatic (see Installation)

  2. Basic knowledge of Python and ASE

  3. A structure file with effective charges (we use BaTiO3 as example)

Tutorial Overview

Tutorial 1: Getting Started

Learn the basics:

  • Loading structures with effective charges

  • Initializing the calculator

  • Computing energy and forces

  • Understanding the output

Start Tutorial 1

Tutorial 2: Supercell Calculations

Work with larger systems:

  • Primitive cell vs supercell concepts

  • Proper supercell initialization

  • Energy consistency checks

  • Atom ordering in supercells

Start Tutorial 2

Tutorial 3: Composite Calculator

Combine electrostatics with other potentials:

  • Why combine short-range and long-range?

  • Using CompositeCalculator

  • Example: Harmonic + Electrostatic

  • Example: ML potential + Electrostatic

Start Tutorial 3

Tutorial 4: SSCHA with Electrostatics

Full anharmonic calculation:

  • Overview of SSCHA method

  • Using GAP potential with electrostatics

  • Running finite-temperature structural relaxation

  • Analyzing results

Start Tutorial 4

Example Files

All tutorial examples are available in the docs/examples/ directory:

  • 01_basic_energy_force.py - Basic usage example

  • 02_supercell.py - Supercell calculations

  • 03_composite.py - Combining potentials

  • 04_sscha_electrostatic.py - Full SSCHA calculation

Getting Help

If you encounter issues:

  1. Check the ../user_guide/troubleshooting guide

  2. Review the Parameter Guide guide

  3. Open an issue on GitHub: https://github.com/mesonepigreco/py-electrostatic/issues