Skip to content

XYZ Format

read_xyz

Reads a file in the xyz format.

Parameter Description
file file name (required)
bounds_mode bounding box mode, default FILE_BOUNDS (bounds read from the file)
enlarge_bounds empty layer added around the domain, default 0
pbc_adjust_xform adjusts the domain transformation
1
2
3
4
- read_xyz:
   file: input_file_rigid_surface.xyz
   bounds_mode: FILE
   enlarge_bounds: 1.0 m

Format of a file of nb particles:

nb
box_size_x box_size_y box_size_z
type_0 pos_x_0 pos_y_0 pos_z_0
type_1 pos_x_1 pos_y_1 pos_z_1
...
type_nb-1 pos_x_nb-1 pos_y_nb-1 pos_z_nb-1

Two particles of the same type in the domain [[0,0,0],[10,10,10]]:

2
10 10 10
0 2.5 5.0 5.0
0 7.5 5.0 5.0

add_xyz adds the particles of an xyz file to an existing simulation, and reads files with several particle types.

write_xyz

Writes a text file (.xyz) with the selected fields.

Parameter Description
fields fields to write, e.g. [ id, velocity, radius ]
filename output file
units units of the fields, e.g. { velocity: "m/s", radius: "m" }

Note

The first line contains the number of particles, the second line the "lattice" description, useful with Ovito.

Example: replace the MPI-IO checkpoints by xyz files.

dump_data_xyz:
  - timestep_file: "dem_pos_vel_%09d.xyz"
  - write_xyz:
     fields: [ id, velocity, radius ]
     units: { velocity: "m/s", radius: "m" }

iteration_dump_writer:
  - dump_data_xyz

global:
  simulation_dump_frequency: 500

scripts/post_processing/profile_pos_vel.py is a minimal, easily modifiable script that computes the averages of the position and velocity components of these files and writes mean_r_v.pdf:

Mean position and velocity