Unverified Commit de49325c authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

add properties example

parent fcb38354
Loading
Loading
Loading
Loading
+30 −2
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@ Retrieving or setting LAMMPS system properties
==============================================

The library interface allows to extract different kinds of information
about the active simulation instance and also to modify some of them.
This allows to combine MD simulation steps with other processing and
about the active simulation instance and also to modify some of it.
This enables combining MD simulation steps with other processing and
simulation methods computed in the calling code or another code that is
coupled to LAMMPS via the library interface.  In some cases the data
returned is direct reference to the original data inside LAMMPS cast
@@ -14,6 +14,34 @@ is the per-processor **local** data and indexed accordingly. These arrays
can change sizes and order at every neighbor list rebuild and atom sort
event as atoms are migrating between sub-domains.

.. code-block:: C

   #include "library.h"
   #include <stdio.h>

   int main(int argc, char **argv)
   {
     void *handle;
     int i;

     handle = lammps_open_no_mpi(0, NULL, NULL);
     lammps_file(handle,"in.sysinit");
     printf("running simulation with %g atoms\n",
            lammps_get_natoms(handle));

     lammps_command(handle,"run 1000 post no");

     for (i=0; i < 10; ++i) {
       lammps_command(handle,"run 100 pre no post no");
       printf("PE = %g\nKE = %g\n",
              lammps_get_thermo(handle,"pe"),
              lammps_get_thermo(handle,"ke"));
     }
     lammps_close(handle);
     return 0;
   }


-----------------------

.. doxygenfunction:: lammps_version