diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index c4b79fee62..2e0659a00d 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -1,5 +1,14 @@ -%{ +%include "cpointer.i" +%include "carrays.i" +%include "cdata.i" +%array_functions(char, charp); +%pointer_functions(int, intp); +%pointer_functions(double, doublep); +%pointer_cast(void *, int *, void_to_int); +%pointer_cast(void *, double *, void_to_double); + +%{ enum _LMP_DATATYPE_CONST { LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ diff --git a/tools/swig/run_lua_example.sh b/tools/swig/run_lua_example.sh index 4dc7bad2f8..4cfd7ec586 100755 --- a/tools/swig/run_lua_example.sh +++ b/tools/swig/run_lua_example.sh @@ -14,7 +14,8 @@ lualammps.lammps_command(lmp, "create_atoms 1 box") print("LAMMPS version ", ver) print("Number of created atoms: ", lualammps.lammps_get_natoms(lmp)) -lualammps.lammps_close(lmp ) +print("Current size of timestep: ", lualammps.doublep_value(lualammps.void_to_double(lualammps.lammps_extract_global(lmp,"dt")))) +lualammps.lammps_close(lmp) EOF lua example.lua diff --git a/tools/swig/run_perl_example.sh b/tools/swig/run_perl_example.sh index 2714bcba6f..689fa0e10a 100755 --- a/tools/swig/run_perl_example.sh +++ b/tools/swig/run_perl_example.sh @@ -14,6 +14,7 @@ pllammps::lammps_command(\$lmp, "create_atoms 1 box"); print("LAMMPS version ",\$ver,"\n"); print("Number of created atoms: ", pllammps::lammps_get_natoms(\$lmp), "\n"); +print("Current size of timestep: ", pllammps::doublep_value(pllammps::void_to_double(pllammps::lammps_extract_global(\$lmp,"dt"))), "\n"); pllammps::lammps_close(\$lmp) EOF diff --git a/tools/swig/run_python_example.sh b/tools/swig/run_python_example.sh index a09f2f119e..7b7f97c99e 100755 --- a/tools/swig/run_python_example.sh +++ b/tools/swig/run_python_example.sh @@ -13,6 +13,7 @@ lammps_command(lmp, "create_atoms 1 box") print("LAMMPS version ",ver) print("Number of created atoms: %g" % lammps_get_natoms(lmp)) +print("Current size of timestep: %g" % doublep_value(void_to_double(lammps_extract_global(lmp,'dt')))) lammps_close(lmp) EOF diff --git a/tools/swig/run_tcl_example.sh b/tools/swig/run_tcl_example.sh index 00ae2e7579..5f9a3bc77f 100755 --- a/tools/swig/run_tcl_example.sh +++ b/tools/swig/run_tcl_example.sh @@ -12,8 +12,10 @@ lammps_command \$lmp "region box block -5 5 -5 5 -5 5" lammps_command \$lmp "create_box 1 box" lammps_command \$lmp "create_atoms 1 box" +set dt [doublep_value [void_to_double [lammps_extract_global \$lmp dt]]] puts "LAMMPS version \$ver" puts [format "Number of created atoms: %g" [lammps_get_natoms \$lmp]] +puts "Current size of timestep: \$dt" lammps_close \$lmp EOF