Using ABCD from the command line interface - RSE-Cambridge/abcd GitHub Wiki

ABCD can be used both for one-off commands

$ abcd select [query]
[output]

or as its own command interpreter

$ abcd
connected to $DB
(abcd) select [query]
[output]

these two modes are broadly equivalent and support the same commands. There are some minor differences - most notably the shell will try to interpret some special characters like > and <. To use these in queries entered into the shell they can either be quoted

$ abcd count total_energy \> -100
[output]

or replaced with synonyms gt and lt

$ abcd count total_energy gt -100
[output]

In the abcd command interpreter however, these characters are not treated specially so do not need to be quoted

$ abcd
connected to $DB
(abcd) count total_energy > -100
[output]

Commands

To import and export data from .xyx files into the data base.

To explore the frames stored in the database.

  • select
  • count
  • keys
  • hist

Importing Data

Data can be inserted into the database with read

$ abcd read mydata.xyz

where the reading of the input file is defered to the ase library. Multiple files can be specified and thee shell expansion can be helpful

$ abcd read cool_experiment_1/*.xyz

Exporting data

Data from the database can be output back to file with export

$ abcd export some_stuff.xyz <query>

and the query is used to select the data of interest. See more on the query syntax below.

Counting matching frames

To count the frames that match a particular query count can be used.

$ abcd count <query>

or without a query

$ abcd count

will display the total number of frames in the whole database.

Exploring properties of frames

In order to select subsets of frames, or to find interesting data, it is useful to see what keys are present in the data set. The keys command

$ abcd keys <query>
count           key key_type
12000   config_type   string
12000        energy   number
12000  total_energy   number
12000        virial    array

shows what keys are present, how many frames in the dataset contain that particular key, and the type of data stored under that key.

To learn more about the distribution of values under a given key, the hist <key> command

$ abcd hist config_type <query>
              bcc_bulk_54_high 28
    bcc_doublevacancy_126_high 78
      bcc_monovacancy_127_high 57
        dislocation_quadrupole 100
    doublevacancy_126_1NN_high 46
    doublevacancy_126_2NN_high 48
                 gamma_surface 18549
                 ...

can be used. This can currently be used on a string or number key and will show the distribution of values under each key.

Finally, the select <key1> <key2> .. <keyn> command

$ abcd select total_energy degauss <query>
[lots of output]

can be used to display a table of values held under each key.

Query Syntax

To select subsets of frames, most of the above commands accept a query subcommand. This can be used on string properties

$ abcd count where config_type = \"bcc_bulk_54_high\"
28

(where note the quoting of the " characters to avoid mangling by the shell) or on numerical parameters

$ abcd count where total_energy gt -15
2000

On string values we can currently only test for equality. On numerical values, we can test for all the standard numeric conditions, greater than (> or gt), less than (< or lt), greater than or equal to (>= or geq), less than or equal to (<= or leq), or also equality. Multiple conditions can be combined with and and or.

⚠️ **GitHub.com Fallback** ⚠️