diff --git a/examples/COUPLE/plugin/liblammpsplugin.c b/examples/COUPLE/plugin/liblammpsplugin.c index 7df23c5b67..5d27a0a64b 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.c +++ b/examples/COUPLE/plugin/liblammpsplugin.c @@ -150,6 +150,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib) ADDSYM(config_has_png_support); ADDSYM(config_has_jpeg_support); ADDSYM(config_has_ffmpeg_support); + ADDSYM(config_has_curl_support); ADDSYM(config_has_exceptions); ADDSYM(config_has_package); diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index 9f53e4749b..556718816c 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -203,6 +203,7 @@ struct _liblammpsplugin { int (*config_has_png_support)(); int (*config_has_jpeg_support)(); int (*config_has_ffmpeg_support)(); + int (*config_has_curl_support)(); int (*config_has_exceptions)(); int (*config_has_package)(const char *); diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index a70a7e8af4..1617891b92 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -196,6 +196,7 @@ MODULE LIBLAMMPS PROCEDURE, NOPASS :: config_has_jpeg_support => lmp_config_has_jpeg_support PROCEDURE, NOPASS :: config_has_ffmpeg_support & => lmp_config_has_ffmpeg_support + PROCEDURE, NOPASS :: config_has_curl_support => lmp_config_has_curl_support PROCEDURE, NOPASS :: config_has_exceptions => lmp_config_has_exceptions PROCEDURE, NOPASS :: config_has_package => lmp_config_has_package PROCEDURE, NOPASS :: config_package_count => lammps_config_package_count @@ -793,6 +794,12 @@ MODULE LIBLAMMPS INTEGER(c_int) :: lammps_config_has_ffmpeg_support END FUNCTION lammps_config_has_ffmpeg_support + FUNCTION lammps_config_has_curl_support() BIND(C) + IMPORT :: c_int + IMPLICIT NONE + INTEGER(c_int) :: lammps_config_has_curl_support + END FUNCTION lammps_config_has_curl_support + FUNCTION lammps_config_has_exceptions() BIND(C) IMPORT :: c_int IMPLICIT NONE @@ -2881,6 +2888,14 @@ CONTAINS lmp_config_has_ffmpeg_support = (has_ffmpeg_support /= 0_c_int) END FUNCTION lmp_config_has_ffmpeg_support + ! equivalent function to lammps_config_has_curl_support + LOGICAL FUNCTION lmp_config_has_curl_support() + INTEGER(c_int) :: has_curl_support + + has_curl_support = lammps_config_has_curl_support() + lmp_config_has_curl_support = (has_curl_support /= 0_c_int) + END FUNCTION lmp_config_has_curl_support + ! equivalent function to lammps_config_has_exceptions LOGICAL FUNCTION lmp_config_has_exceptions() INTEGER(c_int) :: has_exceptions diff --git a/python/lammps/core.py b/python/lammps/core.py index 42e8652fef..9080dd9c56 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -1969,6 +1969,21 @@ class lammps(object): # ------------------------------------------------------------------------- + @property + def has_curl_support(self): + """ Report whether the LAMMPS shared library was compiled with support + for downloading files through libcurl. + + This is a wrapper around the :cpp:func:`lammps_config_has_curl_support` + function of the library interface. + + :return: state of CURL support + :rtype: bool + """ + return self.lib.lammps_config_has_curl_support() != 0 + + # ------------------------------------------------------------------------- + def has_package(self, name): """ Report if the named package has been enabled in the LAMMPS shared library. diff --git a/src/library.cpp b/src/library.cpp index b7a2113de8..549a015767 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -5877,6 +5877,23 @@ int lammps_config_has_ffmpeg_support() { /* ---------------------------------------------------------------------- */ +/** Check if the LAMMPS library supports downloading files via libcurl + +\verbatim embed:rst +The LAMMPS :doc:`geturl command ` supports downloading files +through using `the libcurl library `_. +This function checks whether this feature was :ref:`enabled at compile +time ` and LAMMPS linked to the libcurl library. +\endverbatim + * + * \return 1 if yes, otherwise 0 + */ +int lammps_config_has_curl_support() { + return Info::has_curl_support() ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + /** Check whether LAMMPS errors will throw C++ exceptions. * \verbatim embed:rst diff --git a/src/library.h b/src/library.h index 38ecffb772..ff16aaa088 100644 --- a/src/library.h +++ b/src/library.h @@ -243,6 +243,7 @@ int lammps_config_has_gzip_support(); int lammps_config_has_png_support(); int lammps_config_has_jpeg_support(); int lammps_config_has_ffmpeg_support(); +int lammps_config_has_curl_support(); int lammps_config_has_exceptions(); int lammps_config_has_package(const char *); diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index 2207a72e36..9bef047da4 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -171,6 +171,7 @@ extern int lammps_config_has_gzip_support(); extern int lammps_config_has_png_support(); extern int lammps_config_has_jpeg_support(); extern int lammps_config_has_ffmpeg_support(); +extern int lammps_config_has_curl_support(); extern int lammps_config_has_exceptions(); extern int lammps_config_has_package(const char *); extern int lammps_config_package_count(); @@ -359,6 +360,7 @@ extern int lammps_config_has_gzip_support(); extern int lammps_config_has_png_support(); extern int lammps_config_has_jpeg_support(); extern int lammps_config_has_ffmpeg_support(); +extern int lammps_config_has_curl_support(); extern int lammps_config_has_exceptions(); extern int lammps_config_has_package(const char *); extern int lammps_config_package_count();