\(\renewcommand{\AA}{\text{Å}}\)

1.1.9. Utility functions

To simplify some tasks, the library interface contains these utility functions. They do not directly call the LAMMPS library.

The lammps_free() function is a clean-up function to free memory that the library had allocated previously via other function calls. Look for notes in the descriptions of the individual commands where such memory buffers were allocated that require the use of lammps_free().


int lammps_encode_image_flags(int ix, int iy, int iz)

void lammps_decode_image_flags(int image, int *flags)

void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr)

double **lammps_fix_external_get_force(void *handle, const char *id)

void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng)

void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng)

void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial)

void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial)

void lammps_fix_external_set_vector_length(void *handle, const char *id, int len)

void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val)

void lammps_flush_buffers(void *ptr)

void lammps_free(void *ptr)

int lammps_is_running(void *handle)

void lammps_force_timeout(void *handle)

int lammps_has_error(void *handle)

int lammps_get_last_error_message(void *handle, char *buffer, int buf_size)

int lammps_set_show_error(void *handle, const int flag)

int lammps_python_api_version()