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.8. Compute, fixes, variables — LAMMPS documentation

2.3.8. Compute, fixes, variables

This section documents accessing or modifying data from objects like computes, fixes, or variables in LAMMPS using the lammps module.

For lammps.extract_compute() and lammps.extract_fix(), the global, per-atom, or local data calculated by the compute or fix can be accessed. What is returned depends on whether the compute or fix calculates a scalar or vector or array. For a scalar, a single double value is returned. If the compute or fix calculates a vector or array, a pointer to the internal LAMMPS data is returned, which you can use via normal Python subscripting.

The one exception is that for a fix that calculates a global vector or array, a single double value from the vector or array is returned, indexed by I (vector) or I and J (array). I,J are zero-based indices. See the Howto output page for a discussion of global, per-atom, and local data, and of scalar, vector, and array data types. See the doc pages for individual computes and fixes for a description of what they calculate and store.

For lammps.extract_variable(), an equal-style or atom-style variable is evaluated and its result returned.

For equal-style variables a single c_double value is returned and the group argument is ignored. For atom-style variables, a vector of c_double is returned, one value per atom, which you can use via normal Python subscripting. The values will be zero for atoms not in the specified group.

lammps.numpy.extract_compute(), lammps.numpy.extract_fix(), and lammps.numpy.extract_variable() are equivalent NumPy implementations that return NumPy arrays instead of ctypes pointers.

The lammps.set_variable() method sets an existing string-style variable to a new string value, so that subsequent LAMMPS commands can access the variable.

Methods:

  • lammps.extract_compute(): extract value(s) from a compute

  • lammps.extract_fix(): extract value(s) from a fix

  • lammps.extract_variable(): extract value(s) from a variable

  • lammps.set_variable(): set existing named string-style variable to value

NumPy Methods:

  • lammps.numpy.extract_compute(): extract value(s) from a compute, return arrays as numpy arrays

  • lammps.numpy.extract_fix(): extract value(s) from a fix, return arrays as numpy arrays

  • lammps.numpy.extract_variable(): extract value(s) from a variable, return arrays as numpy arrays

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.