Yaml configuration

Yaml configuration#

pyCIF can be entirely set up with a Yaml file such as in the example below. The Yaml configuration file structure is used to define, initialize and run the building blocks of pyCIF: Plugins.

General info about Yaml#

The basic idea of Yaml syntax is that you can easily define a tree structure using ‘:’ and indentation, which would be automatically interpreted by Python.

Please note that Yaml is flexible with the keys it accepts for booleans. The following keys will be automatically accepted as True or False:

y / Y / yes / Yes / YES / n / N / no / No / NO / true / True / TRUE / false / False / FALSE / on / On / ON / off / Off / OFF

For instance, the following Yaml syntax:

root:
   branch1: grub
   branch2: [0, 1]
   branch3:
      subbranch0: some text
      subbranch1: 2004-01-01
      subbranch2: T

will be interpreted into the following Python dictionary:

{
'root':
   'branch1': 'grub',
   'branch2': [0,1],
   'branch3':
      'subbranch0': 'some text',
      'subbranch1': datetime.datetime(2004, 01, 01),
      'subbranch2': True
}

which is itself loaded into a pyCIF plugin automatically integrated with other plugins and dependencies.

Further examples about the Yaml syntax can be found here.

The initialized dictionary is then loaded as Plugins for later use by pyCIF.

Yaml and pyCIF#

There is a minimal number of arguments mandatory to run a pyCIF simulations. They are:

  1. verbose: the verbose level of the simulations. pyCIF uses the logging python package. Log instances are determined by the commands info, debug and warning

    Verbose levels corresponds to levels in logging:
    • verbose = 0: debugging verbose. Includes the path to the python script were the log instance was called

    • verbose = 1: debugging verbose, without extra information on the script path

    • verbose = 2: only main information are displayed

    • verbose > 2: only warnings are displayed

  2. workdir: directory were the pyCIF computations will be saved

  3. logfile: name of the logfile

  4. datei and datef: the start and end dates of the simulations

Note

Please consult the page here for details on how paths are handled in pyCIF.

The most basic Yaml file is thus:

 1#####################
 2# pyCIF config file #
 3#####################
 4
 5# Define here all parameters for pyCIF following YAML syntax
 6# For details on YAML syntax, please see:
 7# http://docs.ansible.com/ansible/latest/YAMLSyntax.html
 8
 9###############################################################################
10# pyCIF parameters
11
12rootdir: &rootdir /tmp/CIF/
13outdir: &outdir  !join [*rootdir, /.tox/py38/tmp]
14verbose: 2
15logfile: filename
16workdir:  !join [*outdir, /basic]
17datei: 2010-01-01
18datef: 2010-01-05