Python

relax has been designed such that knowledge about Python is not required to be able to fully use the program. A few basics though will aid in understanding relax.

A number of simple programming axioms includes that of strings, integers, floating point numbers, and lists. A string is text and within Python (as well as relax) this is delimited by either single or double quotes. An integer is a number with no decimal point whereas a float is a number with a decimal point. A list in Python (called an array in other languages) is a list of anything separated by commas and delimited by square brackets, an example is [0, 1, 2, `a', 1.2143235].

Probably the most important detail is that functions in Python require brackets around their arguments. For example

[numbers=none]
relax> minimise.execute()

will commence minimisation however

[numbers=none]
relax> minimise.execute

will do nothing.

The arguments to a function are simply a comma separated list within the brackets of the function. For example to save the program's current state type

[numbers=none]
relax> state.save('save', force=True)

Two types of arguments exist in Python - standard arguments and keyword arguments. The majority of arguments you will encounter within relax are keyword arguments however you may, in rare cases, encounter a non-keyword argument. For these standard arguments just type the values in, although they must be in the correct order. Keyword arguments consist of two parts - the key and the value. For example the key may be file and the value you would like to supply is ``R1.out''. Various methods exist for supplying this argument. Firstly you could simply type ``R1.out'' into the correct position in the argument list. Secondly you can type file=`R1.out'. The power of this second option is that argument order is unimportant. Therefore if you would like to change the default value of the very last argument, you don't have to supply values for all other arguments. The only catch is that standard arguments must come before the keyword arguments.

Figure 1.2: A screenshot of relax being run in scripting mode.
Image relax_script_mode

The relax user manual (PDF), created 2016-10-28.