# units command

## Syntax

```
units style
```

style =

*lj*or*real*or*metal*or*si*or*cgs*or*electron*or*micro*or*nano*

## Examples

```
units metal
units lj
```

## Description

This command sets the style of units used for a simulation. It determines the units of all quantities specified in the input script and data file, as well as quantities output to the screen, log file, and dump files. Typically, this command is used at the very beginning of an input script.

For all units except *lj*, LAMMPS uses physical constants from
www.physics.nist.gov. For the definition of Kcal in real units,
LAMMPS uses the thermochemical calorie = 4.184 J.

The choice you make for units simply sets some internal conversion factors within LAMMPS. This means that any simulation you perform for one choice of units can be duplicated with any other unit setting LAMMPS supports. In this context “duplicate” means the particles will have identical trajectories and all output generated by the simulation will be identical. This will be the case for some number of timesteps until round-off effects accumulate, since the conversion factors for two different unit systems are not identical to infinite precision.

To perform the same simulation in a different set of units you must change all the unit-based input parameters in your input script and other input files (data file, potential files, etc) correctly to the new units. And you must correctly convert all output from the new units to the old units when comparing to the original results. That is often not simple to do.

Potential or table files may have a `UNITS:`

tag included in the
first line indicating the unit style those files were created for.
If the tag exists, its value will be compared to the chosen unit style
and LAMMPS will stop with an error message if there is a mismatch.
In some select cases and for specific combinations of unit styles,
LAMMPS is capable of automatically converting potential parameters
from a file. In those cases, a warning message signaling that an
automatic conversion has happened is printed to the screen.

For style *lj*, all quantities are unitless. Without loss of
generality, LAMMPS sets the fundamental quantities mass, \(\sigma\),
\(\epsilon\), and the Boltzmann constant \(k_B = 1\). The
masses, distances, energies you specify are multiples of these
fundamental values. The formulas relating the reduced or unitless
quantity (with an asterisk) to the same quantity with units is also
given. Thus you can use the mass, \(\sigma\), and \(\epsilon\)
values for a specific material and convert the results from a unitless
LJ simulation into physical quantities. Please note that using
these three properties as base, your unit of time has to conform
to the relation \(\epsilon = \frac{m \sigma^2}{\tau^2}\) since
energy is a derived unit (in SI units you equivalently have the relation
\(1\mathsf{J} = 1\frac{\mathsf{kg}\cdot\mathsf{m}^2}{\mathsf{s}^2}\)).

mass = mass or \(m\), where \(M^* = \frac{M}{m}\)

distance = \(\sigma\), where \(x^* = \frac{x}{\sigma}\)

time = \(\tau\), where \(\tau^* = \tau \sqrt{\frac{\epsilon}{m \sigma^2}}\)

energy = \(\epsilon\), where \(E^* = \frac{E}{\epsilon}\)

velocity = \(\frac{\sigma}{\tau}\), where \(v^* = v \frac{\tau}{\sigma}\)

force = \(\frac{\epsilon}{\sigma}\), where \(f^* = f \frac{\sigma}{\epsilon}\)

torque = \(\epsilon\), where \(t^* = \frac{t}{\epsilon}\)

temperature = reduced LJ temperature, where \(T^* = \frac{T k_B}{\epsilon}\)

pressure = reduced LJ pressure, where \(p^* = p \frac{\sigma^3}{\epsilon}\)

dynamic viscosity = reduced LJ viscosity, where \(\eta^* = \eta \frac{\sigma^3}{\epsilon\tau}\)

charge = reduced LJ charge, where \(q^* = q \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon}}\)

dipole = reduced LJ dipole, moment where \(\mu^* = \mu \frac{1}{\sqrt{4 \pi \varepsilon_0 \sigma^3 \epsilon}}\)

electric field = force/charge, where \(E^* = E \frac{\sqrt{4 \pi \varepsilon_0 \sigma \epsilon} \sigma}{\epsilon}\)

density = mass/volume, where \(\rho^* = \rho \sigma^{dim}\)

Note that for LJ units, the default mode of thermodynamic output via the thermo_style command is to normalize all extensive quantities by the number of atoms. E.g. potential energy is extensive because it is summed over atoms, so it is output as energy/atom. Temperature is intensive since it is already normalized by the number of atoms, so it is output as-is. This behavior can be changed via the thermo_modify norm command.

For style *real*, these are the units:

mass = grams/mole

distance = Angstroms

time = femtoseconds

energy = Kcal/mole

velocity = Angstroms/femtosecond

force = Kcal/mole-Angstrom

torque = Kcal/mole

temperature = Kelvin

pressure = atmospheres

dynamic viscosity = Poise

charge = multiple of electron charge (1.0 is a proton)

dipole = charge*Angstroms

electric field = volts/Angstrom

density = gram/cm^dim

For style *metal*, these are the units:

mass = grams/mole

distance = Angstroms

time = picoseconds

energy = eV

velocity = Angstroms/picosecond

force = eV/Angstrom

torque = eV

temperature = Kelvin

pressure = bars

dynamic viscosity = Poise

charge = multiple of electron charge (1.0 is a proton)

dipole = charge*Angstroms

electric field = volts/Angstrom

density = gram/cm^dim

For style *si*, these are the units:

mass = kilograms

distance = meters

time = seconds

energy = Joules

velocity = meters/second

force = Newtons

torque = Newton-meters

temperature = Kelvin

pressure = Pascals

dynamic viscosity = Pascal*second

charge = Coulombs (1.6021765e-19 is a proton)

dipole = Coulombs*meters

electric field = volts/meter

density = kilograms/meter^dim

For style *cgs*, these are the units:

mass = grams

distance = centimeters

time = seconds

energy = ergs

velocity = centimeters/second

force = dynes

torque = dyne-centimeters

temperature = Kelvin

pressure = dyne/cm^2 or barye = 1.0e-6 bars

dynamic viscosity = Poise

charge = statcoulombs or esu (4.8032044e-10 is a proton)

dipole = statcoul-cm = 10^18 debye

electric field = statvolt/cm or dyne/esu

density = grams/cm^dim

For style *electron*, these are the units:

mass = atomic mass units

distance = Bohr

time = femtoseconds

energy = Hartrees

velocity = Bohr/atomic time units [1.03275e-15 seconds]

force = Hartrees/Bohr

temperature = Kelvin

pressure = Pascals

charge = multiple of electron charge (1.0 is a proton)

dipole moment = Debye

electric field = volts/cm

For style *micro*, these are the units:

mass = picograms

distance = micrometers

time = microseconds

energy = picogram-micrometer^2/microsecond^2

velocity = micrometers/microsecond

force = picogram-micrometer/microsecond^2

torque = picogram-micrometer^2/microsecond^2

temperature = Kelvin

pressure = picogram/(micrometer-microsecond^2)

dynamic viscosity = picogram/(micrometer-microsecond)

charge = picocoulombs (1.6021765e-7 is a proton)

dipole = picocoulomb-micrometer

electric field = volt/micrometer

density = picograms/micrometer^dim

For style *nano*, these are the units:

mass = attograms

distance = nanometers

time = nanoseconds

energy = attogram-nanometer^2/nanosecond^2

velocity = nanometers/nanosecond

force = attogram-nanometer/nanosecond^2

torque = attogram-nanometer^2/nanosecond^2

temperature = Kelvin

pressure = attogram/(nanometer-nanosecond^2)

dynamic viscosity = attogram/(nanometer-nanosecond)

charge = multiple of electron charge (1.0 is a proton)

dipole = charge-nanometer

electric field = volt/nanometer

density = attograms/nanometer^dim

The units command also sets the timestep size and neighbor skin distance to default values for each style:

For style

*lj*these are dt = 0.005 \(\tau\) and skin = 0.3 \(\sigma\).For style

*real*these are dt = 1.0 femtoseconds and skin = 2.0 Angstroms.For style

*metal*these are dt = 0.001 picoseconds and skin = 2.0 Angstroms.For style

*si*these are dt = 1.0e-8 seconds and skin = 0.001 meters.For style

*cgs*these are dt = 1.0e-8 seconds and skin = 0.1 centimeters.For style

*electron*these are dt = 0.001 femtoseconds and skin = 2.0 Bohr.For style

*micro*these are dt = 2.0 microseconds and skin = 0.1 micrometers.For style

*nano*these are dt = 0.00045 nanoseconds and skin = 0.1 nanometers.

## Restrictions

This command cannot be used after the simulation box is defined by a read_data or create_box command.

## Default

```
units lj
```