decomnano package
Submodules
decomnano.cli module
Console script for decomnano.
- decomnano.cli.parse_array_in_config(config_dict)[source]
Parse array in config file to numpy array.
decomnano.decomnano module
Main module.
- class decomnano.decomnano.DecomNano(wolfram_kernel=None, input=None, fix_bulk_fraction=False, hollow_shell=False)[source]
Bases:
object
DecomNano class for solving the heterogeneity analysis of bimetallic nanoparticles using coordination numbers obtained from XAS analysis.
- Parameters:
wolfram_kernel (str) – Path to the Wolfram kernel. Defaults to None, which searches system default.
input (dict) – Input dictionary for the heterogeneity analysis. Defaults are {“dP”: 2.77, “dA”: 2.88, “fA”: 0.2, “nAA”: 6.5, “nPP”: 9.9, “nAP”: 0.6, “nPA”: 1.13, “DA”: 0, “DAP”: 18, “DP”: 5}.
- session
Wolfram Language session
- Type:
WolframLanguageSession
- input
Input dictionary for the heterogeneity analysis. Defaults are {“dP”: 2.77, “dA”: 2.88, “fA”: 0.2, “nAA”: 6.5, “nPP”: 9.9, “nAP”: 0.6, “nPA”: 1.13, “DA”: 0, “DAP”: 18, “DP”: 5}.
- Type:
dict
- results
Results of the heterogeneity analysis
- Type:
pd.DataFrame
- column
Column names of the results
- Type:
list
- dict_regex
Regular expression for converting the mathematica results to a dictionary
- Type:
re.Pattern
Note
The variables in the input dictionary different from the paper due to the naming rules of python. Following table shows the correspondence between the variables in the paper and the input dictionary.
Notation in paper
Keys
Descriptions
\(d_P\)
dP
Interatomic spacing of Pt nanoparticles
\(d_A\)
dA
Interatomic spacing of Au nanoparticles
\(\frac{M_A}{M_A + M_P}\)
fA
Molar fraction of Au
\(n_{A-A}\)
nAA
Total first nearest neighbor coordination number of Au-Au bonds.
\(n_{P-P}\)
nPP
Total first nearest neighbor coordination number of Pt-Pt bonds.
\(n_{A-P}\)
nAP
Total first nearest neighbor coordination number of Au-Pt bonds.
\(n_{P-A}\)
nPA
Total first nearest neighbor coordination number of Pt-Au bonds.
\(D_A\)
DA
Diameter of Au nanoparticles
\(D_{AP}\)
DAP
Diameter of PtAu nanoparticles
\(D_P\)
DP
Diameter of Pt nanoparticles
\(n_{A-M,AP}\)
nAM_AP
First nearest neighbor coordination number of Au-metal bonds
\(n_{P-M,AP}\)
nPM_AP
First nearest neighbor coordination number of Pt-metal bonds
\(n_{A-A,AP}\)
nAA_AP
First nearest neighbor coordination number of Au-Au bonds
\(n_{A-P,AP}\)
nAP_AP
First nearest neighbor coordination number of Au-Pt bonds
\(n_{P-A,AP}\)
nPA_AP
First nearest neighbor coordination number of Pt-Au bonds
\(n_{P-P,AP}\)
nPP_AP
First nearest neighbor coordination number of Pt-Pt bonds
\(X_A\)
XA
Molar ratio of Au nanoparticles
\(X_{AP}\)
XAP
Molar ratio of PtAu nanoparticles
\(X_P\)
XP
Molar ratio of Pt nanoparticles
\(y\)
y
Molar fraction of Au in PtAu nanoparticles
- calc_decomnano(**kwargs)[source]
Initialize and solve the heterogeneity analysis of bimetallic nanoparticles using coordination numbers obtained from XAS analysis.
- Parameters:
**kwargs – Keyword arguments for the input dictionary. Defaults are {“dP”: 2.77, “dA”: 2.88, “fA”: 0.2, “nAA”: 6.5, “nPP”: 9.9, “nAP”: 0.6, “nPA”: 1.13, “DA”: 0, “DAP”: 18, “DP”: 5}.
Examples
>>> dn = DecomNano() >>> dn.calc_decomnano(RPt=2.77, RAu=2.88, fAu=0.2, nAuAu=6.5, nPtPt=9.9, nAuPt=0.6, nPtAu=1.13, DA=0, DAP=18, DP=5)
- check_duplicate_input()[source]
Checks if the input dictionary is already solved.
- Returns:
True if the input dictionary is already solved, False otherwise.
- Return type:
bool
- column = ['dP', 'dA', 'fA', 'nAA', 'nPP', 'nAP', 'nPA', 'DA', 'DAP', 'DP', 'nAM_AP', 'nPM_AP', 'nAA_AP', 'nAP_AP', 'nPA_AP', 'nPP_AP', 'XAP', 'XA', 'XP', 'y']
- column_hollow = ['dP', 'dA', 'fA', 'nAA', 'nPP', 'nAP', 'nPA', 'DA', 'DAP', 'DP', 'DAPh', 'nAM_AP', 'nPM_AP', 'nAA_AP', 'nAP_AP', 'nPA_AP', 'nPP_AP', 'XAP', 'XA', 'XP', 'y']
- convert_dict(result)[source]
Helper function to convert the result of WolframLanguageSession.evaluate() to a dictionary.
- Returns:
Dictionary of the result.
- Return type:
dict
- decomnano_equation = 'DecomNano[{dP}, {dA}, {fA}, {nAA}, {nPP}, {nAP}, {nPA}, {DA}, {DAP}, {DP}]'
- decomnano_equation_hollow = 'DecomNanoh[{dP}, {dA}, {fA}, {nAA}, {nPP}, {nAP}, {nPA}, {DA}, {DAP}, {DP}, {DAPh}]'
- init_input(**kwargs)[source]
Initialize the input dictionary of DecomNano class.
- Parameters:
**kwargs – Keyword arguments for the input dictionary. Defaults are {“dP”: 2.77, “dA”: 2.88, “fA”: 0.2, “nAA”: 6.5, “nPP”: 9.9, “nAP”: 0.6, “nPA”: 1.13, “DA”: 0, “DAP”: 18, “DP”: 5}.
Examples
>>> dn = DecomNano() >>> dn.init_input(RPt=2.77, RAu=2.88, fAu=0.2, nAuAu=6.5, nPtPt=9.9, nAuPt=0.6, nPtAu=1.13, DA=0, DAP=18, DP=5)
- load_results(filename='results.csv')[source]
Loads the results to the DecomNano class.
- Parameters:
filename (str) – Filename of the results. Defaults to “results.csv”.
- print_results()[source]
Prints the results of the heterogeneity analysis of bimetallic nanoparticles using coordination numbers obtained from XAS analysis.
- save_results(filename='results.csv')[source]
Saves the results of the heterogeneity analysis of bimetallic nanoparticles using coordination numbers obtained from XAS analysis.
- Parameters:
filename (str) – Filename of the results. Defaults to “results.csv”.
decomnano.sweep module
- class decomnano.sweep.SweepDecomNano(wolfram_kernel=None, input_default=None, input_config=None, fix_bulk_fraction=False, respawn_interval=10000, hollow_shell=False)[source]
Bases:
object
SweepDecomNano class for calculating decomnano with various input parameters.
- Parameters:
wolfam_kernel (str) – Path to the Wolfram kernel. Defaults to None, which uses the default kernel.
- input
Current input parameters used for calculating DecomNano solver.
- Type:
dict
- input_default
Default input parameters used for calculating DecomNano solver. input will be generated by updating input_default with input_config.
- Type:
dict
- input_config
Configuration of input range parameters used for calculating DecomNano solver. input_default will be generated by updating input_default with range specified in input_config. The range of input parameters can be specified by list or numpy array. If the range is specified by list or numpy array, the input parameters varies from the minimum value to the maximum value with the step size of the difference between the maximum value and the minimum value divided by the number of elements in the list or numpy array minus 1. If the range is specified by a single value, the input parameters will be varied from range(input_default-value, input_default+value, resolution). The resolution is set to 0.1 by default.
- Type:
dict
Examples
>>> from decomnano import SweepDecomNano >>> sd = SweepDecomNano() >>> sd.calc_sweep("sweep_results") >>> Pt40Au60BP1_input_default = dict( RPt = 2.77, RAu = 2.88, fAu = 0.6, nAuAu = 4.2, nPtPt = 10.0, nAuPt = 2.8, nPtAu = 0.71, DA = 10, DAP = 17, DP = 17, ) >>> Pt40Au60BP1_input_config = dict( nAuAu = 0.6, nPtPt = 0.7, nAuPt = 0.5, nPtAu = 0.8, DP = list(range(0, 18, 2)), DA = list(range(0, 18, 2)) ) >>> sd.update_input_default(Pt40Ag60BP1_input_default) >>> sd.update_input_config(Pt40Ag60BP1_input_config) >>> sd.calc_sweep("sweep_results.csv")
Note
The variables in the input dictionary different from the paper due to the naming rules of python. Following table shows the correspondence between the variables in the paper and the input dictionary.
Notation in paper
Keys
Descriptions
\(d_P\)
dP
Interatomic spacing of Pt nanoparticles
\(d_A\)
dA
Interatomic spacing of Au nanoparticles
\(\frac{M_A}{M_A + M_P}\)
fA
Molar fraction of Au
\(n_{A-A}\)
nAA
Total first nearest neighbor coordination number of Au-Au bonds.
\(n_{P-P}\)
nPP
Total first nearest neighbor coordination number of Pt-Pt bonds.
\(n_{A-P}\)
nAP
Total first nearest neighbor coordination number of Au-Pt bonds.
\(n_{P-A}\)
nPA
Total first nearest neighbor coordination number of Pt-Au bonds.
\(D_A\)
DA
Diameter of Au nanoparticles
\(D_{AP}\)
DAP
Diameter of PtAu nanoparticles
\(D_P\)
DP
Diameter of Pt nanoparticles
\(n_{A-M,AP}\)
nAM_AP
First nearest neighbor coordination number of Au-metal bonds
\(n_{P-M,AP}\)
nPM_AP
First nearest neighbor coordination number of Pt-metal bonds
\(n_{A-A,AP}\)
nAA_AP
First nearest neighbor coordination number of Au-Au bonds
\(n_{A-P,AP}\)
nAP_AP
First nearest neighbor coordination number of Au-Pt bonds
\(n_{P-A,AP}\)
nPA_AP
First nearest neighbor coordination number of Pt-Au bonds
\(n_{P-P,AP}\)
nPP_AP
First nearest neighbor coordination number of Pt-Pt bonds
\(X_A\)
XA
Molar ratio of Au nanoparticles
\(X_{AP}\)
XAP
Molar ratio of PtAu nanoparticles
\(X_P\)
XP
Molar ratio of Pt nanoparticles
\(y\)
y
Molar fraction of Au in PtAu nanoparticles
- calc_input_range(resolution=0.1)[source]
Calculate input_range from input_default and input_config.
- Parameters:
resolution (float) – Resolution of input_range. Defaults to 0.1. input_default will be generated by updating input_default with range specified in input_config. The range of input parameters can be specified by list or numpy array. If the range is specified by list or numpy array, the input parameters varies from the minimum value to the maximum value with the step size of the difference between the maximum value and the minimum value divided by the number of elements in the list or numpy array minus 1. If the range is specified by a single value, the input parameters will be varied from range(input_default-value, input_default+value, resolution). The resolution is set to 0.1 by default.
- calc_sweep(savepath='result.csv', save_interval=100)[source]
Calculate DecomNano solver with sweep of input parameters.
- Parameters:
savepath (str) – Path to save results. Defaults to “result.csv”.
save_interval (int) – Interval of saving results. The results will be saved after each save_interval. Defaults to 100.
- calc_sweep_const_2param(parameters=['DA', 'DP'], savepath='result.csv', save_interval=100)[source]
Calculate DecomNano solver with sweep of input parameters with constraining two parameters to be the same.
- Parameters:
parameters (list) – List of two parameters to be constrained to be the same. Defaults to [“DA”, “DP”]. Input config of the first parameter will be applied to the second parameter.
savepath (str) – Path to save results. Defaults to “result.csv”.
save_interval (int) – Interval of saving results. The results will be saved after each save_interval. Defaults to 100.
Examples
>>> # To constrain DA = DP, run >>> sd.calc_sweep_const_2param(["DA", "DP"], savepath, save_interval=100)
- init_input(input_default=None, input_config=None)[source]
Initialize input parameters for calculating DecomNano solver. Called in __init__().
- update_input(input_dict)[source]
Update input from dictionary.
- Parameters:
input_dict (dict) – Dictionary of input parameters.
- update_input_config(input_config, resolution=0.1)[source]
Update input_config and calculate input_range. Copies input_config to self.input_config and calculates input_range.
- Parameters:
input_config (dict) – Dictionary to replace input_config.
resolution (float) – Resolution of input_range. Defaults to 0.1. input_default will be generated by updating input_default with range specified in input_config. The range of input parameters can be specified by list or numpy array. If the range is specified by list or numpy array, the input parameters varies from the minimum value to the maximum value with the step size of the difference between the maximum value and the minimum value divided by the number of elements in the list or numpy array minus 1. If the range is specified by a single value, the input parameters will be varied from range(input_default-value, input_default+value, resolution). The resolution is set to 0.1 by default.
- update_input_default(input_default, resolution=0.1)[source]
Update input_default and calculate input_range. Copies input_default to self.input_default and calculates input_range.
- Parameters:
input_default (dict) – Dictionary to replace input_default.
resolution (float) – Resolution of input_range. Defaults to 0.1. input_default will be generated by updating input_default with range specified in input_config. The range of input parameters can be specified by list or numpy array. If the range is specified by list or numpy array, the input parameters varies from the minimum value to the maximum value with the step size of the difference between the maximum value and the minimum value divided by the number of elements in the list or numpy array minus 1. If the range is specified by a single value, the input parameters will be varied from range(input_default-value, input_default+value, resolution). The resolution is set to 0.1 by default.
- update_input_from_list(input_list, label=None)[source]
Update input from list.
- Parameters:
input_list (list) – List of input parameters.
label (list) – List of labels for input parameters. Defaults to None. If label is None, the order of input parameters should be the same as the order of input parameters in self.input. If label is not None, the order of input parameters should be the same as the order of labels.
Module contents
Top-level package for DecomNano.