Back to main menu

## Mode: density

#### Syntax

`atomsk --density <file> <property> <1d|2d|3d> [<x|y|z>] <σ> [options]`

#### Description

This mode computes the density of a given <property>.

The discrete (atomic) values of the given <property> are replaced by Gaussian functions of variance σ2 that are evaluated in a finite-element grid. The density of the <property> at a point of the grid is defined as the sum of Gaussian functions belonging to all atoms.

The parameters associated with this mode are:

- file: file containing atomic positions; must be one of the supported input formats.
- property: name of the property whose density must be computed. It can be "mass", an atom species, or any defined per-atom auxiliary property.
- dimension: must be 1, 2 or 3. Decides if a 1-D, 2-D or 3-D density plot will be computed.
- axis: if dimension=1, the density will be computed along this axis. If dimension=2, the density will be computed in the plane normal to this axis. If dimension=3, must be omitted.
- σ: square root of the variance for the Gaussian functions.

The 1-D density profile will replace atoms by 1-D Gaussian functions, and compute the density along the specified <axis>. This can be used to determine the density of an element, or of a property (e.g. electric charge), along a given direction.

The 2-D density plot will replace atoms by 2-D Gaussian functions, and compute the density in the plane normal to the <axis>. This can be used to apply a Gaussian blur to atomic positions and produce an image comparable to a high-resolution transmission electron microscope image, or determine a density of a property (e.g. electric charge) in a plane.

The 3-D density plot will replace atoms by 3-D Gaussian functions, and compute the density in the whole volume. In addition, the positions where the density is significantly higher or lower than the average will be written into file(s) (see below). This can be useful to find the positions of interstitial atoms, or the positions of vacancies.

The system is considered to be periodic, and the periodic replicas of atoms will contribute to the density.

Output consists of the following files:

- *_density.dat: file containing the data of the 1-D, 2-D or 3-D grid.

In the case of a 2-D density computation, the following file will be produced:

- *_density.gp: gnuplot script that allows to visualize the data file.

And in the case of a 3-D density computation, the following files will also be produced:

- *_interstitial.xsf: positions (x,y,z) where the density is higher than average (in XSF format).
- *_vacancy.xsf: positions (x,y,z) where the density is lower than average (in XSF format).

If this mode is used with one or several options they will be applied to the system before computing the density.

If a selection was defined (with the option `-select`) then only the selected atoms will be counted in the density.

Note that this mode assumes that the atom coordinates are wrapped, i.e. that all atoms are inside of the simulation box. If it is not the case then the calculation may be wrong. Coordinates can be wrapped thanks to the option `-wrap`.

#### Examples

- `atomsk --density myfile.cfg Fe 1d X 0.6`

  This will read the file `myfile.cfg`, and compute the 1-D density profile of iron atoms (Fe) along the X axis. Each iron atom will be replaced by a Gaussian function of variance σ2=0.62. The results will be written in the file `myfile_density.dat`.

- `atomsk --density Al.xsf mass 2d Z 2.0`

  This will read the file `Al.xsf`, and compute the density of mass in the 2-D plane normal to the Z axis, using Gaussian functions with σ=2.0. The results will be written in the file `Al_density.dat`. A gnuplot script named `Al_density.gp` will also be produced to visualize the data.

- `atomsk --density MD_5000.lmc mass 3d 2.0`

  This will read the file `MD_5000.lmc`, and compute the 3-D density of mass in the whole system, using Gaussian functions with σ=2.0. Note that no <axis> must be specified. The results will be written in the file `MD_5000_density.dat`. In addition, if the variations of mass are significant then the positions where the density is high will be written into `MD_5000_interstitials.xsf`, and the positions where it is low will be written into `MD_5000_vacancies.xsf`.

Back to main menu