Models and Queries¶
These modules define the data models for imeall.gb_models.GrainBoundary
and imeall.gb_models.SubGrainBoundary
structures and
the SQL and directory tree database. They also contains classes
for performing maintenance of the grain boundary database and
querying and copying structures from the directory tree.
Maintenance¶
imeall.models.GBMaintenance
contains methods for performing
maintenance and query operations on the directory tree structure and
modifying gb.json and subgb.json files.
-
class
imeall.models.
GBMaintenance
[source]¶ Collection of maintenance routines for the GB database. Methods include routines to regenerate all the csl lattices in the database, take a new grain boundary profile picture for multiple directories, update the gb.json information if a new grain boundary property is desired.
-
add_key_to_dict
(dirname, new_key, new_value, dict_type='subgb.json', modify=False)[source]¶ Add single key to .json dictionary.
Parameters: Returns: Updated json dictionary.
Return type:
-
fix_json
(path)[source]¶ If json file is corrupted and contains two {}{} dictionaries, this function selects the second of the two dictionaries and overwrites json file.
Parameters: path (str) – path to corrupted dictionary.
-
remove_eo_files
(path, num_deleted_files, dryrun=False)[source]¶ Remove files with pattern matching jobname.[eo][0-9]+.
Parameters: Returns: Number of deleted files.
-
retake_pic
(fname, translate=False, toggle=False, confirm=True)[source]¶ DEPRECATED If using AtomEye take grain boundary profile pic in directory requires gb directory with gbid.xyz file in it. Set confirm=False to not prompt for overwrite. In future versions OVITO will be default image generator.
-
Queries¶
imeall.models.GBQuery
contains methods for checking out and
copying structure files and json dictionaries from the
directory tree grain boundary database.
-
class
imeall.models.
GBQuery
[source]¶ Routines for grabbing desired .xyz files and paths.
-
copy_gb_dirtree
(material='alphaFe', or_axis='0,0,1', pots=['PotBH.xml'], target_dir='./', gb_type='tilt')[source]¶ Pull all minimum energy structures, using
pull_minen_structs()
, from database for an orientation axis and copy them to target_dir. Useful for checking out structures into a unique directory for specialized analysis.Parameters: Todo
- Add kwargs to pull_minen_structs to provide additional selection criteria.
-
pull_minen_structs
(material='alphaFe', or_axis='1,1,1', pots=['PotBH.xml'], gb_type='tilt')[source]¶ Grab the minimum energy structure json dictionaries for a given material, orientation_axis, and potential(s) parameter filenames.
Parameters: Returns: List of
SubGrainBoundary
Model
represented as dictionaries.Return type: list[
SubGrainBoundary
]
-
SQL Models¶
These classes define the data models for the imeall.gb_models.GrainBoundary
and imeall.gb_models.SubGrainBoundary models
.
-
class
imeall.gb_models.
GrainBoundary
(*args, **kwargs)[source]¶ GrainBoundary is a peewee :peewee:`Model` of the canonical parent grain. Model is connected to the SQL database of the grain boundaries. All vectors are serialized to csv string for storage.
-
orientation_axis
¶ str – orientation axis defining the grain.
-
angle
¶ str – misorientation angle for defining the grain.
-
boundary_plane
¶ str – boundary plane normal defining the grain.
-
path
¶ str – Full directory string relative to the grain boundary database root.
-
gb_type
¶ str – Grain boundary type (tilt, twist, general).
-
z_planes
¶ list – Location of center of interfacial planes.
-
n_at
¶ int – Number of grains in parent.
-
-
class
imeall.gb_models.
SubGrainBoundary
(*args, **kwargs)[source]¶ SubGrainBoundary Model.
-
path
¶ str – relative to the GRAIN_BOUNDARY database root (set in the application instance/config.py file).
-
canonical_grain(
class:GrainBoundary): Each
SubGrainBoundary
has a parentGrainBoundary
model.
-
rbt
¶ str – rigid body translations.
-
potential
¶ str – Potential parameter file.
-
rcut
¶ float – atom deletion criterion.
-
area
¶ float – grain boundary interfacial area.
-
n_at
¶ int – number of atoms in subgrain structure.
-
E_gb
¶ float – grain boundary energies.
-
E_gb_init
¶ float – Energy of initial unrelaxed structure.
-
notes
¶ str – Special notes of interest about this boundary.
-
gbid
¶ str – SubGrainBoundary id.
-
-
class
imeall.gb_models.
Fracture
(*args, **kwargs)[source]¶ Fracture data
Model
.-
fracture_system
¶ str – Serialized string in form [crack direction](crack plane).
-
G
¶ float – stress energy release rate.
-
strain_rate
¶ float – time incremental rate of strain increase fs^{-1}
-
sim_T
¶ float – simulation temperature.
-
Serialization Methods¶
These methods flip vector or list data back and forth between comma separated value strings which can be stored in the SQL database.
This module contains key grain boundary data models for the SQL database. Also operates as a command line tool to populate local versions of the database.
SQL Database Methods¶
Methods for updating and checking the integrity of the SQL database. These methods ensure the directory tree and the SQL database remain normalized and synchronized.
This module contains key grain boundary data models for the SQL database. Also operates as a command line tool to populate local versions of the database.
-
imeall.gb_models.
add_conv_key
(material='alphaFe', or_axis='001')[source]¶ Check if subgb.json dictionary contains a convergence key. If not add key to subgb.json file and default to false.
Parameters:
-
imeall.gb_models.
gb_check_dir_integrity
(material='alphaFe', or_axis='001')[source]¶ Check if directory in directory tree contains a grain boundary json file, and update sql database to include the parent grain if it is missing.
-
imeall.gb_models.
gb_check_path
(material='alphaFe', or_axis='001', modify_db=False)[source]¶ Compare consistency between location of subgb.json paths and the paths in the closure tree. If path is missing from directory tree delete from the SQL database.
Parameters:
-
imeall.gb_models.
gb_check_conv
(material='alphaFe', or_axis='001', modify_db=False)[source]¶ Scans through grainboundary directory tree, inspecting the subgrain dictionary and the
SubGrainBoundary
to test if the grain boundary energy, number of atoms, gb_area, and convergence flag are consistent. If modify_db is True the SQLite model will be updated.Parameters: - material – Which material to do check json/database convergence consistency on.
- or_axis – Which orientation axis to check.
- modify_db – Boolean. If True updates gb_model in database otherwise just prints inconsistent grain json/database value.
-
imeall.gb_models.
gb_check_force
(material='alphaFe', or_axis='001', force_tol=0.05, modify_db=False, gb_start=0, sub_start=0)[source]¶ Recurse through directory tree, loading the structure file, json dict and the model for each subgrain. Check that the force tolerance in the structure file has actually been met for convergence.
Parameters: - material (str) – material string.
- or_axis (str) – orientation axis.
- force_tol (float) – Max force magnitude on the relaxed structures.
- modify_db (bool) – If True
SubGrainBoundary
will be updated. - gb_start (int) – Start from this grain boundary in list.
- sub_start (int) – Start from this subgrainboundary in list.
-
imeall.gb_models.
change_json_key
(material='alphaFe', or_axis='001')[source]¶ Replace ‘_traj’ string in subgb_dict[‘gbid’] method. Can be modified to update or correct database/subgb strings in json files.
Parameters: