.. _global: .. index:: pair: namespace; global Global Namespace ================ .. toctree:: :hidden: enum_CPMDCFeatureKind.rst struct_CPMDCChargeIntegrals.rst struct_CPMDCEnergyComponents.rst struct_CPMDCFeatureEntry.rst struct_CPMDCMDTrajectoryRow.rst struct_CPMDCMultiStateEnergies.rst struct_CPMDCPropertySnapshot.rst struct_CPMDCResult.rst struct_CPMDCStressTensor.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block // typedefs typedef struct CPMDCResult :ref:`CPMDCResult`; typedef struct CPMDCEnergyComponents :ref:`CPMDCEnergyComponents`; typedef struct CPMDCChargeIntegrals :ref:`CPMDCChargeIntegrals`; typedef struct CPMDCMultiStateEnergies :ref:`CPMDCMultiStateEnergies`; typedef struct CPMDCMDTrajectoryRow :ref:`CPMDCMDTrajectoryRow`; typedef struct CPMDCPropertySnapshot :ref:`CPMDCPropertySnapshot`; typedef struct CPMDCStressTensor :ref:`CPMDCStressTensor`; typedef struct :ref:`CPMDCSession` :ref:`CPMDCSession`; typedef enum :ref:`CPMDCFeatureKind` :ref:`CPMDCFeatureKind`; typedef struct CPMDCFeatureEntry :ref:`CPMDCFeatureEntry`; typedef struct :ref:`cpmdc_restart` :ref:`cpmdc_restart`; // enums enum :ref:`CPMDCFeatureKind`; // structs struct :ref:`CPMDCChargeIntegrals`; struct :ref:`CPMDCEnergyComponents`; struct :ref:`CPMDCFeatureEntry`; struct :ref:`CPMDCMDTrajectoryRow`; struct :ref:`CPMDCMultiStateEnergies`; struct :ref:`CPMDCPropertySnapshot`; struct :ref:`CPMDCResult`; struct :ref:`CPMDCStressTensor`; // global functions int :ref:`cpmdc_set_params`(const void* params_capnp, size_t params_capnp_size_bytes); int :ref:`cpmdc_configure`(const void* config_capnp, size_t config_capnp_size_bytes); :ref:`CPMDCResult` :ref:`cpmdc_energy_gradient`(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr); :ref:`CPMDCResult` :ref:`cpmdc_energy`(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes); :ref:`CPMDCResult` :ref:`cpmdc_energy_forces`(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* forces_h_bohr); int :ref:`cpmdc_bind_calculator`(int ranks_per_calc); :ref:`CPMDCSession`* :ref:`cpmdc_session_create`(const void* params_capnp, size_t params_capnp_size_bytes); int :ref:`cpmdc_session_set_params`(:ref:`CPMDCSession`* session, const void* params_capnp, size_t params_capnp_size_bytes); :ref:`CPMDCSession`* :ref:`cpmdc_session_create_from_config`(const void* config_capnp, size_t config_capnp_size_bytes); int :ref:`cpmdc_session_configure`(:ref:`CPMDCSession`* session, const void* config_capnp, size_t config_capnp_size_bytes); void :ref:`cpmdc_session_destroy`(:ref:`CPMDCSession`* session); :ref:`CPMDCResult` :ref:`cpmdc_session_energy_gradient`(:ref:`CPMDCSession`* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* grad_h_bohr); :ref:`CPMDCResult` :ref:`cpmdc_session_energy`(:ref:`CPMDCSession`* session, int n_atoms, const double* positions_ang, const int* atomic_numbers); :ref:`CPMDCResult` :ref:`cpmdc_session_energy_forces`(:ref:`CPMDCSession`* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* forces_h_bohr); :ref:`CPMDCResult` :ref:`cpmdc_session_calculate_forces`(:ref:`CPMDCSession`* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, double* forces_h_bohr, size_t forces_len); :ref:`CPMDCResult` :ref:`cpmdc_session_calculate_result`(:ref:`CPMDCSession`* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes); :ref:`CPMDCResult` :ref:`cpmdc_calculate_result`(const void* params_capnp, size_t params_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes); :ref:`CPMDCResult` :ref:`cpmdc_calculate_result_from_config`(const void* config_capnp, size_t config_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes); size_t :ref:`cpmdc_potential_result_size_for_force_input`(const void* force_input_capnp, size_t force_input_capnp_size_bytes); int :ref:`cpmdc_capabilities_result`(void* capabilities_capnp, size_t capabilities_capnp_capacity_bytes, size_t* capabilities_capnp_size_bytes); const char* :ref:`cpmdc_version`(void); const char* :ref:`cpmdc_last_error`(void); int :ref:`cpmdc_abi_version`(void); int :ref:`cpmdc_available`(void); void :ref:`cpmdc_finalize`(void); int :ref:`cpmdc_last_energy_components`(:ref:`CPMDCEnergyComponents`* out); int :ref:`cpmdc_session_last_energy_components`(const :ref:`CPMDCSession`* session, :ref:`CPMDCEnergyComponents`* out); int :ref:`cpmdc_last_charge_integrals`(:ref:`CPMDCChargeIntegrals`* out); int :ref:`cpmdc_session_last_charge_integrals`(const :ref:`CPMDCSession`* session, :ref:`CPMDCChargeIntegrals`* out); int :ref:`cpmdc_last_multi_state_energies`(:ref:`CPMDCMultiStateEnergies`* out); int :ref:`cpmdc_session_last_multi_state_energies`(const :ref:`CPMDCSession`* session, :ref:`CPMDCMultiStateEnergies`* out); int :ref:`cpmdc_last_md_trajectory_row`(:ref:`CPMDCMDTrajectoryRow`* out); int :ref:`cpmdc_session_last_md_trajectory_row`(const :ref:`CPMDCSession`* session, :ref:`CPMDCMDTrajectoryRow`* out); int :ref:`cpmdc_last_property_snapshot`(:ref:`CPMDCPropertySnapshot`* out); int :ref:`cpmdc_session_last_property_snapshot`(const :ref:`CPMDCSession`* session, :ref:`CPMDCPropertySnapshot`* out); int :ref:`cpmdc_last_stress`(:ref:`CPMDCStressTensor`* out); int :ref:`cpmdc_session_last_stress`(const :ref:`CPMDCSession`* session, :ref:`CPMDCStressTensor`* out); size_t :ref:`cpmdc_feature_count`(void); const :ref:`CPMDCFeatureEntry`* :ref:`cpmdc_feature_table`(void); const :ref:`CPMDCFeatureEntry`* :ref:`cpmdc_feature_find`(const char* feature_id); :ref:`cpmdc_restart`* :ref:`cpmdc_restart_read_mem`(const void* bytes, size_t nbytes, char* err, size_t err_cap); :ref:`cpmdc_restart`* :ref:`cpmdc_restart_read_path`(const char* path, char* err, size_t err_cap); void :ref:`cpmdc_restart_free`(:ref:`cpmdc_restart`* file); int :ref:`cpmdc_restart_is_stream`(const :ref:`cpmdc_restart`* file); const char* :ref:`cpmdc_restart_header`(const :ref:`cpmdc_restart`* file); int :ref:`cpmdc_restart_section`(const :ref:`cpmdc_restart`* file, int section, int* count); int :ref:`cpmdc_restart_cell`(const :ref:`cpmdc_restart`* file, int* ibrav, int* indpg, double celldm[6]); int :ref:`cpmdc_restart_species`(const :ref:`cpmdc_restart`* file, int* nsp, const int** na_per_species); int :ref:`cpmdc_restart_ncoords`(const :ref:`cpmdc_restart`* file); int :ref:`cpmdc_restart_coordinates`(const :ref:`cpmdc_restart`* file, double* xyz, int n3); int :ref:`cpmdc_restart_velocities`(const :ref:`cpmdc_restart`* file, double* xyz, int n3); int :ref:`cpmdc_restart_initial_coordinates`(const :ref:`cpmdc_restart`* file, double* xyz, int n3); int :ref:`cpmdc_restart_set_coordinates`(:ref:`cpmdc_restart`* file, const double* xyz, int n3); int :ref:`cpmdc_restart_set_velocities`(:ref:`cpmdc_restart`* file, const double* xyz, int n3); int :ref:`cpmdc_restart_set_cell`(:ref:`cpmdc_restart`* file, const double celldm[6]); int :ref:`cpmdc_restart_cutoff`(const :ref:`cpmdc_restart`* file, double* ecut, double* cdual, int* dual_flag, int* nel, int* nr1s, int* nr2s, int* nr3s); int :ref:`cpmdc_restart_states`(const :ref:`cpmdc_restart`* file, int* n, int* nkpts, int* ngw, int* ngwl, int* nhg, int* nhgl); int :ref:`cpmdc_restart_write_mem`(const :ref:`cpmdc_restart`* file, void** bytes, size_t* nbytes, char* err, size_t err_cap); int :ref:`cpmdc_restart_write_path`(const :ref:`cpmdc_restart`* file, const char* path, char* err, size_t err_cap); // macros #define :ref:`CPMDC_ABI_VERSION` #define :ref:`CPMDC_RESTART_ANGSTROM_PER_BOHR` .. _details-global: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Typedefs -------- .. index:: pair: typedef; CPMDCResult .. _doxid-cpmdc_8h_1a624f3d7d040e783aef1536f49e2a43ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCResult CPMDCResult Result returned by energy / gradient / forces entry points. .. index:: pair: typedef; CPMDCEnergyComponents .. _doxid-cpmdc_8h_1aedc8eb0071a1f153ea4db9c0d96bce19: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCEnergyComponents CPMDCEnergyComponents In-process snapshot of OpenCPMD ``ener_com`` scalars (Hartree a.u.). Filled after a successful embed SCF (``wfopts``) or reference PEF evaluation. Hosts read this via ``:ref:`cpmdc_last_energy_components() ``` without parsing CLI ENERGY files or opening a network socket. Field names mirror ``ener_com_t`` in OpenCPMD ``ener.mod.F90``. Zero fields are valid (not set for that run). .. index:: pair: typedef; CPMDCChargeIntegrals .. _doxid-cpmdc_8h_1aae00229c7649a90a8da6e23113d367dd: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCChargeIntegrals CPMDCChargeIntegrals OpenCPMD ``chrg_t`` density integrals (post-SCF module state). .. index:: pair: typedef; CPMDCMultiStateEnergies .. _doxid-cpmdc_8h_1a7154299d9d5bfe722eb33b24d941abf8: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCMultiStateEnergies CPMDCMultiStateEnergies Flattened CAS22-class multi-state catalog (``ener_c`` + ``ener_d``). Layout is backend-defined; ``count`` is the number of doubles copied into ``values`` (caller provides capacity). Returns -1 when no snapshot. .. index:: pair: typedef; CPMDCMDTrajectoryRow .. _doxid-cpmdc_8h_1a116d67931c3d565982c327bb0a335818: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCMDTrajectoryRow CPMDCMDTrajectoryRow One ENERGY-file-equivalent trajectory row (Hartree). Layout (count >= 12 after a successful eval): [0] etot [1] ekin [2] epseu [3] enl [4] eht [5] exc [6] ehep [7] ehee [8] ehii [9] esr [10] eself [11] EKINC (fictitious electronic KE; 0 for BO/SCF-only wfopt, filled in MD) .. index:: pair: typedef; CPMDCPropertySnapshot .. _doxid-cpmdc_8h_1a0ff3c92e7d255d36b825d98d6f9aaff2: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCPropertySnapshot CPMDCPropertySnapshot PROP-style property snapshot after a successful evaluation. * dipole[3]: OpenCPMD ``ddippdipole`` (a.u.) when linked; PEF zeros * polarizability[9]: filled when PROP/aoresponse available; else zeros with count 9 * hessian[]: nuclear gradient dE/dR packed as [natoms\*3] (full Hessian needs dedicated PROP/Hessian run; gradient is always available after force eval) .. index:: pair: typedef; CPMDCStressTensor .. _doxid-cpmdc_8h_1ab0ed88166123b36bd5f3c01bba3400f4: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCStressTensor CPMDCStressTensor Cartesian stress tensor after a successful PEF evaluation. Layout is row-major [xx, xy, xz, yx, yy, yz, zx, zy, zz] in Hartree/Bohr^3 (OpenCPMD ``paiu/omega`` after ``totstr`` when ``cntltpres``). ``valid`` is set only when that tensor was computed for a periodic cell. A positive cell volume is not enough: an isolated (cluster/Hockney) box leaves ``valid`` unset. Returns 0 when ``out->valid`` is set; -1 when stress was not computed. .. index:: pair: typedef; CPMDCSession .. _doxid-cpmdc_8h_1a49ff1835247d81d2ea1d2bea854ba239: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct :ref:`CPMDCSession` CPMDCSession Opaque handle for repeated evaluations with one Cap'n Proto parameter set. .. index:: pair: typedef; CPMDCFeatureKind .. _doxid-cpmdc__features_8h_1ab8efa8b96095d9bcb86951f47cdf3ddd: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef enum :ref:`CPMDCFeatureKind` CPMDCFeatureKind Feature namespace represented by a ``:ref:`CPMDCFeatureEntry ```. .. index:: pair: typedef; CPMDCFeatureEntry .. _doxid-cpmdc__features_8h_1a78e933e2bdea5d5a752302a384a3137b: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct CPMDCFeatureEntry CPMDCFeatureEntry One discoverable ABI, parameter, section, or keyword capability. .. index:: pair: typedef; cpmdc_restart .. _doxid-cpmdc__restart_8h_1a34772f7f4950f85031f3585b7bde72c9: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct :ref:`cpmdc_restart` cpmdc_restart Opaque RESTART image. Global Functions ---------------- .. index:: pair: function; cpmdc_set_params .. _doxid-cpmdc_8h_1a22da50d15419dadce4925c88100a1c23: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_set_params(const void* params_capnp, size_t params_capnp_size_bytes) Apply CPMD method parameters from a Cap'n Proto message. Callers do not need C setter functions for individual CPMD keywords. Build one ``CPMDParams`` message with top-level fields, structured ``inputSections``, and literal ``inputBlocks``, then pass its bytes to this function or to ``:ref:`cpmdc_session_create() ```. Feature discovery mirrors the schema carriers: typed fields such as ``params.inputSections.cpmd.maxIter``, ``params.inputSections.system.cell``, ``params.inputSections.dft.hfxScreening``, and ``params.inputSections.atoms.pseudopotentials``; catalog sections such as ``catalog.section.VDW``; and escape hatches such as ``params.inputSections.raw``. The same serialized params buffer is accepted by ``:ref:`cpmdc_calculate_result() ``` for one-shot calls. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - params_capnp - Pointer to an unpacked flat ``CPMDParams`` message. * - params_capnp_size_bytes - Size of ``params_capnp`` in bytes. .. rubric:: Returns: 0 on success, -1 on parse or configuration failure. Failure text is ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_configure .. _doxid-cpmdc_8h_1a63e0e322b316e71ce331fb8bd720a278: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_configure(const void* config_capnp, size_t config_capnp_size_bytes) Apply configuration from a ``PotentialConfig`` message. The ``cpmd`` union arm carries ``CPMDParams`` and wins wholesale when present. With the arm unset, a set ``common`` overlay (``CommonMethodSpec``) lowers to synthesized ``CPMDParams`` : functional, plane-wave cutoff, charge, multiplicity, MAXITER, and the Monkhorst-Pack kMesh. Setting both the cpmd arm and the overlay is rejected (capnp cannot distinguish unset arm fields from defaults). Overlay fields without a CPMD lowering are rejected and reported through ``:ref:`cpmdc_last_error() ```. .. rubric:: Returns: 0 on success, -1 on parse, lowering, or apply failure. .. index:: pair: function; cpmdc_energy_gradient .. _doxid-cpmdc_8h_1a525b75c1e47dd8595be42d2175f9f64f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_energy_gradient(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* grad_h_bohr) Compute energy and nuclear gradient for an atomic configuration. Positions are Angstrom; gradient is Hartree/Bohr (CPMD ionic forces are negated into a nuclear gradient for API symmetry with nwchemc). .. index:: pair: function; cpmdc_energy .. _doxid-cpmdc_8h_1a6e17756faffc4d181352a5953991f584: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_energy(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes) Compute total energy only (no gradient allocation). .. index:: pair: function; cpmdc_energy_forces .. _doxid-cpmdc_8h_1ad653481360bf399295aed47e14cef118: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_energy_forces(int n_atoms, const double* positions_ang, const int* atomic_numbers, const void* params_capnp, size_t params_capnp_size_bytes, double* forces_h_bohr) Compute energy and nuclear forces (negative gradient, Hartree/Bohr). .. index:: pair: function; cpmdc_bind_calculator .. _doxid-cpmdc_8h_1a7e3d1f5e69de7f1bc8218d7e5b7c8953: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_bind_calculator(int ranks_per_calc) Bind this rank to one CPMD calculator of ``ranks_per_calc`` ranks. Collective on MPI_COMM_WORLD, once, before the first energy call. World size must divide into groups of ranks_per_calc. Each group is one CPMD calculator: its own communicator, its own wavefunction, the same deck. A value of zero or less takes the whole world as one group. Returns the group index, or -1 when the split is refused or the library carries no CPMD backend. Failure text is ``:ref:`cpmdc_last_error() ```. A second call returns the same index and does not split again. .. index:: pair: function; cpmdc_session_create .. _doxid-cpmdc_8h_1a08b6b5b994b9754e6c853d3dd46c7745: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCSession`* cpmdc_session_create(const void* params_capnp, size_t params_capnp_size_bytes) Create a persistent evaluation session from a Cap'n Proto message. The session owns a copy of the serialized message so callers may release the input buffer after this call returns. Returns NULL on failure; the reason is ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_session_set_params .. _doxid-cpmdc_8h_1a0ffb70752daab4a244e5ffd58eaa6db5: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_set_params(:ref:`CPMDCSession`* session, const void* params_capnp, size_t params_capnp_size_bytes) Replace Cap'n Proto parameters before the session accepts topology. .. index:: pair: function; cpmdc_session_create_from_config .. _doxid-cpmdc_8h_1a42fcd68eb0fc7a563dba31de8aae65d4: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCSession`* cpmdc_session_create_from_config(const void* config_capnp, size_t config_capnp_size_bytes) Create a persistent session from a ``PotentialConfig`` message. Resolves the config exactly like ``:ref:`cpmdc_configure() ``` and installs the effective ``CPMDParams`` on a new session. .. index:: pair: function; cpmdc_session_configure .. _doxid-cpmdc_8h_1a9390ba94fbc7816b7badeeaedbbffb55: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_configure(:ref:`CPMDCSession`* session, const void* config_capnp, size_t config_capnp_size_bytes) Configure an existing session from a ``PotentialConfig`` message. Accepted only before the session evaluates; resolution matches ``:ref:`cpmdc_configure() ```. .. index:: pair: function; cpmdc_session_destroy .. _doxid-cpmdc_8h_1a6d07b0b1700b5352f1ce33f396a9f578: .. ref-code-block:: cpp :class: doxyrest-title-code-block void cpmdc_session_destroy(:ref:`CPMDCSession`* session) Release a persistent evaluation session. .. index:: pair: function; cpmdc_session_energy_gradient .. _doxid-cpmdc_8h_1a6d79318bc9f2eae253d4906376123570: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_session_energy_gradient(:ref:`CPMDCSession`* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* grad_h_bohr) Compute energy and nuclear gradient with session-owned parameters. Positions are Angstrom. The gradient buffer must have ``n_atoms * 3`` doubles and is filled in Hartree/Bohr. .. index:: pair: function; cpmdc_session_energy .. _doxid-cpmdc_8h_1a3c36a0c86b25223e47eb139ec2d89a33: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_session_energy(:ref:`CPMDCSession`* session, int n_atoms, const double* positions_ang, const int* atomic_numbers) Compute total energy with session-owned parameters. Positions are Angstrom and the returned energy is Hartree. .. index:: pair: function; cpmdc_session_energy_forces .. _doxid-cpmdc_8h_1ab94170b806559374915fb2510fd46d6b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_session_energy_forces(:ref:`CPMDCSession`* session, int n_atoms, const double* positions_ang, const int* atomic_numbers, double* forces_h_bohr) Compute energy and nuclear forces with session-owned parameters. Positions are Angstrom. The forces buffer must have ``n_atoms * 3`` doubles and is filled in Hartree/Bohr. .. index:: pair: function; cpmdc_session_calculate_forces .. _doxid-cpmdc_8h_1a9f5e4a955e689dcf3e06b52e68b6adb1: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_session_calculate_forces(:ref:`CPMDCSession`* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, double* forces_h_bohr, size_t forces_len) Compute energy and forces for one Cap'n Proto ``ForceInput`` step. Session keeps persistent ``CPMDParams``; each call supplies geometry. Returned energy/forces use CPMD native units: Hartree and Hartree/Bohr. .. index:: pair: function; cpmdc_session_calculate_result .. _doxid-cpmdc_8h_1ac63ef923626641269d88b5319f5eed8a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_session_calculate_result(:ref:`CPMDCSession`* session, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes) Compute forces for one ``ForceInput`` step and write ``PotentialResult``. Direct-call socket entry point: method state in the session, geometry in ``ForceInput``, output energy/forces converted to ``ForceInput.energyUnit`` and ``energyUnit / lengthUnit``. When ``potential_result_capnp_capacity_bytes`` is too small, returns ``ok == 0``, writes the required byte count to ``potential_result_capnp_size_bytes``, and does not evaluate CPMD. .. index:: pair: function; cpmdc_calculate_result .. _doxid-cpmdc_8h_1a9b206e2d2173eafb39c00977101da25b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_calculate_result(const void* params_capnp, size_t params_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes) One-shot Cap'n Proto entry point (params + ForceInput -> PotentialResult). Multi-step callers should create one session and call ``:ref:`cpmdc_session_calculate_result() ``` per step. .. index:: pair: function; cpmdc_calculate_result_from_config .. _doxid-cpmdc_8h_1ae25fc395d2c702ceb3604b211c31101c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`CPMDCResult` cpmdc_calculate_result_from_config(const void* config_capnp, size_t config_capnp_size_bytes, const void* force_input_capnp, size_t force_input_capnp_size_bytes, void* potential_result_capnp, size_t potential_result_capnp_capacity_bytes, size_t* potential_result_capnp_size_bytes) One-shot Cap'n Proto entry point resolving a full ``PotentialConfig`` (native arm plus common overlay, exactly like ``:ref:`cpmdc_configure() ```). Multi-step callers should create one session via ``:ref:`cpmdc_session_create_from_config() ``` and call ``:ref:`cpmdc_session_calculate_result() ``` per step. .. index:: pair: function; cpmdc_potential_result_size_for_force_input .. _doxid-cpmdc_8h_1a50c58b775c95334c2842f3d07c247408: .. ref-code-block:: cpp :class: doxyrest-title-code-block size_t cpmdc_potential_result_size_for_force_input(const void* force_input_capnp, size_t force_input_capnp_size_bytes) Byte count needed for a ``PotentialResult`` for the given ``ForceInput``. Parses geometry only; does not initialize or evaluate CPMD. Returns 0 when the message is invalid or too large for the C ABI. That failure is reported through ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_capabilities_result .. _doxid-cpmdc_8h_1a1b9502d082856395b03a28318cff24a7: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_capabilities_result(void* capabilities_capnp, size_t capabilities_capnp_capacity_bytes, size_t* capabilities_capnp_size_bytes) Write a Cap'n Proto ``Capabilities`` message describing this backend. Loaders negotiate against the message before dispatch: backend name and version, ABI generation, availability, the calculate operations the ABI serves, the ``CommonMethodSpec`` fields the overlay lowers, and the ``PotentialConfig`` arms accepted. A stub build reports the same operation surface with ``available = false``. Returns 0 on success. On a too-small buffer (including the pure size query ``capabilities_capnp == NULL``, ``capabilities_capnp_capacity_bytes == 0``) returns -1 with ``*capabilities_capnp_size_bytes`` set to the required size. That -1 does not write ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_version .. _doxid-cpmdc_8h_1a4d5a0eade3deceabe9f7e48e7a45d430: .. ref-code-block:: cpp :class: doxyrest-title-code-block const char* cpmdc_version(void) Compiled library version string. .. index:: pair: function; cpmdc_last_error .. _doxid-cpmdc_8h_1ac58f0528fddd704c6fcf57da49885956: .. ref-code-block:: cpp :class: doxyrest-title-code-block const char* cpmdc_last_error(void) Diagnostic for the most recent public call on this thread that reports failure through this string. Written by ``:ref:`cpmdc_set_params() ```, ``:ref:`cpmdc_configure() ```, ``:ref:`cpmdc_bind_calculator() ```, ``:ref:`cpmdc_session_create() ```, ``:ref:`cpmdc_session_set_params() ```, ``:ref:`cpmdc_session_create_from_config() ```, ``:ref:`cpmdc_session_configure() ```, ``:ref:`cpmdc_potential_result_size_for_force_input() ```, and every evaluation entry point (``:ref:`cpmdc_energy() ```, ``:ref:`cpmdc_energy_gradient() ```, ``:ref:`cpmdc_energy_forces() ```, the session variants, and the calculate-result calls). When the call returns ``:ref:`CPMDCResult ```, the text matches ``message``, including a missing pseudopotential directory. Empty after a successful call. Snapshot readers (``:ref:`cpmdc_last_stress() ``` and the other ``cpmdc_last_*`` / ``cpmdc_session_last_*`` getters) do not write it: -1 means the snapshot is absent or the output pointer is null. ``:ref:`cpmdc_capabilities_result() ``` does not write it either; its -1 is the size query. .. index:: pair: function; cpmdc_abi_version .. _doxid-cpmdc_8h_1a32d9936fa0bb1380d6da4b8c34c4be44: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_abi_version(void) Numeric ABI generation of the compiled library. Compare against the CPMDC_ABI_VERSION the consumer compiled with. .. index:: pair: function; cpmdc_available .. _doxid-cpmdc_8h_1a25f2bc651370d207f2049574e7073e0d: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_available(void) 1 when the embedded OpenCPMD runtime is available. .. index:: pair: function; cpmdc_finalize .. _doxid-cpmdc_8h_1afae0c7a27c94036223f7a0cf60488f56: .. ref-code-block:: cpp :class: doxyrest-title-code-block void cpmdc_finalize(void) Finalize an owned embedded CPMD runtime. .. index:: pair: function; cpmdc_last_energy_components .. _doxid-cpmdc_8h_1a0d2884a4f1288d9f5e76ec4abb505246: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_last_energy_components(:ref:`CPMDCEnergyComponents`* out) Copy the last in-process ``ener_com`` energy decomposition. The no-session entry points read the active calculator. A session entry point reads that session, including after another session has run. Returns 0 when ``out->valid`` is set. Values are Hartree. .. index:: pair: function; cpmdc_session_last_energy_components .. _doxid-cpmdc_8h_1a6de74b0ee488509c061fcbbdab84701e: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_last_energy_components(const :ref:`CPMDCSession`* session, :ref:`CPMDCEnergyComponents`* out) Copy the last energy decomposition stored on ``session``. .. index:: pair: function; cpmdc_last_charge_integrals .. _doxid-cpmdc_8h_1a730ce53f4a99387b5f1ebe03e23f3883: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_last_charge_integrals(:ref:`CPMDCChargeIntegrals`* out) Copy the last in-process density integrals. Returns 0 when ``out->valid`` is set. Does not write ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_session_last_charge_integrals .. _doxid-cpmdc_8h_1a16b278145c1a0ebe3d1b6da8e0c3b2a2: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_last_charge_integrals(const :ref:`CPMDCSession`* session, :ref:`CPMDCChargeIntegrals`* out) Copy the last density integrals stored on ``session``. .. index:: pair: function; cpmdc_last_multi_state_energies .. _doxid-cpmdc_8h_1a81e70c2ce3ed9bf5ea9d85ca8dcf2c12: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_last_multi_state_energies(:ref:`CPMDCMultiStateEnergies`* out) Copy the last multi-state energy catalog. Returns 0 when ``out->valid`` is set. Does not write ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_session_last_multi_state_energies .. _doxid-cpmdc_8h_1ada692b66033d04c0a292173540ea8ba3: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_last_multi_state_energies(const :ref:`CPMDCSession`* session, :ref:`CPMDCMultiStateEnergies`* out) Copy the last multi-state energy catalog stored on ``session``. .. index:: pair: function; cpmdc_last_md_trajectory_row .. _doxid-cpmdc_8h_1a79b53381ce1bfa4271eb3f0236e4c933: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_last_md_trajectory_row(:ref:`CPMDCMDTrajectoryRow`* out) Copy the last trajectory row. Values are Hartree. Returns 0 when ``out->valid`` is set. Does not write ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_session_last_md_trajectory_row .. _doxid-cpmdc_8h_1ac74b43e1abe4f7a80fc6b1d17b6cd24a: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_last_md_trajectory_row(const :ref:`CPMDCSession`* session, :ref:`CPMDCMDTrajectoryRow`* out) Copy the last trajectory row stored on ``session``. .. index:: pair: function; cpmdc_last_property_snapshot .. _doxid-cpmdc_8h_1a82c93318bc595fe735d8551cf0c2065b: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_last_property_snapshot(:ref:`CPMDCPropertySnapshot`* out) Copy the last property snapshot. Returns 0 when ``out->valid`` is set. Does not write ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_session_last_property_snapshot .. _doxid-cpmdc_8h_1a1bbb45afce5cebb9f5141109fbe2f6d1: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_last_property_snapshot(const :ref:`CPMDCSession`* session, :ref:`CPMDCPropertySnapshot`* out) Copy the last property snapshot stored on ``session``. .. index:: pair: function; cpmdc_last_stress .. _doxid-cpmdc_8h_1ad1997ec438a489fa8321c36bcf5ec0b7: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_last_stress(:ref:`CPMDCStressTensor`* out) Copy the last stress tensor. Returns 0 when ``out->valid`` is set, which is only after stress was computed for a periodic cell. Does not write ``:ref:`cpmdc_last_error() ```. .. index:: pair: function; cpmdc_session_last_stress .. _doxid-cpmdc_8h_1a213829ea7a748a92923d6de4c20e9e50: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_session_last_stress(const :ref:`CPMDCSession`* session, :ref:`CPMDCStressTensor`* out) Copy the last stress tensor stored on ``session``. .. index:: pair: function; cpmdc_feature_count .. _doxid-cpmdc__features_8h_1a4cf7e2f669806606c1d1293533b3d38e: .. ref-code-block:: cpp :class: doxyrest-title-code-block size_t cpmdc_feature_count(void) Number of entries returned by ``:ref:`cpmdc_feature_table() ```. .. index:: pair: function; cpmdc_feature_table .. _doxid-cpmdc__features_8h_1ae40eb0e96927dc5f3feacc20c3869315: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`CPMDCFeatureEntry`* cpmdc_feature_table(void) Return the contiguous feature table. The returned pointer has ``:ref:`cpmdc_feature_count() ``` entries and remains owned by the library. .. index:: pair: function; cpmdc_feature_find .. _doxid-cpmdc__features_8h_1a4d2414cdfa87d867cf1ab1e708dfb4ca: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`CPMDCFeatureEntry`* cpmdc_feature_find(const char* feature_id) Find one feature by stable ID. .. rubric:: Returns: Pointer to the matching table entry, or ``NULL`` when the feature ID is not present. .. index:: pair: function; cpmdc_restart_read_mem .. _doxid-cpmdc__restart_8h_1ae7b62fa4d0ac1400f7ca88fae6687f2e: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`cpmdc_restart`* cpmdc_restart_read_mem(const void* bytes, size_t nbytes, char* err, size_t err_cap) Read a RESTART image from a memory buffer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - bytes - RESTART image bytes. * - nbytes - Number of bytes in ``bytes``. * - err - Diagnostic buffer. May be NULL. * - err_cap - Capacity of ``err``, including the terminating NUL. .. rubric:: Returns: The image, or NULL on failure. .. index:: pair: function; cpmdc_restart_read_path .. _doxid-cpmdc__restart_8h_1ac5c4295836c617d13898d447a69e5d23: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`cpmdc_restart`* cpmdc_restart_read_path(const char* path, char* err, size_t err_cap) Read a RESTART image from a filesystem path. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - path - Filesystem path of the RESTART file. * - err - Diagnostic buffer. May be NULL. * - err_cap - Capacity of ``err``, including the terminating NUL. .. rubric:: Returns: The image, or NULL on failure. .. index:: pair: function; cpmdc_restart_free .. _doxid-cpmdc__restart_8h_1a21508759d96038feef8c60585540cef8: .. ref-code-block:: cpp :class: doxyrest-title-code-block void cpmdc_restart_free(:ref:`cpmdc_restart`* file) Release an image returned by the readers. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to free. May be NULL. .. index:: pair: function; cpmdc_restart_is_stream .. _doxid-cpmdc__restart_8h_1a9b4712e82aa09f84838b8df2dae379df: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_is_stream(const :ref:`cpmdc_restart`* file) Report whether the image uses the continuing-record stream layout. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. .. rubric:: Returns: 1 when ``file`` uses that layout, 0 otherwise. .. index:: pair: function; cpmdc_restart_header .. _doxid-cpmdc__restart_8h_1aba7859dc9d37fbd8e751eef430ca5850: .. ref-code-block:: cpp :class: doxyrest-title-code-block const char* cpmdc_restart_header(const :ref:`cpmdc_restart`* file) Section 1 header text. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. .. rubric:: Returns: The header, or NULL when the image has none. .. index:: pair: function; cpmdc_restart_section .. _doxid-cpmdc__restart_8h_1a050b8c038447fe4331830979e20b168c: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_section(const :ref:`cpmdc_restart`* file, int section, int* count) Report one section's record count. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - section - 1-based section index. * - count - Receives the integer in the section header, or 0 when the section is empty. .. rubric:: Returns: 0 when the section is present. .. index:: pair: function; cpmdc_restart_cell .. _doxid-cpmdc__restart_8h_1ac1cdda0a95509fea2153133d80f96b7b: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_cell(const :ref:`cpmdc_restart`* file, int* ibrav, int* indpg, double celldm[6]) Read the cell description. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - ibrav - Receives the stored ``ibrav``. May be NULL. * - indpg - Receives the stored ``indpg``. May be NULL. * - celldm - Receives the six lattice parameters. Required. .. rubric:: Returns: 0 when the cell section is present. .. index:: pair: function; cpmdc_restart_species .. _doxid-cpmdc__restart_8h_1a25f632af816723de80cb0218a28b016e: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_species(const :ref:`cpmdc_restart`* file, int* nsp, const int** na_per_species) Read the species counts. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - nsp - Receives the stored species count. May be NULL. * - na_per_species - Points at the image's own array. May be NULL. Valid until the image is freed or rewritten. .. rubric:: Returns: 0 when the species section is present. .. index:: pair: function; cpmdc_restart_ncoords .. _doxid-cpmdc__restart_8h_1abfa7aca8335d0fc77ba01516ca77d86a: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_ncoords(const :ref:`cpmdc_restart`* file) Number of coordinate triples in section 4. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. .. rubric:: Returns: The triple count, or 0 when that section is empty. .. index:: pair: function; cpmdc_restart_coordinates .. _doxid-cpmdc__restart_8h_1a1f0b3f9f57fd0ca15b1a07b8ff5a649c: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_coordinates(const :ref:`cpmdc_restart`* file, double* xyz, int n3) Copy coordinates in Bohr. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - xyz - Receives ``ncoords * 3`` doubles. * - n3 - Capacity of ``xyz`` in doubles. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_velocities .. _doxid-cpmdc__restart_8h_1aa8d1e583b86741cb4983f58e2fe911a0: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_velocities(const :ref:`cpmdc_restart`* file, double* xyz, int n3) Copy velocities in Bohr. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - xyz - Receives ``ncoords * 3`` doubles. * - n3 - Capacity of ``xyz`` in doubles. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_initial_coordinates .. _doxid-cpmdc__restart_8h_1a337a3c4578f21b024c908e66e0dd38fe: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_initial_coordinates(const :ref:`cpmdc_restart`* file, double* xyz, int n3) Copy the initial geometry in Bohr. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - xyz - Receives ``ncoords * 3`` doubles. * - n3 - Capacity of ``xyz`` in doubles. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_set_coordinates .. _doxid-cpmdc__restart_8h_1a3f076f8969698092b18908fb462ca13d: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_set_coordinates(:ref:`cpmdc_restart`* file, const double* xyz, int n3) Replace coordinates, leaving every other record unchanged. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to modify. * - xyz - ``n3`` doubles, ``ncoords * 3``, in Bohr. * - n3 - Number of doubles in ``xyz``. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_set_velocities .. _doxid-cpmdc__restart_8h_1a9f63ac6376aac41fd01fae63a73f3894: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_set_velocities(:ref:`cpmdc_restart`* file, const double* xyz, int n3) Replace velocities, leaving every other record unchanged. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to modify. * - xyz - ``n3`` doubles, in Bohr. * - n3 - Number of doubles in ``xyz``. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_set_cell .. _doxid-cpmdc__restart_8h_1a3395624eaaf387d38411b709c6f4c06b: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_set_cell(:ref:`cpmdc_restart`* file, const double celldm[6]) Replace the cell lattice parameters. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to modify. * - celldm - Six lattice parameters. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_cutoff .. _doxid-cpmdc__restart_8h_1a7fb885214c7ad0cda83cb7f7680fac6c: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_cutoff(const :ref:`cpmdc_restart`* file, double* ecut, double* cdual, int* dual_flag, int* nel, int* nr1s, int* nr2s, int* nr3s) Read the cutoff section. ``dual_flag`` is the logical ``dual`` stored in section 7 (0 or 1), not the real dual factor. That factor is ``cdual``. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - ecut - Receives the stored cutoff. May be NULL. * - cdual - Receives the stored real dual factor. May be NULL. * - dual_flag - Receives the stored logical dual, 0 or 1. May be NULL. * - nel - Receives the stored ``nel``. May be NULL. * - nr1s - Receives the stored ``nr1s``. May be NULL. * - nr2s - Receives the stored ``nr2s``. May be NULL. * - nr3s - Receives the stored ``nr3s``. May be NULL. .. rubric:: Returns: 0 when the section is present. .. index:: pair: function; cpmdc_restart_states .. _doxid-cpmdc__restart_8h_1a5870f76d69d3672e1fa136c705475dbc: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_states(const :ref:`cpmdc_restart`* file, int* n, int* nkpts, int* ngw, int* ngwl, int* nhg, int* nhgl) Read the electronic-state counts. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to query. * - n - Receives the stored state count. May be NULL. * - nkpts - Receives the stored k-point count. May be NULL. * - ngw - Receives the stored ``ngw``. May be NULL. * - ngwl - Receives the stored ``ngwl``. May be NULL. * - nhg - Receives the stored ``nhg``. May be NULL. * - nhgl - Receives the stored ``nhgl``. May be NULL. .. rubric:: Returns: 0 when the section is present. .. index:: pair: function; cpmdc_restart_write_mem .. _doxid-cpmdc__restart_8h_1a999ee8be4f5b1b7c629b28fedd6e6a4f: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_write_mem(const :ref:`cpmdc_restart`* file, void** bytes, size_t* nbytes, char* err, size_t err_cap) Write the image to a newly allocated buffer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to write. * - bytes - Receives a buffer the caller frees. * - nbytes - Receives the number of bytes written. * - err - Diagnostic buffer. May be NULL. * - err_cap - Capacity of ``err``, including the terminating NUL. .. rubric:: Returns: 0 on success. .. index:: pair: function; cpmdc_restart_write_path .. _doxid-cpmdc__restart_8h_1adda72bd3313b8e2ebd04360cb4ed5d2f: .. ref-code-block:: cpp :class: doxyrest-title-code-block int cpmdc_restart_write_path(const :ref:`cpmdc_restart`* file, const char* path, char* err, size_t err_cap) Write the image to a filesystem path. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - file - Image to write. * - path - Destination path. * - err - Diagnostic buffer. May be NULL. * - err_cap - Capacity of ``err``, including the terminating NUL. .. rubric:: Returns: 0 on success. Macros ------ .. index:: pair: define; CPMDC_ABI_VERSION .. _doxid-cpmdc_8h_1a3e1546a10c3fe2b968f3bfaffd048056: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define CPMDC_ABI_VERSION Numeric ABI generation of this header. Matches the shared-library soversion and :ref:`cpmdc_abi_version() `; bumps only on an incompatible ABI change. .. index:: pair: define; CPMDC_RESTART_ANGSTROM_PER_BOHR .. _doxid-cpmdc__restart_8h_1af60c430255991bb5fe2489d84b051597: .. ref-code-block:: cpp :class: doxyrest-title-code-block #define CPMDC_RESTART_ANGSTROM_PER_BOHR Angstroms per Bohr, matching OpenCPMD ``cnstfbohr``.