Back to main menu

## Option: swap

#### Syntax

`-swap <id1> <id2>`

`-swap <sp1> <sp2>`

`-swap <x|y|z> <x|y|z>`

`-swap <prop1> <prop2>`

#### Description

This option swaps the positions of the two atoms of the given indices, or swaps two atom species, or swaps the two given Cartesian axes, or swaps two auxiliary properties.

Swapping atoms indices means that their positions are exchanged. If shells (in the sense of an ionic core-shell model) and/or auxiliary properties are defined, then they are also swapped.

Swapping atomic species means that all atoms of corresponding chemical species are replaced with each other. The positions of atoms are not changed. If one of the two atom species does not exist in the system, then the existing species is replaced by the given species (this has the same effect as the option "-substitute").

Swapping Cartesian axes means that the two given vectors of the box are exchanged. For instance, exchanging the Cartesian axes X and Y would result in the following transformation (where H is the old vector and H' the new one):

`H'(1,1) = H(2,2)
H'(1,2) = H(2,1)
H'(2,1) = H(1,2)
H'(2,2) = H(1,1)`

The corresponding coordinates of atoms are also exchanged (i.e. following the same example, the coordinates X and Y of each atom are exchanged).

Swapping two auxiliary properties means that their indexes (or location) will be exchanged, so that they will appear in a different order in the output file.

#### Default

By default no atom is swapped.

#### Examples

- `atomsk initial.cfg -swap 530 1065 final.xsf`

  This will read the file `initial.cfg`, and exchange the positions and all properties of atoms 530 and 1065. The final result will be written into `final.xsf`.

- `atomsk initial.cfg -swap Mg O final.xsf`

  This will read the file `initial.cfg`, and swap the chemical species of Mg and O atoms. The final result will be written into `final.xsf`.

- `atomsk initial.cfg -swap X Y final.xsf`

  This will read the file `initial.cfg`, and exchange the Cartesian axes X and Y. The final result will be written into `final.xsf`.

- `atomsk initial.cfg -swap Epot enthalpy final.cfg`

  This will read the file `initial.cfg`, and exchange the columns of auxiliary properties named "Epot" and "enthalpy". The final result will be written into `final.cfg`.

Back to main menu