Merge branch 'develop' into always-exceptions
This commit is contained in:
310
src/library.cpp
310
src/library.cpp
@ -238,6 +238,8 @@ void *lammps_open_no_mpi(int argc, char **argv, void **ptr)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
This function is a version of :cpp:func:`lammps_open`, that uses an
|
||||
integer for the MPI communicator as the MPI Fortran interface does. It
|
||||
is used in the :f:func:`lammps` constructor of the LAMMPS Fortran
|
||||
@ -248,8 +250,6 @@ communicator with ``MPI_Comm_f2c()`` and then calls
|
||||
If for some reason the creation or initialization of the LAMMPS instance
|
||||
fails a null pointer is returned.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
*See also*
|
||||
:cpp:func:`lammps_open_fortran`, :cpp:func:`lammps_open_no_mpi`
|
||||
|
||||
@ -295,13 +295,13 @@ void lammps_close(void *handle)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
The MPI standard requires that any MPI application must call
|
||||
``MPI_Init()`` exactly once before performing any other MPI function
|
||||
calls. This function checks, whether MPI is already initialized and
|
||||
calls ``MPI_Init()`` in case it is not.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
\endverbatim */
|
||||
|
||||
void lammps_mpi_init()
|
||||
@ -324,6 +324,8 @@ void lammps_mpi_init()
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
The MPI standard requires that any MPI application calls
|
||||
``MPI_Finalize()`` before exiting. Even if a calling program does not
|
||||
do any MPI calls, MPI is still initialized internally to avoid errors
|
||||
@ -332,8 +334,6 @@ before exiting the program to wait until all (parallel) tasks are
|
||||
completed and then MPI is cleanly shut down. After calling this
|
||||
function no more MPI calls may be made.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
*See also*
|
||||
:cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_python_finalize`
|
||||
\endverbatim */
|
||||
@ -357,6 +357,8 @@ void lammps_mpi_finalize()
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 2Jul2021
|
||||
|
||||
The Kokkos library may only be initialized once during the execution of
|
||||
a process. This is done automatically the first time Kokkos
|
||||
functionality is used. This requires that the Kokkos environment
|
||||
@ -364,8 +366,6 @@ must be explicitly shut down after any LAMMPS instance using it is
|
||||
closed (to release associated resources).
|
||||
After calling this function no Kokkos functionality may be used.
|
||||
|
||||
.. versionadded:: 2Jul2021
|
||||
|
||||
*See also*
|
||||
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_python_finalize`
|
||||
\endverbatim */
|
||||
@ -381,6 +381,8 @@ void lammps_kokkos_finalize()
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 20Sep2021
|
||||
|
||||
This function resets and clears an embedded Python environment
|
||||
by calling the `Py_Finalize() function
|
||||
<https://docs.python.org/3/c-api/init.html#c.Py_FinalizeEx>`_
|
||||
@ -400,8 +402,6 @@ after calling Py_Finalize().
|
||||
This function can be called to explicitly clear the Python
|
||||
environment in case it is safe to do so.
|
||||
|
||||
.. versionadded:: 20Sep2021
|
||||
|
||||
*See also*
|
||||
:cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize`
|
||||
\endverbatim */
|
||||
@ -418,6 +418,8 @@ void lammps_python_finalize()
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 3Nov2022
|
||||
|
||||
This function is a wrapper around functions in the ``Error`` to print an
|
||||
error message and then stop LAMMPS.
|
||||
|
||||
@ -426,8 +428,6 @@ of constants from :cpp:enum:`_LMP_ERROR_CONST`. If the value does not
|
||||
match any valid combination of constants a warning is printed and the
|
||||
function returns.
|
||||
|
||||
.. versionadded:: 3Nov2022
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance
|
||||
@ -708,14 +708,16 @@ double lammps_get_natoms(void *handle)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Get current value of a thermo keyword.
|
||||
/** Evaluate a thermo keyword.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
This function returns the current value of a :doc:`thermo keyword
|
||||
<thermo_style>`. Unlike :cpp:func:`lammps_extract_global` it does not
|
||||
give access to the storage of the desired data but returns its value as
|
||||
a ``double``, so it can also return information that is computed on-the-fly.
|
||||
This function returns the current value of a :doc:`thermo keyword <thermo_style>`.
|
||||
Unlike :cpp:func:`lammps_extract_global` it does not give access to the
|
||||
storage of the desired data but returns its value as a ``double``, so it
|
||||
can also return information that is computed on-the-fly.
|
||||
Use :cpp:func:`lammps_last_thermo` to get access to the cached data from
|
||||
the last thermo output.
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
@ -739,6 +741,106 @@ double lammps_get_thermo(void *handle, const char *keyword)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Access cached data from last thermo output
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 15Jun2023
|
||||
|
||||
This function provides access to cached data from the last thermo output.
|
||||
This differs from :cpp:func:`lammps_get_thermo` in that it does not trigger
|
||||
an evaluation. Instead it provides direct access to a read-only location
|
||||
of the last thermo output data and the corresponding keyword strings.
|
||||
The how to handle the return value depends on the value of the *what*
|
||||
argument string.
|
||||
|
||||
.. note::
|
||||
|
||||
The *type* property points to a static location that is reassigned
|
||||
with every call, so the returned pointer should be recast,
|
||||
dereferenced, and assigned immediately. Otherwise, its value may be
|
||||
changed with the next invocation of the function.
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: auto
|
||||
|
||||
* - Value of *what*
|
||||
- Description of return value
|
||||
- Data type
|
||||
- Uses index
|
||||
* - step
|
||||
- timestep when the last thermo output was generated or -1
|
||||
- pointer to bigint
|
||||
- no
|
||||
* - num
|
||||
- number of fields in thermo output
|
||||
- pointer to int
|
||||
- no
|
||||
* - keyword
|
||||
- column keyword for thermo output
|
||||
- pointer to 0-terminated const char array
|
||||
- yes
|
||||
* - type
|
||||
- data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST`
|
||||
- pointer to int
|
||||
- yes
|
||||
* - data
|
||||
- actual field data for column
|
||||
- pointer to int, int64_t or double
|
||||
- yes
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance
|
||||
* \param what string with the kind of data requested
|
||||
* \param index integer with index into data arrays, ignored for scalar data
|
||||
* \return pointer to location of requested data cast to void or NULL */
|
||||
|
||||
void *lammps_last_thermo(void *handle, const char *what, int index)
|
||||
{
|
||||
auto lmp = (LAMMPS *) handle;
|
||||
void *val = nullptr;
|
||||
Thermo *th = lmp->output->thermo;
|
||||
if (!th) return nullptr;
|
||||
const int nfield = *th->get_nfield();
|
||||
|
||||
BEGIN_CAPTURE
|
||||
{
|
||||
if (strcmp(what, "step") == 0) {
|
||||
val = (void *) th->get_timestep();
|
||||
|
||||
} else if (strcmp(what, "num") == 0) {
|
||||
val = (void *) th->get_nfield();
|
||||
|
||||
} else if (strcmp(what, "keyword") == 0) {
|
||||
if ((index < 0) || (index >= nfield)) return nullptr;
|
||||
const auto &keywords = th->get_keywords();
|
||||
val = (void *) keywords[index].c_str();
|
||||
|
||||
} else if (strcmp(what, "type") == 0) {
|
||||
if ((index < 0) || (index >= nfield)) return nullptr;
|
||||
const auto &field = th->get_fields()[index];
|
||||
val = (void *) &field.type;
|
||||
} else if (strcmp(what, "data") == 0) {
|
||||
if ((index < 0) || (index >= nfield)) return nullptr;
|
||||
const auto &field = th->get_fields()[index];
|
||||
if (field.type == multitype::LAMMPS_INT) {
|
||||
val = (void *) &field.data.i;
|
||||
} else if (field.type == multitype::LAMMPS_INT64) {
|
||||
val = (void *) &field.data.b;
|
||||
} else if (field.type == multitype::LAMMPS_DOUBLE) {
|
||||
val = (void *) &field.data.d;
|
||||
}
|
||||
|
||||
} else val = nullptr;
|
||||
}
|
||||
END_CAPTURE
|
||||
return val;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Extract simulation box parameters.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
@ -866,6 +968,8 @@ void lammps_reset_box(void *handle, double *boxlo, double *boxhi,
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
This function will retrieve memory usage information for the current
|
||||
LAMMPS instance or process. The *meminfo* buffer will be filled with
|
||||
3 different numbers (if supported by the operating system). The first
|
||||
@ -878,8 +982,6 @@ third number is the maximum amount of RAM (not swap) used by the process
|
||||
so far. If any of the two latter parameters is not supported by the operating
|
||||
system it will be set to zero.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance
|
||||
@ -899,6 +1001,8 @@ void lammps_memory_usage(void *handle, double *meminfo)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
This will take the LAMMPS "world" communicator and convert it to an
|
||||
integer using ``MPI_Comm_c2f()``, so it is equivalent to the
|
||||
corresponding MPI communicator in Fortran. This way it can be safely
|
||||
@ -907,8 +1011,6 @@ to the C language representation use ``MPI_Comm_f2c()``.
|
||||
|
||||
If LAMMPS was compiled with MPI_STUBS, this function returns -1.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
*See also*
|
||||
:cpp:func:`lammps_open_fortran`
|
||||
|
||||
@ -1171,13 +1273,13 @@ int lammps_extract_setting(void *handle, const char *keyword)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
This function returns an integer that encodes the data type of the global
|
||||
property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid
|
||||
values. Callers of :cpp:func:`lammps_extract_global` can use this information
|
||||
to then decide how to cast the ``void *`` pointer and access the data.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance (unused)
|
||||
@ -1227,6 +1329,13 @@ int lammps_extract_global_datatype(void * /*handle*/, const char *name)
|
||||
if (strcmp(name,"q_flag") == 0) return LAMMPS_INT;
|
||||
|
||||
if (strcmp(name,"units") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"atom_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"pair_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"bond_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"angle_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"dihedral_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"improper_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"kspace_style") == 0) return LAMMPS_STRING;
|
||||
if (strcmp(name,"boltz") == 0) return LAMMPS_DOUBLE;
|
||||
if (strcmp(name,"hplanck") == 0) return LAMMPS_DOUBLE;
|
||||
if (strcmp(name,"mvv2e") == 0) return LAMMPS_DOUBLE;
|
||||
@ -1473,6 +1582,34 @@ report the "native" data type. The following tables are provided:
|
||||
- int
|
||||
- 1
|
||||
- **deprecated**. Use :cpp:func:`lammps_extract_setting` instead.
|
||||
* - atom_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current atom style.
|
||||
* - pair_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current pair style.
|
||||
* - bond_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current bond style.
|
||||
* - angle_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current angle style.
|
||||
* - dihedral_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current dihedral style.
|
||||
* - improper_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current improper style.
|
||||
* - kspace_style
|
||||
- char \*
|
||||
- 1
|
||||
- string with the current KSpace style.
|
||||
|
||||
.. _extract_unit_settings:
|
||||
|
||||
@ -1579,6 +1716,13 @@ void *lammps_extract_global(void *handle, const char *name)
|
||||
auto lmp = (LAMMPS *) handle;
|
||||
|
||||
if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style;
|
||||
if (strcmp(name,"atom_style") == 0) return (void *) lmp->atom->atom_style;
|
||||
if (strcmp(name,"pair_style") == 0) return (void *) lmp->force->pair_style;
|
||||
if (strcmp(name,"bond_style") == 0) return (void *) lmp->force->bond_style;
|
||||
if (strcmp(name,"angle_style") == 0) return (void *) lmp->force->angle_style;
|
||||
if (strcmp(name,"dihedral_style") == 0) return (void *) lmp->force->dihedral_style;
|
||||
if (strcmp(name,"improper_style") == 0) return (void *) lmp->force->improper_style;
|
||||
if (strcmp(name,"kspace_style") == 0) return (void *) lmp->force->kspace_style;
|
||||
if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt;
|
||||
if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep;
|
||||
// update->atime can be referenced as a pointer
|
||||
@ -1660,13 +1804,13 @@ void *lammps_extract_global(void *handle, const char *name)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
This function returns an integer that encodes the data type of the per-atom
|
||||
property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid
|
||||
values. Callers of :cpp:func:`lammps_extract_atom` can use this information
|
||||
to then decide how to cast the ``void *`` pointer and access the data.
|
||||
|
||||
.. versionadded:: 18Sep2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance
|
||||
@ -2193,13 +2337,13 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 3Nov2022
|
||||
|
||||
This function returns an integer that encodes the data type of the variable
|
||||
with the specified name. See :cpp:enum:`_LMP_VAR_CONST` for valid values.
|
||||
Callers of :cpp:func:`lammps_extract_variable` can use this information to
|
||||
decide how to cast the ``void *`` pointer and access the data.
|
||||
|
||||
.. versionadded:: 3Nov2022
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance
|
||||
@ -3051,6 +3195,8 @@ void lammps_scatter_atoms_subset(void *handle, const char *name, int type,
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This function copies the list of all bonds into a buffer provided by
|
||||
the calling code. The buffer will be filled with bond type, bond atom 1,
|
||||
bond atom 2 for each bond. Thus the buffer has to be allocated to the
|
||||
@ -3065,8 +3211,6 @@ When running in parallel, the data buffer must be allocated on **all**
|
||||
MPI ranks and will be filled with the information for **all** bonds
|
||||
in the system.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
Below is a brief C code demonstrating accessing this collected bond information.
|
||||
|
||||
.. code-block:: c
|
||||
@ -3146,7 +3290,8 @@ void lammps_gather_bonds(void *handle, void *data)
|
||||
}
|
||||
|
||||
tagint **bonds;
|
||||
lmp->memory->create(bonds, localbonds, 3, "library:gather_bonds:localbonds");
|
||||
// add 1 to localbonds, so "bonds" does not become a NULL pointer
|
||||
lmp->memory->create(bonds, localbonds+1, 3, "library:gather_bonds:localbonds");
|
||||
lmp->atom->avec->pack_bond(bonds);
|
||||
MPI_Allgatherv(&bonds[0][0], 3*localbonds, MPI_LMP_TAGINT, data, bufsizes,
|
||||
bufoffsets, MPI_LMP_TAGINT, lmp->world);
|
||||
@ -3161,6 +3306,8 @@ void lammps_gather_bonds(void *handle, void *data)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
This function copies the list of all angles into a buffer provided by
|
||||
the calling code. The buffer will be filled with angle type, angle atom 1,
|
||||
angle atom 2, angle atom 3 for each angle. Thus the buffer has to be allocated to the
|
||||
@ -3175,8 +3322,6 @@ When running in parallel, the data buffer must be allocated on **all**
|
||||
MPI ranks and will be filled with the information for **all** angles
|
||||
in the system.
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
Below is a brief C code demonstrating accessing this collected angle information.
|
||||
|
||||
.. code-block:: c
|
||||
@ -3256,7 +3401,8 @@ void lammps_gather_angles(void *handle, void *data)
|
||||
}
|
||||
|
||||
tagint **angles;
|
||||
lmp->memory->create(angles, localangles, 4, "library:gather_angles:localangles");
|
||||
// add 1 to localangles, so "angles" does not become a NULL pointer
|
||||
lmp->memory->create(angles, localangles+1, 4, "library:gather_angles:localangles");
|
||||
lmp->atom->avec->pack_angle(angles);
|
||||
MPI_Allgatherv(&angles[0][0], 4*localangles, MPI_LMP_TAGINT, data, bufsizes,
|
||||
bufoffsets, MPI_LMP_TAGINT, lmp->world);
|
||||
@ -3271,6 +3417,8 @@ void lammps_gather_angles(void *handle, void *data)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
This function copies the list of all dihedrals into a buffer provided by
|
||||
the calling code. The buffer will be filled with dihedral type, dihedral atom 1,
|
||||
dihedral atom 2, dihedral atom 3, dihedral atom 4 for each dihedral.
|
||||
@ -3286,8 +3434,6 @@ When running in parallel, the data buffer must be allocated on **all**
|
||||
MPI ranks and will be filled with the information for **all** dihedrals
|
||||
in the system.
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
Below is a brief C code demonstrating accessing this collected dihedral information.
|
||||
|
||||
.. code-block:: c
|
||||
@ -3367,7 +3513,8 @@ void lammps_gather_dihedrals(void *handle, void *data)
|
||||
}
|
||||
|
||||
tagint **dihedrals;
|
||||
lmp->memory->create(dihedrals, localdihedrals, 5, "library:gather_dihedrals:localdihedrals");
|
||||
// add 1 to localdihedrals, so "dihedrals" does not become a NULL pointer
|
||||
lmp->memory->create(dihedrals, localdihedrals+1, 5, "library:gather_dihedrals:localdihedrals");
|
||||
lmp->atom->avec->pack_dihedral(dihedrals);
|
||||
MPI_Allgatherv(&dihedrals[0][0], 5*localdihedrals, MPI_LMP_TAGINT, data, bufsizes,
|
||||
bufoffsets, MPI_LMP_TAGINT, lmp->world);
|
||||
@ -3382,6 +3529,8 @@ void lammps_gather_dihedrals(void *handle, void *data)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
This function copies the list of all impropers into a buffer provided by
|
||||
the calling code. The buffer will be filled with improper type, improper atom 1,
|
||||
improper atom 2, improper atom 3, improper atom 4 for each improper.
|
||||
@ -3397,8 +3546,6 @@ When running in parallel, the data buffer must be allocated on **all**
|
||||
MPI ranks and will be filled with the information for **all** impropers
|
||||
in the system.
|
||||
|
||||
.. versionadded:: 8Feb2023
|
||||
|
||||
Below is a brief C code demonstrating accessing this collected improper information.
|
||||
|
||||
.. code-block:: c
|
||||
@ -3478,7 +3625,8 @@ void lammps_gather_impropers(void *handle, void *data)
|
||||
}
|
||||
|
||||
tagint **impropers;
|
||||
lmp->memory->create(impropers, localimpropers, 5, "library:gather_impropers:localimpropers");
|
||||
// add 1 to localimpropers, so "impropers" does not become a NULL pointer
|
||||
lmp->memory->create(impropers, localimpropers+1, 5, "library:gather_impropers:localimpropers");
|
||||
lmp->atom->avec->pack_improper(impropers);
|
||||
MPI_Allgatherv(&impropers[0][0], 5*localimpropers, MPI_LMP_TAGINT, data, bufsizes,
|
||||
bufoffsets, MPI_LMP_TAGINT, lmp->world);
|
||||
@ -5191,6 +5339,8 @@ int lammps_version(void *handle)
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
The :cpp:func:`lammps_get_os_info` function can be used to retrieve
|
||||
detailed information about the hosting operating system and
|
||||
compiler/runtime.
|
||||
@ -5199,8 +5349,6 @@ A suitable buffer for a C-style string has to be provided and its length.
|
||||
The assembled text will be truncated to not overflow this buffer. The
|
||||
string is typically a few hundred bytes long.
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param buffer string buffer to copy the information to
|
||||
@ -5429,6 +5577,8 @@ int lammps_config_accelerator(const char *package,
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 14May2021
|
||||
|
||||
The :cpp:func:`lammps_has_gpu_device` function checks at runtime if
|
||||
an accelerator device is present that can be used with the
|
||||
:doc:`GPU package <Speed_gpu>`. If at least one suitable device is
|
||||
@ -5438,8 +5588,6 @@ More detailed information about the available device or devices can
|
||||
be obtained by calling the
|
||||
:cpp:func:`lammps_get_gpu_device_info` function.
|
||||
|
||||
.. versionadded:: 14May2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \return 1 if viable device is available, 0 if not. */
|
||||
@ -5453,6 +5601,8 @@ int lammps_has_gpu_device()
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 14May2021
|
||||
|
||||
The :cpp:func:`lammps_get_gpu_device_info` function can be used to retrieve
|
||||
detailed information about any accelerator devices that are viable for use
|
||||
with the :doc:`GPU package <Speed_gpu>`. It will produce a string that is
|
||||
@ -5464,8 +5614,6 @@ A suitable buffer for a C-style string has to be provided and its length.
|
||||
The assembled text will be truncated to not overflow this buffer. This
|
||||
string can be several kilobytes long, if multiple devices are present.
|
||||
|
||||
.. versionadded:: 14May2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param buffer string buffer to copy the information to
|
||||
@ -5562,12 +5710,13 @@ int lammps_style_name(void *handle, const char *category, int idx,
|
||||
/** Check if a specific ID exists in the current LAMMPS instance
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
This function checks if the current LAMMPS instance a *category* ID of
|
||||
the given *name* exists. Valid categories are: *compute*\ , *dump*\ ,
|
||||
*fix*\ , *group*\ , *molecule*\ , *region*\ , and *variable*\ .
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -5601,13 +5750,14 @@ int lammps_has_id(void *handle, const char *category, const char *name) {
|
||||
/** Count the number of IDs of a category.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
This function counts how many IDs in the provided *category*
|
||||
are defined in the current LAMMPS instance.
|
||||
Please see :cpp:func:`lammps_has_id` for a list of valid
|
||||
categories.
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -5639,6 +5789,9 @@ int lammps_id_count(void *handle, const char *category) {
|
||||
/** Look up the name of an ID by index in the list of IDs of a given category.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
This function copies the name of the *category* ID 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
|
||||
@ -5646,8 +5799,6 @@ exceeds the length of the buffer, it will be truncated accordingly.
|
||||
If the index is out of range, the function returns 0 and *buffer* is
|
||||
set to an empty string, otherwise 1.
|
||||
|
||||
.. versionadded:: 9Oct2020
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -5710,10 +5861,11 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in
|
||||
/** Count the number of loaded plugins
|
||||
*
|
||||
\verbatim embed:rst
|
||||
This function counts how many plugins are currently loaded.
|
||||
|
||||
.. versionadded:: 10Mar2021
|
||||
|
||||
This function counts how many plugins are currently loaded.
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \return number of loaded plugins
|
||||
@ -5732,6 +5884,9 @@ int lammps_plugin_count()
|
||||
/** Look up the info of a loaded plugin by its index in the list of plugins
|
||||
*
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 10Mar2021
|
||||
|
||||
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
|
||||
@ -5739,8 +5894,6 @@ exceeds the length of the buffer, it will be truncated accordingly.
|
||||
If the index is out of range, the function returns 0 and *buffer* is
|
||||
set to an empty string, otherwise 1.
|
||||
|
||||
.. versionadded:: 10Mar2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param idx index of the plugin in the list all or *style* plugins
|
||||
@ -5899,9 +6052,11 @@ void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalF
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
Fix :doc:`external <fix_external>` allows programs that are running LAMMPS through
|
||||
its library interface to add or modify certain LAMMPS properties on specific
|
||||
timesteps, similar to the way other fixes do.
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
Fix :doc:`external <fix_external>` allows programs that are running
|
||||
LAMMPS through its library interface to add or modify certain LAMMPS
|
||||
properties on specific timesteps, similar to the way other fixes do.
|
||||
|
||||
This function provides access to the per-atom force storage in a fix
|
||||
external instance with the given fix-ID to be added to the individual
|
||||
@ -5914,12 +6069,12 @@ data structures can change as well as the order of atom as they migrate
|
||||
between MPI processes because of the domain decomposition
|
||||
parallelization, this function should be always called immediately
|
||||
before the forces are going to be set to get an up-to-date pointer.
|
||||
You can use, for example, :cpp:func:`lammps_extract_setting` to obtain the
|
||||
number of local atoms `nlocal` and then assume the dimensions of the returned
|
||||
force array as ``double force[nlocal][3]``.
|
||||
You can use, for example, :cpp:func:`lammps_extract_setting` to obtain
|
||||
the number of local atoms `nlocal` and then assume the dimensions of
|
||||
the returned force array as ``double force[nlocal][3]``.
|
||||
|
||||
This is an alternative to the callback mechanism in fix external set up by
|
||||
:cpp:func:`lammps_set_fix_external_callback`. The main difference is
|
||||
This is an alternative to the callback mechanism in fix external set up
|
||||
by :cpp:func:`lammps_set_fix_external_callback`. The main difference is
|
||||
that this mechanism can be used when forces are be pre-computed and the
|
||||
control alternates between LAMMPS and the external code, while the
|
||||
callback mechanism can call the external code to compute the force when
|
||||
@ -5929,8 +6084,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -5961,6 +6114,8 @@ double **lammps_fix_external_get_force(void *handle, const char *id)
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and
|
||||
:cpp:func:`lammps_fix_external_get_force` to also set the contribution
|
||||
to the global energy from the external code. The value of the *eng*
|
||||
@ -5977,8 +6132,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -6007,6 +6160,8 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This is a companion function to :cpp:func:`lammps_set_fix_external_callback`
|
||||
and :cpp:func:`lammps_fix_external_get_force` to set the contribution to
|
||||
the global virial from the external code.
|
||||
@ -6025,8 +6180,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -6055,6 +6208,8 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This is a companion function to :cpp:func:`lammps_set_fix_external_callback`
|
||||
to set the per-atom energy contribution due to the fix from the external code
|
||||
as part of the callback function. For this to work, the handle to the
|
||||
@ -6073,8 +6228,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -6103,6 +6256,8 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This is a companion function to :cpp:func:`lammps_set_fix_external_callback`
|
||||
to set the per-atom virial contribution due to the fix from the external code
|
||||
as part of the callback function. For this to work, the handle to the
|
||||
@ -6124,8 +6279,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -6154,6 +6307,8 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and
|
||||
:cpp:func:`lammps_fix_external_get_force` to set the length of a global vector of
|
||||
properties that will be stored with the fix via
|
||||
@ -6168,8 +6323,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -6198,6 +6351,8 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and
|
||||
:cpp:func:`lammps_fix_external_get_force` to set the values of a global vector of
|
||||
properties that will be stored with the fix. And can be accessed from
|
||||
@ -6221,8 +6376,6 @@ Please see the documentation for :doc:`fix external <fix_external>` for
|
||||
more information about how to use the fix and how to couple it with an
|
||||
external code.
|
||||
|
||||
.. versionadded:: 28Jul2021
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \param handle pointer to a previously created LAMMPS instance cast to ``void *``.
|
||||
@ -6375,12 +6528,13 @@ int lammps_get_last_error_message(void *handle, char *buffer, int buf_size) {
|
||||
/** Return API version of embedded Python interpreter
|
||||
|
||||
\verbatim embed:rst
|
||||
|
||||
.. versionadded:: 3Nov2022
|
||||
|
||||
This function is used by the ML-IAP python code (mliappy) to verify
|
||||
the API version of the embedded python interpreter of the PYTHON
|
||||
package. It returns -1 if the PYTHON package is not enabled.
|
||||
|
||||
.. versionadded:: 3Nov2022
|
||||
|
||||
\endverbatim
|
||||
*
|
||||
* \return PYTHON_API_VERSION constant of the python interpreter or -1 */
|
||||
|
||||
Reference in New Issue
Block a user