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 AMUrc[:cpk_colors]
: a dictionary which maps atomic species to their CPK colorsrc[: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 inrc[:paths][:data]
: not directly used byXtals.jl
, but important for other packages which useXtals
, 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_paths
— Function`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. Iftrue
, prints contents ofrc[:paths]
to console. Defaults tofalse
.no_warn::Bool
: Optional. Settrue
to suppress invalid path warnings. Default tofalse
.