GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 1. Introduction
  • 2. Install LAMMPS
  • 3. Build LAMMPS
  • 4. Run LAMMPS
  • 5. Errors
  • 6. Commands
  • 7. Accelerate performance
  • 8. Optional packages
  • 9. Auxiliary tools
  • 10. Howto discussions
  • 11. Example scripts
  • 1. LAMMPS Library Interfaces
  • 2. Use Python with LAMMPS
  • 2.1. Overview

This view

  • Original page
  • New address

GeezerVison is showing docs.lammps.org — 2.3.6. System properties — LAMMPS documentation

2.3.6. System properties

Similar to what is described in System properties, the instances of lammps can be used to extract different kinds of information about the active LAMMPS instance and also to modify some of it.

In some cases the data returned is a direct reference to the original data inside LAMMPS cast to ctypes pointers. Where possible, the wrappers will determine the ctypes data type and cast pointers accordingly. If numpy is installed arrays can also be extracted as numpy arrays, which will access the C arrays directly and have the correct dimensions to protect against invalid accesses.

Warning

When accessing per-atom data, please note that this data 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 subdomains.

from lammps import lammps

lmp = lammps()
lmp.file("in.sysinit")

natoms = lmp.get_natoms()
print(f"running simulation with {natoms} atoms")

lmp.command("run 1000 post no");

for i in range(10):
   lmp.command("run 100 pre no post no")
   pe = lmp.get_thermo("pe")
   ke = lmp.get_thermo("ke")
   print(f"PE = {pe}\nKE = {ke}")

lmp.close()

Methods:

  • version(): return the numerical version id, e.g. LAMMPS 2 Sep 2015 -> 20150902

  • get_thermo(): return current value of a thermo keyword

  • last_thermo(): return a dictionary of the last thermodynamic output

  • get_natoms(): total # of atoms as int

  • reset_box(): reset the simulation box size

  • extract_setting(): return a global setting

  • extract_global(): extract a global quantity

  • extract_box(): extract box info

  • create_atoms(): create N atoms with IDs, types, x, v, and image flags

Properties:

  • last_thermo_step: the last timestep thermodynamic output was computed

Version release
LAMMPS Branch:
develop
stable
release
Downloads:
PDF
Source
Git Info:
13Nov2026
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.