sync new library interface function across all interfaced derived packages

This commit is contained in:
Axel Kohlmeyer
2025-03-24 04:33:27 -04:00
parent 15cdba0bf0
commit e0322b96ec
6 changed files with 24 additions and 5 deletions

View File

@ -204,6 +204,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
ADDSYM(has_error);
ADDSYM(get_last_error_message);
}
ADDSYM(set_show_error);
ADDSYM(python_api_version);
return lmp;

View File

@ -109,6 +109,7 @@ struct _liblammpsplugin {
int abiversion;
int has_exceptions;
void *handle;
#if defined(LAMMPS_LIB_MPI)
void *(*open)(int, char **, MPI_Comm, void **);
#else
@ -187,7 +188,7 @@ struct _liblammpsplugin {
* the ifdef ensures they are compatible with rest of LAMMPS
* caller must match to how LAMMPS library is built */
#ifndef LAMMPS_BIGBIG
#if !defined(LAMMPS_BIGBIG)
int (*create_atoms)(void *, int, int *, int *, double *, double *, int *, int);
#else
int (*create_atoms)(void *, int, int64_t *, int *, double *, double *, int64_t *, int);
@ -255,6 +256,7 @@ struct _liblammpsplugin {
int (*has_error)(void *);
int (*get_last_error_message)(void *, char *, int);
int (*set_show_error)(void *, const int);
int (*python_api_version)();
};

View File

@ -248,6 +248,7 @@ MODULE LIBLAMMPS
PROCEDURE :: force_timeout => lmp_force_timeout
PROCEDURE :: has_error => lmp_has_error
PROCEDURE :: get_last_error_message => lmp_get_last_error_message
PROCEDURE :: set_show_error => lmp_set_show_error
END TYPE lammps
INTERFACE lammps
@ -1041,6 +1042,13 @@ MODULE LIBLAMMPS
INTEGER(c_int), VALUE :: buf_size
END FUNCTION lammps_get_last_error_message
INTEGER(c_int) FUNCTION lammps_set_show_error(handle,flag) BIND(C)
IMPORT :: c_ptr, c_int
IMPLICIT NONE
TYPE(c_ptr), VALUE :: handle
INTEGER(c_int), VALUE :: flag
END FUNCTION lammps_set_show_error
!---------------------------------------------------------------------
! Utility functions imported for convenience (not in library.h)
!---------------------------------------------------------------------
@ -3666,6 +3674,14 @@ CONTAINS
END IF
END SUBROUTINE lmp_get_last_error_message
! equivalent function to lammps_set_show_error
INTEGER FUNCTION lmp_set_show_error(self, flag)
CLASS(lammps), INTENT(IN) :: self
INTEGER, INTENT(IN) :: flag
lmp_set_show_error = lammps_set_show_error(self%handle, flag)
END FUNCTION lmp_set_show_error
! ----------------------------------------------------------------------
! functions to assign user-space pointers to LAMMPS data
! ----------------------------------------------------------------------

View File

@ -320,7 +320,7 @@ void Error::set_last_error(const char *msg, ErrorType type)
int Error::set_show_error(const int flag)
{
int oldflag = show_error
int oldflag = showerror;
showerror = flag;
return oldflag;
}

View File

@ -287,10 +287,8 @@ void lammps_decode_image_flags(int64_t image, int *flags);
#if defined(LAMMPS_BIGBIG)
typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **);
#elif defined(LAMMPS_SMALLBIG)
typedef void (*FixExternalFnPtr)(void *, int64_t, int, int *, double **, double **);
#else
typedef void (*FixExternalFnPtr)(void *, int, int, int *, double **, double **);
typedef void (*FixExternalFnPtr)(void *, int64_t, int, int *, double **, double **);
#endif
void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr,

View File

@ -222,6 +222,7 @@ extern int lammps_is_running(void *handle);
extern void lammps_force_timeout(void *handle);
extern int lammps_has_error(void *handle);
extern int lammps_get_last_error_message(void *handle, char *buffer, int buf_size);
extern int lammps_set_show_error(void *handle, const int flag);
extern int lammps_python_api_version();
%}
@ -418,6 +419,7 @@ extern int lammps_is_running(void *handle);
extern void lammps_force_timeout(void *handle);
extern int lammps_has_error(void *handle);
extern int lammps_get_last_error_message(void *handle, char *buffer, int buf_size);
extern int lammps_set_show_error(void *handle, const int flag);
extern int lammps_python_api_version();
/* last revised on 3 October 2022 */