Python API

Names

The public names live in python/cpmdc. Importing cpmdc does not import ASE. Import cpmdc.ase for CPMDCCalculator.

Name

Role

HARTREE_TO_EV

Hartree to eV, the constant in src/cpmdc.c

BOHR_TO_ANGSTROM

Bohr to Angstrom, the constant in src/cpmdc_params.h

CpmdcError

failure from the library or from loading it

Evaluation

energy_h, forces_h_bohr, stress_h_bohr3

Session

one CPMDCSession handle

Session.energy_forces

one geometry, native units

Session.version

cpmdc/ and the version string

Session.abi_version

numeric ABI generation

Session.available

true when OpenCPMD is linked

Session.close

destroy the handle

Potential

rgpot-shaped provider over one session

Potential.evaluate

eV, eV/Angstrom, optional stress

Potential.caps

stress true, energies false

Potential.close

close the owned session

find_library

explicit path, then the three environment variables

find_schema

CPMDC_SCHEMA or schema/Potentials.capnp

forces_to_ev_per_angstrom

Hartree/Bohr forces to eV/Angstrom

stress_to_ev_per_angstrom3

row-major Hartree/Bohr3tensor to eV/Angstrom3

CPMDCCalculator

ASE calculator: energy, freeenergy, forces, stress

CPMDCCalculator.calculate

fills energy, freeenergy, forces, and stress

CPMDCCalculator.potential

the Potential the calculator owns

CPMDCCalculator.close

close that potential

free_energy on CPMDCCalculator equals energy. A repeated geometry returns the stored step. A null or empty input raises; it does not abort the interpreter.