-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a569dff
commit 9800218
Showing
627 changed files
with
213,706 additions
and
90,703 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: efa2b153c9e066cd129008874a6226a9 | ||
config: 2cea6fe847f1e893635d7bf9cba55855 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
:py:mod:`FF_analysis` | ||
===================== | ||
|
||
.. py:module:: FF_analysis | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
FF_analysis.get_data | ||
FF_analysis.binned_average | ||
FF_analysis.bin_plot | ||
FF_analysis.get_Fig4a | ||
FF_analysis.get_Fig4b | ||
FF_analysis.get_Fig4c | ||
FF_analysis.get_Fig4d | ||
FF_analysis.phys_err | ||
FF_analysis.chem_err | ||
|
||
|
||
|
||
Attributes | ||
~~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
FF_analysis.infile | ||
|
||
|
||
.. py:function:: get_data(infile, limit=2) | ||
.. py:function:: binned_average(DFT_ads, pred_err, bins) | ||
.. py:function:: bin_plot(ax, bins, heights, **kwargs) | ||
.. py:function:: get_Fig4a(raw_error_CO2, raw_error_H2O, b=20, outfile='Fig5a.png') | ||
.. py:function:: get_Fig4b(int_DFT_CO2, err_CO2, int_DFT_H2O, err_H2O, outfile='Fig5b.png') | ||
.. py:function:: get_Fig4c(DFT_CO2, err_CO2, outfile='Fig5c.png') | ||
.. py:function:: get_Fig4d(DFT_H2O, err_H2O, outfile='Fig5d.png') | ||
.. py:function:: phys_err(DFT, FF) | ||
.. py:function:: chem_err(DFT, FF) | ||
.. py:data:: infile | ||
:value: '/storage/home/hcoda1/8/lbrabson3/p-amedford6-0/s2ef/final/data_w_oms.json' | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
:py:mod:`challenge_eval` | ||
======================== | ||
|
||
.. py:module:: challenge_eval | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
challenge_eval.is_successful | ||
challenge_eval.compute_valid_ml_success | ||
challenge_eval.get_dft_data | ||
challenge_eval.process_ml_data | ||
challenge_eval.parse_args | ||
challenge_eval.main | ||
|
||
|
||
|
||
.. py:function:: is_successful(best_pred_energy, best_dft_energy, SUCCESS_THRESHOLD=0.1) | ||
Computes the success rate given the best predicted energy | ||
and the best ground truth DFT energy. | ||
|
||
success_parity: The standard definition for success, where ML needs to be | ||
within the SUCCESS_THRESHOLD, or lower, of the DFT energy. | ||
|
||
Returns: Bool | ||
|
||
|
||
.. py:function:: compute_valid_ml_success(ml_data, dft_data) | ||
Computes validated ML success rates. | ||
Here, results are generated only from ML. DFT single-points are used to | ||
validate whether the ML energy is within 0.1eV of the DFT energy of the | ||
predicted structure. If valid, the ML energy is compared to the ground | ||
truth DFT energy, otherwise it is discarded. | ||
|
||
Return validated ML success rates. | ||
|
||
|
||
.. py:function:: get_dft_data(targets) | ||
Organizes the released target mapping for evaluation lookup. | ||
|
||
Returns: Dict: | ||
{ | ||
'system_id 1': {'config_id 1': dft_ads_energy, 'config_id 2': dft_ads_energy}, | ||
'system_id 2': {'config_id 1': dft_ads_energy, 'config_id 2': dft_ads_energy}, | ||
... | ||
} | ||
|
||
|
||
.. py:function:: process_ml_data(results_file, model, metadata, ml_dft_targets, dft_data) | ||
For ML systems in which no configurations made it through the physical | ||
constraint checks, set energies to an arbitrarily high value to ensure | ||
a failure case in evaluation. | ||
|
||
Returns: Dict: | ||
{ | ||
'system_id 1': {'config_id 1': {'ml_energy': predicted energy, 'ml+dft_energy': dft energy of ML structure} ...}, | ||
'system_id 2': {'config_id 1': {'ml_energy': predicted energy, 'ml+dft_energy': dft energy of ML structure} ...}, | ||
... | ||
} | ||
|
||
|
||
.. py:function:: parse_args() | ||
.. py:function:: main() | ||
This script takes in your prediction file (npz format) | ||
and the ML model name used for ML relaxations. | ||
Then using a mapping file, dft ground truth energy, | ||
and ML relaxed dft energy returns the success rate of your predictions. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
:py:mod:`check_energy_and_forces` | ||
================================= | ||
|
||
.. py:module:: check_energy_and_forces | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
check_energy_and_forces.check_relaxed_forces | ||
check_energy_and_forces.check_adsorption_energy | ||
check_energy_and_forces.check_DFT_energy | ||
check_energy_and_forces.check_positions_across_frames_are_different | ||
check_energy_and_forces.read_pkl | ||
check_energy_and_forces.run_checks | ||
check_energy_and_forces.create_parser | ||
|
||
|
||
|
||
Attributes | ||
~~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
check_energy_and_forces.parser | ||
|
||
|
||
.. py:function:: check_relaxed_forces(sid, path, thres) | ||
Check all forces in the final frame of adslab is less than a threshold. | ||
|
||
|
||
.. py:function:: check_adsorption_energy(sid, path, ref_energy, adsorption_energy) | ||
.. py:function:: check_DFT_energy(sid, path, e_tol=0.05) | ||
Given a relaxation trajectory, check to see if 1. final energy is less than the initial | ||
energy, raise error if not. 2) If the energy decreases throuhghout a trajectory (small spikes are okay). | ||
And 3) if 2 fails, check if it's just a matter of tolerance being too strict by | ||
considering only the first quarter of the trajectory and sampling every 10th frame | ||
to check for _almost_ monotonic decrease in energies. | ||
If any frame(i+1) energy is higher than frame(i) energy, flag it and plot the trajectory. | ||
|
||
|
||
.. py:function:: check_positions_across_frames_are_different(sid, path) | ||
Given a relaxation trajectory, make sure positions for two consecutive | ||
frames are not identical. | ||
|
||
|
||
.. py:function:: read_pkl(fname) | ||
.. py:function:: run_checks(args) | ||
.. py:function:: create_parser() | ||
.. py:data:: parser | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
:py:mod:`check_inputs` | ||
====================== | ||
|
||
.. py:module:: check_inputs | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
check_inputs.obtain_metadata | ||
check_inputs.create_df | ||
check_inputs.adslabs_are_unique | ||
check_inputs.check_commonelems | ||
check_inputs.is_adsorbate_placed_correct | ||
check_inputs._get_connectivity | ||
|
||
|
||
|
||
.. py:function:: obtain_metadata(input_dir, split) | ||
Get the metadata provided input directory and split of data. | ||
:param input_dir: | ||
:type input_dir: str | ||
:param split: 'val_ood_cat/ads/both', and 'test_ood_cat/ads/both'. | ||
:type split: str | ||
|
||
:returns: | ||
|
||
metadata (tuple) adslab properties. | ||
Ex: ('mp-126', (1,1,1), 0.025, True, '*OH', (0,0,0), 'val_ood_ads') | ||
|
||
.. py:function:: create_df(metadata_lst, df_name=None) | ||
Create a df from metadata to used check_dataset.py file | ||
:param metadata_lst A list of adslab properties in tuple form: contain (mpid, miller index, shift, top, adsorbate smile string, | ||
adsorption cartesion coordinates tuple, and which split the data belongs to). | ||
Ex: ('mp-126', (1,1,1), 0.025, True, '*OH', (0,0,0), 'val_ood_ads') | ||
:param each tuple should: contain (mpid, miller index, shift, top, adsorbate smile string, | ||
adsorption cartesion coordinates tuple, and which split the data belongs to). | ||
Ex: ('mp-126', (1,1,1), 0.025, True, '*OH', (0,0,0), 'val_ood_ads') | ||
:returns: df A pandas DataFrame | ||
|
||
|
||
.. py:function:: adslabs_are_unique(df, unique_by=['mpid', 'miller', 'shift', 'top', 'adsorbate', 'adsorption_site']) | ||
Test if there are duplicate adslabs given a df. If the input is another | ||
format, convert it to df first. | ||
:param df A pd.DataFrame containing metadata of the adslabs being checked.: | ||
:param unique_by df column names that are used to detect duplicates. The default: list is the fingerprints represent a unique adslab. | ||
|
||
|
||
.. py:function:: check_commonelems(df, split1, split2, check='adsorbate') | ||
Given a df containing all the metadata of the calculations, check to see if there are | ||
any bulk or adsorbate duplicates between train and val/test_ood. The dataframe should | ||
have a "split_tag" column indicate which split (i.e. train, val_ood_ads, etc) a data belongs to. | ||
:param df A pd.DataFrame containing metadata of the adslabs being checked.: | ||
:param split1: 'val_ood_cat/ads/both', or 'test_ood_cat/ads/both'. | ||
:param split2 two of the splits from 'train': 'val_ood_cat/ads/both', or 'test_ood_cat/ads/both'. | ||
:param 'val_id': 'val_ood_cat/ads/both', or 'test_ood_cat/ads/both'. | ||
:param 'test_id': 'val_ood_cat/ads/both', or 'test_ood_cat/ads/both'. | ||
:param : 'val_ood_cat/ads/both', or 'test_ood_cat/ads/both'. | ||
|
||
|
||
.. py:function:: is_adsorbate_placed_correct(adslab_input, atoms_tag) | ||
Make sure all adsorbate atoms are connected after placement. | ||
False means there is at least one isolated adsorbate atom. | ||
It should be used after input generation but before DFT to avoid | ||
unneccessarily computations. | ||
:param adslab_input `ase.Atoms` of the structure in its initial state: | ||
:param atoms_tag: | ||
:type atoms_tag: list | ||
|
||
:returns: | ||
|
||
boolean If there is any stand alone adsorbate atoms after placement, | ||
return False. | ||
|
||
|
||
.. py:function:: _get_connectivity(atoms) | ||
Generate the connectivity of an atoms obj. | ||
:param atoms An `ase.Atoms` object: | ||
|
||
:returns: matrix The connectivity matrix of the atoms object. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
:py:mod:`compare_inputs_and_trajectory` | ||
======================================= | ||
|
||
.. py:module:: compare_inputs_and_trajectory | ||
Module Contents | ||
--------------- | ||
|
||
|
||
Functions | ||
~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
compare_inputs_and_trajectory.get_starting_structure_from_input_dir | ||
compare_inputs_and_trajectory.min_diff | ||
compare_inputs_and_trajectory.compare | ||
compare_inputs_and_trajectory.read_pkl | ||
compare_inputs_and_trajectory.create_parser | ||
|
||
|
||
|
||
Attributes | ||
~~~~~~~~~~ | ||
|
||
.. autoapisummary:: | ||
|
||
compare_inputs_and_trajectory.parser | ||
|
||
|
||
.. py:function:: get_starting_structure_from_input_dir(input_dir) | ||
.. py:function:: min_diff(atoms_init, atoms_final) | ||
Calculate atom wise distances of two atoms object, | ||
taking into account periodic boundary conditions. | ||
|
||
|
||
.. py:function:: compare(args) | ||
.. py:function:: read_pkl(fname) | ||
.. py:function:: create_parser() | ||
.. py:data:: parser | ||
Oops, something went wrong.