critcatworks.structure package¶
Submodules¶
critcatworks.structure.adsorbates module¶
-
class
critcatworks.structure.adsorbates.
GatherPropertyTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Task to update database from chunk of calculations. Computes properties of systems. Currently, only reaction energies (adsorption energies) are computed. The ids of the input structures in calc_ids are replaced by the ids of the post-simulation structures from analysis_ids.
- Parameters
chunk_size (int) – number of calculations that are run simulataneously. Default -1 means all calculations are run at once.
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= ['adsite_types']¶
-
required_params
= ['chunk_size']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
critcatworks.structure.adsorbates.
update_converged_data
(chunk_size, adsite_types=['top', 'bridge', 'hollow'])[source]¶ Updates the internal fw_spec data from chunk of calculations. Computes properties of systems. Currently, only reaction energies (adsorption energies) are computed. The ids of the input structures in calc_ids are replaced by the ids of the post-simulation structures from analysis_ids.
- Parameters
chunk_size (int) – number of calculations that are run simulataneously. Default -1 means all calculations are run at once.
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
- Returns
Firework GatherPropertyWork
- Return type
Firework
critcatworks.structure.coverage module¶
-
class
critcatworks.structure.coverage.
AddRemoveLadderTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask in the coverage ladder workflow to either add or remove an adsorbate (at k different positions)
The decision where to add or remove adsorbates is quantified by the ranking_metric, either through a similarity or spatial distance metric.
The bond_length parameters ensures that the positions are not too cramped, hence adsorbates never come too close to each other.
- Parameters
bond_length (float) – distance in angstrom under which two adsorbed atoms are considered bound, hence too close
k (int) – number of empty candidate sites for adding / adsorbed atoms for removing to consider per step
ranking_metric (str) – ‘similarity’ or ‘proximity’. Metric based on which to choose k candidates (empty sites / adsorbates)
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
add_adsorbate
(simulation, bond_length, db, ranking_metric='proximity', k=7, adsorbate_name='H', reference_id=-1, workflow_id=-1)[source]¶ Adds one adsorbate to the structure at k different positions, predefined by adsorption sites.
The new structures are added to the simulation collection.
Only supports atomic adsorbates so far.
- Parameters
simulation (dict) – simulation document in custom format
bond_length (float) – distance in angstrom under which two adsorbed atoms are considered bound, hence too close
db (pymongo object) – connection to the mongodb database
k (int) – number of empty candidate sites for adding / adsorbed atoms for removing to consider per step
ranking_metric (str) – ‘similarity’ or ‘proximity’. Metric based on which to choose k candidates (empty sites / adsorbates)
adsorbate_name (str) – element symbol of the adsorbed atom
reference_id (int) – simulation id of the adsorbate reference
workflow_id (int) – unique identifier of the current workflow
- Returns
new simulation ids
- Return type
list
-
get_empty_sites
(site_positions, adsorbate_positions, bond_length=1.5)[source]¶ From a set of predefined adsorption sites, it is reduced to contain only sites which are not too close to existing adsorbate atoms (with respect to parameter bond_length).
- Parameters
site_positions (2D ndarray) – adsorption site positions
adsorbate_positions (2D ndarray) – positions of all adsorbate atoms
bond_length (float) – distance criterion up to which a site is considered occupied by neighbouring atoms
- Returns
- ids of the remaining site positions, ordered by
minimum distance to the adsorbates
- Return type
1D ndarray
-
optional_params
= []¶
-
remove_adsorbate
(simulation, bond_length, db, ranking_metric='similarity', k=7, adsorbate_name='H', workflow_id=-1)[source]¶ Remove one adsorbate from the structure at k different positions.
The new structures are added to the simulation collection.
Only supports atomic adsorbates so far.
- Parameters
simulation (dict) – simulation document in custom format
bond_length (float) – distance in angstrom under which two adsorbed atoms are considered bound, hence too close
db (pymongo object) – connection to the mongodb database
k (int) – number of empty candidate sites for adding / adsorbed atoms for removing to consider per step
ranking_metric (str) – ‘similarity’ or ‘proximity’. Metric based on which to choose k candidates (empty sites / adsorbates)
adsorbate_name (str) – element symbol of the adsorbed atom
workflow_id (int) – unique identifier of the current workflow
- Returns
new simulation ids
- Return type
list
-
required_params
= ['bond_length', 'k', 'ranking_metric']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
split_nanocluster_and_adsorbates
(simulation)[source]¶ Helper function to split a given structure in a simulation document into two ase atoms objects containing only the nanocluster or the adsorbate atoms.
- Parameters
simulation (dict) –
- Returns
- cluster atoms (ase.Atoms),
adsorbate atoms (ase.Atoms), adsorption site ids (list), adsorption site classes (list), reference ids (list), adsorbate ids (list)
- Return type
tuple
-
class
critcatworks.structure.coverage.
AdsorbateEliminationTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask to eliminate too close adsorbate atoms on a covered nanocluster. The adsorbates can be eliminated either based on a minimum distance ‘bond_length’ or the closest ones can be eliminated until only n_remaining adsorbates are left.
The workflow is defused if no adsorbate atoms were removed.
- Parameters
adsorbate_name (str) – element symbol of the adsorbed atom
bond_length (float) – distance in angstrom under which two adsorbed atoms are considered bound, hence too close
n_remaining (int) – number of adsorbates which should remain after the first pre-DFT pruning of the adsorbate coverage
- Returns
- Firework action, updates fw_spec, possible defuses
workflow.
- Return type
FWAction
-
optional_params
= ['bond_length', 'n_remaining']¶
-
required_params
= ['adsorbate_name']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.coverage.
CoverageLadderTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
This Task is at the heart of the coverage ladder workflow. It manages the following steps: - gets lowest energy structures from the previous step - checks if a new root structure has been found - manages branches - computes adsorption free energy - decides upon termination based on parameter d - decides direction of next step
- Parameters
d (int) – maximum depth of the coverage ladder (termination criterion)
l (int) – number of low-energy structures to carry over to the next step
- Returns
- Firework action, updates fw_spec, possible defuses
workflow.
- Return type
FWAction
-
check_new_root
(is_new_root, branch_dct, lowest_idx, ne_dct, n_adsorbates_root, n_adsorbates, reference_energy=0.0, free_energy_correction=0.0)[source]¶ Checks if current lowest-energy configuration is eligible for new root. A special check is done after the first step after root. It depends on the direction of the last step and checks the sign of the adsorption free energy. Otherwise, the method level_check_new_root is called.
- Parameters
is_new_root (bool) – if True, the current step is the first step after root
branch_dct (dict) – parent simulation : list of child simulations
lowest_idx (int) – lowest-energy simulation id
ne_dct (dict) – stores total energies of all calculations with respect to the number of adsorbates and their ids
n_adsorbates_root (int) – number of adsorbates of the root structure
n_adsorbates (int) – number of adsorbates of the current step
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
free_energy_correction (float) – free energy correction of the adsorption reaction at hand
Returns –
bool – new root
-
compute_dg_diff
(idx, branch_dct, ne_dct, reference_energy=0.0, free_energy_correction=0.0)[source]¶ Helper function to compute the adsorption free energy
In the case of hydrogen the property is: dGdiff(nH) = G(nH) - G(nH-1)) - 0.5 G(H2)
- Parameters
idx (int) – simulation id
branch_dct (dict) – parent simulation : list of child simulations
ne_dct (dict) – stores total energies of all calculations with respect to the number of adsorbates and their ids
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
free_energy_correction (float) – free energy correction of the adsorption reaction at hand
Returns –
tuple – adsorption free energy (float), assignment of property to ‘parent’ or ‘child’ simulation
-
decide_next_branch
(open_branches, ne_dct)[source]¶ The next branch from the collected possible branches is picked. The first element is removed from the list which contains information about direction and parent simulation ids
- Parameters
open_branches (list) – each element is a tuple containing parent simulation ids and direction
ne_dct (dict) – stores total energies of all calculations with respect to the number of adsorbates and their ids
- Returns
- direction (bool),
simulation ids (list), updated number of adsorbates (int)
- Return type
tuple
-
find_lowest_energy_structures
(l, calc_ids, energies)[source]¶ Finds the l lowest energy structures based on the given total energies.
- Parameters
l (int) – number of lowest-energy structures
calc_ids (list) – simulation ids
energies (list) – total energies of the systems
- Returns
list of l calc_ids, list of l total energies
- Return type
tuple
-
level_check_new_root
(idx, ne_dct, n_adsorbates_root, n_adsorbates)[source]¶ Has to compare with root, if it is on the same coverage level. The new structure becomes the new root if its total energy is lower.
-
optional_params
= []¶
-
required_params
= ['l', 'd']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.coverage.
GatherLadderTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask for Gathering properties for coverage ladder. Update database from previous calculations. Computes properties of systems. Currently, only reaction energies (adsorption energies) are computed. The ids of the input structures in calc_ids are replaced by the ids of the post-simulation structures from analysis_ids.
Args:
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= []¶
-
required_params
= []¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.coverage.
NewLadderRootTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Task to start CoverageLadder Workflow. It initiates a few fw_spec[“temp”] entries: -“step_history” -“root_history” -“is_return” -“start_id” -“is_new_root” -“n_adsorbates” -“n_adsorbates_root” -“branch_dct” -“open_branches” -“ne_dct” -“direction” -“calc_ids” -“reference_energy” -“free_energy_correction”
- Parameters
start_ids (list) – unique identifiers of the simulations collection which are used to start the workflow
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
free_energy_correction (float) – free energy correction of the adsorption reaction at hand
initial_direction (bool) – True will force the initial step to add an adsorbate, False will force the initial step to remove an adsorbate
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= ['initial_direction']¶
-
required_params
= ['start_ids', 'reference_energy', 'free_energy_correction']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.coverage.
PerTypeCoverageCreationTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Task to cover cluster fully with adsorbates based on a type of site.
Additionally, a reference simulation document is created and the descriptors of the sites are stored.
- Parameters
reference_energy (float) – reference energy of the adsorbate
adsorbate_name (str) – Adsorbate atom name to be placed on all sites found.
adsite_types (list of str) – Can be “top”, “bridge” or “hollow”.
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= []¶
-
required_params
= ['reference_energy', 'adsorbate_name', 'adsite_types']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
critcatworks.structure.coverage.
add_remove_adsorbate
(bond_length, k=7, ranking_metric='similarity')[source]¶ Firework in the coverage ladder workflow to either add or remove an adsorbate (at k different positions)
The decision where to add or remove adsorbates is quantified by the ranking_metric, either through a similarity or spatial distance metric.
The bond_length parameters ensures that the positions are not too cramped, hence adsorbates never come too close to each other.
- Parameters
bond_length (float) – distance in angstrom under which two adsorbed atoms are considered bound, hence too close
k (int) – number of empty candidate sites for adding / adsorbed atoms for removing to consider per step
ranking_metric (str) – ‘similarity’ or ‘proximity’. Metric based on which to choose k candidates (empty sites / adsorbates)
- Returns
Firework AddRemoveLadderWork
- Return type
Firework
-
critcatworks.structure.coverage.
eliminate_closest
(adsorbate_name, n_remaining)[source]¶ Firework to eliminate too close adsorbate atoms on a covered nanocluster. The adsorbates closest to each other are eliminated until only n_remaining adsorbates are left.
The workflow is defused if no adsorbate atoms were removed.
- Parameters
adsorbate_name (str) – element symbol of the adsorbed atom
n_remaining (int) – number of adsorbates which should remain after the first pre-DFT pruning of the adsorbate coverage
- Returns
Firework AdsorbateEliminationWork
- Return type
Firework
-
critcatworks.structure.coverage.
eliminate_pairs
(adsorbate_name, bond_length)[source]¶ Firework to eliminate too close adsorbate atoms on a covered nanocluster. The adsorbates closest to each other are eliminated based on a minimum distance ‘bond_length’.
The workflow is defused if no adsorbate atoms were removed.
- Parameters
adsorbate_name (str) – element symbol of the adsorbed atom
bond_length (float) – distance in angstrom under which two adsorbed atoms are considered bound, hence too close
- Returns
Firework AdsorbateEliminationWork
- Return type
Firework
-
critcatworks.structure.coverage.
gather_ladder
()[source]¶ Firework for Gathering properties for coverage ladder. Update database from previous calculations. Computes properties of systems. Currently, only reaction energies (adsorption energies) are computed. The ids of the input structures in calc_ids are replaced by the ids of the post-simulation structures from analysis_ids.
Args:
- Returns
Firework GatherLadderWork
- Return type
Firework
-
critcatworks.structure.coverage.
get_per_type_coverage
(reference_energy=0.0, adsorbate_name='H', adsite_types=['top', 'bridge', 'hollow'], descriptor='soap', descriptor_params={'crossover': True, 'lmax': 6, 'nmax': 9, 'rcut': 5.0, 'sparse': False})[source]¶ Firework to cover cluster fully with adsorbates based on a type of site.
Additionally, a reference simulation document is created and the descriptors of the sites are stored.
- Parameters
reference_energy (float) – reference energy of the adsorbate
adsorbate_name (str) – Adsorbate atom name to be placed on all sites found.
adsite_types (list of str) – Can be “top”, “bridge” or “hollow”.
descriptor (str) – type of descriptor to be used. For a list of descriptors, see the documentation of dscribe Defaults to ‘soap’
descriptor_params (dict) – descriptor parameters
- Returns
Firework PerTypeCoverageCreationWork
- Return type
Firework
-
critcatworks.structure.coverage.
start_coverage_ladder
(start_ids, initial_direction=1, reference_energy=0.0, free_energy_correction=0.0)[source]¶ Firework to start CoverageLadder Workflow. It initiates a few fw_spec[“temp”] entries: -“step_history” -“root_history” -“is_return” -“start_id” -“is_new_root” -“n_adsorbates” -“n_adsorbates_root” -“branch_dct” -“open_branches” -“ne_dct” -“direction” -“calc_ids” -“reference_energy” -“free_energy_correction”
- Parameters
start_ids (list) – unique identifiers of the simulations collection which are used to start the workflow
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
free_energy_correction (float) – free energy correction of the adsorption reaction at hand
initial_direction (bool) – True will force the initial step to add an adsorbate, False will force the initial step to remove an adsorbate
- Returns
Firework NewLadderRootWork
- Return type
Firework
-
critcatworks.structure.coverage.
step_coverage_ladder
(l=2, d=4)[source]¶ This Firework is at the heart of the coverage ladder workflow. It manages the following steps: - gets lowest energy structures from the previous step - checks if a new root structure has been found - manages branches - computes adsorption free energy - decides upon termination based on parameter d - decides direction of next step
- Parameters
d (int) – maximum depth of the coverage ladder (termination criterion)
l (int) – number of low-energy structures to carry over to the next step
- Returns
Firework CoverageLadderWork
- Return type
Firework
-
critcatworks.structure.coverage.
x2_to_x
(points, bondlength=1.5)[source]¶ Helper function to determine the points closest to all other points. It ranks them removing one by one until no points are closer than the specified parameter bondlength.
- Parameters
points (2D ndarray) – Points in n-dimensional space
bondlength (float) – criterion up to which points should be removed.
- Returns
- ids of the remaining points, ordered by minimum
distance
- Return type
1D ndarray
critcatworks.structure.nanoclusters module¶
-
class
critcatworks.structure.nanoclusters.
NCGenerationTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask to generate binary nanoclusters of defined size and shape. For each binary element combination, for each composition, n_configurations maximally dissimilar structures are created and uploaded to the simulations collection of the mongodb database. For further information on the generation algorithm, consult the documentation of cluskit.
The new structures are added to the simulation collection of the mongodb database.
- Parameters
n_initial_configurations (int) – number of initial configurations per composition to choose from (higher number will make the grid finer)
n_configurations (int) – number of configurations per composition (chosen based on maximally different structural features)
shape (str) – determines shape of nanoclusters. ‘ico’, ‘octa’ and ‘wulff’
nanocluster_size (int) – determines nanocluster size. Meaning depends on shape
compositions (list) – each element determines the amount of atoms of type 1.
elements (list) – elements (str) to iterate over
generate_pure_nanoclusters (bool) – if set to True, also pure nanoclusters are generated
bondlength_dct (dict) – bond lengths to use for specific elements. Some default bond lenghts are provided for common elements
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
generate
(n_initial_configurations, n_configurations, shape, nanocluster_size, compositions, elements, generate_pure_nanoclusters=True, bondlength_dct={}, db=None, workflow_id=-1)[source]¶ Generates binary nanoclusters. For further information, consult the documentation of cluskit
- Parameters
n_initial_configurations (int) – number of initial configurations per composition to choose from (higher number will make the grid finer)
n_configurations (int) – number of configurations per composition (chosen based on maximally different structural features)
shape (str) – determines shape of nanoclusters. ‘ico’, ‘octa’ and ‘wulff’
nanocluster_size (int) – determines nanocluster size. Meaning depends on shape
compositions (list) – each element determines the amount of atoms of type 1.
elements (list) – elements (str) to iterate over
generate_pure_nanoclusters (bool) – if set to True, also pure nanoclusters are generated
bondlength_dct (dict) – bond lengths to use for specific elements. Some default bond lenghts are provided for common elements
db (pymongo object) – connection to the mongodb database
workflow_id (int) – unique identifier of the current workflow
- Returns
- list of nanocluster ase.Atoms objects,
list of simulation ids
- Return type
tuple
-
optional_params
= ['generate_pure_nanoclusters', 'bondlength_dct']¶
-
required_params
= ['n_initial_configurations', 'n_configurations', 'shape', 'nanocluster_size', 'compositions', 'elements']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.nanoclusters.
NCStabilityTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Task to compare the stability of clusters using cohesive or total energy. Cohesive energy requires atomic total energies.
Writes a file called cohesive_energy.json where the energies are summarized split by nanocluster composition.
- Parameters
atomic_energies (list) – atomic energies provided using the same simulation parameters
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= ['atomic_energies']¶
-
required_params
= []¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
critcatworks.structure.nanoclusters.
compare_nanoclusters
(atomic_energies={})[source]¶ Firework to compare the stability of clusters using cohesive or total energy. Cohesive energy requires atomic total energies.
Writes a file called cohesive_energy.json where the energies are summarized split by nanocluster composition.
- Parameters
atomic_energies (list) – atomic energies provided using the same simulation parameters
- Returns
Firework NCStabilityWork
- Return type
Firework
-
critcatworks.structure.nanoclusters.
generate_nanoclusters
(n_initial_configurations, n_configurations, shape, nanocluster_size, compositions, elements, generate_pure_nanoclusters=True, bondlength_dct={})[source]¶ Firework to generate binary nanoclusters of defined size and shape. For each binary element combination, for each composition, n_configurations maximally dissimilar structures are created and uploaded to the simulations collection of the mongodb database. For further information on the generation algorithm, consult the documentation of cluskit.
The new structures are added to the simulation collection of the mongodb database.
- Parameters
n_initial_configurations (int) – number of initial configurations per composition to choose from (higher number will make the grid finer)
n_configurations (int) – number of configurations per composition (chosen based on maximally different structural features)
shape (str) – determines shape of nanoclusters. ‘ico’, ‘octa’ and ‘wulff’
nanocluster_size (int) – determines nanocluster size. Meaning depends on shape
compositions (list) – each element determines the amount of atoms of type 1.
elements (list) – elements (str) to iterate over
generate_pure_nanoclusters (bool) – if set to True, also pure nanoclusters are generated
bondlength_dct (dict) – bond lengths to use for specific elements. Some default bond lenghts are provided for common elements
- Returns
Firework NCGenerationWork
- Return type
Firework
critcatworks.structure.singlesites module¶
-
class
critcatworks.structure.singlesites.
AdsiteCreationTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask to determine adsorption site structures. The adsorbate can only be a single atom. For a molecular adsorbate (binding to only one site), please use the Firetask MonodentateAdsiteCreationTask. On a set of nanoclusters, a combination of top/bridge/hollow sites is classified and populated. Hence, the simulation collection of the mongodb database is updated with structures which each contain a single adsorbate on a nanocluster.
Besides, a descriptor matrix is written to a file for later use.
- Parameters
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
adsorbate_name (str) – element symbold of the adsorbed atom
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= []¶
-
required_params
= ['reference_energy', 'adsorbate_name', 'adsite_types']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.singlesites.
AdsiteRankTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask to determine ranking of adsorption site structures. Based on a previously calculated descriptor matrix (in the fw_spec as a path to a file), the adsorbate structure sites are ranked are ranked for their dissimilarity.
Hence, the calc_ids, the structures to be simulated are reordered.
Besides, the descriptor matrix is reordered and written to a file for later use.
Args:
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= []¶
-
required_params
= []¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.singlesites.
MonodentateAdsiteCreationTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask to determine adsorption site structures. The adsorbate is specified as a molecule with an anchor X which binds to only one site. The position of the binding atom is exactly determined by the adsorption vector of the adsorption site and the bond length between X and the closest, later binding, atom. On a set of nanoclusters, a combination of top/bridge/hollow sites is classified and populated. Hence, the simulation collection of the mongodb database is updated with structures which each contain a single adsorbate on a nanocluster.
Besides, a descriptor matrix is written to a file for later use.
- Parameters
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
adsorbate (dict) – adsorbed molecule as atoms dict. Contains an “X” dummy atom which indicates the anchor point to the nanocluster
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= []¶
-
required_params
= ['reference_energy', 'adsorbate', 'adsite_types']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
class
critcatworks.structure.singlesites.
MonodentateUniqueAdsiteCreationTask
(*args, **kwargs)[source]¶ Bases:
fireworks.core.firework.FiretaskBase
Firetask to determine unique adsorption site structures. The adsorbate is specified as a molecule with an anchor X which binds to only one site. The position of the binding atom is exactly determined by the adsorption vector of the adsorption site and the bond length between X and the closest, later binding, atom. On a set of nanoclusters, a combination of top/bridge/hollow sites is classified. The sites are ranked for their dissimilarity based on a local descriptor (default soap), then uniqueness is defined by a threshold parameter. Only the unique sites are kept and populated with the adsorbate.
Hence, the simulation collection of the mongodb database is updated with structures which each contain a single adsorbate on a nanocluster.
Besides, a descriptor matrix is written to a file for later use.
- Parameters
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
adsorbate (dict) – adsorbed molecule as atoms dict. Contains an “X” dummy atom which indicates the anchor point to the nanocluster
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
threshold (float) – threshold of similarity metric between the local structures of the adsorption sites. Only sites which are more dissimilar than the given threshold are computed
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
optional_params
= []¶
-
required_params
= ['reference_energy', 'adsorbate', 'adsite_types', 'threshold']¶
-
run_task
(fw_spec)[source]¶ This method gets called when the Firetask is run. It can take in a Firework spec, perform some task using that data, and then return an output in the form of a FWAction.
- Parameters
fw_spec (dict) – A Firework spec. This comes from the master spec. In addition, this spec contains a special “_fw_env” key that contains the env settings of the FWorker calling this method. This provides for abstracting out certain commands or settings. For example, “foo” may be named “foo1” in resource 1 and “foo2” in resource 2. The FWorker env can specify { “foo”: “foo1”}, which maps an abstract variable “foo” to the relevant “foo1” or “foo2”. You can then write a task that uses fw_spec[“_fw_env”][“foo”] that will work across all these multiple resources.
- Returns
(FWAction)
-
critcatworks.structure.singlesites.
get_adsites
(reference_energy=0.0, adsorbate_name='H', adsite_types=['top', 'bridge', 'hollow'], descriptor='soap', descriptor_params={'crossover': True, 'lmax': 6, 'nmax': 9, 'rcut': 5.0, 'sparse': False})[source]¶ Firetask to determine adsorption site structures. The adsorbate can only be a single atom. For a molecular adsorbate (binding to only one site), please use the Firetask MonodentateAdsiteCreationTask. On a set of nanoclusters, a combination of top/bridge/hollow sites is classified and populated. Hence, the simulation collection of the mongodb database is updated with structures which each contain a single adsorbate on a nanocluster.
Besides, a descriptor matrix is written to a file for later use.
- Parameters
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
adsorbate_name (str) – element symbold of the adsorbed atom
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
descriptor (str) – type of descriptor to be used. For a list of descriptors, see the documentation of dscribe Defaults to ‘soap’
descriptor_params (dict) – descriptor parameters
- Returns
Firework action, updates fw_spec
- Return type
FWAction
-
critcatworks.structure.singlesites.
get_monodentate_adsites
(reference_energy=0.0, adsorbate={}, adsite_types=['top', 'bridge', 'hollow'], descriptor='soap', descriptor_params={'crossover': True, 'lmax': 6, 'nmax': 9, 'rcut': 5.0, 'sparse': False})[source]¶ Firetask to determine adsorption site structures. The adsorbate is specified as a molecule with an anchor X which binds to only one site. The position of the binding atom is exactly determined by the adsorption vector of the adsorption site and the bond length between X and the closest, later binding, atom. On a set of nanoclusters, a combination of top/bridge/hollow sites is classified and populated. Hence, the simulation collection of the mongodb database is updated with structures which each contain a single adsorbate on a nanocluster.
Besides, a descriptor matrix is written to a file for later use.
- Parameters
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
adsorbate (dict) – adsorbed molecule as atoms dict. Contains an “X” dummy atom which indicates the anchor point to the nanocluster
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
descriptor (str) – type of descriptor to be used. For a list of descriptors, see the documentation of dscribe Defaults to ‘soap’
descriptor_params (dict) – descriptor parameters
- Returns
Firework MonodentateAdsiteCreationWork
- Return type
Firework
-
critcatworks.structure.singlesites.
get_monodentate_unique_adsites
(reference_energy=0.0, adsorbate={}, adsite_types=['top', 'bridge', 'hollow'], threshold=0.001, descriptor='soap', descriptor_params={'crossover': True, 'lmax': 6, 'nmax': 9, 'rcut': 5.0, 'sparse': False})[source]¶ Firework to determine unique adsorption site structures. The adsorbate is specified as a molecule with an anchor X which binds to only one site. The position of the binding atom is exactly determined by the adsorption vector of the adsorption site and the bond length between X and the closest, later binding, atom. On a set of nanoclusters, a combination of top/bridge/hollow sites is classified. The sites are ranked for their dissimilarity based on a local descriptor (default soap), then uniqueness is defined by a threshold parameter. Only the unique sites are kept and populated with the adsorbate.
Hence, the simulation collection of the mongodb database is updated with structures which each contain a single adsorbate on a nanocluster.
Besides, a descriptor matrix is written to a file for later use.
- Parameters
reference_energy (float) – reference energy for the adsorbate. Can be the total energy of the isolated adsorbate molecule or a different reference point
adsorbate (dict) – adsorbed molecule as atoms dict. Contains an “X” dummy atom which indicates the anchor point to the nanocluster
adsite_types (list) – adsorption site types, can contain any combination of “top”, “bridge”, “hollow”
threshold (float) – threshold of similarity metric between the local structures of the adsorption sites. Only sites which are more dissimilar than the given threshold are computed
descriptor (str) – type of descriptor to be used. For a list of descriptors, see the documentation of dscribe Defaults to ‘soap’
descriptor_params (dict) – descriptor parameters
- Returns
Firework MonodentateUniqueAdsiteCreationWork
- Return type
Firework
-
critcatworks.structure.singlesites.
rank_adsites
()[source]¶ Firework to determine ranking of adsorption site structures. Based on a previously calculated descriptor matrix (in the fw_spec as a path to a file), the adsorbate structure sites are ranked are ranked for their dissimilarity.
Hence, the calc_ids, the structures to be simulated are reordered.
Besides, the descriptor matrix is reordered and written to a file for later use.
Args:
- Returns
Firework AdsiteRankWork
- Return type
Firework