partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
InterfacialReactivity._get_grand_potential
Computes the grand potential Phi at a given composition and chemical potential(s). Args: composition (Composition): Composition object. Returns: Grand potential at a given composition at chemical potential(s).
pymatgen/analysis/interface_reactions.py
def _get_grand_potential(self, composition): """ Computes the grand potential Phi at a given composition and chemical potential(s). Args: composition (Composition): Composition object. Returns: Grand potential at a given composition at chemical potential...
def _get_grand_potential(self, composition): """ Computes the grand potential Phi at a given composition and chemical potential(s). Args: composition (Composition): Composition object. Returns: Grand potential at a given composition at chemical potential...
[ "Computes", "the", "grand", "potential", "Phi", "at", "a", "given", "composition", "and", "chemical", "potential", "(", "s", ")", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L170-L194
[ "def", "_get_grand_potential", "(", "self", ",", "composition", ")", ":", "if", "self", ".", "use_hull_energy", ":", "grand_potential", "=", "self", ".", "pd_non_grand", ".", "get_hull_energy", "(", "composition", ")", "else", ":", "grand_potential", "=", "Inter...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity._get_energy
Computes reaction energy in eV/atom at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction energy.
pymatgen/analysis/interface_reactions.py
def _get_energy(self, x): """ Computes reaction energy in eV/atom at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction energy. """ return self.pd.g...
def _get_energy(self, x): """ Computes reaction energy in eV/atom at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction energy. """ return self.pd.g...
[ "Computes", "reaction", "energy", "in", "eV", "/", "atom", "at", "mixing", "ratio", "x", ":", "(", "1", "-", "x", ")", "for", "self", ".", "comp1", ":", "self", ".", "comp2", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L196-L208
[ "def", "_get_energy", "(", "self", ",", "x", ")", ":", "return", "self", ".", "pd", ".", "get_hull_energy", "(", "self", ".", "comp1", "*", "x", "+", "self", ".", "comp2", "*", "(", "1", "-", "x", ")", ")", "-", "self", ".", "e1", "*", "x", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity._get_reaction
Generates balanced reaction at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction object.
pymatgen/analysis/interface_reactions.py
def _get_reaction(self, x): """ Generates balanced reaction at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction object. """ mix_comp = self.comp1 ...
def _get_reaction(self, x): """ Generates balanced reaction at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction object. """ mix_comp = self.comp1 ...
[ "Generates", "balanced", "reaction", "at", "mixing", "ratio", "x", ":", "(", "1", "-", "x", ")", "for", "self", ".", "comp1", ":", "self", ".", "comp2", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L210-L244
[ "def", "_get_reaction", "(", "self", ",", "x", ")", ":", "mix_comp", "=", "self", ".", "comp1", "*", "x", "+", "self", ".", "comp2", "*", "(", "1", "-", "x", ")", "decomp", "=", "self", ".", "pd", ".", "get_decomposition", "(", "mix_comp", ")", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity._get_elmt_amt_in_rxt
Computes total number of atoms in a reaction formula for elements not in external reservoir. This method is used in the calculation of reaction energy per mol of reaction formula. Args: rxt (Reaction): a reaction. Returns: Total number of atoms for non_reservoir...
pymatgen/analysis/interface_reactions.py
def _get_elmt_amt_in_rxt(self, rxt): """ Computes total number of atoms in a reaction formula for elements not in external reservoir. This method is used in the calculation of reaction energy per mol of reaction formula. Args: rxt (Reaction): a reaction. Ret...
def _get_elmt_amt_in_rxt(self, rxt): """ Computes total number of atoms in a reaction formula for elements not in external reservoir. This method is used in the calculation of reaction energy per mol of reaction formula. Args: rxt (Reaction): a reaction. Ret...
[ "Computes", "total", "number", "of", "atoms", "in", "a", "reaction", "formula", "for", "elements", "not", "in", "external", "reservoir", ".", "This", "method", "is", "used", "in", "the", "calculation", "of", "reaction", "energy", "per", "mol", "of", "reactio...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L246-L258
[ "def", "_get_elmt_amt_in_rxt", "(", "self", ",", "rxt", ")", ":", "return", "sum", "(", "[", "rxt", ".", "get_el_amount", "(", "e", ")", "for", "e", "in", "self", ".", "pd", ".", "elements", "]", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.get_products
List of formulas of potential products. E.g., ['Li','O2','Mn'].
pymatgen/analysis/interface_reactions.py
def get_products(self): """ List of formulas of potential products. E.g., ['Li','O2','Mn']. """ products = set() for _, _, _, react, _ in self.get_kinks(): products = products.union(set([k.reduced_formula for k in react.produ...
def get_products(self): """ List of formulas of potential products. E.g., ['Li','O2','Mn']. """ products = set() for _, _, _, react, _ in self.get_kinks(): products = products.union(set([k.reduced_formula for k in react.produ...
[ "List", "of", "formulas", "of", "potential", "products", ".", "E", ".", "g", ".", "[", "Li", "O2", "Mn", "]", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L260-L268
[ "def", "get_products", "(", "self", ")", ":", "products", "=", "set", "(", ")", "for", "_", ",", "_", ",", "_", ",", "react", ",", "_", "in", "self", ".", "get_kinks", "(", ")", ":", "products", "=", "products", ".", "union", "(", "set", "(", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity._convert
Converts mixing ratio x in comp1 - comp2 tie line to that in c1 - c2 tie line. Args: x (float): Mixing ratio x in comp1 - comp2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio between composition c1 and processed compositio...
pymatgen/analysis/interface_reactions.py
def _convert(x, factor1, factor2): """ Converts mixing ratio x in comp1 - comp2 tie line to that in c1 - c2 tie line. Args: x (float): Mixing ratio x in comp1 - comp2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio between ...
def _convert(x, factor1, factor2): """ Converts mixing ratio x in comp1 - comp2 tie line to that in c1 - c2 tie line. Args: x (float): Mixing ratio x in comp1 - comp2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio between ...
[ "Converts", "mixing", "ratio", "x", "in", "comp1", "-", "comp2", "tie", "line", "to", "that", "in", "c1", "-", "c2", "tie", "line", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L271-L288
[ "def", "_convert", "(", "x", ",", "factor1", ",", "factor2", ")", ":", "return", "x", "*", "factor2", "/", "(", "(", "1", "-", "x", ")", "*", "factor1", "+", "x", "*", "factor2", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity._reverse_convert
Converts mixing ratio x in c1 - c2 tie line to that in comp1 - comp2 tie line. Args: x (float): Mixing ratio x in c1 - c2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio between composition c1 and processed composition comp...
pymatgen/analysis/interface_reactions.py
def _reverse_convert(x, factor1, factor2): """ Converts mixing ratio x in c1 - c2 tie line to that in comp1 - comp2 tie line. Args: x (float): Mixing ratio x in c1 - c2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio betwee...
def _reverse_convert(x, factor1, factor2): """ Converts mixing ratio x in c1 - c2 tie line to that in comp1 - comp2 tie line. Args: x (float): Mixing ratio x in c1 - c2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio betwee...
[ "Converts", "mixing", "ratio", "x", "in", "c1", "-", "c2", "tie", "line", "to", "that", "in", "comp1", "-", "comp2", "tie", "line", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L291-L308
[ "def", "_reverse_convert", "(", "x", ",", "factor1", ",", "factor2", ")", ":", "return", "x", "*", "factor1", "/", "(", "(", "1", "-", "x", ")", "*", "factor2", "+", "x", "*", "factor1", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.get_kinks
Finds all the kinks in mixing ratio where reaction products changes along the tie line of composition self.c1 and composition self.c2. Returns: Zip object of tuples (index, mixing ratio, reaction energy per atom in eV/atom, ...
pymatgen/analysis/interface_reactions.py
def get_kinks(self): """ Finds all the kinks in mixing ratio where reaction products changes along the tie line of composition self.c1 and composition self.c2. Returns: Zip object of tuples (index, mixing ratio, reaction energy per atom in e...
def get_kinks(self): """ Finds all the kinks in mixing ratio where reaction products changes along the tie line of composition self.c1 and composition self.c2. Returns: Zip object of tuples (index, mixing ratio, reaction energy per atom in e...
[ "Finds", "all", "the", "kinks", "in", "mixing", "ratio", "where", "reaction", "products", "changes", "along", "the", "tie", "line", "of", "composition", "self", ".", "c1", "and", "composition", "self", ".", "c2", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L310-L372
[ "def", "get_kinks", "(", "self", ")", ":", "c1_coord", "=", "self", ".", "pd", ".", "pd_coords", "(", "self", ".", "comp1", ")", "c2_coord", "=", "self", ".", "pd", ".", "pd_coords", "(", "self", ".", "comp2", ")", "n1", "=", "self", ".", "comp1", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.get_critical_original_kink_ratio
Returns a list of molar mixing ratio for each kink between ORIGINAL (instead of processed) reactant compositions. This is the same list as mixing ratio obtained from get_kinks method if self.norm = False. Returns: A list of floats representing molar mixing ratios between ...
pymatgen/analysis/interface_reactions.py
def get_critical_original_kink_ratio(self): """ Returns a list of molar mixing ratio for each kink between ORIGINAL (instead of processed) reactant compositions. This is the same list as mixing ratio obtained from get_kinks method if self.norm = False. Returns: ...
def get_critical_original_kink_ratio(self): """ Returns a list of molar mixing ratio for each kink between ORIGINAL (instead of processed) reactant compositions. This is the same list as mixing ratio obtained from get_kinks method if self.norm = False. Returns: ...
[ "Returns", "a", "list", "of", "molar", "mixing", "ratio", "for", "each", "kink", "between", "ORIGINAL", "(", "instead", "of", "processed", ")", "reactant", "compositions", ".", "This", "is", "the", "same", "list", "as", "mixing", "ratio", "obtained", "from",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L374-L391
[ "def", "get_critical_original_kink_ratio", "(", "self", ")", ":", "ratios", "=", "[", "]", "if", "self", ".", "c1_original", "==", "self", ".", "c2_original", ":", "return", "[", "0", ",", "1", "]", "reaction_kink", "=", "[", "k", "[", "3", "]", "for",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity._get_original_composition_ratio
Returns the molar mixing ratio between the reactants with ORIGINAL ( instead of processed) compositions for a reaction. Args: reaction (Reaction): Reaction object that contains the original reactant compositions. Returns: The molar mixing ratio between t...
pymatgen/analysis/interface_reactions.py
def _get_original_composition_ratio(self, reaction): """ Returns the molar mixing ratio between the reactants with ORIGINAL ( instead of processed) compositions for a reaction. Args: reaction (Reaction): Reaction object that contains the original reactant com...
def _get_original_composition_ratio(self, reaction): """ Returns the molar mixing ratio between the reactants with ORIGINAL ( instead of processed) compositions for a reaction. Args: reaction (Reaction): Reaction object that contains the original reactant com...
[ "Returns", "the", "molar", "mixing", "ratio", "between", "the", "reactants", "with", "ORIGINAL", "(", "instead", "of", "processed", ")", "compositions", "for", "a", "reaction", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L393-L412
[ "def", "_get_original_composition_ratio", "(", "self", ",", "reaction", ")", ":", "if", "self", ".", "c1_original", "==", "self", ".", "c2_original", ":", "return", "1", "c1_coeff", "=", "reaction", ".", "get_coeff", "(", "self", ".", "c1_original", ")", "if...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.labels
Returns a dictionary containing kink information: {index: 'x= mixing_ratio energy= reaction_energy reaction_equation'}. E.g., {1: 'x= 0.0 energy = 0.0 Mn -> Mn', 2: 'x= 0.5 energy = -15.0 O2 + Mn -> MnO2', 3: 'x= 1.0 energy = 0.0 O2 -> O2'}.
pymatgen/analysis/interface_reactions.py
def labels(self): """ Returns a dictionary containing kink information: {index: 'x= mixing_ratio energy= reaction_energy reaction_equation'}. E.g., {1: 'x= 0.0 energy = 0.0 Mn -> Mn', 2: 'x= 0.5 energy = -15.0 O2 + Mn -> MnO2', 3: 'x= 1.0 energy = 0.0 O2 -> ...
def labels(self): """ Returns a dictionary containing kink information: {index: 'x= mixing_ratio energy= reaction_energy reaction_equation'}. E.g., {1: 'x= 0.0 energy = 0.0 Mn -> Mn', 2: 'x= 0.5 energy = -15.0 O2 + Mn -> MnO2', 3: 'x= 1.0 energy = 0.0 O2 -> ...
[ "Returns", "a", "dictionary", "containing", "kink", "information", ":", "{", "index", ":", "x", "=", "mixing_ratio", "energy", "=", "reaction_energy", "reaction_equation", "}", ".", "E", ".", "g", ".", "{", "1", ":", "x", "=", "0", ".", "0", "energy", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L414-L424
[ "def", "labels", "(", "self", ")", ":", "return", "{", "j", ":", "'x= '", "+", "str", "(", "round", "(", "x", ",", "4", ")", ")", "+", "' energy in eV/atom = '", "+", "str", "(", "round", "(", "energy", ",", "4", ")", ")", "+", "' '", "+", "str...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.plot
Plots reaction energy as a function of mixing ratio x in self.c1 - self.c2 tie line using pylab. Returns: Pylab object that plots reaction energy as a function of mixing ratio x.
pymatgen/analysis/interface_reactions.py
def plot(self): """ Plots reaction energy as a function of mixing ratio x in self.c1 - self.c2 tie line using pylab. Returns: Pylab object that plots reaction energy as a function of mixing ratio x. """ plt.rcParams['xtick.major.pad'] = '6' ...
def plot(self): """ Plots reaction energy as a function of mixing ratio x in self.c1 - self.c2 tie line using pylab. Returns: Pylab object that plots reaction energy as a function of mixing ratio x. """ plt.rcParams['xtick.major.pad'] = '6' ...
[ "Plots", "reaction", "energy", "as", "a", "function", "of", "mixing", "ratio", "x", "in", "self", ".", "c1", "-", "self", ".", "c2", "tie", "line", "using", "pylab", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L426-L471
[ "def", "plot", "(", "self", ")", ":", "plt", ".", "rcParams", "[", "'xtick.major.pad'", "]", "=", "'6'", "plt", ".", "rcParams", "[", "'ytick.major.pad'", "]", "=", "'6'", "plt", ".", "rcParams", "[", "'axes.linewidth'", "]", "=", "2", "npoint", "=", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.minimum
Finds the minimum reaction energy E_min and corresponding mixing ratio x_min. Returns: Tuple (x_min, E_min).
pymatgen/analysis/interface_reactions.py
def minimum(self): """ Finds the minimum reaction energy E_min and corresponding mixing ratio x_min. Returns: Tuple (x_min, E_min). """ return min([(x, energy) for _, x, energy, _, _ in self.get_kinks()], key=lambda i: i[1])
def minimum(self): """ Finds the minimum reaction energy E_min and corresponding mixing ratio x_min. Returns: Tuple (x_min, E_min). """ return min([(x, energy) for _, x, energy, _, _ in self.get_kinks()], key=lambda i: i[1])
[ "Finds", "the", "minimum", "reaction", "energy", "E_min", "and", "corresponding", "mixing", "ratio", "x_min", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L473-L482
[ "def", "minimum", "(", "self", ")", ":", "return", "min", "(", "[", "(", "x", ",", "energy", ")", "for", "_", ",", "x", ",", "energy", ",", "_", ",", "_", "in", "self", ".", "get_kinks", "(", ")", "]", ",", "key", "=", "lambda", "i", ":", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.get_no_mixing_energy
Generates the opposite number of energy above grand potential convex hull for both reactants. Returns: [(reactant1, no_mixing_energy1),(reactant2,no_mixing_energy2)].
pymatgen/analysis/interface_reactions.py
def get_no_mixing_energy(self): """ Generates the opposite number of energy above grand potential convex hull for both reactants. Returns: [(reactant1, no_mixing_energy1),(reactant2,no_mixing_energy2)]. """ assert self.grand == 1, \ 'Please provid...
def get_no_mixing_energy(self): """ Generates the opposite number of energy above grand potential convex hull for both reactants. Returns: [(reactant1, no_mixing_energy1),(reactant2,no_mixing_energy2)]. """ assert self.grand == 1, \ 'Please provid...
[ "Generates", "the", "opposite", "number", "of", "energy", "above", "grand", "potential", "convex", "hull", "for", "both", "reactants", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L484-L506
[ "def", "get_no_mixing_energy", "(", "self", ")", ":", "assert", "self", ".", "grand", "==", "1", ",", "'Please provide grand potential phase diagram '", "'for computing no_mixing_energy!'", "energy1", "=", "self", ".", "pd", ".", "get_hull_energy", "(", "self", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
InterfacialReactivity.get_chempot_correction
Get the normalized correction term Δμ for chemical potential of a gas phase consisting of element at given temperature and pressure, referenced to that in the standard state (T_std = 298.15 K, T_std = 1 bar). The gas phase is limited to be one of O2, N2, Cl2, F2, H2. Calculation formula ...
pymatgen/analysis/interface_reactions.py
def get_chempot_correction(element, temp, pres): """ Get the normalized correction term Δμ for chemical potential of a gas phase consisting of element at given temperature and pressure, referenced to that in the standard state (T_std = 298.15 K, T_std = 1 bar). The gas phase is l...
def get_chempot_correction(element, temp, pres): """ Get the normalized correction term Δμ for chemical potential of a gas phase consisting of element at given temperature and pressure, referenced to that in the standard state (T_std = 298.15 K, T_std = 1 bar). The gas phase is l...
[ "Get", "the", "normalized", "correction", "term", "Δμ", "for", "chemical", "potential", "of", "a", "gas", "phase", "consisting", "of", "element", "at", "given", "temperature", "and", "pressure", "referenced", "to", "that", "in", "the", "standard", "state", "("...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L509-L564
[ "def", "get_chempot_correction", "(", "element", ",", "temp", ",", "pres", ")", ":", "if", "element", "not", "in", "[", "\"O\"", ",", "\"N\"", ",", "\"Cl\"", ",", "\"F\"", ",", "\"H\"", "]", ":", "return", "0", "std_temp", "=", "298.15", "std_pres", "=...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_atom_map
Returns a dict that maps each atomic symbol to a unique integer starting from 1. Args: structure (Structure) Returns: dict
pymatgen/io/feff/inputs.py
def get_atom_map(structure): """ Returns a dict that maps each atomic symbol to a unique integer starting from 1. Args: structure (Structure) Returns: dict """ syms = [site.specie.symbol for site in structure] unique_pot_atoms = [] [unique_pot_atoms.append(i) for i ...
def get_atom_map(structure): """ Returns a dict that maps each atomic symbol to a unique integer starting from 1. Args: structure (Structure) Returns: dict """ syms = [site.specie.symbol for site in structure] unique_pot_atoms = [] [unique_pot_atoms.append(i) for i ...
[ "Returns", "a", "dict", "that", "maps", "each", "atomic", "symbol", "to", "a", "unique", "integer", "starting", "from", "1", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L905-L922
[ "def", "get_atom_map", "(", "structure", ")", ":", "syms", "=", "[", "site", ".", "specie", ".", "symbol", "for", "site", "in", "structure", "]", "unique_pot_atoms", "=", "[", "]", "[", "unique_pot_atoms", ".", "append", "(", "i", ")", "for", "i", "in"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_absorbing_atom_symbol_index
Return the absorbing atom symboll and site index in the given structure. Args: absorbing_atom (str/int): symbol or site index structure (Structure) Returns: str, int: symbol and site index
pymatgen/io/feff/inputs.py
def get_absorbing_atom_symbol_index(absorbing_atom, structure): """ Return the absorbing atom symboll and site index in the given structure. Args: absorbing_atom (str/int): symbol or site index structure (Structure) Returns: str, int: symbol and site index """ if isinst...
def get_absorbing_atom_symbol_index(absorbing_atom, structure): """ Return the absorbing atom symboll and site index in the given structure. Args: absorbing_atom (str/int): symbol or site index structure (Structure) Returns: str, int: symbol and site index """ if isinst...
[ "Return", "the", "absorbing", "atom", "symboll", "and", "site", "index", "in", "the", "given", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L925-L941
[ "def", "get_absorbing_atom_symbol_index", "(", "absorbing_atom", ",", "structure", ")", ":", "if", "isinstance", "(", "absorbing_atom", ",", "str", ")", ":", "return", "absorbing_atom", ",", "structure", ".", "indices_from_symbol", "(", "absorbing_atom", ")", "[", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Header.from_cif_file
Static method to create Header object from cif_file Args: cif_file: cif_file path and name source: User supplied identifier, i.e. for Materials Project this would be the material ID number comment: User comment that goes in header Returns: ...
pymatgen/io/feff/inputs.py
def from_cif_file(cif_file, source='', comment=''): """ Static method to create Header object from cif_file Args: cif_file: cif_file path and name source: User supplied identifier, i.e. for Materials Project this would be the material ID number ...
def from_cif_file(cif_file, source='', comment=''): """ Static method to create Header object from cif_file Args: cif_file: cif_file path and name source: User supplied identifier, i.e. for Materials Project this would be the material ID number ...
[ "Static", "method", "to", "create", "Header", "object", "from", "cif_file" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L104-L119
[ "def", "from_cif_file", "(", "cif_file", ",", "source", "=", "''", ",", "comment", "=", "''", ")", ":", "r", "=", "CifParser", "(", "cif_file", ")", "structure", "=", "r", ".", "get_structures", "(", ")", "[", "0", "]", "return", "Header", "(", "stru...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Header.header_string_from_file
Reads Header string from either a HEADER file or feff.inp file Will also read a header from a non-pymatgen generated feff.inp file Args: filename: File name containing the Header data. Returns: Reads header string.
pymatgen/io/feff/inputs.py
def header_string_from_file(filename='feff.inp'): """ Reads Header string from either a HEADER file or feff.inp file Will also read a header from a non-pymatgen generated feff.inp file Args: filename: File name containing the Header data. Returns: Reads ...
def header_string_from_file(filename='feff.inp'): """ Reads Header string from either a HEADER file or feff.inp file Will also read a header from a non-pymatgen generated feff.inp file Args: filename: File name containing the Header data. Returns: Reads ...
[ "Reads", "Header", "string", "from", "either", "a", "HEADER", "file", "or", "feff", ".", "inp", "file", "Will", "also", "read", "a", "header", "from", "a", "non", "-", "pymatgen", "generated", "feff", ".", "inp", "file" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L147-L186
[ "def", "header_string_from_file", "(", "filename", "=", "'feff.inp'", ")", ":", "with", "zopen", "(", "filename", ",", "\"r\"", ")", "as", "fobject", ":", "f", "=", "fobject", ".", "readlines", "(", ")", "feff_header_str", "=", "[", "]", "ln", "=", "0", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Header.from_string
Reads Header string and returns Header object if header was generated by pymatgen. Note: Checks to see if generated by pymatgen, if not it is impossible to generate structure object so it is not possible to generate header object and routine ends Args: header...
pymatgen/io/feff/inputs.py
def from_string(header_str): """ Reads Header string and returns Header object if header was generated by pymatgen. Note: Checks to see if generated by pymatgen, if not it is impossible to generate structure object so it is not possible to generate header object a...
def from_string(header_str): """ Reads Header string and returns Header object if header was generated by pymatgen. Note: Checks to see if generated by pymatgen, if not it is impossible to generate structure object so it is not possible to generate header object a...
[ "Reads", "Header", "string", "and", "returns", "Header", "object", "if", "header", "was", "generated", "by", "pymatgen", ".", "Note", ":", "Checks", "to", "see", "if", "generated", "by", "pymatgen", "if", "not", "it", "is", "impossible", "to", "generate", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L189-L245
[ "def", "from_string", "(", "header_str", ")", ":", "lines", "=", "tuple", "(", "clean_lines", "(", "header_str", ".", "split", "(", "\"\\n\"", ")", ",", "False", ")", ")", "comment1", "=", "lines", "[", "0", "]", "feffpmg", "=", "comment1", ".", "find"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Header.write_file
Writes Header into filename on disk. Args: filename: Filename and path for file to be written to disk
pymatgen/io/feff/inputs.py
def write_file(self, filename='HEADER'): """ Writes Header into filename on disk. Args: filename: Filename and path for file to be written to disk """ with open(filename, "w") as f: f.write(str(self) + "\n")
def write_file(self, filename='HEADER'): """ Writes Header into filename on disk. Args: filename: Filename and path for file to be written to disk """ with open(filename, "w") as f: f.write(str(self) + "\n")
[ "Writes", "Header", "into", "filename", "on", "disk", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L272-L280
[ "def", "write_file", "(", "self", ",", "filename", "=", "'HEADER'", ")", ":", "with", "open", "(", "filename", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "str", "(", "self", ")", "+", "\"\\n\"", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Atoms._set_cluster
Compute and set the cluster of atoms as a Molecule object. The siteato coordinates are translated such that the absorbing atom(aka central atom) is at the origin. Returns: Molecule
pymatgen/io/feff/inputs.py
def _set_cluster(self): """ Compute and set the cluster of atoms as a Molecule object. The siteato coordinates are translated such that the absorbing atom(aka central atom) is at the origin. Returns: Molecule """ center = self.struct[self.center_index...
def _set_cluster(self): """ Compute and set the cluster of atoms as a Molecule object. The siteato coordinates are translated such that the absorbing atom(aka central atom) is at the origin. Returns: Molecule """ center = self.struct[self.center_index...
[ "Compute", "and", "set", "the", "cluster", "of", "atoms", "as", "a", "Molecule", "object", ".", "The", "siteato", "coordinates", "are", "translated", "such", "that", "the", "absorbing", "atom", "(", "aka", "central", "atom", ")", "is", "at", "the", "origin...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L307-L325
[ "def", "_set_cluster", "(", "self", ")", ":", "center", "=", "self", ".", "struct", "[", "self", ".", "center_index", "]", ".", "coords", "sphere", "=", "self", ".", "struct", ".", "get_neighbors", "(", "self", ".", "struct", "[", "self", ".", "center_...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Atoms.atoms_string_from_file
Reads atomic shells from file such as feff.inp or ATOMS file The lines are arranged as follows: x y z ipot Atom Symbol Distance Number with distance being the shell radius and ipot an integer identifying the potential used. Args: filename: File name contai...
pymatgen/io/feff/inputs.py
def atoms_string_from_file(filename): """ Reads atomic shells from file such as feff.inp or ATOMS file The lines are arranged as follows: x y z ipot Atom Symbol Distance Number with distance being the shell radius and ipot an integer identifying the potential u...
def atoms_string_from_file(filename): """ Reads atomic shells from file such as feff.inp or ATOMS file The lines are arranged as follows: x y z ipot Atom Symbol Distance Number with distance being the shell radius and ipot an integer identifying the potential u...
[ "Reads", "atomic", "shells", "from", "file", "such", "as", "feff", ".", "inp", "or", "ATOMS", "file", "The", "lines", "are", "arranged", "as", "follows", ":" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L335-L364
[ "def", "atoms_string_from_file", "(", "filename", ")", ":", "with", "zopen", "(", "filename", ",", "\"rt\"", ")", "as", "fobject", ":", "f", "=", "fobject", ".", "readlines", "(", ")", "coords", "=", "0", "atoms_str", "=", "[", "]", "for", "line", "in"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Atoms.cluster_from_file
Parse the feff input file and return the atomic cluster as a Molecule object. Args: filename (str): path the feff input file Returns: Molecule: the atomic cluster as Molecule object. The absorbing atom is the one at the origin.
pymatgen/io/feff/inputs.py
def cluster_from_file(filename): """ Parse the feff input file and return the atomic cluster as a Molecule object. Args: filename (str): path the feff input file Returns: Molecule: the atomic cluster as Molecule object. The absorbing atom ...
def cluster_from_file(filename): """ Parse the feff input file and return the atomic cluster as a Molecule object. Args: filename (str): path the feff input file Returns: Molecule: the atomic cluster as Molecule object. The absorbing atom ...
[ "Parse", "the", "feff", "input", "file", "and", "return", "the", "atomic", "cluster", "as", "a", "Molecule", "object", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L367-L387
[ "def", "cluster_from_file", "(", "filename", ")", ":", "atoms_string", "=", "Atoms", ".", "atoms_string_from_file", "(", "filename", ")", "line_list", "=", "[", "l", ".", "split", "(", ")", "for", "l", "in", "atoms_string", ".", "splitlines", "(", ")", "["...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Atoms.get_lines
Returns a list of string representations of the atomic configuration information(x, y, z, ipot, atom_symbol, distance, id). Returns: list: list of strings, sorted by the distance from the absorbing atom.
pymatgen/io/feff/inputs.py
def get_lines(self): """ Returns a list of string representations of the atomic configuration information(x, y, z, ipot, atom_symbol, distance, id). Returns: list: list of strings, sorted by the distance from the absorbing atom. """ lines = [[...
def get_lines(self): """ Returns a list of string representations of the atomic configuration information(x, y, z, ipot, atom_symbol, distance, id). Returns: list: list of strings, sorted by the distance from the absorbing atom. """ lines = [[...
[ "Returns", "a", "list", "of", "string", "representations", "of", "the", "atomic", "configuration", "information", "(", "x", "y", "z", "ipot", "atom_symbol", "distance", "id", ")", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L389-L409
[ "def", "get_lines", "(", "self", ")", ":", "lines", "=", "[", "[", "\"{:f}\"", ".", "format", "(", "self", ".", "_cluster", "[", "0", "]", ".", "x", ")", ",", "\"{:f}\"", ".", "format", "(", "self", ".", "_cluster", "[", "0", "]", ".", "y", ")"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tags.as_dict
Dict representation. Returns: Dictionary of parameters from fefftags object
pymatgen/io/feff/inputs.py
def as_dict(self): """ Dict representation. Returns: Dictionary of parameters from fefftags object """ tags_dict = dict(self) tags_dict['@module'] = self.__class__.__module__ tags_dict['@class'] = self.__class__.__name__ return tags_dict
def as_dict(self): """ Dict representation. Returns: Dictionary of parameters from fefftags object """ tags_dict = dict(self) tags_dict['@module'] = self.__class__.__module__ tags_dict['@class'] = self.__class__.__name__ return tags_dict
[ "Dict", "representation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L464-L474
[ "def", "as_dict", "(", "self", ")", ":", "tags_dict", "=", "dict", "(", "self", ")", "tags_dict", "[", "'@module'", "]", "=", "self", ".", "__class__", ".", "__module__", "tags_dict", "[", "'@class'", "]", "=", "self", ".", "__class__", ".", "__name__", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tags.from_dict
Creates Tags object from a dictionary. Args: d: Dict of feff parameters and values. Returns: Tags object
pymatgen/io/feff/inputs.py
def from_dict(d): """ Creates Tags object from a dictionary. Args: d: Dict of feff parameters and values. Returns: Tags object """ i = Tags() for k, v in d.items(): if k not in ("@module", "@class"): i[k] = v ...
def from_dict(d): """ Creates Tags object from a dictionary. Args: d: Dict of feff parameters and values. Returns: Tags object """ i = Tags() for k, v in d.items(): if k not in ("@module", "@class"): i[k] = v ...
[ "Creates", "Tags", "object", "from", "a", "dictionary", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L477-L491
[ "def", "from_dict", "(", "d", ")", ":", "i", "=", "Tags", "(", ")", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "k", "not", "in", "(", "\"@module\"", ",", "\"@class\"", ")", ":", "i", "[", "k", "]", "=", "v", "return...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tags.get_string
Returns a string representation of the Tags. The reason why this method is different from the __str__ method is to provide options for pretty printing. Args: sort_keys: Set to True to sort the Feff parameters alphabetically. Defaults to False. pretty: Se...
pymatgen/io/feff/inputs.py
def get_string(self, sort_keys=False, pretty=False): """ Returns a string representation of the Tags. The reason why this method is different from the __str__ method is to provide options for pretty printing. Args: sort_keys: Set to True to sort the Feff parameters ...
def get_string(self, sort_keys=False, pretty=False): """ Returns a string representation of the Tags. The reason why this method is different from the __str__ method is to provide options for pretty printing. Args: sort_keys: Set to True to sort the Feff parameters ...
[ "Returns", "a", "string", "representation", "of", "the", "Tags", ".", "The", "reason", "why", "this", "method", "is", "different", "from", "the", "__str__", "method", "is", "to", "provide", "options", "for", "pretty", "printing", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L493-L532
[ "def", "get_string", "(", "self", ",", "sort_keys", "=", "False", ",", "pretty", "=", "False", ")", ":", "keys", "=", "self", ".", "keys", "(", ")", "if", "sort_keys", ":", "keys", "=", "sorted", "(", "keys", ")", "lines", "=", "[", "]", "for", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tags._stringify_val
Convert the given value to string.
pymatgen/io/feff/inputs.py
def _stringify_val(val): """ Convert the given value to string. """ if isinstance(val, list): return " ".join([str(i) for i in val]) else: return str(val)
def _stringify_val(val): """ Convert the given value to string. """ if isinstance(val, list): return " ".join([str(i) for i in val]) else: return str(val)
[ "Convert", "the", "given", "value", "to", "string", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L535-L542
[ "def", "_stringify_val", "(", "val", ")", ":", "if", "isinstance", "(", "val", ",", "list", ")", ":", "return", "\" \"", ".", "join", "(", "[", "str", "(", "i", ")", "for", "i", "in", "val", "]", ")", "else", ":", "return", "str", "(", "val", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tags.from_file
Creates a Feff_tag dictionary from a PARAMETER or feff.inp file. Args: filename: Filename for either PARAMETER or feff.inp file Returns: Feff_tag object
pymatgen/io/feff/inputs.py
def from_file(filename="feff.inp"): """ Creates a Feff_tag dictionary from a PARAMETER or feff.inp file. Args: filename: Filename for either PARAMETER or feff.inp file Returns: Feff_tag object """ with zopen(filename, "rt") as f: line...
def from_file(filename="feff.inp"): """ Creates a Feff_tag dictionary from a PARAMETER or feff.inp file. Args: filename: Filename for either PARAMETER or feff.inp file Returns: Feff_tag object """ with zopen(filename, "rt") as f: line...
[ "Creates", "a", "Feff_tag", "dictionary", "from", "a", "PARAMETER", "or", "feff", ".", "inp", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L558-L603
[ "def", "from_file", "(", "filename", "=", "\"feff.inp\"", ")", ":", "with", "zopen", "(", "filename", ",", "\"rt\"", ")", "as", "f", ":", "lines", "=", "list", "(", "clean_lines", "(", "f", ".", "readlines", "(", ")", ")", ")", "params", "=", "{", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tags.proc_val
Static helper method to convert Feff parameters to proper types, e.g. integers, floats, lists, etc. Args: key: Feff parameter key val: Actual value of Feff parameter.
pymatgen/io/feff/inputs.py
def proc_val(key, val): """ Static helper method to convert Feff parameters to proper types, e.g. integers, floats, lists, etc. Args: key: Feff parameter key val: Actual value of Feff parameter. """ list_type_keys = list(VALID_FEFF_TAGS) ...
def proc_val(key, val): """ Static helper method to convert Feff parameters to proper types, e.g. integers, floats, lists, etc. Args: key: Feff parameter key val: Actual value of Feff parameter. """ list_type_keys = list(VALID_FEFF_TAGS) ...
[ "Static", "helper", "method", "to", "convert", "Feff", "parameters", "to", "proper", "types", "e", ".", "g", ".", "integers", "floats", "lists", "etc", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L606-L660
[ "def", "proc_val", "(", "key", ",", "val", ")", ":", "list_type_keys", "=", "list", "(", "VALID_FEFF_TAGS", ")", "del", "list_type_keys", "[", "list_type_keys", ".", "index", "(", "\"ELNES\"", ")", "]", "del", "list_type_keys", "[", "list_type_keys", ".", "i...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Potential.pot_string_from_file
Reads Potential parameters from a feff.inp or FEFFPOT file. The lines are arranged as follows: ipot Z element lmax1 lmax2 stoichometry spinph Args: filename: file name containing potential data. Returns: FEFFPOT string.
pymatgen/io/feff/inputs.py
def pot_string_from_file(filename='feff.inp'): """ Reads Potential parameters from a feff.inp or FEFFPOT file. The lines are arranged as follows: ipot Z element lmax1 lmax2 stoichometry spinph Args: filename: file name containing potential data. ...
def pot_string_from_file(filename='feff.inp'): """ Reads Potential parameters from a feff.inp or FEFFPOT file. The lines are arranged as follows: ipot Z element lmax1 lmax2 stoichometry spinph Args: filename: file name containing potential data. ...
[ "Reads", "Potential", "parameters", "from", "a", "feff", ".", "inp", "or", "FEFFPOT", "file", ".", "The", "lines", "are", "arranged", "as", "follows", ":" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L730-L772
[ "def", "pot_string_from_file", "(", "filename", "=", "'feff.inp'", ")", ":", "with", "zopen", "(", "filename", ",", "\"rt\"", ")", "as", "f_object", ":", "f", "=", "f_object", ".", "readlines", "(", ")", "ln", "=", "-", "1", "pot_str", "=", "[", "\"POT...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Potential.pot_dict_from_string
Creates atomic symbol/potential number dictionary forward and reverse Arg: pot_data: potential data in string format Returns: forward and reverse atom symbol and potential number dictionaries.
pymatgen/io/feff/inputs.py
def pot_dict_from_string(pot_data): """ Creates atomic symbol/potential number dictionary forward and reverse Arg: pot_data: potential data in string format Returns: forward and reverse atom symbol and potential number dictionaries. """ ...
def pot_dict_from_string(pot_data): """ Creates atomic symbol/potential number dictionary forward and reverse Arg: pot_data: potential data in string format Returns: forward and reverse atom symbol and potential number dictionaries. """ ...
[ "Creates", "atomic", "symbol", "/", "potential", "number", "dictionary", "forward", "and", "reverse" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L775-L806
[ "def", "pot_dict_from_string", "(", "pot_data", ")", ":", "pot_dict", "=", "{", "}", "pot_dict_reverse", "=", "{", "}", "begin", "=", "0", "ln", "=", "-", "1", "for", "line", "in", "pot_data", ".", "split", "(", "\"\\n\"", ")", ":", "try", ":", "if",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Paths.write_file
Write paths.dat.
pymatgen/io/feff/inputs.py
def write_file(self, filename="paths.dat"): """ Write paths.dat. """ with zopen(filename, "wt") as f: f.write(str(self) + "\n")
def write_file(self, filename="paths.dat"): """ Write paths.dat. """ with zopen(filename, "wt") as f: f.write(str(self) + "\n")
[ "Write", "paths", ".", "dat", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/inputs.py#L884-L889
[ "def", "write_file", "(", "self", ",", "filename", "=", "\"paths.dat\"", ")", ":", "with", "zopen", "(", "filename", ",", "\"wt\"", ")", "as", "f", ":", "f", ".", "write", "(", "str", "(", "self", ")", "+", "\"\\n\"", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
lattice_from_abivars
Returns a `Lattice` object from a dictionary with the Abinit variables `acell` and either `rprim` in Bohr or `angdeg` If acell is not given, the Abinit default is used i.e. [1,1,1] Bohr Args: cls: Lattice class to be instantiated. pymatgen.core.lattice.Lattice if `cls` is None Example: ...
pymatgen/io/abinit/abiobjects.py
def lattice_from_abivars(cls=None, *args, **kwargs): """ Returns a `Lattice` object from a dictionary with the Abinit variables `acell` and either `rprim` in Bohr or `angdeg` If acell is not given, the Abinit default is used i.e. [1,1,1] Bohr Args: cls: Lattice class to be instantiated. pym...
def lattice_from_abivars(cls=None, *args, **kwargs): """ Returns a `Lattice` object from a dictionary with the Abinit variables `acell` and either `rprim` in Bohr or `angdeg` If acell is not given, the Abinit default is used i.e. [1,1,1] Bohr Args: cls: Lattice class to be instantiated. pym...
[ "Returns", "a", "Lattice", "object", "from", "a", "dictionary", "with", "the", "Abinit", "variables", "acell", "and", "either", "rprim", "in", "Bohr", "or", "angdeg", "If", "acell", "is", "not", "given", "the", "Abinit", "default", "is", "used", "i", ".", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L26-L92
[ "def", "lattice_from_abivars", "(", "cls", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cls", "=", "Lattice", "if", "cls", "is", "None", "else", "cls", "kwargs", ".", "update", "(", "dict", "(", "*", "args", ")", ")", "d", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
structure_from_abivars
Build a :class:`Structure` object from a dictionary with ABINIT variables. Args: cls: Structure class to be instantiated. pymatgen.core.structure.Structure if cls is None example: al_structure = structure_from_abivars( acell=3*[7.5], rprim=[0.0, 0.5, 0.5, ...
pymatgen/io/abinit/abiobjects.py
def structure_from_abivars(cls=None, *args, **kwargs): """ Build a :class:`Structure` object from a dictionary with ABINIT variables. Args: cls: Structure class to be instantiated. pymatgen.core.structure.Structure if cls is None example: al_structure = structure_from_abivars( ...
def structure_from_abivars(cls=None, *args, **kwargs): """ Build a :class:`Structure` object from a dictionary with ABINIT variables. Args: cls: Structure class to be instantiated. pymatgen.core.structure.Structure if cls is None example: al_structure = structure_from_abivars( ...
[ "Build", "a", ":", "class", ":", "Structure", "object", "from", "a", "dictionary", "with", "ABINIT", "variables", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L95-L157
[ "def", "structure_from_abivars", "(", "cls", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "dict", "(", "*", "args", ")", ")", "d", "=", "kwargs", "cls", "=", "Structure", "if", "cls", "is", "None",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
structure_to_abivars
Receives a structure and returns a dictionary with the ABINIT variables.
pymatgen/io/abinit/abiobjects.py
def structure_to_abivars(structure, **kwargs): """ Receives a structure and returns a dictionary with the ABINIT variables. """ if not structure.is_ordered: raise ValueError("""\ Received disordered structure with partial occupancies that cannot be converted into an Abinit input Please use Order...
def structure_to_abivars(structure, **kwargs): """ Receives a structure and returns a dictionary with the ABINIT variables. """ if not structure.is_ordered: raise ValueError("""\ Received disordered structure with partial occupancies that cannot be converted into an Abinit input Please use Order...
[ "Receives", "a", "structure", "and", "returns", "a", "dictionary", "with", "the", "ABINIT", "variables", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L160-L224
[ "def", "structure_to_abivars", "(", "structure", ",", "*", "*", "kwargs", ")", ":", "if", "not", "structure", ".", "is_ordered", ":", "raise", "ValueError", "(", "\"\"\"\\\nReceived disordered structure with partial occupancies that cannot be converted into an Abinit input\nPle...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
contract
>>> assert contract("1 1 1 2 2 3") == "3*1 2*2 1*3" >>> assert contract("1 1 3 2 3") == "2*1 1*3 1*2 1*3"
pymatgen/io/abinit/abiobjects.py
def contract(s): """ >>> assert contract("1 1 1 2 2 3") == "3*1 2*2 1*3" >>> assert contract("1 1 3 2 3") == "2*1 1*3 1*2 1*3" """ if not s: return s tokens = s.split() old = tokens[0] count = [[1, old]] for t in tokens[1:]: if t == old: count[-1][0] += 1 ...
def contract(s): """ >>> assert contract("1 1 1 2 2 3") == "3*1 2*2 1*3" >>> assert contract("1 1 3 2 3") == "2*1 1*3 1*2 1*3" """ if not s: return s tokens = s.split() old = tokens[0] count = [[1, old]] for t in tokens[1:]: if t == old: count[-1][0] += 1 ...
[ ">>>", "assert", "contract", "(", "1", "1", "1", "2", "2", "3", ")", "==", "3", "*", "1", "2", "*", "2", "1", "*", "3", ">>>", "assert", "contract", "(", "1", "1", "3", "2", "3", ")", "==", "2", "*", "1", "1", "*", "3", "1", "*", "2", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L227-L245
[ "def", "contract", "(", "s", ")", ":", "if", "not", "s", ":", "return", "s", "tokens", "=", "s", ".", "split", "(", ")", "old", "=", "tokens", "[", "0", "]", "count", "=", "[", "[", "1", ",", "old", "]", "]", "for", "t", "in", "tokens", "["...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SpinMode.as_spinmode
Converts obj into a `SpinMode` instance
pymatgen/io/abinit/abiobjects.py
def as_spinmode(cls, obj): """Converts obj into a `SpinMode` instance""" if isinstance(obj, cls): return obj else: # Assume a string with mode try: return _mode2spinvars[obj] except KeyError: raise KeyError("Wrong va...
def as_spinmode(cls, obj): """Converts obj into a `SpinMode` instance""" if isinstance(obj, cls): return obj else: # Assume a string with mode try: return _mode2spinvars[obj] except KeyError: raise KeyError("Wrong va...
[ "Converts", "obj", "into", "a", "SpinMode", "instance" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L298-L307
[ "def", "as_spinmode", "(", "cls", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "cls", ")", ":", "return", "obj", "else", ":", "# Assume a string with mode", "try", ":", "return", "_mode2spinvars", "[", "obj", "]", "except", "KeyError", ":", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Smearing.as_smearing
Constructs an instance of `Smearing` from obj. Accepts obj in the form: * Smearing instance * "name:tsmear" e.g. "gaussian:0.004" (Hartree units) * "name:tsmear units" e.g. "gaussian:0.1 eV" * None --> no smearing
pymatgen/io/abinit/abiobjects.py
def as_smearing(cls, obj): """ Constructs an instance of `Smearing` from obj. Accepts obj in the form: * Smearing instance * "name:tsmear" e.g. "gaussian:0.004" (Hartree units) * "name:tsmear units" e.g. "gaussian:0.1 eV" * None --> no smearing ...
def as_smearing(cls, obj): """ Constructs an instance of `Smearing` from obj. Accepts obj in the form: * Smearing instance * "name:tsmear" e.g. "gaussian:0.004" (Hartree units) * "name:tsmear units" e.g. "gaussian:0.1 eV" * None --> no smearing ...
[ "Constructs", "an", "instance", "of", "Smearing", "from", "obj", ".", "Accepts", "obj", "in", "the", "form", ":" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L373-L402
[ "def", "as_smearing", "(", "cls", ",", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "Smearing", ".", "nosmearing", "(", ")", "if", "isinstance", "(", "obj", ",", "cls", ")", ":", "return", "obj", "# obj is a string", "if", "obj", "==", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Electrons.as_dict
json friendly dict representation
pymatgen/io/abinit/abiobjects.py
def as_dict(self): "json friendly dict representation" d = {} d["@module"] = self.__class__.__module__ d["@class"] = self.__class__.__name__ d["spin_mode"] = self.spin_mode.as_dict() d["smearing"] = self.smearing.as_dict() d["algorithm"] = self.algorithm.as_dict()...
def as_dict(self): "json friendly dict representation" d = {} d["@module"] = self.__class__.__module__ d["@class"] = self.__class__.__name__ d["spin_mode"] = self.spin_mode.as_dict() d["smearing"] = self.smearing.as_dict() d["algorithm"] = self.algorithm.as_dict()...
[ "json", "friendly", "dict", "representation" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L494-L506
[ "def", "as_dict", "(", "self", ")", ":", "d", "=", "{", "}", "d", "[", "\"@module\"", "]", "=", "self", ".", "__class__", ".", "__module__", "d", "[", "\"@class\"", "]", "=", "self", ".", "__class__", ".", "__name__", "d", "[", "\"spin_mode\"", "]", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling.gamma_centered
Convenient static constructor for an automatic Gamma centered Kpoint grid. Args: kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors. use_symmetries: False if spatial symmetries should not be used to reduce the number of independent k-points. ...
pymatgen/io/abinit/abiobjects.py
def gamma_centered(cls, kpts=(1, 1, 1), use_symmetries=True, use_time_reversal=True): """ Convenient static constructor for an automatic Gamma centered Kpoint grid. Args: kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors. use_symmetries: False if spati...
def gamma_centered(cls, kpts=(1, 1, 1), use_symmetries=True, use_time_reversal=True): """ Convenient static constructor for an automatic Gamma centered Kpoint grid. Args: kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors. use_symmetries: False if spati...
[ "Convenient", "static", "constructor", "for", "an", "automatic", "Gamma", "centered", "Kpoint", "grid", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L667-L683
[ "def", "gamma_centered", "(", "cls", ",", "kpts", "=", "(", "1", ",", "1", ",", "1", ")", ",", "use_symmetries", "=", "True", ",", "use_time_reversal", "=", "True", ")", ":", "return", "cls", "(", "kpts", "=", "[", "kpts", "]", ",", "kpt_shifts", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling.monkhorst
Convenient static constructor for a Monkhorst-Pack mesh. Args: ngkpt: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors. shiftk: Shift to be applied to the kpoints. use_symmetries: Use spatial symmetries to reduce the number of k-points. use_time_rev...
pymatgen/io/abinit/abiobjects.py
def monkhorst(cls, ngkpt, shiftk=(0.5, 0.5, 0.5), chksymbreak=None, use_symmetries=True, use_time_reversal=True, comment=None): """ Convenient static constructor for a Monkhorst-Pack mesh. Args: ngkpt: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors....
def monkhorst(cls, ngkpt, shiftk=(0.5, 0.5, 0.5), chksymbreak=None, use_symmetries=True, use_time_reversal=True, comment=None): """ Convenient static constructor for a Monkhorst-Pack mesh. Args: ngkpt: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors....
[ "Convenient", "static", "constructor", "for", "a", "Monkhorst", "-", "Pack", "mesh", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L686-L703
[ "def", "monkhorst", "(", "cls", ",", "ngkpt", ",", "shiftk", "=", "(", "0.5", ",", "0.5", ",", "0.5", ")", ",", "chksymbreak", "=", "None", ",", "use_symmetries", "=", "True", ",", "use_time_reversal", "=", "True", ",", "comment", "=", "None", ")", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling.monkhorst_automatic
Convenient static constructor for an automatic Monkhorst-Pack mesh. Args: structure: :class:`Structure` object. ngkpt: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors. use_symmetries: Use spatial symmetries to reduce the number of k-points. use_tim...
pymatgen/io/abinit/abiobjects.py
def monkhorst_automatic(cls, structure, ngkpt, use_symmetries=True, use_time_reversal=True, chksymbreak=None, comment=None): """ Convenient static constructor for an automatic Monkhorst-Pack mesh. Args: structure: :class:`Structure` object. ng...
def monkhorst_automatic(cls, structure, ngkpt, use_symmetries=True, use_time_reversal=True, chksymbreak=None, comment=None): """ Convenient static constructor for an automatic Monkhorst-Pack mesh. Args: structure: :class:`Structure` object. ng...
[ "Convenient", "static", "constructor", "for", "an", "automatic", "Monkhorst", "-", "Pack", "mesh", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L706-L734
[ "def", "monkhorst_automatic", "(", "cls", ",", "structure", ",", "ngkpt", ",", "use_symmetries", "=", "True", ",", "use_time_reversal", "=", "True", ",", "chksymbreak", "=", "None", ",", "comment", "=", "None", ")", ":", "sg", "=", "SpacegroupAnalyzer", "(",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling._path
Static constructor for path in k-space. Args: structure: :class:`Structure` object. kpath_bounds: List with the reduced coordinates of the k-points defining the path. ndivsm: Number of division for the smallest segment. comment: Comment string. Returns: ...
pymatgen/io/abinit/abiobjects.py
def _path(cls, ndivsm, structure=None, kpath_bounds=None, comment=None): """ Static constructor for path in k-space. Args: structure: :class:`Structure` object. kpath_bounds: List with the reduced coordinates of the k-points defining the path. ndivsm: Number ...
def _path(cls, ndivsm, structure=None, kpath_bounds=None, comment=None): """ Static constructor for path in k-space. Args: structure: :class:`Structure` object. kpath_bounds: List with the reduced coordinates of the k-points defining the path. ndivsm: Number ...
[ "Static", "constructor", "for", "path", "in", "k", "-", "space", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L737-L767
[ "def", "_path", "(", "cls", ",", "ndivsm", ",", "structure", "=", "None", ",", "kpath_bounds", "=", "None", ",", "comment", "=", "None", ")", ":", "if", "kpath_bounds", "is", "None", ":", "# Compute the boundaries from the input structure.", "from", "pymatgen", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling.path_from_structure
See _path for the meaning of the variables
pymatgen/io/abinit/abiobjects.py
def path_from_structure(cls, ndivsm, structure): """See _path for the meaning of the variables""" return cls._path(ndivsm, structure=structure, comment="K-path generated automatically from structure")
def path_from_structure(cls, ndivsm, structure): """See _path for the meaning of the variables""" return cls._path(ndivsm, structure=structure, comment="K-path generated automatically from structure")
[ "See", "_path", "for", "the", "meaning", "of", "the", "variables" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L770-L772
[ "def", "path_from_structure", "(", "cls", ",", "ndivsm", ",", "structure", ")", ":", "return", "cls", ".", "_path", "(", "ndivsm", ",", "structure", "=", "structure", ",", "comment", "=", "\"K-path generated automatically from structure\"", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling.explicit_path
See _path for the meaning of the variables
pymatgen/io/abinit/abiobjects.py
def explicit_path(cls, ndivsm, kpath_bounds): """See _path for the meaning of the variables""" return cls._path(ndivsm, kpath_bounds=kpath_bounds, comment="Explicit K-path")
def explicit_path(cls, ndivsm, kpath_bounds): """See _path for the meaning of the variables""" return cls._path(ndivsm, kpath_bounds=kpath_bounds, comment="Explicit K-path")
[ "See", "_path", "for", "the", "meaning", "of", "the", "variables" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L775-L777
[ "def", "explicit_path", "(", "cls", ",", "ndivsm", ",", "kpath_bounds", ")", ":", "return", "cls", ".", "_path", "(", "ndivsm", ",", "kpath_bounds", "=", "kpath_bounds", ",", "comment", "=", "\"Explicit K-path\"", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
KSampling.automatic_density
Returns an automatic Kpoint object based on a structure and a kpoint density. Uses Gamma centered meshes for hexagonal cells and Monkhorst-Pack grids otherwise. Algorithm: Uses a simple approach scaling the number of divisions along each reciprocal lattice vector proportional to...
pymatgen/io/abinit/abiobjects.py
def automatic_density(cls, structure, kppa, chksymbreak=None, use_symmetries=True, use_time_reversal=True, shifts=(0.5, 0.5, 0.5)): """ Returns an automatic Kpoint object based on a structure and a kpoint density. Uses Gamma centered meshes for hexagonal cells and Monkh...
def automatic_density(cls, structure, kppa, chksymbreak=None, use_symmetries=True, use_time_reversal=True, shifts=(0.5, 0.5, 0.5)): """ Returns an automatic Kpoint object based on a structure and a kpoint density. Uses Gamma centered meshes for hexagonal cells and Monkh...
[ "Returns", "an", "automatic", "Kpoint", "object", "based", "on", "a", "structure", "and", "a", "kpoint", "density", ".", "Uses", "Gamma", "centered", "meshes", "for", "hexagonal", "cells", "and", "Monkhorst", "-", "Pack", "grids", "otherwise", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L780-L829
[ "def", "automatic_density", "(", "cls", ",", "structure", ",", "kppa", ",", "chksymbreak", "=", "None", ",", "use_symmetries", "=", "True", ",", "use_time_reversal", "=", "True", ",", "shifts", "=", "(", "0.5", ",", "0.5", ",", "0.5", ")", ")", ":", "l...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
RelaxationMethod.to_abivars
Returns a dictionary with the abinit variables
pymatgen/io/abinit/abiobjects.py
def to_abivars(self): """Returns a dictionary with the abinit variables""" # These variables are always present. out_vars = { "ionmov" : self.abivars.ionmov, "optcell": self.abivars.optcell, "ntime" : self.abivars.ntime, } # Atom relaxation. ...
def to_abivars(self): """Returns a dictionary with the abinit variables""" # These variables are always present. out_vars = { "ionmov" : self.abivars.ionmov, "optcell": self.abivars.optcell, "ntime" : self.abivars.ntime, } # Atom relaxation. ...
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L926-L955
[ "def", "to_abivars", "(", "self", ")", ":", "# These variables are always present.", "out_vars", "=", "{", "\"ionmov\"", ":", "self", ".", "abivars", ".", "ionmov", ",", "\"optcell\"", ":", "self", ".", "abivars", ".", "optcell", ",", "\"ntime\"", ":", "self",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PPModel.as_ppmodel
Constructs an instance of PPModel from obj. Accepts obj in the form: * PPmodel instance * string. e.g "godby:12.3 eV", "linden".
pymatgen/io/abinit/abiobjects.py
def as_ppmodel(cls, obj): """ Constructs an instance of PPModel from obj. Accepts obj in the form: * PPmodel instance * string. e.g "godby:12.3 eV", "linden". """ if isinstance(obj, cls): return obj # obj is a string if ":" no...
def as_ppmodel(cls, obj): """ Constructs an instance of PPModel from obj. Accepts obj in the form: * PPmodel instance * string. e.g "godby:12.3 eV", "linden". """ if isinstance(obj, cls): return obj # obj is a string if ":" no...
[ "Constructs", "an", "instance", "of", "PPModel", "from", "obj", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L987-L1010
[ "def", "as_ppmodel", "(", "cls", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "cls", ")", ":", "return", "obj", "# obj is a string", "if", "\":\"", "not", "in", "obj", ":", "mode", ",", "plasmon_freq", "=", "obj", ",", "None", "else", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
HilbertTransform.to_abivars
Returns a dictionary with the abinit variables
pymatgen/io/abinit/abiobjects.py
def to_abivars(self): """Returns a dictionary with the abinit variables""" return { # Spectral function "nomegasf": self.nomegasf, "domegasf": self.domegasf, "spmeth" : self.spmeth, # Frequency mesh for the polarizability ...
def to_abivars(self): """Returns a dictionary with the abinit variables""" return { # Spectral function "nomegasf": self.nomegasf, "domegasf": self.domegasf, "spmeth" : self.spmeth, # Frequency mesh for the polarizability ...
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1092-L1104
[ "def", "to_abivars", "(", "self", ")", ":", "return", "{", "# Spectral function", "\"nomegasf\"", ":", "self", ".", "nomegasf", ",", "\"domegasf\"", ":", "self", ".", "domegasf", ",", "\"spmeth\"", ":", "self", ".", "spmeth", ",", "# Frequency mesh for the polar...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Screening.to_abivars
Returns a dictionary with the abinit variables
pymatgen/io/abinit/abiobjects.py
def to_abivars(self): """Returns a dictionary with the abinit variables""" abivars = { "ecuteps" : self.ecuteps, "ecutwfn" : self.ecutwfn, "inclvkb" : self.inclvkb, "gwpara" : self.gwpara, "awtr" : self.awtr, "symchi" ...
def to_abivars(self): """Returns a dictionary with the abinit variables""" abivars = { "ecuteps" : self.ecuteps, "ecutwfn" : self.ecutwfn, "inclvkb" : self.inclvkb, "gwpara" : self.gwpara, "awtr" : self.awtr, "symchi" ...
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1185-L1204
[ "def", "to_abivars", "(", "self", ")", ":", "abivars", "=", "{", "\"ecuteps\"", ":", "self", ".", "ecuteps", ",", "\"ecutwfn\"", ":", "self", ".", "ecutwfn", ",", "\"inclvkb\"", ":", "self", ".", "inclvkb", ",", "\"gwpara\"", ":", "self", ".", "gwpara", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SelfEnergy.gwcalctyp
Returns the value of the gwcalctyp input variable.
pymatgen/io/abinit/abiobjects.py
def gwcalctyp(self): """Returns the value of the gwcalctyp input variable.""" dig0 = str(self._SIGMA_TYPES[self.type]) dig1 = str(self._SC_MODES[self.sc_mode]) return dig1.strip() + dig0.strip()
def gwcalctyp(self): """Returns the value of the gwcalctyp input variable.""" dig0 = str(self._SIGMA_TYPES[self.type]) dig1 = str(self._SC_MODES[self.sc_mode]) return dig1.strip() + dig0.strip()
[ "Returns", "the", "value", "of", "the", "gwcalctyp", "input", "variable", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1293-L1297
[ "def", "gwcalctyp", "(", "self", ")", ":", "dig0", "=", "str", "(", "self", ".", "_SIGMA_TYPES", "[", "self", ".", "type", "]", ")", "dig1", "=", "str", "(", "self", ".", "_SC_MODES", "[", "self", ".", "sc_mode", "]", ")", "return", "dig1", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SelfEnergy.to_abivars
Returns a dictionary with the abinit variables.
pymatgen/io/abinit/abiobjects.py
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( gwcalctyp=self.gwcalctyp, ecuteps=self.ecuteps, ecutsigx=self.ecutsigx, symsigma=self.symsigma, gw_qprange=self.gw_qprange, gwpara=self.gwpa...
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( gwcalctyp=self.gwcalctyp, ecuteps=self.ecuteps, ecutsigx=self.ecutsigx, symsigma=self.symsigma, gw_qprange=self.gw_qprange, gwpara=self.gwpa...
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1304-L1328
[ "def", "to_abivars", "(", "self", ")", ":", "abivars", "=", "dict", "(", "gwcalctyp", "=", "self", ".", "gwcalctyp", ",", "ecuteps", "=", "self", ".", "ecuteps", ",", "ecutsigx", "=", "self", ".", "ecutsigx", ",", "symsigma", "=", "self", ".", "symsigm...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
ExcHamiltonian.to_abivars
Returns a dictionary with the abinit variables.
pymatgen/io/abinit/abiobjects.py
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( bs_calctype=1, bs_loband=self.bs_loband, #nband=self.nband, mbpt_sciss=self.mbpt_sciss, ecuteps=self.ecuteps, bs_algorithm=self._ALGO2VAR[se...
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( bs_calctype=1, bs_loband=self.bs_loband, #nband=self.nband, mbpt_sciss=self.mbpt_sciss, ecuteps=self.ecuteps, bs_algorithm=self._ALGO2VAR[se...
[ "Returns", "a", "dictionary", "with", "the", "abinit", "variables", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiobjects.py#L1431-L1470
[ "def", "to_abivars", "(", "self", ")", ":", "abivars", "=", "dict", "(", "bs_calctype", "=", "1", ",", "bs_loband", "=", "self", ".", "bs_loband", ",", "#nband=self.nband,", "mbpt_sciss", "=", "self", ".", "mbpt_sciss", ",", "ecuteps", "=", "self", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BandstructureLoader.set_upper_lower_bands
Set fake upper/lower bands, useful to set the same energy range in the spin up/down bands when calculating the DOS
pymatgen/electronic_structure/boltztrap2.py
def set_upper_lower_bands(self,e_lower,e_upper): """ Set fake upper/lower bands, useful to set the same energy range in the spin up/down bands when calculating the DOS """ lower_band = e_lower*np.ones((1,self.ebands.shape[1])) upper_band = e_upper*np.ones((1,self....
def set_upper_lower_bands(self,e_lower,e_upper): """ Set fake upper/lower bands, useful to set the same energy range in the spin up/down bands when calculating the DOS """ lower_band = e_lower*np.ones((1,self.ebands.shape[1])) upper_band = e_upper*np.ones((1,self....
[ "Set", "fake", "upper", "/", "lower", "bands", "useful", "to", "set", "the", "same", "energy", "range", "in", "the", "spin", "up", "/", "down", "bands", "when", "calculating", "the", "DOS" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L144-L156
[ "def", "set_upper_lower_bands", "(", "self", ",", "e_lower", ",", "e_upper", ")", ":", "lower_band", "=", "e_lower", "*", "np", ".", "ones", "(", "(", "1", ",", "self", ".", "ebands", ".", "shape", "[", "1", "]", ")", ")", "upper_band", "=", "e_upper...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VasprunLoader.from_file
Get a vasprun.xml file and return a VasprunLoader
pymatgen/electronic_structure/boltztrap2.py
def from_file(self, vasprun_file): """Get a vasprun.xml file and return a VasprunLoader""" vrun_obj = Vasprun(vasprun_file, parse_projected_eigen=True) return VasprunLoader(vrun_obj)
def from_file(self, vasprun_file): """Get a vasprun.xml file and return a VasprunLoader""" vrun_obj = Vasprun(vasprun_file, parse_projected_eigen=True) return VasprunLoader(vrun_obj)
[ "Get", "a", "vasprun", ".", "xml", "file", "and", "return", "a", "VasprunLoader" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L197-L200
[ "def", "from_file", "(", "self", ",", "vasprun_file", ")", ":", "vrun_obj", "=", "Vasprun", "(", "vasprun_file", ",", "parse_projected_eigen", "=", "True", ")", "return", "VasprunLoader", "(", "vrun_obj", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VasprunLoader.bandana
Cut out bands outside the range (emin,emax)
pymatgen/electronic_structure/boltztrap2.py
def bandana(self, emin=-np.inf, emax=np.inf): """Cut out bands outside the range (emin,emax)""" bandmin = np.min(self.ebands, axis=1) bandmax = np.max(self.ebands, axis=1) ii = np.nonzero(bandmin < emax) nemax = ii[0][-1] ii = np.nonzero(bandmax > emin) nemin = ii...
def bandana(self, emin=-np.inf, emax=np.inf): """Cut out bands outside the range (emin,emax)""" bandmin = np.min(self.ebands, axis=1) bandmax = np.max(self.ebands, axis=1) ii = np.nonzero(bandmin < emax) nemax = ii[0][-1] ii = np.nonzero(bandmax > emin) nemin = ii...
[ "Cut", "out", "bands", "outside", "the", "range", "(", "emin", "emax", ")" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L209-L231
[ "def", "bandana", "(", "self", ",", "emin", "=", "-", "np", ".", "inf", ",", "emax", "=", "np", ".", "inf", ")", ":", "bandmin", "=", "np", ".", "min", "(", "self", ".", "ebands", ",", "axis", "=", "1", ")", "bandmax", "=", "np", ".", "max", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztInterpolator.get_band_structure
Return a BandStructureSymmLine object interpolating bands along a High symmetry path calculated from the structure using HighSymmKpath function
pymatgen/electronic_structure/boltztrap2.py
def get_band_structure(self): """Return a BandStructureSymmLine object interpolating bands along a High symmetry path calculated from the structure using HighSymmKpath function""" kpath = HighSymmKpath(self.data.structure) kpt_line = [Kpoint(k, self.data.structure.lattice) for k ...
def get_band_structure(self): """Return a BandStructureSymmLine object interpolating bands along a High symmetry path calculated from the structure using HighSymmKpath function""" kpath = HighSymmKpath(self.data.structure) kpt_line = [Kpoint(k, self.data.structure.lattice) for k ...
[ "Return", "a", "BandStructureSymmLine", "object", "interpolating", "bands", "along", "a", "High", "symmetry", "path", "calculated", "from", "the", "structure", "using", "HighSymmKpath", "function" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L278-L302
[ "def", "get_band_structure", "(", "self", ")", ":", "kpath", "=", "HighSymmKpath", "(", "self", ".", "data", ".", "structure", ")", "kpt_line", "=", "[", "Kpoint", "(", "k", ",", "self", ".", "data", ".", "structure", ".", "lattice", ")", "for", "k", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztInterpolator.get_dos
Return a Dos object interpolating bands Args: partial_dos: if True, projections will be interpolated as well and partial doses will be return. Projections must be available in the loader. npts_mu: number of energy points of the Dos ...
pymatgen/electronic_structure/boltztrap2.py
def get_dos(self, partial_dos=False, npts_mu=10000, T=None): """ Return a Dos object interpolating bands Args: partial_dos: if True, projections will be interpolated as well and partial doses will be return. Projections must be available ...
def get_dos(self, partial_dos=False, npts_mu=10000, T=None): """ Return a Dos object interpolating bands Args: partial_dos: if True, projections will be interpolated as well and partial doses will be return. Projections must be available ...
[ "Return", "a", "Dos", "object", "interpolating", "bands" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L304-L327
[ "def", "get_dos", "(", "self", ",", "partial_dos", "=", "False", ",", "npts_mu", "=", "10000", ",", "T", "=", "None", ")", ":", "spin", "=", "self", ".", "data", ".", "spin", "if", "isinstance", "(", "self", ".", "data", ".", "spin", ",", "int", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztInterpolator.get_partial_doses
Return a CompleteDos object interpolating the projections tdos: total dos previously calculated npts_mu: number of energy points of the Dos T: parameter used to smooth the Dos
pymatgen/electronic_structure/boltztrap2.py
def get_partial_doses(self, tdos, npts_mu, T): """ Return a CompleteDos object interpolating the projections tdos: total dos previously calculated npts_mu: number of energy points of the Dos T: parameter used to smooth the Dos """ spin = self.data...
def get_partial_doses(self, tdos, npts_mu, T): """ Return a CompleteDos object interpolating the projections tdos: total dos previously calculated npts_mu: number of energy points of the Dos T: parameter used to smooth the Dos """ spin = self.data...
[ "Return", "a", "CompleteDos", "object", "interpolating", "the", "projections" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L329-L369
[ "def", "get_partial_doses", "(", "self", ",", "tdos", ",", "npts_mu", ",", "T", ")", ":", "spin", "=", "self", ".", "data", ".", "spin", "if", "isinstance", "(", "self", ".", "data", ".", "spin", ",", "int", ")", "else", "1", "if", "not", "isinstan...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztTransportProperties.compute_properties_doping
Calculate all the properties w.r.t. the doping levels in input. Args: doping: numpy array specifing the doping levels When executed, it add the following variable at the BztTransportProperties object: Conductivity_doping, Seebeck_doping, Kappa_doping, Power_Factor_dopin...
pymatgen/electronic_structure/boltztrap2.py
def compute_properties_doping(self, doping, temp_r=None): """ Calculate all the properties w.r.t. the doping levels in input. Args: doping: numpy array specifing the doping levels When executed, it add the following variable at the BztTransportProperties object: ...
def compute_properties_doping(self, doping, temp_r=None): """ Calculate all the properties w.r.t. the doping levels in input. Args: doping: numpy array specifing the doping levels When executed, it add the following variable at the BztTransportProperties object: ...
[ "Calculate", "all", "the", "properties", "w", ".", "r", ".", "t", ".", "the", "doping", "levels", "in", "input", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L462-L528
[ "def", "compute_properties_doping", "(", "self", ",", "doping", ",", "temp_r", "=", "None", ")", ":", "if", "temp_r", "is", "None", ":", "temp_r", "=", "self", ".", "temp_r", "self", ".", "Conductivity_doping", ",", "self", ".", "Seebeck_doping", ",", "sel...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztPlotter.plot_props
Function to plot the transport properties. Args: prop_y: property to plot among ("Conductivity","Seebeck","Kappa","Carrier_conc","Hall_carrier_conc_trace"). Abbreviations are possible, like "S" for "Seebeck" prop_x: independent variable in the x-axis among ('mu','doping','te...
pymatgen/electronic_structure/boltztrap2.py
def plot_props(self, prop_y, prop_x, prop_z='temp', output='avg_eigs', dop_type='n', doping=None, temps=None, xlim=(-2, 2), ax=None): """ Function to plot the transport properties. Args: prop_y: property to plot among ("Conductivity...
def plot_props(self, prop_y, prop_x, prop_z='temp', output='avg_eigs', dop_type='n', doping=None, temps=None, xlim=(-2, 2), ax=None): """ Function to plot the transport properties. Args: prop_y: property to plot among ("Conductivity...
[ "Function", "to", "plot", "the", "transport", "properties", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L575-L706
[ "def", "plot_props", "(", "self", ",", "prop_y", ",", "prop_x", ",", "prop_z", "=", "'temp'", ",", "output", "=", "'avg_eigs'", ",", "dop_type", "=", "'n'", ",", "doping", "=", "None", ",", "temps", "=", "None", ",", "xlim", "=", "(", "-", "2", ","...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztPlotter.plot_bands
Plot a band structure on symmetry line using BSPlotter()
pymatgen/electronic_structure/boltztrap2.py
def plot_bands(self): """ Plot a band structure on symmetry line using BSPlotter() """ if self.bzt_interp is None: raise BoltztrapError("BztInterpolator not present") sbs = self.bzt_interp.get_band_structure() return BSPlotter(sbs).get_plot()
def plot_bands(self): """ Plot a band structure on symmetry line using BSPlotter() """ if self.bzt_interp is None: raise BoltztrapError("BztInterpolator not present") sbs = self.bzt_interp.get_band_structure() return BSPlotter(sbs).get_plot()
[ "Plot", "a", "band", "structure", "on", "symmetry", "line", "using", "BSPlotter", "()" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L708-L717
[ "def", "plot_bands", "(", "self", ")", ":", "if", "self", ".", "bzt_interp", "is", "None", ":", "raise", "BoltztrapError", "(", "\"BztInterpolator not present\"", ")", "sbs", "=", "self", ".", "bzt_interp", ".", "get_band_structure", "(", ")", "return", "BSPlo...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BztPlotter.plot_dos
Plot the total Dos using DosPlotter()
pymatgen/electronic_structure/boltztrap2.py
def plot_dos(self, T=None, npoints=10000): """ Plot the total Dos using DosPlotter() """ if self.bzt_interp is None: raise BoltztrapError("BztInterpolator not present") tdos = self.bzt_interp.get_dos(T=T,npts_mu=npoints) #print(npoints) dosPlotter...
def plot_dos(self, T=None, npoints=10000): """ Plot the total Dos using DosPlotter() """ if self.bzt_interp is None: raise BoltztrapError("BztInterpolator not present") tdos = self.bzt_interp.get_dos(T=T,npts_mu=npoints) #print(npoints) dosPlotter...
[ "Plot", "the", "total", "Dos", "using", "DosPlotter", "()" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap2.py#L719-L731
[ "def", "plot_dos", "(", "self", ",", "T", "=", "None", ",", "npoints", "=", "10000", ")", ":", "if", "self", ".", "bzt_interp", "is", "None", ":", "raise", "BoltztrapError", "(", "\"BztInterpolator not present\"", ")", "tdos", "=", "self", ".", "bzt_interp...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.calculate_energy
Calculates the energy of the reaction. Args: energies ({Composition: float}): Energy for each composition. E.g ., {comp1: energy1, comp2: energy2}. Returns: reaction energy as a float.
pymatgen/analysis/reaction_calculator.py
def calculate_energy(self, energies): """ Calculates the energy of the reaction. Args: energies ({Composition: float}): Energy for each composition. E.g ., {comp1: energy1, comp2: energy2}. Returns: reaction energy as a float. """ ...
def calculate_energy(self, energies): """ Calculates the energy of the reaction. Args: energies ({Composition: float}): Energy for each composition. E.g ., {comp1: energy1, comp2: energy2}. Returns: reaction energy as a float. """ ...
[ "Calculates", "the", "energy", "of", "the", "reaction", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L80-L92
[ "def", "calculate_energy", "(", "self", ",", "energies", ")", ":", "return", "sum", "(", "[", "amt", "*", "energies", "[", "c", "]", "for", "amt", ",", "c", "in", "zip", "(", "self", ".", "_coeffs", ",", "self", ".", "_all_comp", ")", "]", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.normalize_to
Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to factor (float): Factor to normalize to. Defaults to 1...
pymatgen/analysis/reaction_calculator.py
def normalize_to(self, comp, factor=1): """ Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to ...
def normalize_to(self, comp, factor=1): """ Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to ...
[ "Normalizes", "the", "reaction", "to", "one", "of", "the", "compositions", ".", "By", "default", "normalizes", "such", "that", "the", "composition", "given", "has", "a", "coefficient", "of", "1", ".", "Another", "factor", "can", "be", "specified", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L94-L106
[ "def", "normalize_to", "(", "self", ",", "comp", ",", "factor", "=", "1", ")", ":", "scale_factor", "=", "abs", "(", "1", "/", "self", ".", "_coeffs", "[", "self", ".", "_all_comp", ".", "index", "(", "comp", ")", "]", "*", "factor", ")", "self", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.normalize_to_element
Normalizes the reaction to one of the elements. By default, normalizes such that the amount of the element is 1. Another factor can be specified. Args: element (Element/Specie): Element to normalize to. factor (float): Factor to normalize to. Defaults to 1.
pymatgen/analysis/reaction_calculator.py
def normalize_to_element(self, element, factor=1): """ Normalizes the reaction to one of the elements. By default, normalizes such that the amount of the element is 1. Another factor can be specified. Args: element (Element/Specie): Element to normalize to. ...
def normalize_to_element(self, element, factor=1): """ Normalizes the reaction to one of the elements. By default, normalizes such that the amount of the element is 1. Another factor can be specified. Args: element (Element/Specie): Element to normalize to. ...
[ "Normalizes", "the", "reaction", "to", "one", "of", "the", "elements", ".", "By", "default", "normalizes", "such", "that", "the", "amount", "of", "the", "element", "is", "1", ".", "Another", "factor", "can", "be", "specified", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L108-L123
[ "def", "normalize_to_element", "(", "self", ",", "element", ",", "factor", "=", "1", ")", ":", "all_comp", "=", "self", ".", "_all_comp", "coeffs", "=", "self", ".", "_coeffs", "current_el_amount", "=", "sum", "(", "[", "all_comp", "[", "i", "]", "[", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.get_el_amount
Returns the amount of the element in the reaction. Args: element (Element/Specie): Element in the reaction Returns: Amount of that element in the reaction.
pymatgen/analysis/reaction_calculator.py
def get_el_amount(self, element): """ Returns the amount of the element in the reaction. Args: element (Element/Specie): Element in the reaction Returns: Amount of that element in the reaction. """ return sum([self._all_comp[i][element] * abs(sel...
def get_el_amount(self, element): """ Returns the amount of the element in the reaction. Args: element (Element/Specie): Element in the reaction Returns: Amount of that element in the reaction. """ return sum([self._all_comp[i][element] * abs(sel...
[ "Returns", "the", "amount", "of", "the", "element", "in", "the", "reaction", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L125-L136
[ "def", "get_el_amount", "(", "self", ",", "element", ")", ":", "return", "sum", "(", "[", "self", ".", "_all_comp", "[", "i", "]", "[", "element", "]", "*", "abs", "(", "self", ".", "_coeffs", "[", "i", "]", ")", "for", "i", "in", "range", "(", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.reactants
List of reactants
pymatgen/analysis/reaction_calculator.py
def reactants(self): """ List of reactants """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] < 0]
def reactants(self): """ List of reactants """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] < 0]
[ "List", "of", "reactants" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L160-L165
[ "def", "reactants", "(", "self", ")", ":", "return", "[", "self", ".", "_all_comp", "[", "i", "]", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_all_comp", ")", ")", "if", "self", ".", "_coeffs", "[", "i", "]", "<", "0", "]" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.products
List of products
pymatgen/analysis/reaction_calculator.py
def products(self): """ List of products """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] > 0]
def products(self): """ List of products """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] > 0]
[ "List", "of", "products" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L168-L173
[ "def", "products", "(", "self", ")", ":", "return", "[", "self", ".", "_all_comp", "[", "i", "]", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_all_comp", ")", ")", "if", "self", ".", "_coeffs", "[", "i", "]", ">", "0", "]" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.as_entry
Returns a ComputedEntry representation of the reaction. :return:
pymatgen/analysis/reaction_calculator.py
def as_entry(self, energies): """ Returns a ComputedEntry representation of the reaction. :return: """ relevant_comp = [comp * abs(coeff) for coeff, comp in zip(self._coeffs, self._all_comp)] comp = sum(relevant_comp, Composition()) entry ...
def as_entry(self, energies): """ Returns a ComputedEntry representation of the reaction. :return: """ relevant_comp = [comp * abs(coeff) for coeff, comp in zip(self._coeffs, self._all_comp)] comp = sum(relevant_comp, Composition()) entry ...
[ "Returns", "a", "ComputedEntry", "representation", "of", "the", "reaction", ".", ":", "return", ":" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L244-L254
[ "def", "as_entry", "(", "self", ",", "energies", ")", ":", "relevant_comp", "=", "[", "comp", "*", "abs", "(", "coeff", ")", "for", "coeff", ",", "comp", "in", "zip", "(", "self", ".", "_coeffs", ",", "self", ".", "_all_comp", ")", "]", "comp", "="...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BalancedReaction.from_string
Generates a balanced reaction from a string. The reaction must already be balanced. Args: rxn_string: The reaction string. For example, "4 Li + O2-> 2Li2O" Returns: BalancedReaction
pymatgen/analysis/reaction_calculator.py
def from_string(rxn_string): """ Generates a balanced reaction from a string. The reaction must already be balanced. Args: rxn_string: The reaction string. For example, "4 Li + O2-> 2Li2O" Returns: BalancedReaction """ rct...
def from_string(rxn_string): """ Generates a balanced reaction from a string. The reaction must already be balanced. Args: rxn_string: The reaction string. For example, "4 Li + O2-> 2Li2O" Returns: BalancedReaction """ rct...
[ "Generates", "a", "balanced", "reaction", "from", "a", "string", ".", "The", "reaction", "must", "already", "be", "balanced", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L273-L291
[ "def", "from_string", "(", "rxn_string", ")", ":", "rct_str", ",", "prod_str", "=", "rxn_string", ".", "split", "(", "\"->\"", ")", "def", "get_comp_amt", "(", "comp_str", ")", ":", "return", "{", "Composition", "(", "m", ".", "group", "(", "2", ")", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
ComputedReaction.all_entries
Equivalent of all_comp but returns entries, in the same order as the coefficients.
pymatgen/analysis/reaction_calculator.py
def all_entries(self): """ Equivalent of all_comp but returns entries, in the same order as the coefficients. """ entries = [] for c in self._all_comp: for e in self._all_entries: if e.composition.reduced_formula == c.reduced_formula: ...
def all_entries(self): """ Equivalent of all_comp but returns entries, in the same order as the coefficients. """ entries = [] for c in self._all_comp: for e in self._all_entries: if e.composition.reduced_formula == c.reduced_formula: ...
[ "Equivalent", "of", "all_comp", "but", "returns", "entries", "in", "the", "same", "order", "as", "the", "coefficients", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/reaction_calculator.py#L440-L451
[ "def", "all_entries", "(", "self", ")", ":", "entries", "=", "[", "]", "for", "c", "in", "self", ".", "_all_comp", ":", "for", "e", "in", "self", ".", "_all_entries", ":", "if", "e", ".", "composition", ".", "reduced_formula", "==", "c", ".", "reduce...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_energy_tersoff
Compute the energy of a structure using Tersoff potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: GULP command if not in standard place
pymatgen/command_line/gulp_caller.py
def get_energy_tersoff(structure, gulp_cmd='gulp'): """ Compute the energy of a structure using Tersoff potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: GULP command if not in standard place """ gio = GulpIO() gc = GulpCaller(gulp_cmd) gin = gio.tersof...
def get_energy_tersoff(structure, gulp_cmd='gulp'): """ Compute the energy of a structure using Tersoff potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: GULP command if not in standard place """ gio = GulpIO() gc = GulpCaller(gulp_cmd) gin = gio.tersof...
[ "Compute", "the", "energy", "of", "a", "structure", "using", "Tersoff", "potential", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L557-L569
[ "def", "get_energy_tersoff", "(", "structure", ",", "gulp_cmd", "=", "'gulp'", ")", ":", "gio", "=", "GulpIO", "(", ")", "gc", "=", "GulpCaller", "(", "gulp_cmd", ")", "gin", "=", "gio", ".", "tersoff_input", "(", "structure", ")", "gout", "=", "gc", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_energy_buckingham
Compute the energy of a structure using Buckingham potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: GULP command if not in standard place keywords: GULP first line keywords valence_dict: {El: valence}. Needed if the structure is not charge neutral.
pymatgen/command_line/gulp_caller.py
def get_energy_buckingham(structure, gulp_cmd='gulp', keywords=('optimise', 'conp', 'qok'), valence_dict=None): """ Compute the energy of a structure using Buckingham potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: ...
def get_energy_buckingham(structure, gulp_cmd='gulp', keywords=('optimise', 'conp', 'qok'), valence_dict=None): """ Compute the energy of a structure using Buckingham potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: ...
[ "Compute", "the", "energy", "of", "a", "structure", "using", "Buckingham", "potential", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L572-L591
[ "def", "get_energy_buckingham", "(", "structure", ",", "gulp_cmd", "=", "'gulp'", ",", "keywords", "=", "(", "'optimise'", ",", "'conp'", ",", "'qok'", ")", ",", "valence_dict", "=", "None", ")", ":", "gio", "=", "GulpIO", "(", ")", "gc", "=", "GulpCalle...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_energy_relax_structure_buckingham
Relax a structure and compute the energy using Buckingham potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: GULP command if not in standard place keywords: GULP first line keywords valence_dict: {El: valence}. Needed if the structure is not charge n...
pymatgen/command_line/gulp_caller.py
def get_energy_relax_structure_buckingham(structure, gulp_cmd='gulp', keywords=('optimise', 'conp'), valence_dict=None): """ Relax a structure and compute the energy using Buckingham pot...
def get_energy_relax_structure_buckingham(structure, gulp_cmd='gulp', keywords=('optimise', 'conp'), valence_dict=None): """ Relax a structure and compute the energy using Buckingham pot...
[ "Relax", "a", "structure", "and", "compute", "the", "energy", "using", "Buckingham", "potential", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L594-L616
[ "def", "get_energy_relax_structure_buckingham", "(", "structure", ",", "gulp_cmd", "=", "'gulp'", ",", "keywords", "=", "(", "'optimise'", ",", "'conp'", ")", ",", "valence_dict", "=", "None", ")", ":", "gio", "=", "GulpIO", "(", ")", "gc", "=", "GulpCaller"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpIO.structure_lines
Generates GULP input string corresponding to pymatgen structure. Args: structure: pymatgen Structure object cell_flg (default = True): Option to use lattice parameters. fractional_flg (default = True): If True, fractional coordinates are used. Else, cartesian...
pymatgen/command_line/gulp_caller.py
def structure_lines(self, structure, cell_flg=True, frac_flg=True, anion_shell_flg=True, cation_shell_flg=False, symm_flg=True): """ Generates GULP input string corresponding to pymatgen structure. Args: structure: pymatgen Structure o...
def structure_lines(self, structure, cell_flg=True, frac_flg=True, anion_shell_flg=True, cation_shell_flg=False, symm_flg=True): """ Generates GULP input string corresponding to pymatgen structure. Args: structure: pymatgen Structure o...
[ "Generates", "GULP", "input", "string", "corresponding", "to", "pymatgen", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L101-L157
[ "def", "structure_lines", "(", "self", ",", "structure", ",", "cell_flg", "=", "True", ",", "frac_flg", "=", "True", ",", "anion_shell_flg", "=", "True", ",", "cation_shell_flg", "=", "False", ",", "symm_flg", "=", "True", ")", ":", "gin", "=", "\"\"", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpIO.library_line
Specifies GULP library file to read species and potential parameters. If using library don't specify species and potential in the input file and vice versa. Make sure the elements of structure are in the library file. Args: file_name: Name of GULP library file Retur...
pymatgen/command_line/gulp_caller.py
def library_line(self, file_name): """ Specifies GULP library file to read species and potential parameters. If using library don't specify species and potential in the input file and vice versa. Make sure the elements of structure are in the library file. Args: ...
def library_line(self, file_name): """ Specifies GULP library file to read species and potential parameters. If using library don't specify species and potential in the input file and vice versa. Make sure the elements of structure are in the library file. Args: ...
[ "Specifies", "GULP", "library", "file", "to", "read", "species", "and", "potential", "parameters", ".", "If", "using", "library", "don", "t", "specify", "species", "and", "potential", "in", "the", "input", "file", "and", "vice", "versa", ".", "Make", "sure",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L185-L237
[ "def", "library_line", "(", "self", ",", "file_name", ")", ":", "gulplib_set", "=", "lambda", ":", "'GULP_LIB'", "in", "os", ".", "environ", ".", "keys", "(", ")", "readable", "=", "lambda", "f", ":", "os", ".", "path", ".", "isfile", "(", "f", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpIO.buckingham_input
Gets a GULP input for an oxide structure and buckingham potential from library. Args: structure: pymatgen.core.structure.Structure keywords: GULP first line keywords. library (Default=None): File containing the species and potential. uc (Default=True): Un...
pymatgen/command_line/gulp_caller.py
def buckingham_input(self, structure, keywords, library=None, uc=True, valence_dict=None): """ Gets a GULP input for an oxide structure and buckingham potential from library. Args: structure: pymatgen.core.structure.Structure keywords: GU...
def buckingham_input(self, structure, keywords, library=None, uc=True, valence_dict=None): """ Gets a GULP input for an oxide structure and buckingham potential from library. Args: structure: pymatgen.core.structure.Structure keywords: GU...
[ "Gets", "a", "GULP", "input", "for", "an", "oxide", "structure", "and", "buckingham", "potential", "from", "library", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L239-L258
[ "def", "buckingham_input", "(", "self", ",", "structure", ",", "keywords", ",", "library", "=", "None", ",", "uc", "=", "True", ",", "valence_dict", "=", "None", ")", ":", "gin", "=", "self", ".", "keyword_line", "(", "*", "keywords", ")", "gin", "+=",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpIO.buckingham_potential
Generate species, buckingham, and spring options for an oxide structure using the parameters in default libraries. Ref: 1. G.V. Lewis and C.R.A. Catlow, J. Phys. C: Solid State Phys., 18, 1149-1161 (1985) 2. T.S.Bush, J.D.Gale, C.R.A.Catlow and P.D. Battle, ...
pymatgen/command_line/gulp_caller.py
def buckingham_potential(self, structure, val_dict=None): """ Generate species, buckingham, and spring options for an oxide structure using the parameters in default libraries. Ref: 1. G.V. Lewis and C.R.A. Catlow, J. Phys. C: Solid State Phys., 18, 1149-1161 ...
def buckingham_potential(self, structure, val_dict=None): """ Generate species, buckingham, and spring options for an oxide structure using the parameters in default libraries. Ref: 1. G.V. Lewis and C.R.A. Catlow, J. Phys. C: Solid State Phys., 18, 1149-1161 ...
[ "Generate", "species", "buckingham", "and", "spring", "options", "for", "an", "oxide", "structure", "using", "the", "parameters", "in", "default", "libraries", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L260-L329
[ "def", "buckingham_potential", "(", "self", ",", "structure", ",", "val_dict", "=", "None", ")", ":", "if", "not", "val_dict", ":", "try", ":", "#If structure is oxidation state decorated, use that first.", "el", "=", "[", "site", ".", "specie", ".", "symbol", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpIO.tersoff_input
Gets a GULP input with Tersoff potential for an oxide structure Args: structure: pymatgen.core.structure.Structure periodic (Default=False): Flag denoting whether periodic boundary conditions are used library (Default=None): File containing the species and po...
pymatgen/command_line/gulp_caller.py
def tersoff_input(self, structure, periodic=False, uc=True, *keywords): """ Gets a GULP input with Tersoff potential for an oxide structure Args: structure: pymatgen.core.structure.Structure periodic (Default=False): Flag denoting whether periodic boundar...
def tersoff_input(self, structure, periodic=False, uc=True, *keywords): """ Gets a GULP input with Tersoff potential for an oxide structure Args: structure: pymatgen.core.structure.Structure periodic (Default=False): Flag denoting whether periodic boundar...
[ "Gets", "a", "GULP", "input", "with", "Tersoff", "potential", "for", "an", "oxide", "structure" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L331-L350
[ "def", "tersoff_input", "(", "self", ",", "structure", ",", "periodic", "=", "False", ",", "uc", "=", "True", ",", "*", "keywords", ")", ":", "#gin=\"static noelectrostatics \\n \"", "gin", "=", "self", ".", "keyword_line", "(", "*", "keywords", ")", "gin", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpIO.tersoff_potential
Generate the species, tersoff potential lines for an oxide structure Args: structure: pymatgen.core.structure.Structure
pymatgen/command_line/gulp_caller.py
def tersoff_potential(self, structure): """ Generate the species, tersoff potential lines for an oxide structure Args: structure: pymatgen.core.structure.Structure """ bv = BVAnalyzer() el = [site.specie.symbol for site in structure] valences = bv.get...
def tersoff_potential(self, structure): """ Generate the species, tersoff potential lines for an oxide structure Args: structure: pymatgen.core.structure.Structure """ bv = BVAnalyzer() el = [site.specie.symbol for site in structure] valences = bv.get...
[ "Generate", "the", "species", "tersoff", "potential", "lines", "for", "an", "oxide", "structure" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L352-L383
[ "def", "tersoff_potential", "(", "self", ",", "structure", ")", ":", "bv", "=", "BVAnalyzer", "(", ")", "el", "=", "[", "site", ".", "specie", ".", "symbol", "for", "site", "in", "structure", "]", "valences", "=", "bv", ".", "get_valences", "(", "struc...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
GulpCaller.run
Run GULP using the gin as input Args: gin: GULP input string Returns: gout: GULP output string
pymatgen/command_line/gulp_caller.py
def run(self, gin): """ Run GULP using the gin as input Args: gin: GULP input string Returns: gout: GULP output string """ with ScratchDir("."): p = subprocess.Popen( self._gulp_cmd, stdout=subprocess.PIPE, ...
def run(self, gin): """ Run GULP using the gin as input Args: gin: GULP input string Returns: gout: GULP output string """ with ScratchDir("."): p = subprocess.Popen( self._gulp_cmd, stdout=subprocess.PIPE, ...
[ "Run", "GULP", "using", "the", "gin", "as", "input" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/gulp_caller.py#L512-L554
[ "def", "run", "(", "self", ",", "gin", ")", ":", "with", "ScratchDir", "(", "\".\"", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "self", ".", "_gulp_cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stdin", "=", "subprocess", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
autodoc_event_handlers
Print to the given string, the documentation for the events and the associated handlers.
pymatgen/io/abinit/events.py
def autodoc_event_handlers(stream=sys.stdout): """ Print to the given string, the documentation for the events and the associated handlers. """ lines = [] for cls in all_subclasses(EventHandler): if cls in _ABC_EVHANDLER_CLASSES: continue event_class = cls.event_class lin...
def autodoc_event_handlers(stream=sys.stdout): """ Print to the given string, the documentation for the events and the associated handlers. """ lines = [] for cls in all_subclasses(EventHandler): if cls in _ABC_EVHANDLER_CLASSES: continue event_class = cls.event_class lin...
[ "Print", "to", "the", "given", "string", "the", "documentation", "for", "the", "events", "and", "the", "associated", "handlers", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L660-L676
[ "def", "autodoc_event_handlers", "(", "stream", "=", "sys", ".", "stdout", ")", ":", "lines", "=", "[", "]", "for", "cls", "in", "all_subclasses", "(", "EventHandler", ")", ":", "if", "cls", "in", "_ABC_EVHANDLER_CLASSES", ":", "continue", "event_class", "="...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_event_handler_classes
Return the list of handler classes.
pymatgen/io/abinit/events.py
def get_event_handler_classes(categories=None): """Return the list of handler classes.""" classes = [c for c in all_subclasses(EventHandler) if c not in _ABC_EVHANDLER_CLASSES] return classes
def get_event_handler_classes(categories=None): """Return the list of handler classes.""" classes = [c for c in all_subclasses(EventHandler) if c not in _ABC_EVHANDLER_CLASSES] return classes
[ "Return", "the", "list", "of", "handler", "classes", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L679-L682
[ "def", "get_event_handler_classes", "(", "categories", "=", "None", ")", ":", "classes", "=", "[", "c", "for", "c", "in", "all_subclasses", "(", "EventHandler", ")", "if", "c", "not", "in", "_ABC_EVHANDLER_CLASSES", "]", "return", "classes" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
as_event_class
Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag
pymatgen/io/abinit/events.py
def as_event_class(obj): """ Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag """ if is_string(obj): for c in all_subclasses(AbinitEvent): if c.__name__ == obj or c.yaml_tag == obj: return c raise ValueE...
def as_event_class(obj): """ Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag """ if is_string(obj): for c in all_subclasses(AbinitEvent): if c.__name__ == obj or c.yaml_tag == obj: return c raise ValueE...
[ "Convert", "obj", "into", "a", "subclass", "of", "AbinitEvent", ".", "obj", "can", "be", "either", "a", "class", "or", "a", "string", "with", "the", "class", "name", "or", "the", "YAML", "tag" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L685-L697
[ "def", "as_event_class", "(", "obj", ")", ":", "if", "is_string", "(", "obj", ")", ":", "for", "c", "in", "all_subclasses", "(", "AbinitEvent", ")", ":", "if", "c", ".", "__name__", "==", "obj", "or", "c", ".", "yaml_tag", "==", "obj", ":", "return",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AbinitEvent.baseclass
The baseclass of self.
pymatgen/io/abinit/events.py
def baseclass(self): """The baseclass of self.""" for cls in _BASE_CLASSES: if isinstance(self, cls): return cls raise ValueError("Cannot determine the base class of %s" % self.__class__.__name__)
def baseclass(self): """The baseclass of self.""" for cls in _BASE_CLASSES: if isinstance(self, cls): return cls raise ValueError("Cannot determine the base class of %s" % self.__class__.__name__)
[ "The", "baseclass", "of", "self", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L146-L152
[ "def", "baseclass", "(", "self", ")", ":", "for", "cls", "in", "_BASE_CLASSES", ":", "if", "isinstance", "(", "self", ",", "cls", ")", ":", "return", "cls", "raise", "ValueError", "(", "\"Cannot determine the base class of %s\"", "%", "self", ".", "__class__",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EventReport.append
Add an event to the list.
pymatgen/io/abinit/events.py
def append(self, event): """Add an event to the list.""" self._events.append(event) self._events_by_baseclass[event.baseclass].append(event)
def append(self, event): """Add an event to the list.""" self._events.append(event) self._events_by_baseclass[event.baseclass].append(event)
[ "Add", "an", "event", "to", "the", "list", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L315-L318
[ "def", "append", "(", "self", ",", "event", ")", ":", "self", ".", "_events", ".", "append", "(", "event", ")", "self", ".", "_events_by_baseclass", "[", "event", ".", "baseclass", "]", ".", "append", "(", "event", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EventReport.set_run_completed
Set the value of _run_completed.
pymatgen/io/abinit/events.py
def set_run_completed(self, boolean, start_datetime, end_datetime): """Set the value of _run_completed.""" self._run_completed = boolean if (start_datetime, end_datetime) != (None, None): # start_datetime: Sat Feb 28 23:54:27 2015 # end_datetime: Sat Feb 28 23:54:30 2015...
def set_run_completed(self, boolean, start_datetime, end_datetime): """Set the value of _run_completed.""" self._run_completed = boolean if (start_datetime, end_datetime) != (None, None): # start_datetime: Sat Feb 28 23:54:27 2015 # end_datetime: Sat Feb 28 23:54:30 2015...
[ "Set", "the", "value", "of", "_run_completed", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L320-L333
[ "def", "set_run_completed", "(", "self", ",", "boolean", ",", "start_datetime", ",", "end_datetime", ")", ":", "self", ".", "_run_completed", "=", "boolean", "if", "(", "start_datetime", ",", "end_datetime", ")", "!=", "(", "None", ",", "None", ")", ":", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EventReport.run_etime
Wall-time of the run as `timedelta` object.
pymatgen/io/abinit/events.py
def run_etime(self): """Wall-time of the run as `timedelta` object.""" if self.start_datetime is None or self.end_datetime is None: return None return self.end_datetime - self.start_datetime
def run_etime(self): """Wall-time of the run as `timedelta` object.""" if self.start_datetime is None or self.end_datetime is None: return None return self.end_datetime - self.start_datetime
[ "Wall", "-", "time", "of", "the", "run", "as", "timedelta", "object", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L336-L341
[ "def", "run_etime", "(", "self", ")", ":", "if", "self", ".", "start_datetime", "is", "None", "or", "self", ".", "end_datetime", "is", "None", ":", "return", "None", "return", "self", ".", "end_datetime", "-", "self", ".", "start_datetime" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EventsParser.parse
Parse the given file. Return :class:`EventReport`.
pymatgen/io/abinit/events.py
def parse(self, filename, verbose=0): """ Parse the given file. Return :class:`EventReport`. """ run_completed, start_datetime, end_datetime = False, None, None filename = os.path.abspath(filename) report = EventReport(filename) w = WildCard("*Error|*Warning|*Com...
def parse(self, filename, verbose=0): """ Parse the given file. Return :class:`EventReport`. """ run_completed, start_datetime, end_datetime = False, None, None filename = os.path.abspath(filename) report = EventReport(filename) w = WildCard("*Error|*Warning|*Com...
[ "Parse", "the", "given", "file", ".", "Return", ":", "class", ":", "EventReport", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L416-L464
[ "def", "parse", "(", "self", ",", "filename", ",", "verbose", "=", "0", ")", ":", "run_completed", ",", "start_datetime", ",", "end_datetime", "=", "False", ",", "None", ",", "None", "filename", "=", "os", ".", "path", ".", "abspath", "(", "filename", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EventsParser.report_exception
This method is used when self.parser raises an Exception so that we can report a customized :class:`EventReport` object with info the exception.
pymatgen/io/abinit/events.py
def report_exception(self, filename, exc): """ This method is used when self.parser raises an Exception so that we can report a customized :class:`EventReport` object with info the exception. """ # Build fake event. event = AbinitError(src_file="Unknown", src_line=0, mess...
def report_exception(self, filename, exc): """ This method is used when self.parser raises an Exception so that we can report a customized :class:`EventReport` object with info the exception. """ # Build fake event. event = AbinitError(src_file="Unknown", src_line=0, mess...
[ "This", "method", "is", "used", "when", "self", ".", "parser", "raises", "an", "Exception", "so", "that", "we", "can", "report", "a", "customized", ":", "class", ":", "EventReport", "object", "with", "info", "the", "exception", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L466-L473
[ "def", "report_exception", "(", "self", ",", "filename", ",", "exc", ")", ":", "# Build fake event.", "event", "=", "AbinitError", "(", "src_file", "=", "\"Unknown\"", ",", "src_line", "=", "0", ",", "message", "=", "str", "(", "exc", ")", ")", "return", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EventHandler.count
Return the number of times the event associated to this handler has been already fixed in the :class:`Task`.
pymatgen/io/abinit/events.py
def count(self, task): """ Return the number of times the event associated to this handler has been already fixed in the :class:`Task`. """ return len([c for c in task.corrections if c["event"]["@class"] == self.event_class])
def count(self, task): """ Return the number of times the event associated to this handler has been already fixed in the :class:`Task`. """ return len([c for c in task.corrections if c["event"]["@class"] == self.event_class])
[ "Return", "the", "number", "of", "times", "the", "event", "associated", "to", "this", "handler", "has", "been", "already", "fixed", "in", "the", ":", "class", ":", "Task", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/events.py#L546-L551
[ "def", "count", "(", "self", ",", "task", ")", ":", "return", "len", "(", "[", "c", "for", "c", "in", "task", ".", "corrections", "if", "c", "[", "\"event\"", "]", "[", "\"@class\"", "]", "==", "self", ".", "event_class", "]", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectPhaseDiagram.find_stable_charges
Sets the stable charges and transition states for a series of defect entries. This function uses scipy's HalfspaceInterection to oncstruct the polygons corresponding to defect stability as a function of the Fermi-level. The Halfspace Intersection constructs N-dimensional hyperplanes, in ...
pymatgen/analysis/defects/thermodynamics.py
def find_stable_charges(self): """ Sets the stable charges and transition states for a series of defect entries. This function uses scipy's HalfspaceInterection to oncstruct the polygons corresponding to defect stability as a function of the Fermi-level. The Halfspace Intersectio...
def find_stable_charges(self): """ Sets the stable charges and transition states for a series of defect entries. This function uses scipy's HalfspaceInterection to oncstruct the polygons corresponding to defect stability as a function of the Fermi-level. The Halfspace Intersectio...
[ "Sets", "the", "stable", "charges", "and", "transition", "states", "for", "a", "series", "of", "defect", "entries", ".", "This", "function", "uses", "scipy", "s", "HalfspaceInterection", "to", "oncstruct", "the", "polygons", "corresponding", "to", "defect", "sta...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/thermodynamics.py#L51-L147
[ "def", "find_stable_charges", "(", "self", ")", ":", "def", "similar_defect", "(", "a", ")", ":", "\"\"\"\n Used to filter out similar defects of different charges which\n are defined by the same type and location\n \"\"\"", "return", "(", "a", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectPhaseDiagram.all_unstable_entries
List all unstable entries (defect+charge) in the DefectPhaseDiagram
pymatgen/analysis/defects/thermodynamics.py
def all_unstable_entries(self): """ List all unstable entries (defect+charge) in the DefectPhaseDiagram """ all_stable_entries = self.all_stable_entries return [e for e in self.entries if e not in all_stable_entries]
def all_unstable_entries(self): """ List all unstable entries (defect+charge) in the DefectPhaseDiagram """ all_stable_entries = self.all_stable_entries return [e for e in self.entries if e not in all_stable_entries]
[ "List", "all", "unstable", "entries", "(", "defect", "+", "charge", ")", "in", "the", "DefectPhaseDiagram" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/thermodynamics.py#L164-L169
[ "def", "all_unstable_entries", "(", "self", ")", ":", "all_stable_entries", "=", "self", ".", "all_stable_entries", "return", "[", "e", "for", "e", "in", "self", ".", "entries", "if", "e", "not", "in", "all_stable_entries", "]" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectPhaseDiagram.defect_concentrations
Give list of all concentrations at specified efermi in the DefectPhaseDiagram args: chemical_potentials = {Element: number} is dictionary of chemical potentials to provide formation energies for temperature = temperature to produce concentrations from fermi_level: (float) is ...
pymatgen/analysis/defects/thermodynamics.py
def defect_concentrations(self, chemical_potentials, temperature=300, fermi_level=0.): """ Give list of all concentrations at specified efermi in the DefectPhaseDiagram args: chemical_potentials = {Element: number} is dictionary of chemical potentials to provide formation energies fo...
def defect_concentrations(self, chemical_potentials, temperature=300, fermi_level=0.): """ Give list of all concentrations at specified efermi in the DefectPhaseDiagram args: chemical_potentials = {Element: number} is dictionary of chemical potentials to provide formation energies fo...
[ "Give", "list", "of", "all", "concentrations", "at", "specified", "efermi", "in", "the", "DefectPhaseDiagram", "args", ":", "chemical_potentials", "=", "{", "Element", ":", "number", "}", "is", "dictionary", "of", "chemical", "potentials", "to", "provide", "form...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/thermodynamics.py#L171-L194
[ "def", "defect_concentrations", "(", "self", ",", "chemical_potentials", ",", "temperature", "=", "300", ",", "fermi_level", "=", "0.", ")", ":", "concentrations", "=", "[", "]", "for", "dfct", "in", "self", ".", "all_stable_entries", ":", "concentrations", "....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectPhaseDiagram.suggest_charges
Suggest possible charges for defects to computee based on proximity of known transitions from entires to VBM and CBM Args: tolerance (float): tolerance with respect to the VBM and CBM to ` continue to compute new charges
pymatgen/analysis/defects/thermodynamics.py
def suggest_charges(self, tolerance=0.1): """ Suggest possible charges for defects to computee based on proximity of known transitions from entires to VBM and CBM Args: tolerance (float): tolerance with respect to the VBM and CBM to ` continue to...
def suggest_charges(self, tolerance=0.1): """ Suggest possible charges for defects to computee based on proximity of known transitions from entires to VBM and CBM Args: tolerance (float): tolerance with respect to the VBM and CBM to ` continue to...
[ "Suggest", "possible", "charges", "for", "defects", "to", "computee", "based", "on", "proximity", "of", "known", "transitions", "from", "entires", "to", "VBM", "and", "CBM" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/thermodynamics.py#L196-L232
[ "def", "suggest_charges", "(", "self", ",", "tolerance", "=", "0.1", ")", ":", "recommendations", "=", "{", "}", "for", "def_type", "in", "self", ".", "defect_types", ":", "test_charges", "=", "np", ".", "arange", "(", "np", ".", "min", "(", "self", "....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectPhaseDiagram.solve_for_fermi_energy
Solve for the Fermi energy self-consistently as a function of T and p_O2 Observations are Defect concentrations, electron and hole conc Args: bulk_dos: bulk system dos (pymatgen Dos object) gap: Can be used to specify experimental gap. Will be useful if th...
pymatgen/analysis/defects/thermodynamics.py
def solve_for_fermi_energy(self, temperature, chemical_potentials, bulk_dos): """ Solve for the Fermi energy self-consistently as a function of T and p_O2 Observations are Defect concentrations, electron and hole conc Args: bulk_dos: bulk system dos (pymatgen Dos obje...
def solve_for_fermi_energy(self, temperature, chemical_potentials, bulk_dos): """ Solve for the Fermi energy self-consistently as a function of T and p_O2 Observations are Defect concentrations, electron and hole conc Args: bulk_dos: bulk system dos (pymatgen Dos obje...
[ "Solve", "for", "the", "Fermi", "energy", "self", "-", "consistently", "as", "a", "function", "of", "T", "and", "p_O2", "Observations", "are", "Defect", "concentrations", "electron", "and", "hole", "conc", "Args", ":", "bulk_dos", ":", "bulk", "system", "dos...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/thermodynamics.py#L234-L260
[ "def", "solve_for_fermi_energy", "(", "self", ",", "temperature", ",", "chemical_potentials", ",", "bulk_dos", ")", ":", "fdos", "=", "FermiDos", "(", "bulk_dos", ",", "bandgap", "=", "self", ".", "band_gap", ")", "def", "_get_total_q", "(", "ef", ")", ":", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
XcFunc.asxc
Convert object into Xcfunc.
pymatgen/core/xcfunc.py
def asxc(cls, obj): """Convert object into Xcfunc.""" if isinstance(obj, cls): return obj if is_string(obj): return cls.from_name(obj) raise TypeError("Don't know how to convert <%s:%s> to Xcfunc" % (type(obj), str(obj)))
def asxc(cls, obj): """Convert object into Xcfunc.""" if isinstance(obj, cls): return obj if is_string(obj): return cls.from_name(obj) raise TypeError("Don't know how to convert <%s:%s> to Xcfunc" % (type(obj), str(obj)))
[ "Convert", "object", "into", "Xcfunc", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L118-L122
[ "def", "asxc", "(", "cls", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "cls", ")", ":", "return", "obj", "if", "is_string", "(", "obj", ")", ":", "return", "cls", ".", "from_name", "(", "obj", ")", "raise", "TypeError", "(", "\"Don't...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da