Global Variables

In Xtals.jl, global variables are stored in a dictionary called rc. The entries in rc are used for holding various important pieces of information:

  • rc[:atomic_masses] : a dictionary which maps atomic species to their masses in AMU
  • rc[:cpk_colors] : a dictionary which maps atomic species to their CPK colors
  • rc[:bonding_rules] : an array which lists the maximum bonding distances between each pair of atom types in Å
  • rc[:covalent_radii] : a dictionary which maps atomic species to their covalent radii in Å
  • rc[:paths] : a dictionary of paths to directories to search for input data

Paths

The rc[:paths] dictionary holds the following:

  • rc[:paths][:crystals] : the path to find crystallographic files (.cif, .cssr) to read in
  • rc[:paths][:data] : not directly used by Xtals.jl, but important for other packages which use Xtals, e.g. PorousMaterials.jl

When Xtals is first loaded, the paths are set based on the present working directory. Xtals expects to find a folder named data in the working directory, and assumes that crystallographic data will be present in data/crystals. To change the location of the crystal inputs, either set rc[:paths][:crystals] directly, or use set_paths:

rc[:paths][:crystals] = "other_crystals" # crystals are now loaded from "other_crystals"
set_paths("other_data") # crystals are now loaded from "other_data/crystals"

Detailed Docs

Xtals.set_pathsFunction
`set_paths("path_to_data", print_paths=true)`

Sets all paths in rc[:paths] relative to path_to_data. Paths follow the standard format of rc[:paths][:foo] = "path_to_data/foo", except for rc[:paths][:data] which is "path_to_data". Warnings are issued if any chosen paths are not valid folders.

Arguments

  • path_to_data::AbstractString : an absolute or relative path to use as the root of the data folder tree. Defaults to present working directory.
  • print_paths::Bool : Optional. If true, prints contents of rc[:paths] to console. Defaults to false.
  • no_warn::Bool : Optional. Set true to suppress invalid path warnings. Default to false.
source