Back to main menu

## Mode: interactive

#### Syntax

`atomsk`

`atomsk < script.ats`

#### Description

Running the program without any argument will enter interactive mode, which offers a command-line interpreter. When the program is started by double-clicking the executable, or a link from the system's menu, then it runs in interactive mode.

In this mode the user can enter commands, and they are executed in real-time. The available commands are:

- help Display a summary of commands
- cd Change directory
- ls Display a list of files in the current directory
- pwd Display current working directory
- print Display current box vectors and atom positions
- memory Display a summary of the memory used
- create Create a system from scratch
- read <file> Read the <file> and load its content in memory
- write <file> Write the current system into <file>
- clear Clear the memory, destroying the current atomic system
- quit Exit this mode and close Atomsk

The command create can be called with the same arguments as the mode `--create`. If no argument is provided then the user will be prompted.

The options of Atomsk are also available. They must be called without the leading dash sign (-), and with all their parameters.

Functions can also be called, making Atomsk behave like a calculator. Syntax for writing functions is detailed in this page.

For now the other modes of Atomsk cannot be called from the interactive mode.

Note that only one command (or option) can be issued at a time, and it will take effect immediately.

This mode reads commands from the standard input, which by default is the keyboard. In GNU/Linux environments it is possible to use the standard redirection (<) to use a file as standard input (instead of the keyboard). That means that commands can be saved in a text file and be used as a script, using the standard redirection (see examples below).

When running in interactive mode the verbosity level is automatically reset to 1 if it is set to 0 or 2.

#### Examples

- `atomsk`

  Just enter "`atomsk`" and follow the instructions.

- `user@computer:~$ atomsk
  >>> Atomsk is a free Open Source software, for details type 'atomsk --license'.
  >>> Atomsk command-line interpreter:
  ..> Type "help" for a summary of commands.
  user@atomsk> read initial.xsf
  user@atomsk> duplicate 6 6 2
  user@atomsk> write final.xsf cfg
  user@atomsk> quit`

  The user just entered "atomsk" without argument, thus running the program in interactive mode. In interactive mode, Atomsk waits for commands and executes them in real-time. In this example, the user reads a file ("initial.xsf"), uses the option `-duplicate`, and then writes the system into output files "final.xsf" and "final.cfg". Note that in interactive mode, options must be used without the leading dash sign: use "duplicate" instead of "-duplicate". The last command "quit" exits Atomsk.

- ##### script.ats

  `#!/usr/local/bin/atomsk
  create fcc 4.02 Al
  duplicate 20 20 1
  deform x 0.3% 0.33
  wrap
  write deformed_al.xsf
  `

  `atomsk < script.ats`

  Some commands were written in the text file "script.ats". Then, atomsk is run in interactive mode (because no command-line argument is present) and will execute commands from the standard input, i.e. the file "script.ats". Note that in interactive mode, the options must not have their leading dash sign, e.g. write "wrap" and not "-wrap".

Back to main menu