Add library functions for accessing LAMMPS configuration

This commit is contained in:
Richard Berger
2018-06-25 23:56:18 -04:00
parent 35f5a685f6
commit 19f81e0802
5 changed files with 100 additions and 6 deletions

View File

@ -38,6 +38,7 @@
#include "memory.h"
#include "error.h"
#include "force.h"
#include "info.h"
using namespace LAMMPS_NS;
@ -1522,6 +1523,56 @@ void lammps_create_atoms(void *ptr, int n, tagint *id, int *type,
END_CAPTURE
}
// ----------------------------------------------------------------------
// library API functions for accessing LAMMPS configuration
// ----------------------------------------------------------------------
int lammps_config_has_package(char * package_name) {
return Info::has_package(package_name);
}
int lammps_config_package_count() {
int i = 0;
while(LAMMPS::installed_packages[i] != NULL) {
++i;
}
return i;
}
int lammps_config_package_name(int index, char * buffer, int max_size) {
int i = 0;
while(LAMMPS::installed_packages[i] != NULL && i < index) {
++i;
}
if(LAMMPS::installed_packages[i] != NULL) {
strncpy(buffer, LAMMPS::installed_packages[i], max_size);
return true;
}
return false;
}
int lammps_config_has_gzip_support() {
return Info::has_gzip_support();
}
int lammps_config_has_png_support() {
return Info::has_png_support();
}
int lammps_config_has_jpeg_support() {
return Info::has_jpeg_support();
}
int lammps_config_has_ffmpeg_support() {
return Info::has_ffmpeg_support();
}
int lammps_config_has_exceptions() {
return Info::has_exceptions();
}
// ----------------------------------------------------------------------
// library API functions for error handling
// ----------------------------------------------------------------------