1.1.4. Per-atom properties

This section documents the following functions:


int lammps_extract_atom_datatype(void *handle, const char *name)

Get data type of a LAMMPS per-atom property

This function returns an integer that encodes the data type of the per-atom property with the specified name. See _LMP_DATATYPE_CONST for valid values. Callers of lammps_extract_atom() can use this information to then decide how to cast the (void*) pointer and access the data.

New in version 18Sep2020.

Parameters
  • handle – pointer to a previously created LAMMPS instance

  • name – string with the name of the extracted property

Returns

integer constant encoding the data type of the property or -1 if not found.


void *lammps_extract_atom(void *handle, const char *name)

Get pointer to a LAMMPS per-atom property.

This function returns a pointer to the location of per-atom properties (and per-atom-type properties in the case of the ‘mass’ keyword). Per-atom data is distributed across sub-domains and thus MPI ranks. The returned pointer is cast to void * and needs to be cast to a pointer of data type that the entity represents.

A table with supported keywords is included in the documentation of the Atom::extract() function.

Warning

The pointers returned by this function are generally not persistent since per-atom data may be re-distributed, re-allocated, and re-ordered at every re-neighboring operation.

Parameters
  • handle – pointer to a previously created LAMMPS instance

  • name – string with the name of the extracted property

Returns

pointer (cast to void *) to the location of the requested data or NULL if not found.