Back to main menu

## Option: substitute

#### Syntax

`-substitute <sp1> <sp2>`

#### Description

This option substitutes all atoms of species <sp1> by atoms of species <sp2>.

The <sp1> and <sp2> can be entered as atomic number or species names.

If a selection was defined (with the option `-select`) then only selected atoms are substituted.

#### Default

By default no atom is substituted.

#### Examples

- `atomsk sto.cfg -substitute 38 56 bto.xsf`

  This will read the file `sto.cfg`, replace all strontium atoms (atomic number=38) by barium atoms (atomic number=56), and output the final system into `bto.xsf`.

- `atomsk initial.cfg -sub Fe W final.xyz`

  This will read `initial.cfg`, substitute iron (Fe) by tungsten (W) and write the result into `final.xyz`.

- `atomsk initial.lmc -sub 1 Si -sub 2 C final.xyz`

  This option can also be useful when reading file formats containing "atom types" (1, 2, 3...) instead of actual atomic numbers, like the LAMMPS custom format (lmc). The command above will replace all atoms of type 1 by silicon (Si), and those of type 2 by carbon (C).

Back to main menu