catkit.hub package

Submodules

catkit.hub.ase_connect module

catkit.hub.ase_connect.main()[source]

catkit.hub.cathubsqlite module

class catkit.hub.cathubsqlite.CathubSQLite(filename)[source]

Class for managing SQLite3 database for reaction energies, publications and atomic structures. Builds on top of the ASE database for atomic strucutres https://wiki.fysik.dtu.dk/ase/ase/db/db.html with four additional tables:

publication: publication info

publication_system: one-to-many mapping between publication table and
systems table in ASE database

reaction: reaction energies for surfaces

reaction_system: mamy-to-many mapping between reaction table and
systems table in ASE database

Connect to a database object:

db = CathubSQLite(‘yourdbfile.db’)

Set up a connection for several manipulations:

with db as CathubSQLite(‘yourdbfile.db’):
Do your work…
Parameters:filename (str) – name of database file
check(chemical_composition, reaction_energy)[source]

Check if entry with same surface and energy is allready written to database file :param chemcial_composition: :type chemcial_composition: str :param reaction_energy: :type reaction_energy: str :param Returns id or None:

check_publication(pub_id)[source]
check_publication_structure(pub_id, ase_id)[source]
check_reaction_on_surface(chemical_composition, reactants, products)[source]

Check if entry with same surface and reaction is allready written to database file

Parameters:
  • chemcial_composition (str) –
  • reactants (dict) –
  • products (dict) –
  • id or None (Returns) –
get_last_id(cur, table='reaction')[source]

Get the id of the last written row in table

Parameters:
  • cur (database connection()cursor() object) –
  • table (str) – ‘reaction’, ‘publication’, ‘publication_system’, ‘reaction_system’
  • Returns (id) –
read(id, table='reaction')[source]

Return an entire row of a table :param id: row integer :type id: int :param table: ‘reaction’, ‘publication’, ‘publication_system’, ‘reaction_system’ :type table: str

update(id, values, key_names='all')[source]

Update reaction info for a selected row

Parameters:
  • id (int) – row integer
  • values (dict) – See write() method for details
  • key_names (list or 'all') – list with name of columns to update. Should match the keys-value pairs in values. default is ‘all’
write(values, data=None)[source]

Write reaction info to db file

Parameters:
  • values (dict) –
  • values dict can include (The) –
  • {'chemical_composition' (str (chemical composition on empty slab) ,) –
  • 'surface_composition' (str (reduced chemical composition or) – shortname),
  • 'facet' (str) –
  • 'sites' (dict) – adsorption sites of species. f.ex: {‘OH’: ‘ontop’, ‘O’: ‘hollow’}
  • 'coverages' (dict) – coverage of adsorbates relative to the unit cell f.ex. {‘OH’: 0.25, ‘O’: 0.5})
  • 'products' ('reactants'/) – keys with name of chemical species folloved by phase (gas, *) values are the prefactor in the reaction. For reaction H2Ogas -> 2Hstar + O star you would write: ‘reactants’: {OHstar: 1, Hstar: 2} ‘products’: {OHstar: 1, Hstar: 2}
  • 'reaction_energy' (float) –
  • 'activation_energy' (float) –
  • 'dft_code' (str) –
  • 'dft_functional' (str) –
  • 'username' (str) –
  • 'pub_id' (str) – Should match the pub_id of the corresponding publications
  • }
write_publication(values)[source]

Write publication info to db

Parameters:values (dict with entries) – {‘pub_id’: str (short name for publication), ‘authors’: list of str () ‘journal’: str, ‘volume’: str, ‘number’: str, ‘pages’: ‘str’ ‘year’: int, ‘publisher’: str, ‘doi’: str, ‘tags’: list of str}
catkit.hub.cathubsqlite.check_ase_ids(values, ase_ids)[source]
catkit.hub.cathubsqlite.get_key_value_list(key_list, values, table='reaction')[source]
catkit.hub.cathubsqlite.get_key_value_str(values)[source]
catkit.hub.cathubsqlite.get_value_strlist(value_list)[source]

catkit.hub.cli module

catkit.hub.convert_traj module

catkit.hub.convert_traj.main(base)[source]

catkit.hub.create_user module

catkit.hub.create_user.main(user)[source]

catkit.hub.db2server module

catkit.hub.db2server.main(dbfile, start_id=1, write_reaction=True, write_ase=True, write_publication=True, write_reaction_system=True, block_size=1000, start_block=0, db_user='catroot', db_password=None)[source]

catkit.hub.folder2db module

catkit.hub.folder2db.main(folder_name, debug=False, skip=[], goto_reaction=None, old=False)[source]

catkit.hub.folder_check module

catkit.hub.folder_check.main(folder)[source]

catkit.hub.folderreader module

class catkit.hub.folderreader.FolderReader(folder_name, debug=False, strict=True, verbose=False, update=True)[source]

Class for reading data from organized folders and writing to local CathubSQLite database. Folders should be arranged with make_folders_template and are read in the order:

level:

0 folder_name 1 |– publication 2 |– dft_code 3 |– dft_functional 4 |– gas 4 |– metal1 5 |– facet 6 |– reaction

Parameters:
  • foldername (str) –
  • debug (bool) – default is False. Choose True if the folderreader should continue in spite of errors.
  • update (bool) – Update data if allready present in database file. defalt is True
read(skip=[], goto_metal=None, goto_reaction=None)[source]

Get reactions from folders.

Parameters:
  • skip (list of str) – list of folders not to read
  • goto_reaction (str) – Skip ahead to this metal
  • goto_reaction – Skip ahead to this reacion
read_bulk(root, files)[source]
read_energies(root, files)[source]
read_gas(root)[source]
read_pub(root)[source]
read_reaction(root, files)[source]
read_slab(root, files)[source]
write(skip=[], goto_reaction=None)[source]
write_publication(pub_data)[source]
catkit.hub.folderreader.read_name_from_folder(root)[source]

catkit.hub.maintain_server module

class catkit.hub.maintain_server.MaintainPostgres(user='catroot', password=None, stdin=<open file '<stdin>', mode 'r'>, stdout=<open file '<stdout>', mode 'w'>)[source]

Bases: catkit.hub.postgresql.CathubPostgreSQL

delete_lost_systems()[source]
fill_reaction_system()[source]

catkit.hub.make_folders_template module

catkit.hub.organize module

catkit.hub.organize.collect_structures(foldername, options)[source]
catkit.hub.organize.create_folders(options, structures, root='')[source]
catkit.hub.organize.fuzzy_match(structures, options)[source]
catkit.hub.organize.get_chemical_formula(atoms)[source]

Compatibility function, return mode=metal, when available, mode=hill, when not (ASE <= 3.13)

catkit.hub.organize.main(options)[source]
catkit.hub.organize.symbols(atoms)[source]

catkit.hub.postgresql module

class catkit.hub.postgresql.CathubPostgreSQL(user='catroot', password=None, stdin=<open file '<stdin>', mode 'r'>, stdout=<open file '<stdout>', mode 'w'>)[source]

Class for setting up the catalysis hub reaction energy database on postgreSQL server.

check(pub_id, chemical_composition, reactants, products, reaction_energy=None, strict=True)[source]
create_user(user)[source]
delete(authorlist, year, doi=None)[source]
publication_status()[source]
read(id, table='reaction')[source]
remove_user(user)[source]
status(table='reaction')[source]
transfer(filename_sqlite, start_id=1, write_ase=True, write_publication=True, write_reaction=True, write_reaction_system=True, block_size=1000, start_block=0)[source]
update(id, values, key_names='all')[source]
update_publication(pub_dict)[source]
write(values, table='reaction')[source]
write_publication(pub_values)[source]
catkit.hub.postgresql.get_key_value_str(values, table='reaction')[source]

catkit.hub.psql_server_connect module

catkit.hub.psql_server_connect.main(user)[source]

catkit.hub.query module

catkit.hub.query.convert(name)[source]
catkit.hub.query.execute_graphQL(query_string)[source]
catkit.hub.query.get_ase_db()[source]
catkit.hub.query.get_atoms_by_id(unique_id)[source]
catkit.hub.query.get_atomsrow_by_id(unique_id)[source]
catkit.hub.query.get_publications(**kwargs)[source]
catkit.hub.query.get_reactions(n_results=20, write_db=False, **kwargs)[source]

Get reactions from server

Give key value strings as arguments

catkit.hub.query.graphql_query(table='reactions', subtables=[], columns=['chemicalComposition', 'reactants', 'products'], n_results=10, queries={})[source]
catkit.hub.query.map_column_names(column)[source]
catkit.hub.query.query(table='reactions', columns=['chemicalComposition', 'reactants', 'products'], subtables=[], n_results=10, queries={}, print_output=False)[source]

catkit.hub.tools module

catkit.hub.tools.add_atoms(atoms_list)[source]
catkit.hub.tools.check_reaction(reactants, products)[source]

Check the stoichiometry and format of chemical reaction used for folder structure. list of reactants -> list of products

catkit.hub.tools.extract_atoms(molecule)[source]

Return a string with all atoms in molecule

catkit.hub.tools.get_bases(folder_name)[source]
catkit.hub.tools.get_catbase()[source]

Module contents