Skip to main content

Module python

Module python 

Source
Expand description

Python bindings for CP2K – thin PyO3 wrapper around crate::worker.

All blocking operations release the GIL via py.detach(...), delegating the actual work to the GIL-free functions in crate::worker.

§Typical usage

import cp2k_rs

cp2k_rs.init_cp2k(nproc=4)
fe = cp2k_rs.PyForceEnv("input.inp", "output.out")
fe.calc_energy_force()
e = fe.get_potential_energy()
cp2k_rs.finalize_cp2k()

Structs§

PyForceEnv
Python wrapper around a CP2K force environment running inside the MPI worker.

Functions§

finalize_cp2k
Shut down the MPI worker and clean up resources.
init_cp2k
Start the MPI worker and return once the socket is ready.
ipc_call
Send a command and receive the response. Releases the GIL while blocked.