Back to main menu

## Option: rotate

#### Syntax

`-rotate [com] <x|y|z> <θ>`

`-rotate [com] [hkl] <θ>`

`-rotate [com] <Vx> <Vy> <Vz> <θ>`

`-rotate [com] <filename>`

#### Description

This option applies a rotation to the whole system (i.e. both the box and atoms).

The axis of rotation can be one of 'x', 'y', 'z' (referring to cartesian axes), or a crystallographic direction defined by its Miller indices (see how to specify Miller indices). If the crystallographic orientation of the system is defined (e.g. through the option `-properties`) then the Miller indices are considered with respect to that orientation. Otherwise the orientation assumed is X=[100], Y=[010], Z=[001]. It is also possible to give any other direction by entering the Cartesian coordinates of a vector (Vx Vy Vz) in angströms. The angle of rotation θ must be provided in degrees.

If a <filename> is provided, then this file must contain a rotation matrix in the form of three lines, with three entrees per line. Each entry can be a real number, or a function. Syntax for writing functions is detailed in this page.

If the keyword "com" is used, then the center of rotation is the center of mass of the system. Otherwise (i.e. if the keyword is omitted), the center of rotation is the Cartesian origin (0,0,0).

If forces (fx,fy,fz) or velocities (vx,vy,vz) exist as auxiliary properties, then they are rotated accordingly.

This option affects some properties of the system (e.g. the elastic tensor) if they were read with the option `-properties` before the present option.

If a selection was defined (with the option `-select`) then the rotation is applied only to selected atoms, and the box is not rotated. If the keyword "com" is used, then the selected atoms are rotated around their center of mass.

After the application of this option, some atoms may end up out of the box, which can be fixed thanks to the option `-wrap`.

#### Default

By default the system is not rotated.

#### Examples

- `atomsk initial.cfg -rotate x 45 final.xyz`

  This will rotate the whole system (atoms and cell) by 45 degrees around X.

- `atomsk initial.cfg -select in cylinder Z 0.5*box 0.5*box 25 -rotate com Z 24° final.xyz`

  This command will select a cylinder of radius 25 Å along Z, then will rotate this cylinder around its center of mass by an angle of 24 degrees around Z. The box will not be rotated.

- `atomsk initial.cfg -rotate [111] 45 final.xyz`

  This will rotate the whole system (atoms and cell) by 45 degrees around the [111] crystal direction.

- `atomsk initial.cfg -rotate 1.2 0.0 3.9 21.7 final.xyz`

  This will rotate the whole system (atoms and cell) by 21.7 degrees around the Cartesian vector of components (1.2 0.0 3.9).

- ##### rot_matrix.txt

  `# A rotation to apply to my system
  1 0 0
  0 0.5 -sqrt(3)/2
  0 sqrt(3)/2 1/2
  `

  `atomsk initial.cfg -rotate rot_matrix.txt final.cfg`

  This will read the rotation matrix from the file "`rot_matrix.txt`", and rotate the system accordingly. Note that values can be written as numerical values or as mathematical functions in the file. In this example, the rotation matrix corresponds to a 60 degrees rotation around the X axis.

Back to main menu