MDStressLab++
Loading...
Searching...
No Matches
visualize Namespace Reference

Functions

 read_file (filename)
 Reads a .stress file containing atomistic stress data.
 
 plot_contour (data, output_fname, component_index, component_label)
 Plots a 2D contour of the selected stress component.
 

Variables

dict STRESS_COMPONENTS
 Mapping from stress component names to (column index, label).
 
 filename = sys.argv[1]
 
 component_key = sys.argv[2].lower()
 
 component_index
 
 component_label
 
 base
 
 _
 
str plt_fname = f"{base}_{component_key}.pdf"
 
 data = read_file(filename)
 

Function Documentation

◆ plot_contour()

visualize.plot_contour (   data,
  output_fname,
  component_index,
  component_label 
)

Plots a 2D contour of the selected stress component.

Parameters
dataList of rows with [x, y, z, σ_xx, ..., σ_yz].
output_fnameOutput PDF filename.
component_indexIndex of the stress component to plot.
component_labelLabel for the plot title.

Uses SciPy's griddata to interpolate the scattered data, and matplotlib to create a filled contour plot with 100 levels using the RdBu_r colormap.

Definition at line 86 of file visualize.py.

◆ read_file()

visualize.read_file (   filename)

Reads a .stress file containing atomistic stress data.

Parameters
filenameThe path to the .stress file.
Returns
A list of rows with [x, y, z, σ_xx, σ_yy, σ_zz, σ_xy, σ_xz, σ_yz].

The file is expected to have:

  • Line 1: number of atoms (ignored)
  • Line 2: metadata (e.g., Properties=...)
  • Line 3 onward: whitespace-delimited numeric data (one line per atom)

Malformed or non-numeric lines are skipped.

Definition at line 61 of file visualize.py.

Variable Documentation

◆ _

visualize._
protected

Definition at line 122 of file visualize.py.

◆ base

visualize.base

Definition at line 122 of file visualize.py.

◆ component_index

visualize.component_index

Definition at line 120 of file visualize.py.

◆ component_key

visualize.component_key = sys.argv[2].lower()

Definition at line 114 of file visualize.py.

◆ component_label

visualize.component_label

Definition at line 120 of file visualize.py.

◆ data

visualize.data = read_file(filename)

Definition at line 125 of file visualize.py.

◆ filename

visualize.filename = sys.argv[1]

Definition at line 113 of file visualize.py.

◆ plt_fname

str visualize.plt_fname = f"{base}_{component_key}.pdf"

Definition at line 123 of file visualize.py.

◆ STRESS_COMPONENTS

dict visualize.STRESS_COMPONENTS
Initial value:
1= {
2 'xx': (3, r'$\sigma_{xx}$'),
3 'yy': (4, r'$\sigma_{yy}$'),
4 'zz': (5, r'$\sigma_{zz}$'),
5 'xy': (6, r'$\sigma_{xy}$'),
6 'xz': (7, r'$\sigma_{xz}$'),
7 'yz': (8, r'$\sigma_{yz}$'),
8}

Mapping from stress component names to (column index, label).

Definition at line 41 of file visualize.py.