Implemented plugin_name and plugin_count and their docs
This commit is contained in:
@ -350,6 +350,10 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS.
|
|||||||
:ftype id_count: function
|
:ftype id_count: function
|
||||||
:f id_name: :f:subr:`id_name`
|
:f id_name: :f:subr:`id_name`
|
||||||
:ftype id_name: subroutine
|
:ftype id_name: subroutine
|
||||||
|
:f plugin_count: :f:func:`plugin_count`
|
||||||
|
:ftype plugin_count: function
|
||||||
|
:f plugin_name: :f:subr:`plugin_name`
|
||||||
|
:ftype plugin_count: subroutine
|
||||||
:f encode_image_flags: :f:func:`encode_image_flags`
|
:f encode_image_flags: :f:func:`encode_image_flags`
|
||||||
:ftype encode_image_flags: function
|
:ftype encode_image_flags: function
|
||||||
:f decode_image_flags: :f:subr:`decode_image_flags`
|
:f decode_image_flags: :f:subr:`decode_image_flags`
|
||||||
@ -741,7 +745,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
|||||||
:to: :cpp:func:`lammps_extract_global`
|
:to: :cpp:func:`lammps_extract_global`
|
||||||
:r pointer [polymorphic]: pointer to LAMMPS data. The left-hand side of the
|
:r pointer [polymorphic]: pointer to LAMMPS data. The left-hand side of the
|
||||||
assignment should be either a string (if expecting string data) or a
|
assignment should be either a string (if expecting string data) or a
|
||||||
C-compatible pointer (e.g., ``INTEGER (c_int), POINTER :: nlocal``) to the
|
C-compatible pointer (e.g., ``INTEGER(c_int), POINTER :: nlocal``) to the
|
||||||
extracted property. If expecting vector data, the pointer should have
|
extracted property. If expecting vector data, the pointer should have
|
||||||
dimension ":".
|
dimension ":".
|
||||||
|
|
||||||
@ -777,7 +781,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
|||||||
:to: :cpp:func:`lammps_extract_atom`
|
:to: :cpp:func:`lammps_extract_atom`
|
||||||
:r pointer: pointer to LAMMPS data. The left-hand side of the
|
:r pointer: pointer to LAMMPS data. The left-hand side of the
|
||||||
assignment should be a C-interoperable pointer of appropriate kind and rank
|
assignment should be a C-interoperable pointer of appropriate kind and rank
|
||||||
(e.g., ``INTEGER (c_int), POINTER :: mask(:)``) to the extracted
|
(e.g., ``INTEGER(c_int), POINTER :: mask(:)``) to the extracted
|
||||||
property. If expecting vector data, the pointer should have dimension ":";
|
property. If expecting vector data, the pointer should have dimension ":";
|
||||||
if expecting matrix data, the pointer should have dimension ":,:".
|
if expecting matrix data, the pointer should have dimension ":,:".
|
||||||
:rtype pointer: polymorphic
|
:rtype pointer: polymorphic
|
||||||
@ -955,7 +959,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
|||||||
(scalar, vector, or array)
|
(scalar, vector, or array)
|
||||||
:to: :cpp:func:`lammps_extract_compute`
|
:to: :cpp:func:`lammps_extract_compute`
|
||||||
:r pointer: pointer to LAMMPS data. The left-hand side of the assignment
|
:r pointer: pointer to LAMMPS data. The left-hand side of the assignment
|
||||||
should be a C-compatible pointer (e.g., ``REAL (c_double), POINTER :: x``)
|
should be a C-compatible pointer (e.g., ``REAL(c_double), POINTER :: x``)
|
||||||
to the extracted property. If expecting vector data, the pointer should
|
to the extracted property. If expecting vector data, the pointer should
|
||||||
have dimension ":"; if expecting array (matrix) data, the pointer should
|
have dimension ":"; if expecting array (matrix) data, the pointer should
|
||||||
have dimension ":,:".
|
have dimension ":,:".
|
||||||
@ -1985,6 +1989,48 @@ Procedures Bound to the :f:type:`lammps` Derived Type
|
|||||||
If *idx* is out of range, *buffer* is set to an empty string and a warning
|
If *idx* is out of range, *buffer* is set to an empty string and a warning
|
||||||
is issued.
|
is issued.
|
||||||
|
|
||||||
|
:p character(len=\*) category: category of IDs
|
||||||
|
:p integer(c_int) idx: index of the ID in the list of *category*
|
||||||
|
styles (:math:`0 \leq idx < count`)
|
||||||
|
:p character(len=\*) buffer: string into which to copy the name of the
|
||||||
|
style
|
||||||
|
:to: :cpp:func:`lammps_id_name`
|
||||||
|
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. f:function:: plugin_count()
|
||||||
|
|
||||||
|
This function counts the number of loaded plugins.
|
||||||
|
|
||||||
|
.. versionadded:: TBD
|
||||||
|
|
||||||
|
:to: :cpp:func:`lammps_plugin_count`
|
||||||
|
:r n: number of loaded plugins
|
||||||
|
:rtype n: integer(c_int)
|
||||||
|
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. f:subroutine:: plugin_name(idx, stylebuf, namebuf)
|
||||||
|
|
||||||
|
Look up the style and name of a plugin by its index in the list of plugins.
|
||||||
|
|
||||||
|
.. versionadded:: TBD
|
||||||
|
|
||||||
|
This function copies the name of the *style* plugin with the index *idx*
|
||||||
|
into the provided C-style string buffer. The length of the buffer must be
|
||||||
|
provided as *buf_size* argument. If the name of the style exceeds the
|
||||||
|
length of the buffer, it will be truncated accordingly. If the index is out
|
||||||
|
of range, both strings are set to the empty string and a warning is
|
||||||
|
printed.
|
||||||
|
|
||||||
|
:p integer(c_int) idx: index of the plugin in the list all or
|
||||||
|
*style* plugins
|
||||||
|
:p character(len=\*) stylebuf: string into which to copy the style of the
|
||||||
|
plugin
|
||||||
|
:p character(len=\*) namebuf: string into which to copy the style of the
|
||||||
|
plugin
|
||||||
|
:to: :cpp:func:`lammps_plugin_name`
|
||||||
|
|
||||||
--------
|
--------
|
||||||
|
|
||||||
.. f:function:: encode_image_flags(ix, iy, iz)
|
.. f:function:: encode_image_flags(ix, iy, iz)
|
||||||
|
|||||||
@ -163,7 +163,8 @@ MODULE LIBLAMMPS
|
|||||||
PROCEDURE :: has_id => lmp_has_id
|
PROCEDURE :: has_id => lmp_has_id
|
||||||
PROCEDURE :: id_count => lmp_id_count
|
PROCEDURE :: id_count => lmp_id_count
|
||||||
PROCEDURE :: id_name => lmp_id_name
|
PROCEDURE :: id_name => lmp_id_name
|
||||||
!
|
PROCEDURE, NOPASS :: plugin_count => lammps_plugin_count
|
||||||
|
PROCEDURE :: plugin_name => lmp_plugin_name
|
||||||
PROCEDURE :: encode_image_flags => lmp_encode_image_flags
|
PROCEDURE :: encode_image_flags => lmp_encode_image_flags
|
||||||
PROCEDURE, PRIVATE :: lmp_decode_image_flags
|
PROCEDURE, PRIVATE :: lmp_decode_image_flags
|
||||||
PROCEDURE, PRIVATE :: lmp_decode_image_flags_bigbig
|
PROCEDURE, PRIVATE :: lmp_decode_image_flags_bigbig
|
||||||
@ -684,8 +685,19 @@ MODULE LIBLAMMPS
|
|||||||
INTEGER(c_int) :: lammps_id_name
|
INTEGER(c_int) :: lammps_id_name
|
||||||
END FUNCTION lammps_id_name
|
END FUNCTION lammps_id_name
|
||||||
|
|
||||||
!INTEGER(c_int) FUNCTION lammps_plugin_count
|
FUNCTION lammps_plugin_count() BIND(C)
|
||||||
!SUBROUTINE lammps_plugin_name
|
IMPORT :: c_int
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(c_int) :: lammps_plugin_count
|
||||||
|
END FUNCTION lammps_plugin_count
|
||||||
|
|
||||||
|
FUNCTION lammps_plugin_name(idx, stylebuf, namebuf, buf_size) BIND(C)
|
||||||
|
IMPORT :: c_int, c_ptr
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(c_int), VALUE :: idx, buf_size
|
||||||
|
TYPE(c_ptr), VALUE :: stylebuf, namebuf
|
||||||
|
INTEGER(c_int) :: lammps_plugin_name
|
||||||
|
END FUNCTION lammps_plugin_name
|
||||||
|
|
||||||
! We don't call lammps_encode_image_flags because its interface is
|
! We don't call lammps_encode_image_flags because its interface is
|
||||||
! ambiguous: we don't know sizeof(imageint) prior to compile time.
|
! ambiguous: we don't know sizeof(imageint) prior to compile time.
|
||||||
@ -2177,6 +2189,31 @@ CONTAINS
|
|||||||
CALL lammps_free(Cbuffer)
|
CALL lammps_free(Cbuffer)
|
||||||
END SUBROUTINE lmp_id_name
|
END SUBROUTINE lmp_id_name
|
||||||
|
|
||||||
|
! equivalent function to lammps_plugin_name
|
||||||
|
SUBROUTINE lmp_plugin_name(self, idx, stylebuf, namebuf)
|
||||||
|
CLASS(lammps), INTENT(IN) :: self
|
||||||
|
INTEGER(c_int), INTENT(IN) :: idx
|
||||||
|
CHARACTER(LEN=*), INTENT(OUT) :: stylebuf, namebuf
|
||||||
|
INTEGER(c_int) :: buf_size, success
|
||||||
|
TYPE(c_ptr) :: Cstylebuf, Cnamebuf
|
||||||
|
|
||||||
|
buf_size = MIN(LEN(stylebuf, KIND=c_int), LEN(namebuf, KIND=c_int))
|
||||||
|
Cstylebuf = lammps_malloc(INT(buf_size, KIND=c_size_t))
|
||||||
|
Cnamebuf = lammps_malloc(INT(buf_size, KIND=c_size_t))
|
||||||
|
success = lammps_plugin_name(idx, Cstylebuf, Cnamebuf, buf_size)
|
||||||
|
IF (success /= 0_c_int) THEN
|
||||||
|
stylebuf = c2f_string(Cstylebuf)
|
||||||
|
namebuf = c2f_string(Cnamebuf)
|
||||||
|
ELSE
|
||||||
|
stylebuf = ''
|
||||||
|
namebuf = ''
|
||||||
|
CALL lmp_error(self, LMP_ERROR_WARNING + LMP_ERROR_WORLD, &
|
||||||
|
'call to lammps_plugin_name failed [Fortran/plugin_name]')
|
||||||
|
END IF
|
||||||
|
CALL lammps_free(Cstylebuf)
|
||||||
|
CALL lammps_free(Cnamebuf)
|
||||||
|
END SUBROUTINE lmp_plugin_name
|
||||||
|
|
||||||
! equivalent function to lammps_encode_image_flags
|
! equivalent function to lammps_encode_image_flags
|
||||||
FUNCTION lmp_encode_image_flags(self, ix, iy, iz) RESULT (image)
|
FUNCTION lmp_encode_image_flags(self, ix, iy, iz) RESULT (image)
|
||||||
CLASS(lammps), INTENT(IN), TARGET :: self
|
CLASS(lammps), INTENT(IN), TARGET :: self
|
||||||
|
|||||||
Reference in New Issue
Block a user