Fixed optional parameters in find_pair_neighlist

This commit is contained in:
Karl Hammond
2022-10-28 20:53:46 -05:00
parent 55dafc110d
commit 73bf0334e4
2 changed files with 26 additions and 14 deletions

View File

@ -1517,7 +1517,7 @@ Procedures Bound to the :f:type:`lammps` Derived Type
-------- --------
.. f:function:: find_pair_neighlist(style, exact, nsub, reqid) .. f:function:: find_pair_neighlist(style[, exact][, nsub][, reqid])
Find index of a neighbor list requested by a pair style. Find index of a neighbor list requested by a pair style.
@ -1539,13 +1539,14 @@ Procedures Bound to the :f:type:`lammps` Derived Type
lists and set the request ID to a value greater than zero. lists and set the request ID to a value greater than zero.
:p character(len=\*) style: String used to search for pair style instance. :p character(len=\*) style: String used to search for pair style instance.
:p exact: Flag to control whther style should match exactly or only a :o exact: Flag to control whther style should match exactly or only a
regular expression/sub-string match is applied. regular expression/sub-string match is applied. Default: ``.TRUE.``.
:ptype exact: logical :otype exact: logical
:p integer(c_int) nsub: Match *nsub*\ th hybrid sub-style instance of :o integer(c_int) nsub: Match *nsub*\ th hybrid sub-style instance of
the same style the same style. Default: 0.
:p integer(c_int) reqid: Request ID to identify the neighbor list in :o integer(c_int) reqid: Request ID to identify the neighbor list in
case there are multiple requests from the same pair style instance. case there are multiple requests from the same pair style instance.
Default: 0.
:to: :cpp:func:`lammps_find_pair_neighlist` :to: :cpp:func:`lammps_find_pair_neighlist`
:r integer(c_int) index: Neighbor list index if found, otherwise :r integer(c_int) index: Neighbor list index if found, otherwise
:math:`-1`. :math:`-1`.

View File

@ -1857,19 +1857,30 @@ CONTAINS
reqid) reqid)
CLASS(lammps), INTENT(IN) :: self CLASS(lammps), INTENT(IN) :: self
CHARACTER(LEN=*), INTENT(IN) :: style CHARACTER(LEN=*), INTENT(IN) :: style
LOGICAL, INTENT(IN) :: exact LOGICAL, INTENT(IN), OPTIONAL :: exact
INTEGER(c_int), INTENT(IN) :: nsub, reqid INTEGER(c_int), INTENT(IN), OPTIONAL :: nsub, reqid
TYPE(c_ptr) :: Cstyle TYPE(c_ptr) :: Cstyle
INTEGER(c_int) :: Cexact INTEGER(c_int) :: Cexact, Cnsub, Creqid
IF (exact) THEN Cexact = 0_c_int
Cexact = 1_c_int IF (PRESENT(exact)) THEN
IF (exact) THEN
Cexact = 1_c_int
END IF
END IF
IF (PRESENT(nsub)) THEN
Cnsub = nsub
ELSE ELSE
Cexact = 0_c_int Cnsub = 0_c_int
END IF
IF (PRESENT(reqid)) THEN
Creqid = reqid
ELSE
Creqid = 0_c_int
END IF END IF
Cstyle = f2c_string(style) Cstyle = f2c_string(style)
lmp_find_pair_neighlist = lammps_find_pair_neighlist(self%handle, Cstyle, & lmp_find_pair_neighlist = lammps_find_pair_neighlist(self%handle, Cstyle, &
Cexact, nsub, reqid) Cexact, Cnsub, Creqid)
IF (lmp_find_pair_neighlist < 0) THEN IF (lmp_find_pair_neighlist < 0) THEN
CALL lmp_error(self, LMP_ERROR_WARNING + LMP_ERROR_WORLD, & CALL lmp_error(self, LMP_ERROR_WARNING + LMP_ERROR_WORLD, &
'unable to find pair neighbor list [Fortran/find_pair_neighlist]') 'unable to find pair neighbor list [Fortran/find_pair_neighlist]')