Back to main menu

## Option: unit

#### Syntax

`-unit <property> <factor>`

`-unit <unit1> <unit2>`

#### Description

This option multiplies the values of the given auxiliary property by the given factor. It also allows to convert atom coordinates or velocities from one unit system <unit1> to another <unit2>.

The <property> can be a Cartesian direction (X, Y or Z) to rescale atom coordinates, or any defined auxiliary property (like vx, vy or vz for atom velocities, fx, fy, fz for atom forces, etc.). The <factor> must be a real number (it may be equal to zero).

This option also has presets that allow to convert the cell dimensions and atom coordinates from one unit system into another. The supported units of distance are:

- km
- m
- mm
- micron or µm
- nm
- A or Angstroms or angstroms
- B or Bohr or bohr
- pm
- fm

This option also has presets to convert atom velocities. Units of velocity must be specified as the concatenation of a unit of distance, a slash symbol (/), and a unit of time (see examples below). The supported units of time are:

- h
- min
- s
- ms
- µs
- ns
- ps
- fs

Note that in any case, Atomsk performs the conversion blindly, as it has no way to know in which unit the coordinates are written in the input file. It is up to the user to make sure that the <unit1> actually corresponds to what is written in the input file.

If a selection was defined (with the option `-select`) then the unit conversion is applied only to selected atoms. Non-selected atoms and box vectors will remain unchanged.

#### Default

By default the units are not changed. When reading an input file, Atomsk just reads and stores the numbers as-is, without performing any implicit conversion of units. For instance if the input file contains the atom coordinates "1.0 2.0 3.0" in units of Bohr radius, then they will also appear as "1.0 2.0 3.0" in the output file, even in file formats that use another unit as their default. The conversion of units must be performed explicitely by the user, e.g. with the option `-unit`.

#### Examples

- `atomsk initial.lmc -unit x 1.1 final.cfg`

  This will multiply all X coordinates of atoms by a factor of 1.1.

- `atomsk initial.lmc -unit vx 2.0 -unit vy 2 -unit vz 2 final.cfg`

  This will multiply all atom velocities (vx, vy, vz) by a factor of 2.

- `atomsk initial.xyz -unit Bohr Angstroms final.xsf`

  This will read the file `initial.xyz`, where atom coordinates are written in units of Bohr radius, convert them to angströms, and output the result into `final.xsf`.

- `atomsk initial.xsf -unit A nm final.xyz`

  This will convert from Angströms to nanometers.

- `atomsk initial.lmc -unit A/ps nm/ps final.cfg`

  This will convert atom velocities from Angströms per picosecond (Å/ps) to nanometers per picosecond (nm/ps).

- `atomsk initial.lmc -unit nm/fs km/h final.cfg`

  This will convert atom velocities from nanometers per femtosecond (nm/fs) into kilometers per hour (km/h).

Back to main menu