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 | calculate_similar_artists | generates a list of similar artists in lastfm by utiliizing the 'similar_items'
api of the models | examples/lastfm.py | def calculate_similar_artists(output_filename, model_name="als"):
""" generates a list of similar artists in lastfm by utiliizing the 'similar_items'
api of the models """
artists, users, plays = get_lastfm()
# create a model from the input data
model = get_model(model_name)
# if we're trainin... | def calculate_similar_artists(output_filename, model_name="als"):
""" generates a list of similar artists in lastfm by utiliizing the 'similar_items'
api of the models """
artists, users, plays = get_lastfm()
# create a model from the input data
model = get_model(model_name)
# if we're trainin... | [
"generates",
"a",
"list",
"of",
"similar",
"artists",
"in",
"lastfm",
"by",
"utiliizing",
"the",
"similar_items",
"api",
"of",
"the",
"models"
] | benfred/implicit | python | https://github.com/benfred/implicit/blob/6b16c50d1d514a814f2e5b8cf2a829ff23dbba63/examples/lastfm.py#L55-L98 | [
"def",
"calculate_similar_artists",
"(",
"output_filename",
",",
"model_name",
"=",
"\"als\"",
")",
":",
"artists",
",",
"users",
",",
"plays",
"=",
"get_lastfm",
"(",
")",
"# create a model from the input data",
"model",
"=",
"get_model",
"(",
"model_name",
")",
... | 6b16c50d1d514a814f2e5b8cf2a829ff23dbba63 |
train | calculate_recommendations | Generates artist recommendations for each user in the dataset | examples/lastfm.py | def calculate_recommendations(output_filename, model_name="als"):
""" Generates artist recommendations for each user in the dataset """
# train the model based off input params
artists, users, plays = get_lastfm()
# create a model from the input data
model = get_model(model_name)
# if we're tr... | def calculate_recommendations(output_filename, model_name="als"):
""" Generates artist recommendations for each user in the dataset """
# train the model based off input params
artists, users, plays = get_lastfm()
# create a model from the input data
model = get_model(model_name)
# if we're tr... | [
"Generates",
"artist",
"recommendations",
"for",
"each",
"user",
"in",
"the",
"dataset"
] | benfred/implicit | python | https://github.com/benfred/implicit/blob/6b16c50d1d514a814f2e5b8cf2a829ff23dbba63/examples/lastfm.py#L101-L136 | [
"def",
"calculate_recommendations",
"(",
"output_filename",
",",
"model_name",
"=",
"\"als\"",
")",
":",
"# train the model based off input params",
"artists",
",",
"users",
",",
"plays",
"=",
"get_lastfm",
"(",
")",
"# create a model from the input data",
"model",
"=",
... | 6b16c50d1d514a814f2e5b8cf2a829ff23dbba63 |
train | ion_or_solid_comp_object | Returns either an ion object or composition object given
a formula.
Args:
formula: String formula. Eg. of ion: NaOH(aq), Na[+];
Eg. of solid: Fe2O3(s), Fe(s), Na2O
Returns:
Composition/Ion object | pymatgen/analysis/pourbaix_diagram.py | def ion_or_solid_comp_object(formula):
"""
Returns either an ion object or composition object given
a formula.
Args:
formula: String formula. Eg. of ion: NaOH(aq), Na[+];
Eg. of solid: Fe2O3(s), Fe(s), Na2O
Returns:
Composition/Ion object
"""
m = re.search(r"\[(... | def ion_or_solid_comp_object(formula):
"""
Returns either an ion object or composition object given
a formula.
Args:
formula: String formula. Eg. of ion: NaOH(aq), Na[+];
Eg. of solid: Fe2O3(s), Fe(s), Na2O
Returns:
Composition/Ion object
"""
m = re.search(r"\[(... | [
"Returns",
"either",
"an",
"ion",
"object",
"or",
"composition",
"object",
"given",
"a",
"formula",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L360-L379 | [
"def",
"ion_or_solid_comp_object",
"(",
"formula",
")",
":",
"m",
"=",
"re",
".",
"search",
"(",
"r\"\\[([^\\[\\]]+)\\]|\\(aq\\)\"",
",",
"formula",
")",
"if",
"m",
":",
"comp_obj",
"=",
"Ion",
".",
"from_formula",
"(",
"formula",
")",
"elif",
"re",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | generate_entry_label | Generates a label for the pourbaix plotter
Args:
entry (PourbaixEntry or MultiEntry): entry to get a label for | pymatgen/analysis/pourbaix_diagram.py | def generate_entry_label(entry):
"""
Generates a label for the pourbaix plotter
Args:
entry (PourbaixEntry or MultiEntry): entry to get a label for
"""
if isinstance(entry, MultiEntry):
return " + ".join([latexify_ion(e.name) for e in entry.entry_list])
else:
return late... | def generate_entry_label(entry):
"""
Generates a label for the pourbaix plotter
Args:
entry (PourbaixEntry or MultiEntry): entry to get a label for
"""
if isinstance(entry, MultiEntry):
return " + ".join([latexify_ion(e.name) for e in entry.entry_list])
else:
return late... | [
"Generates",
"a",
"label",
"for",
"the",
"pourbaix",
"plotter"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L887-L897 | [
"def",
"generate_entry_label",
"(",
"entry",
")",
":",
"if",
"isinstance",
"(",
"entry",
",",
"MultiEntry",
")",
":",
"return",
"\" + \"",
".",
"join",
"(",
"[",
"latexify_ion",
"(",
"e",
".",
"name",
")",
"for",
"e",
"in",
"entry",
".",
"entry_list",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixEntry.energy_at_conditions | Get free energy for a given pH and V
Args:
pH (float): pH at which to evaluate free energy
V (float): voltage at which to evaluate free energy
Returns:
free energy at conditions | pymatgen/analysis/pourbaix_diagram.py | def energy_at_conditions(self, pH, V):
"""
Get free energy for a given pH and V
Args:
pH (float): pH at which to evaluate free energy
V (float): voltage at which to evaluate free energy
Returns:
free energy at conditions
"""
return se... | def energy_at_conditions(self, pH, V):
"""
Get free energy for a given pH and V
Args:
pH (float): pH at which to evaluate free energy
V (float): voltage at which to evaluate free energy
Returns:
free energy at conditions
"""
return se... | [
"Get",
"free",
"energy",
"for",
"a",
"given",
"pH",
"and",
"V"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L132-L143 | [
"def",
"energy_at_conditions",
"(",
"self",
",",
"pH",
",",
"V",
")",
":",
"return",
"self",
".",
"energy",
"+",
"self",
".",
"npH",
"*",
"PREFAC",
"*",
"pH",
"+",
"self",
".",
"nPhi",
"*",
"V"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixEntry.normalized_energy_at_conditions | Energy at an electrochemical condition, compatible with
numpy arrays for pH/V input
Args:
pH (float): pH at condition
V (float): applied potential at condition
Returns:
energy normalized by number of non-O/H atoms at condition | pymatgen/analysis/pourbaix_diagram.py | def normalized_energy_at_conditions(self, pH, V):
"""
Energy at an electrochemical condition, compatible with
numpy arrays for pH/V input
Args:
pH (float): pH at condition
V (float): applied potential at condition
Returns:
energy normalized b... | def normalized_energy_at_conditions(self, pH, V):
"""
Energy at an electrochemical condition, compatible with
numpy arrays for pH/V input
Args:
pH (float): pH at condition
V (float): applied potential at condition
Returns:
energy normalized b... | [
"Energy",
"at",
"an",
"electrochemical",
"condition",
"compatible",
"with",
"numpy",
"arrays",
"for",
"pH",
"/",
"V",
"input"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L154-L166 | [
"def",
"normalized_energy_at_conditions",
"(",
"self",
",",
"pH",
",",
"V",
")",
":",
"return",
"self",
".",
"energy_at_conditions",
"(",
"pH",
",",
"V",
")",
"*",
"self",
".",
"normalization_factor"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixEntry.as_dict | Returns dict which contains Pourbaix Entry data.
Note that the pH, voltage, H2O factors are always calculated when
constructing a PourbaixEntry object. | pymatgen/analysis/pourbaix_diagram.py | def as_dict(self):
"""
Returns dict which contains Pourbaix Entry data.
Note that the pH, voltage, H2O factors are always calculated when
constructing a PourbaixEntry object.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__}
... | def as_dict(self):
"""
Returns dict which contains Pourbaix Entry data.
Note that the pH, voltage, H2O factors are always calculated when
constructing a PourbaixEntry object.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__}
... | [
"Returns",
"dict",
"which",
"contains",
"Pourbaix",
"Entry",
"data",
".",
"Note",
"that",
"the",
"pH",
"voltage",
"H2O",
"factors",
"are",
"always",
"calculated",
"when",
"constructing",
"a",
"PourbaixEntry",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L177-L192 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
"}",
"if",
"isinstance",
"(",
"self",
".",
"entry",
",",
"IonEnt... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixEntry.from_dict | Invokes | pymatgen/analysis/pourbaix_diagram.py | def from_dict(cls, d):
"""
Invokes
"""
entry_type = d["entry_type"]
if entry_type == "Ion":
entry = IonEntry.from_dict(d["entry"])
else:
entry = PDEntry.from_dict(d["entry"])
entry_id = d["entry_id"]
concentration = d["concentration... | def from_dict(cls, d):
"""
Invokes
"""
entry_type = d["entry_type"]
if entry_type == "Ion":
entry = IonEntry.from_dict(d["entry"])
else:
entry = PDEntry.from_dict(d["entry"])
entry_id = d["entry_id"]
concentration = d["concentration... | [
"Invokes"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L195-L206 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"entry_type",
"=",
"d",
"[",
"\"entry_type\"",
"]",
"if",
"entry_type",
"==",
"\"Ion\"",
":",
"entry",
"=",
"IonEntry",
".",
"from_dict",
"(",
"d",
"[",
"\"entry\"",
"]",
")",
"else",
":",
"entry",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixEntry.normalization_factor | Sum of number of atoms minus the number of H and O in composition | pymatgen/analysis/pourbaix_diagram.py | def normalization_factor(self):
"""
Sum of number of atoms minus the number of H and O in composition
"""
return 1.0 / (self.num_atoms - self.composition.get('H', 0)
- self.composition.get('O', 0)) | def normalization_factor(self):
"""
Sum of number of atoms minus the number of H and O in composition
"""
return 1.0 / (self.num_atoms - self.composition.get('H', 0)
- self.composition.get('O', 0)) | [
"Sum",
"of",
"number",
"of",
"atoms",
"minus",
"the",
"number",
"of",
"H",
"and",
"O",
"in",
"composition"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L209-L214 | [
"def",
"normalization_factor",
"(",
"self",
")",
":",
"return",
"1.0",
"/",
"(",
"self",
".",
"num_atoms",
"-",
"self",
".",
"composition",
".",
"get",
"(",
"'H'",
",",
"0",
")",
"-",
"self",
".",
"composition",
".",
"get",
"(",
"'O'",
",",
"0",
")... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | IonEntry.from_dict | Returns an IonEntry object from a dict. | pymatgen/analysis/pourbaix_diagram.py | def from_dict(cls, d):
"""
Returns an IonEntry object from a dict.
"""
return IonEntry(Ion.from_dict(d["ion"]), d["energy"], d.get("name", None)) | def from_dict(cls, d):
"""
Returns an IonEntry object from a dict.
"""
return IonEntry(Ion.from_dict(d["ion"]), d["energy"], d.get("name", None)) | [
"Returns",
"an",
"IonEntry",
"object",
"from",
"a",
"dict",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L338-L342 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"return",
"IonEntry",
"(",
"Ion",
".",
"from_dict",
"(",
"d",
"[",
"\"ion\"",
"]",
")",
",",
"d",
"[",
"\"energy\"",
"]",
",",
"d",
".",
"get",
"(",
"\"name\"",
",",
"None",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | IonEntry.as_dict | Creates a dict of composition, energy, and ion name | pymatgen/analysis/pourbaix_diagram.py | def as_dict(self):
"""
Creates a dict of composition, energy, and ion name
"""
d = {"ion": self.ion.as_dict(), "energy": self.energy,
"name": self.name}
return d | def as_dict(self):
"""
Creates a dict of composition, energy, and ion name
"""
d = {"ion": self.ion.as_dict(), "energy": self.energy,
"name": self.name}
return d | [
"Creates",
"a",
"dict",
"of",
"composition",
"energy",
"and",
"ion",
"name"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L344-L350 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"ion\"",
":",
"self",
".",
"ion",
".",
"as_dict",
"(",
")",
",",
"\"energy\"",
":",
"self",
".",
"energy",
",",
"\"name\"",
":",
"self",
".",
"name",
"}",
"return",
"d"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixDiagram._generate_multielement_entries | Create entries for multi-element Pourbaix construction.
This works by finding all possible linear combinations
of entries that can result in the specified composition
from the initialized comp_dict.
Args:
entries ([PourbaixEntries]): list of pourbaix entries
... | pymatgen/analysis/pourbaix_diagram.py | def _generate_multielement_entries(self, entries, forced_include=None,
nproc=None):
"""
Create entries for multi-element Pourbaix construction.
This works by finding all possible linear combinations
of entries that can result in the specified compo... | def _generate_multielement_entries(self, entries, forced_include=None,
nproc=None):
"""
Create entries for multi-element Pourbaix construction.
This works by finding all possible linear combinations
of entries that can result in the specified compo... | [
"Create",
"entries",
"for",
"multi",
"-",
"element",
"Pourbaix",
"construction",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L494-L546 | [
"def",
"_generate_multielement_entries",
"(",
"self",
",",
"entries",
",",
"forced_include",
"=",
"None",
",",
"nproc",
"=",
"None",
")",
":",
"N",
"=",
"len",
"(",
"self",
".",
"_elt_comp",
")",
"# No. of elements",
"total_comp",
"=",
"Composition",
"(",
"s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixDiagram.process_multientry | Static method for finding a multientry based on
a list of entries and a product composition.
Essentially checks to see if a valid aqueous
reaction exists between the entries and the
product composition and returns a MultiEntry
with weights according to the coefficients if so.
... | pymatgen/analysis/pourbaix_diagram.py | def process_multientry(entry_list, prod_comp, coeff_threshold=1e-4):
"""
Static method for finding a multientry based on
a list of entries and a product composition.
Essentially checks to see if a valid aqueous
reaction exists between the entries and the
product compositi... | def process_multientry(entry_list, prod_comp, coeff_threshold=1e-4):
"""
Static method for finding a multientry based on
a list of entries and a product composition.
Essentially checks to see if a valid aqueous
reaction exists between the entries and the
product compositi... | [
"Static",
"method",
"for",
"finding",
"a",
"multientry",
"based",
"on",
"a",
"list",
"of",
"entries",
"and",
"a",
"product",
"composition",
".",
"Essentially",
"checks",
"to",
"see",
"if",
"a",
"valid",
"aqueous",
"reaction",
"exists",
"between",
"the",
"ent... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L549-L583 | [
"def",
"process_multientry",
"(",
"entry_list",
",",
"prod_comp",
",",
"coeff_threshold",
"=",
"1e-4",
")",
":",
"dummy_oh",
"=",
"[",
"Composition",
"(",
"\"H\"",
")",
",",
"Composition",
"(",
"\"O\"",
")",
"]",
"try",
":",
"# Get balanced reaction coeffs, ensu... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixDiagram.get_pourbaix_domains | Returns a set of pourbaix stable domains (i. e. polygons) in
pH-V space from a list of pourbaix_entries
This function works by using scipy's HalfspaceIntersection
function to construct all of the 2-D polygons that form the
boundaries of the planes corresponding to individual entry
... | pymatgen/analysis/pourbaix_diagram.py | def get_pourbaix_domains(pourbaix_entries, limits=None):
"""
Returns a set of pourbaix stable domains (i. e. polygons) in
pH-V space from a list of pourbaix_entries
This function works by using scipy's HalfspaceIntersection
function to construct all of the 2-D polygons that form... | def get_pourbaix_domains(pourbaix_entries, limits=None):
"""
Returns a set of pourbaix stable domains (i. e. polygons) in
pH-V space from a list of pourbaix_entries
This function works by using scipy's HalfspaceIntersection
function to construct all of the 2-D polygons that form... | [
"Returns",
"a",
"set",
"of",
"pourbaix",
"stable",
"domains",
"(",
"i",
".",
"e",
".",
"polygons",
")",
"in",
"pH",
"-",
"V",
"space",
"from",
"a",
"list",
"of",
"pourbaix_entries"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L586-L667 | [
"def",
"get_pourbaix_domains",
"(",
"pourbaix_entries",
",",
"limits",
"=",
"None",
")",
":",
"if",
"limits",
"is",
"None",
":",
"limits",
"=",
"[",
"[",
"-",
"2",
",",
"16",
"]",
",",
"[",
"-",
"4",
",",
"4",
"]",
"]",
"# Get hyperplanes",
"hyperpla... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixDiagram.find_stable_entry | Finds stable entry at a pH,V condition
Args:
pH (float): pH to find stable entry
V (float): V to find stable entry
Returns: | pymatgen/analysis/pourbaix_diagram.py | def find_stable_entry(self, pH, V):
"""
Finds stable entry at a pH,V condition
Args:
pH (float): pH to find stable entry
V (float): V to find stable entry
Returns:
"""
energies_at_conditions = [e.normalized_energy_at_conditions(pH, V)
... | def find_stable_entry(self, pH, V):
"""
Finds stable entry at a pH,V condition
Args:
pH (float): pH to find stable entry
V (float): V to find stable entry
Returns:
"""
energies_at_conditions = [e.normalized_energy_at_conditions(pH, V)
... | [
"Finds",
"stable",
"entry",
"at",
"a",
"pH",
"V",
"condition",
"Args",
":",
"pH",
"(",
"float",
")",
":",
"pH",
"to",
"find",
"stable",
"entry",
"V",
"(",
"float",
")",
":",
"V",
"to",
"find",
"stable",
"entry"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L669-L681 | [
"def",
"find_stable_entry",
"(",
"self",
",",
"pH",
",",
"V",
")",
":",
"energies_at_conditions",
"=",
"[",
"e",
".",
"normalized_energy_at_conditions",
"(",
"pH",
",",
"V",
")",
"for",
"e",
"in",
"self",
".",
"stable_entries",
"]",
"return",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixDiagram.get_decomposition_energy | Finds decomposition to most stable entry
Args:
entry (PourbaixEntry): PourbaixEntry corresponding to
compound to find the decomposition for
pH (float): pH at which to find the decomposition
V (float): voltage at which to find the decomposition
Return... | pymatgen/analysis/pourbaix_diagram.py | def get_decomposition_energy(self, entry, pH, V):
"""
Finds decomposition to most stable entry
Args:
entry (PourbaixEntry): PourbaixEntry corresponding to
compound to find the decomposition for
pH (float): pH at which to find the decomposition
... | def get_decomposition_energy(self, entry, pH, V):
"""
Finds decomposition to most stable entry
Args:
entry (PourbaixEntry): PourbaixEntry corresponding to
compound to find the decomposition for
pH (float): pH at which to find the decomposition
... | [
"Finds",
"decomposition",
"to",
"most",
"stable",
"entry"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L683-L714 | [
"def",
"get_decomposition_energy",
"(",
"self",
",",
"entry",
",",
"pH",
",",
"V",
")",
":",
"# Find representative multientry",
"if",
"self",
".",
"_multielement",
"and",
"not",
"isinstance",
"(",
"entry",
",",
"MultiEntry",
")",
":",
"possible_entries",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixPlotter.show | Shows the pourbaix plot
Args:
*args: args to get_pourbaix_plot
**kwargs: kwargs to get_pourbaix_plot
Returns:
None | pymatgen/analysis/pourbaix_diagram.py | def show(self, *args, **kwargs):
"""
Shows the pourbaix plot
Args:
*args: args to get_pourbaix_plot
**kwargs: kwargs to get_pourbaix_plot
Returns:
None
"""
plt = self.get_pourbaix_plot(*args, **kwargs)
plt.show() | def show(self, *args, **kwargs):
"""
Shows the pourbaix plot
Args:
*args: args to get_pourbaix_plot
**kwargs: kwargs to get_pourbaix_plot
Returns:
None
"""
plt = self.get_pourbaix_plot(*args, **kwargs)
plt.show() | [
"Shows",
"the",
"pourbaix",
"plot"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L782-L794 | [
"def",
"show",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
"=",
"self",
".",
"get_pourbaix_plot",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"plt",
".",
"show",
"(",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourbaixPlotter.get_pourbaix_plot | Plot Pourbaix diagram.
Args:
limits: 2D list containing limits of the Pourbaix diagram
of the form [[xlo, xhi], [ylo, yhi]]
title (str): Title to display on plot
label_domains (bool): whether to label pourbaix domains
plt (pyplot): Pyplot instance... | pymatgen/analysis/pourbaix_diagram.py | def get_pourbaix_plot(self, limits=None, title="",
label_domains=True, plt=None):
"""
Plot Pourbaix diagram.
Args:
limits: 2D list containing limits of the Pourbaix diagram
of the form [[xlo, xhi], [ylo, yhi]]
title (str): Title ... | def get_pourbaix_plot(self, limits=None, title="",
label_domains=True, plt=None):
"""
Plot Pourbaix diagram.
Args:
limits: 2D list containing limits of the Pourbaix diagram
of the form [[xlo, xhi], [ylo, yhi]]
title (str): Title ... | [
"Plot",
"Pourbaix",
"diagram",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/pourbaix_diagram.py#L796-L846 | [
"def",
"get_pourbaix_plot",
"(",
"self",
",",
"limits",
"=",
"None",
",",
"title",
"=",
"\"\"",
",",
"label_domains",
"=",
"True",
",",
"plt",
"=",
"None",
")",
":",
"if",
"limits",
"is",
"None",
":",
"limits",
"=",
"[",
"[",
"-",
"2",
",",
"16",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | TranslateSitesTransformation.as_dict | Json-serializable dict representation. | pymatgen/transformations/site_transformations.py | def as_dict(self):
"""
Json-serializable dict representation.
"""
d = MSONable.as_dict(self)
d["translation_vector"] = self.translation_vector.tolist()
return d | def as_dict(self):
"""
Json-serializable dict representation.
"""
d = MSONable.as_dict(self)
d["translation_vector"] = self.translation_vector.tolist()
return d | [
"Json",
"-",
"serializable",
"dict",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/site_transformations.py#L199-L205 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"MSONable",
".",
"as_dict",
"(",
"self",
")",
"d",
"[",
"\"translation_vector\"",
"]",
"=",
"self",
".",
"translation_vector",
".",
"tolist",
"(",
")",
"return",
"d"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PartialRemoveSitesTransformation.fast_ordering | This method uses the matrix form of ewaldsum to calculate the ewald
sums of the potential structures. This is on the order of 4 orders of
magnitude faster when there are large numbers of permutations to
consider. There are further optimizations possible (doing a smarter
search of permuta... | pymatgen/transformations/site_transformations.py | def fast_ordering(self, structure, num_remove_dict, num_to_return=1):
"""
This method uses the matrix form of ewaldsum to calculate the ewald
sums of the potential structures. This is on the order of 4 orders of
magnitude faster when there are large numbers of permutations to
con... | def fast_ordering(self, structure, num_remove_dict, num_to_return=1):
"""
This method uses the matrix form of ewaldsum to calculate the ewald
sums of the potential structures. This is on the order of 4 orders of
magnitude faster when there are large numbers of permutations to
con... | [
"This",
"method",
"uses",
"the",
"matrix",
"form",
"of",
"ewaldsum",
"to",
"calculate",
"the",
"ewald",
"sums",
"of",
"the",
"potential",
"structures",
".",
"This",
"is",
"on",
"the",
"order",
"of",
"4",
"orders",
"of",
"magnitude",
"faster",
"when",
"ther... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/site_transformations.py#L368-L417 | [
"def",
"fast_ordering",
"(",
"self",
",",
"structure",
",",
"num_remove_dict",
",",
"num_to_return",
"=",
"1",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Performing fast ordering\"",
")",
"starttime",
"=",
"time",
".",
"time",
"(",
")",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PartialRemoveSitesTransformation.apply_transformation | Apply the transformation.
Args:
structure: input structure
return_ranked_list (bool): Whether or not multiple structures are
returned. If return_ranked_list is a number, that number of
structures is returned.
Returns:
Depending on ret... | pymatgen/transformations/site_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply the transformation.
Args:
structure: input structure
return_ranked_list (bool): Whether or not multiple structures are
returned. If return_ranked_list is a number, that number ... | def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply the transformation.
Args:
structure: input structure
return_ranked_list (bool): Whether or not multiple structures are
returned. If return_ranked_list is a number, that number ... | [
"Apply",
"the",
"transformation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/site_transformations.py#L434-L496 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"num_remove_dict",
"=",
"{",
"}",
"total_combis",
"=",
"0",
"for",
"indices",
",",
"frac",
"in",
"zip",
"(",
"self",
".",
"indices",
",",
"self... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AddSitePropertyTransformation.apply_transformation | apply the transformation
Args:
structure (Structure): structure to add site properties to | pymatgen/transformations/site_transformations.py | def apply_transformation(self, structure):
"""
apply the transformation
Args:
structure (Structure): structure to add site properties to
"""
new_structure = structure.copy()
for prop in self.site_properties.keys():
new_structure.add_site_p... | def apply_transformation(self, structure):
"""
apply the transformation
Args:
structure (Structure): structure to add site properties to
"""
new_structure = structure.copy()
for prop in self.site_properties.keys():
new_structure.add_site_p... | [
"apply",
"the",
"transformation",
"Args",
":",
"structure",
"(",
"Structure",
")",
":",
"structure",
"to",
"add",
"site",
"properties",
"to"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/site_transformations.py#L525-L535 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
")",
":",
"new_structure",
"=",
"structure",
".",
"copy",
"(",
")",
"for",
"prop",
"in",
"self",
".",
"site_properties",
".",
"keys",
"(",
")",
":",
"new_structure",
".",
"add_site_property",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | write_lammps_inputs | Writes input files for a LAMMPS run. Input script is constructed
from a str template with placeholders to be filled by custom
settings. Data file is either written from a LammpsData
instance or copied from an existing file if read_data cmd is
inspected in the input script. Other supporting files are not... | pymatgen/io/lammps/inputs.py | def write_lammps_inputs(output_dir, script_template, settings=None,
data=None, script_filename="in.lammps",
make_dir_if_not_present=True, **kwargs):
"""
Writes input files for a LAMMPS run. Input script is constructed
from a str template with placeholders to b... | def write_lammps_inputs(output_dir, script_template, settings=None,
data=None, script_filename="in.lammps",
make_dir_if_not_present=True, **kwargs):
"""
Writes input files for a LAMMPS run. Input script is constructed
from a str template with placeholders to b... | [
"Writes",
"input",
"files",
"for",
"a",
"LAMMPS",
"run",
".",
"Input",
"script",
"is",
"constructed",
"from",
"a",
"str",
"template",
"with",
"placeholders",
"to",
"be",
"filled",
"by",
"custom",
"settings",
".",
"Data",
"file",
"is",
"either",
"written",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/inputs.py#L104-L199 | [
"def",
"write_lammps_inputs",
"(",
"output_dir",
",",
"script_template",
",",
"settings",
"=",
"None",
",",
"data",
"=",
"None",
",",
"script_filename",
"=",
"\"in.lammps\"",
",",
"make_dir_if_not_present",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"vari... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsRun.write_inputs | Writes all input files (input script, and data if needed).
Other supporting files are not handled at this moment.
Args:
output_dir (str): Directory to output the input files.
**kwargs: kwargs supported by LammpsData.write_file. | pymatgen/io/lammps/inputs.py | def write_inputs(self, output_dir, **kwargs):
"""
Writes all input files (input script, and data if needed).
Other supporting files are not handled at this moment.
Args:
output_dir (str): Directory to output the input files.
**kwargs: kwargs supported by LammpsDa... | def write_inputs(self, output_dir, **kwargs):
"""
Writes all input files (input script, and data if needed).
Other supporting files are not handled at this moment.
Args:
output_dir (str): Directory to output the input files.
**kwargs: kwargs supported by LammpsDa... | [
"Writes",
"all",
"input",
"files",
"(",
"input",
"script",
"and",
"data",
"if",
"needed",
")",
".",
"Other",
"supporting",
"files",
"are",
"not",
"handled",
"at",
"this",
"moment",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/inputs.py#L61-L74 | [
"def",
"write_inputs",
"(",
"self",
",",
"output_dir",
",",
"*",
"*",
"kwargs",
")",
":",
"write_lammps_inputs",
"(",
"output_dir",
"=",
"output_dir",
",",
"script_template",
"=",
"self",
".",
"script_template",
",",
"settings",
"=",
"self",
".",
"settings",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsRun.md | Example for a simple MD run based on template md.txt.
Args:
data (LammpsData or str): Data file as a LammpsData
instance or path to an existing data file.
force_field (str): Combined force field related cmds. For
example, 'pair_style eam\npair_coeff * * C... | pymatgen/io/lammps/inputs.py | def md(cls, data, force_field, temperature, nsteps,
other_settings=None):
"""
Example for a simple MD run based on template md.txt.
Args:
data (LammpsData or str): Data file as a LammpsData
instance or path to an existing data file.
force_field... | def md(cls, data, force_field, temperature, nsteps,
other_settings=None):
"""
Example for a simple MD run based on template md.txt.
Args:
data (LammpsData or str): Data file as a LammpsData
instance or path to an existing data file.
force_field... | [
"Example",
"for",
"a",
"simple",
"MD",
"run",
"based",
"on",
"template",
"md",
".",
"txt",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/inputs.py#L77-L101 | [
"def",
"md",
"(",
"cls",
",",
"data",
",",
"force_field",
",",
"temperature",
",",
"nsteps",
",",
"other_settings",
"=",
"None",
")",
":",
"template_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cls",
".",
"template_dir",
",",
"\"md.txt\"",
")",
"w... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | genrecip | Args:
a1, a2, a3: lattice vectors in bohr
encut: energy cut off in eV
Returns:
reciprocal lattice vectors with energy less than encut | pymatgen/analysis/defects/utils.py | def genrecip(a1, a2, a3, encut):
"""
Args:
a1, a2, a3: lattice vectors in bohr
encut: energy cut off in eV
Returns:
reciprocal lattice vectors with energy less than encut
"""
vol = np.dot(a1, np.cross(a2, a3)) # 1/bohr^3
b1 = (2 * np.pi / vol) * np.cross(a2, a3) # units... | def genrecip(a1, a2, a3, encut):
"""
Args:
a1, a2, a3: lattice vectors in bohr
encut: energy cut off in eV
Returns:
reciprocal lattice vectors with energy less than encut
"""
vol = np.dot(a1, np.cross(a2, a3)) # 1/bohr^3
b1 = (2 * np.pi / vol) * np.cross(a2, a3) # units... | [
"Args",
":",
"a1",
"a2",
"a3",
":",
"lattice",
"vectors",
"in",
"bohr",
"encut",
":",
"energy",
"cut",
"off",
"in",
"eV",
"Returns",
":",
"reciprocal",
"lattice",
"vectors",
"with",
"energy",
"less",
"than",
"encut"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L129-L164 | [
"def",
"genrecip",
"(",
"a1",
",",
"a2",
",",
"a3",
",",
"encut",
")",
":",
"vol",
"=",
"np",
".",
"dot",
"(",
"a1",
",",
"np",
".",
"cross",
"(",
"a2",
",",
"a3",
")",
")",
"# 1/bohr^3",
"b1",
"=",
"(",
"2",
"*",
"np",
".",
"pi",
"/",
"v... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | generate_reciprocal_vectors_squared | Generate reciprocal vector magnitudes within the cutoff along the specied
lattice vectors.
Args:
a1: Lattice vector a (in Bohrs)
a2: Lattice vector b (in Bohrs)
a3: Lattice vector c (in Bohrs)
encut: Reciprocal vector energy cutoff
Returns:
[[g1^2], [g2^2], ...] Squa... | pymatgen/analysis/defects/utils.py | def generate_reciprocal_vectors_squared(a1, a2, a3, encut):
"""
Generate reciprocal vector magnitudes within the cutoff along the specied
lattice vectors.
Args:
a1: Lattice vector a (in Bohrs)
a2: Lattice vector b (in Bohrs)
a3: Lattice vector c (in Bohrs)
encut: Reciproc... | def generate_reciprocal_vectors_squared(a1, a2, a3, encut):
"""
Generate reciprocal vector magnitudes within the cutoff along the specied
lattice vectors.
Args:
a1: Lattice vector a (in Bohrs)
a2: Lattice vector b (in Bohrs)
a3: Lattice vector c (in Bohrs)
encut: Reciproc... | [
"Generate",
"reciprocal",
"vector",
"magnitudes",
"within",
"the",
"cutoff",
"along",
"the",
"specied",
"lattice",
"vectors",
".",
"Args",
":",
"a1",
":",
"Lattice",
"vector",
"a",
"(",
"in",
"Bohrs",
")",
"a2",
":",
"Lattice",
"vector",
"b",
"(",
"in",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L167-L182 | [
"def",
"generate_reciprocal_vectors_squared",
"(",
"a1",
",",
"a2",
",",
"a3",
",",
"encut",
")",
":",
"for",
"vec",
"in",
"genrecip",
"(",
"a1",
",",
"a2",
",",
"a3",
",",
"encut",
")",
":",
"yield",
"np",
".",
"dot",
"(",
"vec",
",",
"vec",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | closestsites | Returns closest site to the input position
for both bulk and defect structures
Args:
struct_blk: Bulk structure
struct_def: Defect structure
pos: Position
Return: (site object, dist, index) | pymatgen/analysis/defects/utils.py | def closestsites(struct_blk, struct_def, pos):
"""
Returns closest site to the input position
for both bulk and defect structures
Args:
struct_blk: Bulk structure
struct_def: Defect structure
pos: Position
Return: (site object, dist, index)
"""
blk_close_sites = struc... | def closestsites(struct_blk, struct_def, pos):
"""
Returns closest site to the input position
for both bulk and defect structures
Args:
struct_blk: Bulk structure
struct_def: Defect structure
pos: Position
Return: (site object, dist, index)
"""
blk_close_sites = struc... | [
"Returns",
"closest",
"site",
"to",
"the",
"input",
"position",
"for",
"both",
"bulk",
"and",
"defect",
"structures",
"Args",
":",
"struct_blk",
":",
"Bulk",
"structure",
"struct_def",
":",
"Defect",
"structure",
"pos",
":",
"Position",
"Return",
":",
"(",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L185-L200 | [
"def",
"closestsites",
"(",
"struct_blk",
",",
"struct_def",
",",
"pos",
")",
":",
"blk_close_sites",
"=",
"struct_blk",
".",
"get_sites_in_sphere",
"(",
"pos",
",",
"5",
",",
"include_index",
"=",
"True",
")",
"blk_close_sites",
".",
"sort",
"(",
"key",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | converge | simple newton iteration based convergence function | pymatgen/analysis/defects/utils.py | def converge(f, step, tol, max_h):
"""
simple newton iteration based convergence function
"""
g = f(0)
dx = 10000
h = step
while (dx > tol):
g2 = f(h)
dx = abs(g - g2)
g = g2
h += step
if h > max_h:
raise Exception("Did not converge before... | def converge(f, step, tol, max_h):
"""
simple newton iteration based convergence function
"""
g = f(0)
dx = 10000
h = step
while (dx > tol):
g2 = f(h)
dx = abs(g - g2)
g = g2
h += step
if h > max_h:
raise Exception("Did not converge before... | [
"simple",
"newton",
"iteration",
"based",
"convergence",
"function"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1273-L1288 | [
"def",
"converge",
"(",
"f",
",",
"step",
",",
"tol",
",",
"max_h",
")",
":",
"g",
"=",
"f",
"(",
"0",
")",
"dx",
"=",
"10000",
"h",
"=",
"step",
"while",
"(",
"dx",
">",
"tol",
")",
":",
"g2",
"=",
"f",
"(",
"h",
")",
"dx",
"=",
"abs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QModel.rho_rec | Reciprocal space model charge value
for input squared reciprocal vector.
Args:
g2: Square of reciprocal vector
Returns:
Charge density at the reciprocal vector magnitude | pymatgen/analysis/defects/utils.py | def rho_rec(self, g2):
"""
Reciprocal space model charge value
for input squared reciprocal vector.
Args:
g2: Square of reciprocal vector
Returns:
Charge density at the reciprocal vector magnitude
"""
return (self.expnorm / np.sqrt(1 + sel... | def rho_rec(self, g2):
"""
Reciprocal space model charge value
for input squared reciprocal vector.
Args:
g2: Square of reciprocal vector
Returns:
Charge density at the reciprocal vector magnitude
"""
return (self.expnorm / np.sqrt(1 + sel... | [
"Reciprocal",
"space",
"model",
"charge",
"value",
"for",
"input",
"squared",
"reciprocal",
"vector",
".",
"Args",
":",
"g2",
":",
"Square",
"of",
"reciprocal",
"vector"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L93-L104 | [
"def",
"rho_rec",
"(",
"self",
",",
"g2",
")",
":",
"return",
"(",
"self",
".",
"expnorm",
"/",
"np",
".",
"sqrt",
"(",
"1",
"+",
"self",
".",
"gamma2",
"*",
"g2",
")",
"+",
"(",
"1",
"-",
"self",
".",
"expnorm",
")",
"*",
"np",
".",
"exp",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QModel.rho_rec_limit0 | Reciprocal space model charge value
close to reciprocal vector 0 .
rho_rec(g->0) -> 1 + rho_rec_limit0 * g^2 | pymatgen/analysis/defects/utils.py | def rho_rec_limit0(self):
"""
Reciprocal space model charge value
close to reciprocal vector 0 .
rho_rec(g->0) -> 1 + rho_rec_limit0 * g^2
"""
return -2 * self.gamma2 * self.expnorm - 0.25 * self.beta2 * (
1 - self.expnorm) | def rho_rec_limit0(self):
"""
Reciprocal space model charge value
close to reciprocal vector 0 .
rho_rec(g->0) -> 1 + rho_rec_limit0 * g^2
"""
return -2 * self.gamma2 * self.expnorm - 0.25 * self.beta2 * (
1 - self.expnorm) | [
"Reciprocal",
"space",
"model",
"charge",
"value",
"close",
"to",
"reciprocal",
"vector",
"0",
".",
"rho_rec",
"(",
"g",
"-",
">",
"0",
")",
"-",
">",
"1",
"+",
"rho_rec_limit0",
"*",
"g^2"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L107-L114 | [
"def",
"rho_rec_limit0",
"(",
"self",
")",
":",
"return",
"-",
"2",
"*",
"self",
".",
"gamma2",
"*",
"self",
".",
"expnorm",
"-",
"0.25",
"*",
"self",
".",
"beta2",
"*",
"(",
"1",
"-",
"self",
".",
"expnorm",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureMotifInterstitial.make_supercells_with_defects | Generate a sequence of supercells
in which each supercell contains a single interstitial,
except for the first supercell in the sequence
which is a copy of the defect-free input structure.
Args:
scaling_matrix (3x3 integer array): scaling matrix
to transform ... | pymatgen/analysis/defects/utils.py | def make_supercells_with_defects(self, scaling_matrix):
"""
Generate a sequence of supercells
in which each supercell contains a single interstitial,
except for the first supercell in the sequence
which is a copy of the defect-free input structure.
Args:
scal... | def make_supercells_with_defects(self, scaling_matrix):
"""
Generate a sequence of supercells
in which each supercell contains a single interstitial,
except for the first supercell in the sequence
which is a copy of the defect-free input structure.
Args:
scal... | [
"Generate",
"a",
"sequence",
"of",
"supercells",
"in",
"which",
"each",
"supercell",
"contains",
"a",
"single",
"interstitial",
"except",
"for",
"the",
"first",
"supercell",
"in",
"the",
"sequence",
"which",
"is",
"a",
"copy",
"of",
"the",
"defect",
"-",
"fr... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L518-L549 | [
"def",
"make_supercells_with_defects",
"(",
"self",
",",
"scaling_matrix",
")",
":",
"scs",
"=",
"[",
"]",
"sc",
"=",
"self",
".",
"_structure",
".",
"copy",
"(",
")",
"sc",
".",
"make_supercell",
"(",
"scaling_matrix",
")",
"scs",
".",
"append",
"(",
"s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | TopographyAnalyzer.cluster_nodes | Cluster nodes that are too close together using a tol.
Args:
tol (float): A distance tolerance. PBC is taken into account. | pymatgen/analysis/defects/utils.py | def cluster_nodes(self, tol=0.2):
"""
Cluster nodes that are too close together using a tol.
Args:
tol (float): A distance tolerance. PBC is taken into account.
"""
lattice = self.structure.lattice
vfcoords = [v.frac_coords for v in self.vnodes]
# M... | def cluster_nodes(self, tol=0.2):
"""
Cluster nodes that are too close together using a tol.
Args:
tol (float): A distance tolerance. PBC is taken into account.
"""
lattice = self.structure.lattice
vfcoords = [v.frac_coords for v in self.vnodes]
# M... | [
"Cluster",
"nodes",
"that",
"are",
"too",
"close",
"together",
"using",
"a",
"tol",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L735-L773 | [
"def",
"cluster_nodes",
"(",
"self",
",",
"tol",
"=",
"0.2",
")",
":",
"lattice",
"=",
"self",
".",
"structure",
".",
"lattice",
"vfcoords",
"=",
"[",
"v",
".",
"frac_coords",
"for",
"v",
"in",
"self",
".",
"vnodes",
"]",
"# Manually generate the distance ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | TopographyAnalyzer.remove_collisions | Remove vnodes that are too close to existing atoms in the structure
Args:
min_dist(float): The minimum distance that a vertex needs to be
from existing atoms. | pymatgen/analysis/defects/utils.py | def remove_collisions(self, min_dist=0.5):
"""
Remove vnodes that are too close to existing atoms in the structure
Args:
min_dist(float): The minimum distance that a vertex needs to be
from existing atoms.
"""
vfcoords = [v.frac_coords for v in self.v... | def remove_collisions(self, min_dist=0.5):
"""
Remove vnodes that are too close to existing atoms in the structure
Args:
min_dist(float): The minimum distance that a vertex needs to be
from existing atoms.
"""
vfcoords = [v.frac_coords for v in self.v... | [
"Remove",
"vnodes",
"that",
"are",
"too",
"close",
"to",
"existing",
"atoms",
"in",
"the",
"structure"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L775-L792 | [
"def",
"remove_collisions",
"(",
"self",
",",
"min_dist",
"=",
"0.5",
")",
":",
"vfcoords",
"=",
"[",
"v",
".",
"frac_coords",
"for",
"v",
"in",
"self",
".",
"vnodes",
"]",
"sfcoords",
"=",
"self",
".",
"structure",
".",
"frac_coords",
"dist_matrix",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | TopographyAnalyzer.get_structure_with_nodes | Get the modified structure with the voronoi nodes inserted. The
species is set as a DummySpecie X. | pymatgen/analysis/defects/utils.py | def get_structure_with_nodes(self):
"""
Get the modified structure with the voronoi nodes inserted. The
species is set as a DummySpecie X.
"""
new_s = Structure.from_sites(self.structure)
for v in self.vnodes:
new_s.append("X", v.frac_coords)
return ne... | def get_structure_with_nodes(self):
"""
Get the modified structure with the voronoi nodes inserted. The
species is set as a DummySpecie X.
"""
new_s = Structure.from_sites(self.structure)
for v in self.vnodes:
new_s.append("X", v.frac_coords)
return ne... | [
"Get",
"the",
"modified",
"structure",
"with",
"the",
"voronoi",
"nodes",
"inserted",
".",
"The",
"species",
"is",
"set",
"as",
"a",
"DummySpecie",
"X",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L794-L802 | [
"def",
"get_structure_with_nodes",
"(",
"self",
")",
":",
"new_s",
"=",
"Structure",
".",
"from_sites",
"(",
"self",
".",
"structure",
")",
"for",
"v",
"in",
"self",
".",
"vnodes",
":",
"new_s",
".",
"append",
"(",
"\"X\"",
",",
"v",
".",
"frac_coords",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer._get_charge_distribution_df | Return a complete table of fractional coordinates - charge density. | pymatgen/analysis/defects/utils.py | def _get_charge_distribution_df(self):
"""
Return a complete table of fractional coordinates - charge density.
"""
# Fraction coordinates and corresponding indices
axis_grid = np.array([np.array(self.chgcar.get_axis_grid(i)) /
self.structure.lattice.... | def _get_charge_distribution_df(self):
"""
Return a complete table of fractional coordinates - charge density.
"""
# Fraction coordinates and corresponding indices
axis_grid = np.array([np.array(self.chgcar.get_axis_grid(i)) /
self.structure.lattice.... | [
"Return",
"a",
"complete",
"table",
"of",
"fractional",
"coordinates",
"-",
"charge",
"density",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L951-L972 | [
"def",
"_get_charge_distribution_df",
"(",
"self",
")",
":",
"# Fraction coordinates and corresponding indices",
"axis_grid",
"=",
"np",
".",
"array",
"(",
"[",
"np",
".",
"array",
"(",
"self",
".",
"chgcar",
".",
"get_axis_grid",
"(",
"i",
")",
")",
"/",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer._update_extrema | Update _extrema_df, extrema_type and extrema_coords | pymatgen/analysis/defects/utils.py | def _update_extrema(self, f_coords, extrema_type, threshold_frac=None,
threshold_abs=None):
"""Update _extrema_df, extrema_type and extrema_coords"""
if threshold_frac is not None:
if threshold_abs is not None:
logger.warning( # Exit if both filter a... | def _update_extrema(self, f_coords, extrema_type, threshold_frac=None,
threshold_abs=None):
"""Update _extrema_df, extrema_type and extrema_coords"""
if threshold_frac is not None:
if threshold_abs is not None:
logger.warning( # Exit if both filter a... | [
"Update",
"_extrema_df",
"extrema_type",
"and",
"extrema_coords"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L974-L1025 | [
"def",
"_update_extrema",
"(",
"self",
",",
"f_coords",
",",
"extrema_type",
",",
"threshold_frac",
"=",
"None",
",",
"threshold_abs",
"=",
"None",
")",
":",
"if",
"threshold_frac",
"is",
"not",
"None",
":",
"if",
"threshold_abs",
"is",
"not",
"None",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer.get_local_extrema | Get all local extrema fractional coordinates in charge density,
searching for local minimum by default. Note that sites are NOT grouped
symmetrically.
Args:
find_min (bool): True to find local minimum else maximum, otherwise
find local maximum.
threshold... | pymatgen/analysis/defects/utils.py | def get_local_extrema(self, find_min=True, threshold_frac=None,
threshold_abs=None):
"""
Get all local extrema fractional coordinates in charge density,
searching for local minimum by default. Note that sites are NOT grouped
symmetrically.
Args:
... | def get_local_extrema(self, find_min=True, threshold_frac=None,
threshold_abs=None):
"""
Get all local extrema fractional coordinates in charge density,
searching for local minimum by default. Note that sites are NOT grouped
symmetrically.
Args:
... | [
"Get",
"all",
"local",
"extrema",
"fractional",
"coordinates",
"in",
"charge",
"density",
"searching",
"for",
"local",
"minimum",
"by",
"default",
".",
"Note",
"that",
"sites",
"are",
"NOT",
"grouped",
"symmetrically",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1030-L1083 | [
"def",
"get_local_extrema",
"(",
"self",
",",
"find_min",
"=",
"True",
",",
"threshold_frac",
"=",
"None",
",",
"threshold_abs",
"=",
"None",
")",
":",
"sign",
",",
"extrema_type",
"=",
"1",
",",
"\"local maxima\"",
"if",
"find_min",
":",
"sign",
",",
"ext... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer.cluster_nodes | Cluster nodes that are too close together using a tol.
Args:
tol (float): A distance tolerance. PBC is taken into account. | pymatgen/analysis/defects/utils.py | def cluster_nodes(self, tol=0.2):
"""
Cluster nodes that are too close together using a tol.
Args:
tol (float): A distance tolerance. PBC is taken into account.
"""
lattice = self.structure.lattice
vf_coords = self.extrema_coords
if len(vf_coords) ==... | def cluster_nodes(self, tol=0.2):
"""
Cluster nodes that are too close together using a tol.
Args:
tol (float): A distance tolerance. PBC is taken into account.
"""
lattice = self.structure.lattice
vf_coords = self.extrema_coords
if len(vf_coords) ==... | [
"Cluster",
"nodes",
"that",
"are",
"too",
"close",
"together",
"using",
"a",
"tol",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1085-L1136 | [
"def",
"cluster_nodes",
"(",
"self",
",",
"tol",
"=",
"0.2",
")",
":",
"lattice",
"=",
"self",
".",
"structure",
".",
"lattice",
"vf_coords",
"=",
"self",
".",
"extrema_coords",
"if",
"len",
"(",
"vf_coords",
")",
"==",
"0",
":",
"if",
"self",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer.remove_collisions | Remove predicted sites that are too close to existing atoms in the
structure.
Args:
min_dist (float): The minimum distance (in Angstrom) that
a predicted site needs to be from existing atoms. A min_dist
with value <= 0 returns all sites without distance check... | pymatgen/analysis/defects/utils.py | def remove_collisions(self, min_dist=0.5):
"""
Remove predicted sites that are too close to existing atoms in the
structure.
Args:
min_dist (float): The minimum distance (in Angstrom) that
a predicted site needs to be from existing atoms. A min_dist
... | def remove_collisions(self, min_dist=0.5):
"""
Remove predicted sites that are too close to existing atoms in the
structure.
Args:
min_dist (float): The minimum distance (in Angstrom) that
a predicted site needs to be from existing atoms. A min_dist
... | [
"Remove",
"predicted",
"sites",
"that",
"are",
"too",
"close",
"to",
"existing",
"atoms",
"in",
"the",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1138-L1169 | [
"def",
"remove_collisions",
"(",
"self",
",",
"min_dist",
"=",
"0.5",
")",
":",
"s_f_coords",
"=",
"self",
".",
"structure",
".",
"frac_coords",
"f_coords",
"=",
"self",
".",
"extrema_coords",
"if",
"len",
"(",
"f_coords",
")",
"==",
"0",
":",
"if",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer.get_structure_with_nodes | Get the modified structure with the possible interstitial sites added.
The species is set as a DummySpecie X.
Args:
find_min (bool): True to find local minimum else maximum, otherwise
find local maximum.
min_dist (float): The minimum distance (in Angstrom) that
... | pymatgen/analysis/defects/utils.py | def get_structure_with_nodes(self, find_min=True, min_dist=0.5, tol=0.2,
threshold_frac=None, threshold_abs=None):
"""
Get the modified structure with the possible interstitial sites added.
The species is set as a DummySpecie X.
Args:
find_mi... | def get_structure_with_nodes(self, find_min=True, min_dist=0.5, tol=0.2,
threshold_frac=None, threshold_abs=None):
"""
Get the modified structure with the possible interstitial sites added.
The species is set as a DummySpecie X.
Args:
find_mi... | [
"Get",
"the",
"modified",
"structure",
"with",
"the",
"possible",
"interstitial",
"sites",
"added",
".",
"The",
"species",
"is",
"set",
"as",
"a",
"DummySpecie",
"X",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1171-L1220 | [
"def",
"get_structure_with_nodes",
"(",
"self",
",",
"find_min",
"=",
"True",
",",
"min_dist",
"=",
"0.5",
",",
"tol",
"=",
"0.2",
",",
"threshold_frac",
"=",
"None",
",",
"threshold_abs",
"=",
"None",
")",
":",
"structure",
"=",
"self",
".",
"structure",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChargeDensityAnalyzer.sort_sites_by_integrated_chg | Get the average charge density around each local minima in the charge density
and store the result in _extrema_df
Args:
r (float): radius of sphere around each site to evaluate the average | pymatgen/analysis/defects/utils.py | def sort_sites_by_integrated_chg(self, r=0.4):
"""
Get the average charge density around each local minima in the charge density
and store the result in _extrema_df
Args:
r (float): radius of sphere around each site to evaluate the average
"""
if self.extrema... | def sort_sites_by_integrated_chg(self, r=0.4):
"""
Get the average charge density around each local minima in the charge density
and store the result in _extrema_df
Args:
r (float): radius of sphere around each site to evaluate the average
"""
if self.extrema... | [
"Get",
"the",
"average",
"charge",
"density",
"around",
"each",
"local",
"minima",
"in",
"the",
"charge",
"density",
"and",
"store",
"the",
"result",
"in",
"_extrema_df",
"Args",
":",
"r",
"(",
"float",
")",
":",
"radius",
"of",
"sphere",
"around",
"each",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1222-L1240 | [
"def",
"sort_sites_by_integrated_chg",
"(",
"self",
",",
"r",
"=",
"0.4",
")",
":",
"if",
"self",
".",
"extrema_type",
"is",
"None",
":",
"self",
".",
"get_local_extrema",
"(",
")",
"int_den",
"=",
"[",
"]",
"for",
"isite",
"in",
"self",
".",
"extrema_co... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput.multiple_outputs_from_file | Parses a QChem output file with multiple calculations
1.) Seperates the output into sub-files
e.g. qcout -> qcout.0, qcout.1, qcout.2 ... qcout.N
a.) Find delimeter for multiple calcualtions
b.) Make seperate output sub-files
2.) Creates seperate Q... | pymatgen/io/qchem/outputs.py | def multiple_outputs_from_file(cls, filename, keep_sub_files=True):
"""
Parses a QChem output file with multiple calculations
1.) Seperates the output into sub-files
e.g. qcout -> qcout.0, qcout.1, qcout.2 ... qcout.N
a.) Find delimeter for multiple calcua... | def multiple_outputs_from_file(cls, filename, keep_sub_files=True):
"""
Parses a QChem output file with multiple calculations
1.) Seperates the output into sub-files
e.g. qcout -> qcout.0, qcout.1, qcout.2 ... qcout.N
a.) Find delimeter for multiple calcua... | [
"Parses",
"a",
"QChem",
"output",
"file",
"with",
"multiple",
"calculations",
"1",
".",
")",
"Seperates",
"the",
"output",
"into",
"sub",
"-",
"files",
"e",
".",
"g",
".",
"qcout",
"-",
">",
"qcout",
".",
"0",
"qcout",
".",
"1",
"qcout",
".",
"2",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L237-L260 | [
"def",
"multiple_outputs_from_file",
"(",
"cls",
",",
"filename",
",",
"keep_sub_files",
"=",
"True",
")",
":",
"to_return",
"=",
"[",
"]",
"with",
"zopen",
"(",
"filename",
",",
"'rt'",
")",
"as",
"f",
":",
"text",
"=",
"re",
".",
"split",
"(",
"r'\\s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_charge_and_multiplicity | Parses charge and multiplicity. | pymatgen/io/qchem/outputs.py | def _read_charge_and_multiplicity(self):
"""
Parses charge and multiplicity.
"""
temp_charge = read_pattern(
self.text, {
"key": r"\$molecule\s+([\-\d]+)\s+\d"
},
terminate_on_match=True).get('key')
if temp_charge != None:
... | def _read_charge_and_multiplicity(self):
"""
Parses charge and multiplicity.
"""
temp_charge = read_pattern(
self.text, {
"key": r"\$molecule\s+([\-\d]+)\s+\d"
},
terminate_on_match=True).get('key')
if temp_charge != None:
... | [
"Parses",
"charge",
"and",
"multiplicity",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L262-L301 | [
"def",
"_read_charge_and_multiplicity",
"(",
"self",
")",
":",
"temp_charge",
"=",
"read_pattern",
"(",
"self",
".",
"text",
",",
"{",
"\"key\"",
":",
"r\"\\$molecule\\s+([\\-\\d]+)\\s+\\d\"",
"}",
",",
"terminate_on_match",
"=",
"True",
")",
".",
"get",
"(",
"'... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_species_and_inital_geometry | Parses species and initial geometry. | pymatgen/io/qchem/outputs.py | def _read_species_and_inital_geometry(self):
"""
Parses species and initial geometry.
"""
header_pattern = r"Standard Nuclear Orientation \(Angstroms\)\s+I\s+Atom\s+X\s+Y\s+Z\s+-+"
table_pattern = r"\s*\d+\s+([a-zA-Z]+)\s*([\d\-\.]+)\s*([\d\-\.]+)\s*([\d\-\.]+)\s*"
footer... | def _read_species_and_inital_geometry(self):
"""
Parses species and initial geometry.
"""
header_pattern = r"Standard Nuclear Orientation \(Angstroms\)\s+I\s+Atom\s+X\s+Y\s+Z\s+-+"
table_pattern = r"\s*\d+\s+([a-zA-Z]+)\s*([\d\-\.]+)\s*([\d\-\.]+)\s*([\d\-\.]+)\s*"
footer... | [
"Parses",
"species",
"and",
"initial",
"geometry",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L303-L341 | [
"def",
"_read_species_and_inital_geometry",
"(",
"self",
")",
":",
"header_pattern",
"=",
"r\"Standard Nuclear Orientation \\(Angstroms\\)\\s+I\\s+Atom\\s+X\\s+Y\\s+Z\\s+-+\"",
"table_pattern",
"=",
"r\"\\s*\\d+\\s+([a-zA-Z]+)\\s*([\\d\\-\\.]+)\\s*([\\d\\-\\.]+)\\s*([\\d\\-\\.]+)\\s*\"",
"fo... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_SCF | Parses both old and new SCFs. | pymatgen/io/qchem/outputs.py | def _read_SCF(self):
"""
Parses both old and new SCFs.
"""
if self.data.get('using_GEN_SCFMAN', []):
if "SCF_failed_to_converge" in self.data.get("errors"):
footer_pattern = r"^\s*gen_scfman_exception: SCF failed to converge"
else:
... | def _read_SCF(self):
"""
Parses both old and new SCFs.
"""
if self.data.get('using_GEN_SCFMAN', []):
if "SCF_failed_to_converge" in self.data.get("errors"):
footer_pattern = r"^\s*gen_scfman_exception: SCF failed to converge"
else:
... | [
"Parses",
"both",
"old",
"and",
"new",
"SCFs",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L343-L372 | [
"def",
"_read_SCF",
"(",
"self",
")",
":",
"if",
"self",
".",
"data",
".",
"get",
"(",
"'using_GEN_SCFMAN'",
",",
"[",
"]",
")",
":",
"if",
"\"SCF_failed_to_converge\"",
"in",
"self",
".",
"data",
".",
"get",
"(",
"\"errors\"",
")",
":",
"footer_pattern"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_mulliken | Parses Mulliken charges. Also parses spins given an unrestricted SCF. | pymatgen/io/qchem/outputs.py | def _read_mulliken(self):
"""
Parses Mulliken charges. Also parses spins given an unrestricted SCF.
"""
if self.data.get('unrestricted', []):
header_pattern = r"\-+\s+Ground-State Mulliken Net Atomic Charges\s+Atom\s+Charge \(a\.u\.\)\s+Spin\s\(a\.u\.\)\s+\-+"
tab... | def _read_mulliken(self):
"""
Parses Mulliken charges. Also parses spins given an unrestricted SCF.
"""
if self.data.get('unrestricted', []):
header_pattern = r"\-+\s+Ground-State Mulliken Net Atomic Charges\s+Atom\s+Charge \(a\.u\.\)\s+Spin\s\(a\.u\.\)\s+\-+"
tab... | [
"Parses",
"Mulliken",
"charges",
".",
"Also",
"parses",
"spins",
"given",
"an",
"unrestricted",
"SCF",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L374-L402 | [
"def",
"_read_mulliken",
"(",
"self",
")",
":",
"if",
"self",
".",
"data",
".",
"get",
"(",
"'unrestricted'",
",",
"[",
"]",
")",
":",
"header_pattern",
"=",
"r\"\\-+\\s+Ground-State Mulliken Net Atomic Charges\\s+Atom\\s+Charge \\(a\\.u\\.\\)\\s+Spin\\s\\(a\\.u\\.\\)\\s+\\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_optimized_geometry | Parses optimized XYZ coordinates. If not present, parses optimized Z-matrix. | pymatgen/io/qchem/outputs.py | def _read_optimized_geometry(self):
"""
Parses optimized XYZ coordinates. If not present, parses optimized Z-matrix.
"""
header_pattern = r"\*+\s+OPTIMIZATION\s+CONVERGED\s+\*+\s+\*+\s+Coordinates \(Angstroms\)\s+ATOM\s+X\s+Y\s+Z"
table_pattern = r"\s+\d+\s+\w+\s+([\d\-\.]+)\s+([... | def _read_optimized_geometry(self):
"""
Parses optimized XYZ coordinates. If not present, parses optimized Z-matrix.
"""
header_pattern = r"\*+\s+OPTIMIZATION\s+CONVERGED\s+\*+\s+\*+\s+Coordinates \(Angstroms\)\s+ATOM\s+X\s+Y\s+Z"
table_pattern = r"\s+\d+\s+\w+\s+([\d\-\.]+)\s+([... | [
"Parses",
"optimized",
"XYZ",
"coordinates",
".",
"If",
"not",
"present",
"parses",
"optimized",
"Z",
"-",
"matrix",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L404-L430 | [
"def",
"_read_optimized_geometry",
"(",
"self",
")",
":",
"header_pattern",
"=",
"r\"\\*+\\s+OPTIMIZATION\\s+CONVERGED\\s+\\*+\\s+\\*+\\s+Coordinates \\(Angstroms\\)\\s+ATOM\\s+X\\s+Y\\s+Z\"",
"table_pattern",
"=",
"r\"\\s+\\d+\\s+\\w+\\s+([\\d\\-\\.]+)\\s+([\\d\\-\\.]+)\\s+([\\d\\-\\.]+)\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_last_geometry | Parses the last geometry from an optimization trajectory for use in a new input file. | pymatgen/io/qchem/outputs.py | def _read_last_geometry(self):
"""
Parses the last geometry from an optimization trajectory for use in a new input file.
"""
header_pattern = r"\s+Optimization\sCycle:\s+" + \
str(len(self.data.get("energy_trajectory"))) + \
r"\s+Coordinates \(Angstroms\)\s+ATOM\s... | def _read_last_geometry(self):
"""
Parses the last geometry from an optimization trajectory for use in a new input file.
"""
header_pattern = r"\s+Optimization\sCycle:\s+" + \
str(len(self.data.get("energy_trajectory"))) + \
r"\s+Coordinates \(Angstroms\)\s+ATOM\s... | [
"Parses",
"the",
"last",
"geometry",
"from",
"an",
"optimization",
"trajectory",
"for",
"use",
"in",
"a",
"new",
"input",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L432-L454 | [
"def",
"_read_last_geometry",
"(",
"self",
")",
":",
"header_pattern",
"=",
"r\"\\s+Optimization\\sCycle:\\s+\"",
"+",
"str",
"(",
"len",
"(",
"self",
".",
"data",
".",
"get",
"(",
"\"energy_trajectory\"",
")",
")",
")",
"+",
"r\"\\s+Coordinates \\(Angstroms\\)\\s+A... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_frequency_data | Parses frequencies, enthalpy, entropy, and mode vectors. | pymatgen/io/qchem/outputs.py | def _read_frequency_data(self):
"""
Parses frequencies, enthalpy, entropy, and mode vectors.
"""
temp_dict = read_pattern(
self.text, {
"frequencies":
r"\s*Frequency:\s+([\d\-\.]+)(?:\s+([\d\-\.]+)(?:\s+([\d\-\.]+))*)*",
"IR_int... | def _read_frequency_data(self):
"""
Parses frequencies, enthalpy, entropy, and mode vectors.
"""
temp_dict = read_pattern(
self.text, {
"frequencies":
r"\s*Frequency:\s+([\d\-\.]+)(?:\s+([\d\-\.]+)(?:\s+([\d\-\.]+))*)*",
"IR_int... | [
"Parses",
"frequencies",
"enthalpy",
"entropy",
"and",
"mode",
"vectors",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L479-L567 | [
"def",
"_read_frequency_data",
"(",
"self",
")",
":",
"temp_dict",
"=",
"read_pattern",
"(",
"self",
".",
"text",
",",
"{",
"\"frequencies\"",
":",
"r\"\\s*Frequency:\\s+([\\d\\-\\.]+)(?:\\s+([\\d\\-\\.]+)(?:\\s+([\\d\\-\\.]+))*)*\"",
",",
"\"IR_intens\"",
":",
"r\"\\s*IR I... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_single_point_data | Parses final free energy information from single-point calculations. | pymatgen/io/qchem/outputs.py | def _read_single_point_data(self):
"""
Parses final free energy information from single-point calculations.
"""
temp_dict = read_pattern(
self.text, {
"final_energy":
r"\s*SCF\s+energy in the final basis set\s+=\s*([\d\-\.]+)"
}... | def _read_single_point_data(self):
"""
Parses final free energy information from single-point calculations.
"""
temp_dict = read_pattern(
self.text, {
"final_energy":
r"\s*SCF\s+energy in the final basis set\s+=\s*([\d\-\.]+)"
}... | [
"Parses",
"final",
"free",
"energy",
"information",
"from",
"single",
"-",
"point",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L569-L584 | [
"def",
"_read_single_point_data",
"(",
"self",
")",
":",
"temp_dict",
"=",
"read_pattern",
"(",
"self",
".",
"text",
",",
"{",
"\"final_energy\"",
":",
"r\"\\s*SCF\\s+energy in the final basis set\\s+=\\s*([\\d\\-\\.]+)\"",
"}",
")",
"if",
"temp_dict",
".",
"get",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._read_pcm_information | Parses information from PCM solvent calculations. | pymatgen/io/qchem/outputs.py | def _read_pcm_information(self):
"""
Parses information from PCM solvent calculations.
"""
temp_dict = read_pattern(
self.text, {
"g_electrostatic": r"\s*G_electrostatic\s+=\s+([\d\-\.]+)\s+hartree\s+=\s+([\d\-\.]+)\s+kcal/mol\s*",
"g_cavitati... | def _read_pcm_information(self):
"""
Parses information from PCM solvent calculations.
"""
temp_dict = read_pattern(
self.text, {
"g_electrostatic": r"\s*G_electrostatic\s+=\s+([\d\-\.]+)\s+hartree\s+=\s+([\d\-\.]+)\s+kcal/mol\s*",
"g_cavitati... | [
"Parses",
"information",
"from",
"PCM",
"solvent",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L586-L624 | [
"def",
"_read_pcm_information",
"(",
"self",
")",
":",
"temp_dict",
"=",
"read_pattern",
"(",
"self",
".",
"text",
",",
"{",
"\"g_electrostatic\"",
":",
"r\"\\s*G_electrostatic\\s+=\\s+([\\d\\-\\.]+)\\s+hartree\\s+=\\s+([\\d\\-\\.]+)\\s+kcal/mol\\s*\"",
",",
"\"g_cavitation\"",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._check_optimization_errors | Parses three potential optimization errors: failing to converge within the allowed number
of optimization cycles, failure to determine the lamda needed to continue, and inconsistent
size of MO files due to a linear dependence in the AO basis. | pymatgen/io/qchem/outputs.py | def _check_optimization_errors(self):
"""
Parses three potential optimization errors: failing to converge within the allowed number
of optimization cycles, failure to determine the lamda needed to continue, and inconsistent
size of MO files due to a linear dependence in the AO basis.
... | def _check_optimization_errors(self):
"""
Parses three potential optimization errors: failing to converge within the allowed number
of optimization cycles, failure to determine the lamda needed to continue, and inconsistent
size of MO files due to a linear dependence in the AO basis.
... | [
"Parses",
"three",
"potential",
"optimization",
"errors",
":",
"failing",
"to",
"converge",
"within",
"the",
"allowed",
"number",
"of",
"optimization",
"cycles",
"failure",
"to",
"determine",
"the",
"lamda",
"needed",
"to",
"continue",
"and",
"inconsistent",
"size... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L626-L649 | [
"def",
"_check_optimization_errors",
"(",
"self",
")",
":",
"if",
"read_pattern",
"(",
"self",
".",
"text",
",",
"{",
"\"key\"",
":",
"r\"MAXIMUM OPTIMIZATION CYCLES REACHED\"",
"}",
",",
"terminate_on_match",
"=",
"True",
")",
".",
"get",
"(",
"'key'",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QCOutput._check_completion_errors | Parses four potential errors that can cause jobs to crash: inability to transform
coordinates due to a bad symmetric specification, an input file that fails to pass
inspection, and errors reading and writing files. | pymatgen/io/qchem/outputs.py | def _check_completion_errors(self):
"""
Parses four potential errors that can cause jobs to crash: inability to transform
coordinates due to a bad symmetric specification, an input file that fails to pass
inspection, and errors reading and writing files.
"""
if read_patte... | def _check_completion_errors(self):
"""
Parses four potential errors that can cause jobs to crash: inability to transform
coordinates due to a bad symmetric specification, an input file that fails to pass
inspection, and errors reading and writing files.
"""
if read_patte... | [
"Parses",
"four",
"potential",
"errors",
"that",
"can",
"cause",
"jobs",
"to",
"crash",
":",
"inability",
"to",
"transform",
"coordinates",
"due",
"to",
"a",
"bad",
"symmetric",
"specification",
"an",
"input",
"file",
"that",
"fails",
"to",
"pass",
"inspection... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem/outputs.py#L651-L696 | [
"def",
"_check_completion_errors",
"(",
"self",
")",
":",
"if",
"read_pattern",
"(",
"self",
".",
"text",
",",
"{",
"\"key\"",
":",
"r\"Coordinates do not transform within specified threshold\"",
"}",
",",
"terminate_on_match",
"=",
"True",
")",
".",
"get",
"(",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | COD.get_cod_ids | Queries the COD for all cod ids associated with a formula. Requires
mysql executable to be in the path.
Args:
formula (str): Formula.
Returns:
List of cod ids. | pymatgen/ext/cod.py | def get_cod_ids(self, formula):
"""
Queries the COD for all cod ids associated with a formula. Requires
mysql executable to be in the path.
Args:
formula (str): Formula.
Returns:
List of cod ids.
"""
# TODO: Remove dependency on external ... | def get_cod_ids(self, formula):
"""
Queries the COD for all cod ids associated with a formula. Requires
mysql executable to be in the path.
Args:
formula (str): Formula.
Returns:
List of cod ids.
"""
# TODO: Remove dependency on external ... | [
"Queries",
"the",
"COD",
"for",
"all",
"cod",
"ids",
"associated",
"with",
"a",
"formula",
".",
"Requires",
"mysql",
"executable",
"to",
"be",
"in",
"the",
"path",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/ext/cod.py#L65-L88 | [
"def",
"get_cod_ids",
"(",
"self",
",",
"formula",
")",
":",
"# TODO: Remove dependency on external mysql call. MySQL-python package does not support Py3!",
"# Standardize formula to the version used by COD.",
"sql",
"=",
"'select file from data where formula=\"- %s -\"'",
"%",
"Composit... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | COD.get_structure_by_id | Queries the COD for a structure by id.
Args:
cod_id (int): COD id.
kwargs: All kwargs supported by
:func:`pymatgen.core.structure.Structure.from_str`.
Returns:
A Structure. | pymatgen/ext/cod.py | def get_structure_by_id(self, cod_id, **kwargs):
"""
Queries the COD for a structure by id.
Args:
cod_id (int): COD id.
kwargs: All kwargs supported by
:func:`pymatgen.core.structure.Structure.from_str`.
Returns:
A Structure.
... | def get_structure_by_id(self, cod_id, **kwargs):
"""
Queries the COD for a structure by id.
Args:
cod_id (int): COD id.
kwargs: All kwargs supported by
:func:`pymatgen.core.structure.Structure.from_str`.
Returns:
A Structure.
... | [
"Queries",
"the",
"COD",
"for",
"a",
"structure",
"by",
"id",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/ext/cod.py#L90-L103 | [
"def",
"get_structure_by_id",
"(",
"self",
",",
"cod_id",
",",
"*",
"*",
"kwargs",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"\"http://www.crystallography.net/cod/%s.cif\"",
"%",
"cod_id",
")",
"return",
"Structure",
".",
"from_str",
"(",
"r",
".",
"t... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | COD.get_structure_by_formula | Queries the COD for structures by formula. Requires mysql executable to
be in the path.
Args:
cod_id (int): COD id.
kwargs: All kwargs supported by
:func:`pymatgen.core.structure.Structure.from_str`.
Returns:
A list of dict of the format
... | pymatgen/ext/cod.py | def get_structure_by_formula(self, formula, **kwargs):
"""
Queries the COD for structures by formula. Requires mysql executable to
be in the path.
Args:
cod_id (int): COD id.
kwargs: All kwargs supported by
:func:`pymatgen.core.structure.Structure... | def get_structure_by_formula(self, formula, **kwargs):
"""
Queries the COD for structures by formula. Requires mysql executable to
be in the path.
Args:
cod_id (int): COD id.
kwargs: All kwargs supported by
:func:`pymatgen.core.structure.Structure... | [
"Queries",
"the",
"COD",
"for",
"structures",
"by",
"formula",
".",
"Requires",
"mysql",
"executable",
"to",
"be",
"in",
"the",
"path",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/ext/cod.py#L106-L139 | [
"def",
"get_structure_by_formula",
"(",
"self",
",",
"formula",
",",
"*",
"*",
"kwargs",
")",
":",
"structures",
"=",
"[",
"]",
"sql",
"=",
"'select file, sg from data where formula=\"- %s -\"'",
"%",
"Composition",
"(",
"formula",
")",
".",
"hill_formula",
"text"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureEnvironments.get_csms | Returns the continuous symmetry measure(s) of site with index isite with respect to the
perfect coordination environment with mp_symbol. For some environments, a given mp_symbol might not
be available (if there is no voronoi parameters leading to a number of neighbours corresponding to
the co... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def get_csms(self, isite, mp_symbol):
"""
Returns the continuous symmetry measure(s) of site with index isite with respect to the
perfect coordination environment with mp_symbol. For some environments, a given mp_symbol might not
be available (if there is no voronoi parameters leading ... | def get_csms(self, isite, mp_symbol):
"""
Returns the continuous symmetry measure(s) of site with index isite with respect to the
perfect coordination environment with mp_symbol. For some environments, a given mp_symbol might not
be available (if there is no voronoi parameters leading ... | [
"Returns",
"the",
"continuous",
"symmetry",
"measure",
"(",
"s",
")",
"of",
"site",
"with",
"index",
"isite",
"with",
"respect",
"to",
"the",
"perfect",
"coordination",
"environment",
"with",
"mp_symbol",
".",
"For",
"some",
"environments",
"a",
"given",
"mp_s... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L471-L487 | [
"def",
"get_csms",
"(",
"self",
",",
"isite",
",",
"mp_symbol",
")",
":",
"cn",
"=",
"symbol_cn_mapping",
"[",
"mp_symbol",
"]",
"if",
"cn",
"not",
"in",
"self",
".",
"ce_list",
"[",
"isite",
"]",
":",
"return",
"[",
"]",
"else",
":",
"return",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureEnvironments.plot_csm_and_maps | Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure
as the value for the color of that distfactor/angfactor set.
:param isite: Index... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def plot_csm_and_maps(self, isite, max_csm=8.0):
"""
Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure
as the value for th... | def plot_csm_and_maps(self, isite, max_csm=8.0):
"""
Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure
as the value for th... | [
"Plotting",
"of",
"the",
"coordination",
"numbers",
"of",
"a",
"given",
"site",
"for",
"all",
"the",
"distfactor",
"/",
"angfactor",
"parameters",
".",
"If",
"the",
"chemical",
"environments",
"are",
"given",
"a",
"color",
"map",
"is",
"added",
"to",
"the",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L489-L512 | [
"def",
"plot_csm_and_maps",
"(",
"self",
",",
"isite",
",",
"max_csm",
"=",
"8.0",
")",
":",
"try",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"except",
"ImportError",
":",
"print",
"(",
"'Plotting Chemical Environments requires matplotlib ... exiting ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureEnvironments.get_environments_figure | Plotting of the coordination environments of a given site for all the distfactor/angfactor regions. The
chemical environments with the lowest continuous symmetry measure is shown for each distfactor/angfactor
region as the value for the color of that distfactor/angfactor region (using a colormap).
... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def get_environments_figure(self, isite, plot_type=None, title='Coordination numbers', max_dist=2.0,
additional_condition=AC.ONLY_ACB, colormap=None, figsize=None,
strategy=None):
"""
Plotting of the coordination environments of a given sit... | def get_environments_figure(self, isite, plot_type=None, title='Coordination numbers', max_dist=2.0,
additional_condition=AC.ONLY_ACB, colormap=None, figsize=None,
strategy=None):
"""
Plotting of the coordination environments of a given sit... | [
"Plotting",
"of",
"the",
"coordination",
"environments",
"of",
"a",
"given",
"site",
"for",
"all",
"the",
"distfactor",
"/",
"angfactor",
"regions",
".",
"The",
"chemical",
"environments",
"with",
"the",
"lowest",
"continuous",
"symmetry",
"measure",
"is",
"show... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L642-L782 | [
"def",
"get_environments_figure",
"(",
"self",
",",
"isite",
",",
"plot_type",
"=",
"None",
",",
"title",
"=",
"'Coordination numbers'",
",",
"max_dist",
"=",
"2.0",
",",
"additional_condition",
"=",
"AC",
".",
"ONLY_ACB",
",",
"colormap",
"=",
"None",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureEnvironments.plot_environments | Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure
as the value for the color of that distfactor/angfactor set.
:param isite: Index... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def plot_environments(self, isite, plot_type=None, title='Coordination numbers', max_dist=2.0,
additional_condition=AC.ONLY_ACB, figsize=None, strategy=None):
"""
Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
c... | def plot_environments(self, isite, plot_type=None, title='Coordination numbers', max_dist=2.0,
additional_condition=AC.ONLY_ACB, figsize=None, strategy=None):
"""
Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
c... | [
"Plotting",
"of",
"the",
"coordination",
"numbers",
"of",
"a",
"given",
"site",
"for",
"all",
"the",
"distfactor",
"/",
"angfactor",
"parameters",
".",
"If",
"the",
"chemical",
"environments",
"are",
"given",
"a",
"color",
"map",
"is",
"added",
"to",
"the",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L784-L805 | [
"def",
"plot_environments",
"(",
"self",
",",
"isite",
",",
"plot_type",
"=",
"None",
",",
"title",
"=",
"'Coordination numbers'",
",",
"max_dist",
"=",
"2.0",
",",
"additional_condition",
"=",
"AC",
".",
"ONLY_ACB",
",",
"figsize",
"=",
"None",
",",
"strate... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureEnvironments.as_dict | Bson-serializable dict representation of the StructureEnvironments object.
:return: Bson-serializable dict representation of the StructureEnvironments object. | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def as_dict(self):
"""
Bson-serializable dict representation of the StructureEnvironments object.
:return: Bson-serializable dict representation of the StructureEnvironments object.
"""
ce_list_dict = [{str(cn): [ce.as_dict() if ce is not None else None for ce in ce_dict[cn]]
... | def as_dict(self):
"""
Bson-serializable dict representation of the StructureEnvironments object.
:return: Bson-serializable dict representation of the StructureEnvironments object.
"""
ce_list_dict = [{str(cn): [ce.as_dict() if ce is not None else None for ce in ce_dict[cn]]
... | [
"Bson",
"-",
"serializable",
"dict",
"representation",
"of",
"the",
"StructureEnvironments",
"object",
".",
":",
"return",
":",
"Bson",
"-",
"serializable",
"dict",
"representation",
"of",
"the",
"StructureEnvironments",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L936-L963 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"ce_list_dict",
"=",
"[",
"{",
"str",
"(",
"cn",
")",
":",
"[",
"ce",
".",
"as_dict",
"(",
")",
"if",
"ce",
"is",
"not",
"None",
"else",
"None",
"for",
"ce",
"in",
"ce_dict",
"[",
"cn",
"]",
"]",
"for",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureEnvironments.from_dict | Reconstructs the StructureEnvironments object from a dict representation of the StructureEnvironments created
using the as_dict method.
:param d: dict representation of the StructureEnvironments object
:return: StructureEnvironments object | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def from_dict(cls, d):
"""
Reconstructs the StructureEnvironments object from a dict representation of the StructureEnvironments created
using the as_dict method.
:param d: dict representation of the StructureEnvironments object
:return: StructureEnvironments object
"""
... | def from_dict(cls, d):
"""
Reconstructs the StructureEnvironments object from a dict representation of the StructureEnvironments created
using the as_dict method.
:param d: dict representation of the StructureEnvironments object
:return: StructureEnvironments object
"""
... | [
"Reconstructs",
"the",
"StructureEnvironments",
"object",
"from",
"a",
"dict",
"representation",
"of",
"the",
"StructureEnvironments",
"created",
"using",
"the",
"as_dict",
"method",
".",
":",
"param",
"d",
":",
"dict",
"representation",
"of",
"the",
"StructureEnvir... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L966-L998 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"ce_list",
"=",
"[",
"None",
"if",
"(",
"ce_dict",
"==",
"'None'",
"or",
"ce_dict",
"is",
"None",
")",
"else",
"{",
"int",
"(",
"cn",
")",
":",
"[",
"None",
"if",
"(",
"ced",
"is",
"None",
"or... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LightStructureEnvironments.structure_contains_atom_environment | Checks whether the structure contains a given atom in a given environment
:param atom_symbol: Symbol of the atom
:param ce_symbol: Symbol of the coordination environment
:return: True if the coordination environment is found, False otherwise | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def structure_contains_atom_environment(self, atom_symbol, ce_symbol):
"""
Checks whether the structure contains a given atom in a given environment
:param atom_symbol: Symbol of the atom
:param ce_symbol: Symbol of the coordination environment
:return: True if the coordination e... | def structure_contains_atom_environment(self, atom_symbol, ce_symbol):
"""
Checks whether the structure contains a given atom in a given environment
:param atom_symbol: Symbol of the atom
:param ce_symbol: Symbol of the coordination environment
:return: True if the coordination e... | [
"Checks",
"whether",
"the",
"structure",
"contains",
"a",
"given",
"atom",
"in",
"a",
"given",
"environment",
":",
"param",
"atom_symbol",
":",
"Symbol",
"of",
"the",
"atom",
":",
"param",
"ce_symbol",
":",
"Symbol",
"of",
"the",
"coordination",
"environment",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1419-L1430 | [
"def",
"structure_contains_atom_environment",
"(",
"self",
",",
"atom_symbol",
",",
"ce_symbol",
")",
":",
"for",
"isite",
",",
"site",
"in",
"enumerate",
"(",
"self",
".",
"structure",
")",
":",
"if",
"(",
"Element",
"(",
"atom_symbol",
")",
"in",
"site",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LightStructureEnvironments.as_dict | Bson-serializable dict representation of the LightStructureEnvironments object.
:return: Bson-serializable dict representation of the LightStructureEnvironments object. | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def as_dict(self):
"""
Bson-serializable dict representation of the LightStructureEnvironments object.
:return: Bson-serializable dict representation of the LightStructureEnvironments object.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class... | def as_dict(self):
"""
Bson-serializable dict representation of the LightStructureEnvironments object.
:return: Bson-serializable dict representation of the LightStructureEnvironments object.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class... | [
"Bson",
"-",
"serializable",
"dict",
"representation",
"of",
"the",
"LightStructureEnvironments",
"object",
".",
":",
"return",
":",
"Bson",
"-",
"serializable",
"dict",
"representation",
"of",
"the",
"LightStructureEnvironments",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1462-L1478 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"strategy\"",
":",
"self",
".",
"strategy",
".",
"as_dict",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LightStructureEnvironments.from_dict | Reconstructs the LightStructureEnvironments object from a dict representation of the
LightStructureEnvironments created using the as_dict method.
:param d: dict representation of the LightStructureEnvironments object
:return: LightStructureEnvironments object | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def from_dict(cls, d):
"""
Reconstructs the LightStructureEnvironments object from a dict representation of the
LightStructureEnvironments created using the as_dict method.
:param d: dict representation of the LightStructureEnvironments object
:return: LightStructureEnvironments ... | def from_dict(cls, d):
"""
Reconstructs the LightStructureEnvironments object from a dict representation of the
LightStructureEnvironments created using the as_dict method.
:param d: dict representation of the LightStructureEnvironments object
:return: LightStructureEnvironments ... | [
"Reconstructs",
"the",
"LightStructureEnvironments",
"object",
"from",
"a",
"dict",
"representation",
"of",
"the",
"LightStructureEnvironments",
"created",
"using",
"the",
"as_dict",
"method",
".",
":",
"param",
"d",
":",
"dict",
"representation",
"of",
"the",
"Ligh... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1481-L1514 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"dec",
"=",
"MontyDecoder",
"(",
")",
"structure",
"=",
"dec",
".",
"process_decoded",
"(",
"d",
"[",
"'structure'",
"]",
")",
"all_nbs_sites",
"=",
"[",
"]",
"for",
"nb_site",
"in",
"d",
"[",
"'all... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChemicalEnvironments.minimum_geometry | Returns the geometry with the minimum continuous symmetry measure of this ChemicalEnvironments
:return: tuple (symbol, csm) with symbol being the geometry with the minimum continuous symmetry measure and
csm being the continuous symmetry measure associted to it
:raise: ValueError if no coordinat... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def minimum_geometry(self, symmetry_measure_type=None, max_csm=None):
"""
Returns the geometry with the minimum continuous symmetry measure of this ChemicalEnvironments
:return: tuple (symbol, csm) with symbol being the geometry with the minimum continuous symmetry measure and
csm being ... | def minimum_geometry(self, symmetry_measure_type=None, max_csm=None):
"""
Returns the geometry with the minimum continuous symmetry measure of this ChemicalEnvironments
:return: tuple (symbol, csm) with symbol being the geometry with the minimum continuous symmetry measure and
csm being ... | [
"Returns",
"the",
"geometry",
"with",
"the",
"minimum",
"continuous",
"symmetry",
"measure",
"of",
"this",
"ChemicalEnvironments",
":",
"return",
":",
"tuple",
"(",
"symbol",
"csm",
")",
"with",
"symbol",
"being",
"the",
"geometry",
"with",
"the",
"minimum",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1550-L1569 | [
"def",
"minimum_geometry",
"(",
"self",
",",
"symmetry_measure_type",
"=",
"None",
",",
"max_csm",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"coord_geoms",
")",
"==",
"0",
":",
"return",
"None",
"cglist",
"=",
"[",
"cg",
"for",
"cg",
"in",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChemicalEnvironments.minimum_geometries | Returns a list of geometries with increasing continuous symmetry measure in this ChemicalEnvironments object
:param n: Number of geometries to be included in the list
:return: list of geometries with increasing continuous symmetry measure in this ChemicalEnvironments object
:raise: ValueError if... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def minimum_geometries(self, n=None, symmetry_measure_type=None, max_csm=None):
"""
Returns a list of geometries with increasing continuous symmetry measure in this ChemicalEnvironments object
:param n: Number of geometries to be included in the list
:return: list of geometries with incr... | def minimum_geometries(self, n=None, symmetry_measure_type=None, max_csm=None):
"""
Returns a list of geometries with increasing continuous symmetry measure in this ChemicalEnvironments object
:param n: Number of geometries to be included in the list
:return: list of geometries with incr... | [
"Returns",
"a",
"list",
"of",
"geometries",
"with",
"increasing",
"continuous",
"symmetry",
"measure",
"in",
"this",
"ChemicalEnvironments",
"object",
":",
"param",
"n",
":",
"Number",
"of",
"geometries",
"to",
"be",
"included",
"in",
"the",
"list",
":",
"retu... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1571-L1594 | [
"def",
"minimum_geometries",
"(",
"self",
",",
"n",
"=",
"None",
",",
"symmetry_measure_type",
"=",
"None",
",",
"max_csm",
"=",
"None",
")",
":",
"cglist",
"=",
"[",
"cg",
"for",
"cg",
"in",
"self",
".",
"coord_geoms",
"]",
"if",
"symmetry_measure_type",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChemicalEnvironments.add_coord_geom | Adds a coordination geometry to the ChemicalEnvironments object
:param mp_symbol: Symbol (internal) of the coordination geometry added
:param symmetry_measure: Symmetry measure of the coordination geometry added
:param algo: Algorithm used for the search of the coordination geometry added
... | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def add_coord_geom(self, mp_symbol, symmetry_measure, algo='UNKNOWN', permutation=None, override=False,
local2perfect_map=None, perfect2local_map=None, detailed_voronoi_index=None,
other_symmetry_measures=None, rotation_matrix=None, scaling_factor=None):
"""
... | def add_coord_geom(self, mp_symbol, symmetry_measure, algo='UNKNOWN', permutation=None, override=False,
local2perfect_map=None, perfect2local_map=None, detailed_voronoi_index=None,
other_symmetry_measures=None, rotation_matrix=None, scaling_factor=None):
"""
... | [
"Adds",
"a",
"coordination",
"geometry",
"to",
"the",
"ChemicalEnvironments",
"object",
":",
"param",
"mp_symbol",
":",
"Symbol",
"(",
"internal",
")",
"of",
"the",
"coordination",
"geometry",
"added",
":",
"param",
"symmetry_measure",
":",
"Symmetry",
"measure",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1596-L1625 | [
"def",
"add_coord_geom",
"(",
"self",
",",
"mp_symbol",
",",
"symmetry_measure",
",",
"algo",
"=",
"'UNKNOWN'",
",",
"permutation",
"=",
"None",
",",
"override",
"=",
"False",
",",
"local2perfect_map",
"=",
"None",
",",
"perfect2local_map",
"=",
"None",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChemicalEnvironments.as_dict | Returns a dictionary representation of the ChemicalEnvironments object
:return: | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def as_dict(self):
"""
Returns a dictionary representation of the ChemicalEnvironments object
:return:
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"coord_geoms": jsanitize(self.coord_geoms)} | def as_dict(self):
"""
Returns a dictionary representation of the ChemicalEnvironments object
:return:
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"coord_geoms": jsanitize(self.coord_geoms)} | [
"Returns",
"a",
"dictionary",
"representation",
"of",
"the",
"ChemicalEnvironments",
"object",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1700-L1707 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"coord_geoms\"",
":",
"jsanitize",
"(",
"self",
".",
"coord_g... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ChemicalEnvironments.from_dict | Reconstructs the ChemicalEnvironments object from a dict representation of the ChemicalEnvironments created
using the as_dict method.
:param d: dict representation of the ChemicalEnvironments object
:return: ChemicalEnvironments object | pymatgen/analysis/chemenv/coordination_environments/structure_environments.py | def from_dict(cls, d):
"""
Reconstructs the ChemicalEnvironments object from a dict representation of the ChemicalEnvironments created
using the as_dict method.
:param d: dict representation of the ChemicalEnvironments object
:return: ChemicalEnvironments object
"""
... | def from_dict(cls, d):
"""
Reconstructs the ChemicalEnvironments object from a dict representation of the ChemicalEnvironments created
using the as_dict method.
:param d: dict representation of the ChemicalEnvironments object
:return: ChemicalEnvironments object
"""
... | [
"Reconstructs",
"the",
"ChemicalEnvironments",
"object",
"from",
"a",
"dict",
"representation",
"of",
"the",
"ChemicalEnvironments",
"created",
"using",
"the",
"as_dict",
"method",
".",
":",
"param",
"d",
":",
"dict",
"representation",
"of",
"the",
"ChemicalEnvironm... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py#L1710-L1742 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"ce",
"=",
"cls",
"(",
")",
"for",
"cg",
"in",
"d",
"[",
"'coord_geoms'",
"]",
".",
"keys",
"(",
")",
":",
"if",
"d",
"[",
"'coord_geoms'",
"]",
"[",
"cg",
"]",
"[",
"'local2perfect_map'",
"]",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Cohpcar._get_bond_data | Subroutine to extract bond label, site indices, and length from
a LOBSTER header line. The site indices are zero-based, so they
can be easily used with a Structure object.
Example header line: No.4:Fe1->Fe9(2.4524893531900283)
Example header line for orbtial-resolved COHP:
N... | pymatgen/io/lobster.py | def _get_bond_data(line):
"""
Subroutine to extract bond label, site indices, and length from
a LOBSTER header line. The site indices are zero-based, so they
can be easily used with a Structure object.
Example header line: No.4:Fe1->Fe9(2.4524893531900283)
Example header... | def _get_bond_data(line):
"""
Subroutine to extract bond label, site indices, and length from
a LOBSTER header line. The site indices are zero-based, so they
can be easily used with a Structure object.
Example header line: No.4:Fe1->Fe9(2.4524893531900283)
Example header... | [
"Subroutine",
"to",
"extract",
"bond",
"label",
"site",
"indices",
"and",
"length",
"from",
"a",
"LOBSTER",
"header",
"line",
".",
"The",
"site",
"indices",
"are",
"zero",
"-",
"based",
"so",
"they",
"can",
"be",
"easily",
"used",
"with",
"a",
"Structure",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lobster.py#L169-L217 | [
"def",
"_get_bond_data",
"(",
"line",
")",
":",
"orb_labs",
"=",
"[",
"\"s\"",
",",
"\"p_y\"",
",",
"\"p_z\"",
",",
"\"p_x\"",
",",
"\"d_xy\"",
",",
"\"d_yz\"",
",",
"\"d_z^2\"",
",",
"\"d_xz\"",
",",
"\"d_x^2-y^2\"",
",",
"\"f_y(3x^2-y^2)\"",
",",
"\"f_xyz\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Icohplist.icohplist | Returns: icohplist compatible with older version of this class | pymatgen/io/lobster.py | def icohplist(self):
"""
Returns: icohplist compatible with older version of this class
"""
icohplist_new = {}
for key, value in self._icohpcollection._icohplist.items():
icohplist_new[key] = {"length": value._length, "number_of_bonds": value._num,
... | def icohplist(self):
"""
Returns: icohplist compatible with older version of this class
"""
icohplist_new = {}
for key, value in self._icohpcollection._icohplist.items():
icohplist_new[key] = {"length": value._length, "number_of_bonds": value._num,
... | [
"Returns",
":",
"icohplist",
"compatible",
"with",
"older",
"version",
"of",
"this",
"class"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lobster.py#L333-L341 | [
"def",
"icohplist",
"(",
"self",
")",
":",
"icohplist_new",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"self",
".",
"_icohpcollection",
".",
"_icohplist",
".",
"items",
"(",
")",
":",
"icohplist_new",
"[",
"key",
"]",
"=",
"{",
"\"length\"",
":",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Charge.get_structure_with_charges | get a Structure with Mulliken and Loewdin charges as site properties
Args:
structure_filename: filename of POSCAR
Returns:
Structure Object with Mulliken and Loewdin charges as site properties | pymatgen/io/lobster.py | def get_structure_with_charges(self, structure_filename):
"""
get a Structure with Mulliken and Loewdin charges as site properties
Args:
structure_filename: filename of POSCAR
Returns:
Structure Object with Mulliken and Loewdin charges as site properties
"... | def get_structure_with_charges(self, structure_filename):
"""
get a Structure with Mulliken and Loewdin charges as site properties
Args:
structure_filename: filename of POSCAR
Returns:
Structure Object with Mulliken and Loewdin charges as site properties
"... | [
"get",
"a",
"Structure",
"with",
"Mulliken",
"and",
"Loewdin",
"charges",
"as",
"site",
"properties",
"Args",
":",
"structure_filename",
":",
"filename",
"of",
"POSCAR",
"Returns",
":",
"Structure",
"Object",
"with",
"Mulliken",
"and",
"Loewdin",
"charges",
"as"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lobster.py#L531-L545 | [
"def",
"get_structure_with_charges",
"(",
"self",
",",
"structure_filename",
")",
":",
"struct",
"=",
"Structure",
".",
"from_file",
"(",
"structure_filename",
")",
"Mulliken",
"=",
"self",
".",
"Mulliken",
"Loewdin",
"=",
"self",
".",
"Loewdin",
"site_properties"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Fatband.get_bandstructure | returns a LobsterBandStructureSymmLine object which can be plotted with a normal BSPlotter | pymatgen/io/lobster.py | def get_bandstructure(self):
"""
returns a LobsterBandStructureSymmLine object which can be plotted with a normal BSPlotter
"""
return LobsterBandStructureSymmLine(kpoints=self.kpoints_array, eigenvals=self.eigenvals, lattice=self.lattice,
efe... | def get_bandstructure(self):
"""
returns a LobsterBandStructureSymmLine object which can be plotted with a normal BSPlotter
"""
return LobsterBandStructureSymmLine(kpoints=self.kpoints_array, eigenvals=self.eigenvals, lattice=self.lattice,
efe... | [
"returns",
"a",
"LobsterBandStructureSymmLine",
"object",
"which",
"can",
"be",
"plotted",
"with",
"a",
"normal",
"BSPlotter"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lobster.py#L1113-L1121 | [
"def",
"get_bandstructure",
"(",
"self",
")",
":",
"return",
"LobsterBandStructureSymmLine",
"(",
"kpoints",
"=",
"self",
".",
"kpoints_array",
",",
"eigenvals",
"=",
"self",
".",
"eigenvals",
",",
"lattice",
"=",
"self",
".",
"lattice",
",",
"efermi",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CostAnalyzer.get_lowest_decomposition | Get the decomposition leading to lowest cost
Args:
composition:
Composition as a pymatgen.core.structure.Composition
Returns:
Decomposition as a dict of {Entry: amount} | pymatgen/analysis/cost/cost.py | def get_lowest_decomposition(self, composition):
"""
Get the decomposition leading to lowest cost
Args:
composition:
Composition as a pymatgen.core.structure.Composition
Returns:
Decomposition as a dict of {Entry: amount}
"""
entr... | def get_lowest_decomposition(self, composition):
"""
Get the decomposition leading to lowest cost
Args:
composition:
Composition as a pymatgen.core.structure.Composition
Returns:
Decomposition as a dict of {Entry: amount}
"""
entr... | [
"Get",
"the",
"decomposition",
"leading",
"to",
"lowest",
"cost"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/cost/cost.py#L134-L157 | [
"def",
"get_lowest_decomposition",
"(",
"self",
",",
"composition",
")",
":",
"entries_list",
"=",
"[",
"]",
"elements",
"=",
"[",
"e",
".",
"symbol",
"for",
"e",
"in",
"composition",
".",
"elements",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"e... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CostAnalyzer.get_cost_per_mol | Get best estimate of minimum cost/mol based on known data
Args:
comp:
Composition as a pymatgen.core.structure.Composition
Returns:
float of cost/mol | pymatgen/analysis/cost/cost.py | def get_cost_per_mol(self, comp):
"""
Get best estimate of minimum cost/mol based on known data
Args:
comp:
Composition as a pymatgen.core.structure.Composition
Returns:
float of cost/mol
"""
comp = comp if isinstance(comp, Compos... | def get_cost_per_mol(self, comp):
"""
Get best estimate of minimum cost/mol based on known data
Args:
comp:
Composition as a pymatgen.core.structure.Composition
Returns:
float of cost/mol
"""
comp = comp if isinstance(comp, Compos... | [
"Get",
"best",
"estimate",
"of",
"minimum",
"cost",
"/",
"mol",
"based",
"on",
"known",
"data"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/cost/cost.py#L159-L173 | [
"def",
"get_cost_per_mol",
"(",
"self",
",",
"comp",
")",
":",
"comp",
"=",
"comp",
"if",
"isinstance",
"(",
"comp",
",",
"Composition",
")",
"else",
"Composition",
"(",
"comp",
")",
"decomp",
"=",
"self",
".",
"get_lowest_decomposition",
"(",
"comp",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CostAnalyzer.get_cost_per_kg | Get best estimate of minimum cost/kg based on known data
Args:
comp:
Composition as a pymatgen.core.structure.Composition
Returns:
float of cost/kg | pymatgen/analysis/cost/cost.py | def get_cost_per_kg(self, comp):
"""
Get best estimate of minimum cost/kg based on known data
Args:
comp:
Composition as a pymatgen.core.structure.Composition
Returns:
float of cost/kg
"""
comp = comp if isinstance(comp, Compositio... | def get_cost_per_kg(self, comp):
"""
Get best estimate of minimum cost/kg based on known data
Args:
comp:
Composition as a pymatgen.core.structure.Composition
Returns:
float of cost/kg
"""
comp = comp if isinstance(comp, Compositio... | [
"Get",
"best",
"estimate",
"of",
"minimum",
"cost",
"/",
"kg",
"based",
"on",
"known",
"data"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/cost/cost.py#L175-L187 | [
"def",
"get_cost_per_kg",
"(",
"self",
",",
"comp",
")",
":",
"comp",
"=",
"comp",
"if",
"isinstance",
"(",
"comp",
",",
"Composition",
")",
"else",
"Composition",
"(",
"comp",
")",
"return",
"self",
".",
"get_cost_per_mol",
"(",
"comp",
")",
"/",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | as_bool | Convert a string into a boolean.
>>> assert as_bool(True) is True and as_bool("Yes") is True and as_bool("false") is False | pymatgen/io/abinit/utils.py | def as_bool(s):
"""
Convert a string into a boolean.
>>> assert as_bool(True) is True and as_bool("Yes") is True and as_bool("false") is False
"""
if s in (False, True): return s
# Assume string
s = s.lower()
if s in ("yes", "true"):
return True
elif s in ("no", "false"):
... | def as_bool(s):
"""
Convert a string into a boolean.
>>> assert as_bool(True) is True and as_bool("Yes") is True and as_bool("false") is False
"""
if s in (False, True): return s
# Assume string
s = s.lower()
if s in ("yes", "true"):
return True
elif s in ("no", "false"):
... | [
"Convert",
"a",
"string",
"into",
"a",
"boolean",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L24-L38 | [
"def",
"as_bool",
"(",
"s",
")",
":",
"if",
"s",
"in",
"(",
"False",
",",
"True",
")",
":",
"return",
"s",
"# Assume string",
"s",
"=",
"s",
".",
"lower",
"(",
")",
"if",
"s",
"in",
"(",
"\"yes\"",
",",
"\"true\"",
")",
":",
"return",
"True",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | abi_splitext | Split the ABINIT extension from a filename.
"Extension" are found by searching in an internal database.
Returns "(root, ext)" where ext is the registered ABINIT extension
The final ".nc" is included (if any)
>>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK')
>>> assert abi_splitext("/home/guido... | pymatgen/io/abinit/utils.py | def abi_splitext(filename):
"""
Split the ABINIT extension from a filename.
"Extension" are found by searching in an internal database.
Returns "(root, ext)" where ext is the registered ABINIT extension
The final ".nc" is included (if any)
>>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK')
... | def abi_splitext(filename):
"""
Split the ABINIT extension from a filename.
"Extension" are found by searching in an internal database.
Returns "(root, ext)" where ext is the registered ABINIT extension
The final ".nc" is included (if any)
>>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK')
... | [
"Split",
"the",
"ABINIT",
"extension",
"from",
"a",
"filename",
".",
"Extension",
"are",
"found",
"by",
"searching",
"in",
"an",
"internal",
"database",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L495-L528 | [
"def",
"abi_splitext",
"(",
"filename",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"is_ncfile",
"=",
"False",
"if",
"filename",
".",
"endswith",
"(",
"\".nc\"",
")",
":",
"is_ncfile",
"=",
"True",
"filename",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | map2rpn | Convert a Mongodb-like dictionary to a RPN list of operands and operators.
Reverse Polish notation (RPN) is a mathematical notation in which every
operator follows all of its operands, e.g.
3 - 4 + 5 --> 3 4 - 5 +
>>> d = {2.0: {'$eq': 1.0}}
>>> assert map2rpn(d, None) == [2.0, 1.0, '$eq'] | pymatgen/io/abinit/utils.py | def map2rpn(map, obj):
"""
Convert a Mongodb-like dictionary to a RPN list of operands and operators.
Reverse Polish notation (RPN) is a mathematical notation in which every
operator follows all of its operands, e.g.
3 - 4 + 5 --> 3 4 - 5 +
>>> d = {2.0: {'$eq': 1.0}}
>>> assert map2rpn... | def map2rpn(map, obj):
"""
Convert a Mongodb-like dictionary to a RPN list of operands and operators.
Reverse Polish notation (RPN) is a mathematical notation in which every
operator follows all of its operands, e.g.
3 - 4 + 5 --> 3 4 - 5 +
>>> d = {2.0: {'$eq': 1.0}}
>>> assert map2rpn... | [
"Convert",
"a",
"Mongodb",
"-",
"like",
"dictionary",
"to",
"a",
"RPN",
"list",
"of",
"operands",
"and",
"operators",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L658-L717 | [
"def",
"map2rpn",
"(",
"map",
",",
"obj",
")",
":",
"rpn",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"map",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"_ALL_OPS",
":",
"if",
"isinstance",
"(",
"v",
",",
"collections",
".",
"abc",
".",
"Ma... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | evaluate_rpn | Evaluates the RPN form produced my map2rpn.
Returns:
bool | pymatgen/io/abinit/utils.py | def evaluate_rpn(rpn):
"""
Evaluates the RPN form produced my map2rpn.
Returns:
bool
"""
vals_stack = []
for item in rpn:
if item in _ALL_OPS:
# Apply the operator and push to the task.
v2 = vals_stack.pop()
if item in _UNARY_OPS:
... | def evaluate_rpn(rpn):
"""
Evaluates the RPN form produced my map2rpn.
Returns:
bool
"""
vals_stack = []
for item in rpn:
if item in _ALL_OPS:
# Apply the operator and push to the task.
v2 = vals_stack.pop()
if item in _UNARY_OPS:
... | [
"Evaluates",
"the",
"RPN",
"form",
"produced",
"my",
"map2rpn",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L720-L755 | [
"def",
"evaluate_rpn",
"(",
"rpn",
")",
":",
"vals_stack",
"=",
"[",
"]",
"for",
"item",
"in",
"rpn",
":",
"if",
"item",
"in",
"_ALL_OPS",
":",
"# Apply the operator and push to the task.",
"v2",
"=",
"vals_stack",
".",
"pop",
"(",
")",
"if",
"item",
"in",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | File.relpath | Relative path. | pymatgen/io/abinit/utils.py | def relpath(self):
"""Relative path."""
try:
return os.path.relpath(self.path)
except OSError:
# current working directory may not be defined!
return self.path | def relpath(self):
"""Relative path."""
try:
return os.path.relpath(self.path)
except OSError:
# current working directory may not be defined!
return self.path | [
"Relative",
"path",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L72-L78 | [
"def",
"relpath",
"(",
"self",
")",
":",
"try",
":",
"return",
"os",
".",
"path",
".",
"relpath",
"(",
"self",
".",
"path",
")",
"except",
"OSError",
":",
"# current working directory may not be defined!",
"return",
"self",
".",
"path"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | File.write | Write string to file. | pymatgen/io/abinit/utils.py | def write(self, string):
"""Write string to file."""
self.make_dir()
with open(self.path, "w") as f:
if not string.endswith("\n"):
return f.write(string + "\n")
else:
return f.write(string) | def write(self, string):
"""Write string to file."""
self.make_dir()
with open(self.path, "w") as f:
if not string.endswith("\n"):
return f.write(string + "\n")
else:
return f.write(string) | [
"Write",
"string",
"to",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L109-L116 | [
"def",
"write",
"(",
"self",
",",
"string",
")",
":",
"self",
".",
"make_dir",
"(",
")",
"with",
"open",
"(",
"self",
".",
"path",
",",
"\"w\"",
")",
"as",
"f",
":",
"if",
"not",
"string",
".",
"endswith",
"(",
"\"\\n\"",
")",
":",
"return",
"f",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | File.writelines | Write a list of strings to file. | pymatgen/io/abinit/utils.py | def writelines(self, lines):
"""Write a list of strings to file."""
self.make_dir()
with open(self.path, "w") as f:
return f.writelines(lines) | def writelines(self, lines):
"""Write a list of strings to file."""
self.make_dir()
with open(self.path, "w") as f:
return f.writelines(lines) | [
"Write",
"a",
"list",
"of",
"strings",
"to",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L118-L122 | [
"def",
"writelines",
"(",
"self",
",",
"lines",
")",
":",
"self",
".",
"make_dir",
"(",
")",
"with",
"open",
"(",
"self",
".",
"path",
",",
"\"w\"",
")",
"as",
"f",
":",
"return",
"f",
".",
"writelines",
"(",
"lines",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | File.make_dir | Make the directory where the file is located. | pymatgen/io/abinit/utils.py | def make_dir(self):
"""Make the directory where the file is located."""
if not os.path.exists(self.dirname):
os.makedirs(self.dirname) | def make_dir(self):
"""Make the directory where the file is located."""
if not os.path.exists(self.dirname):
os.makedirs(self.dirname) | [
"Make",
"the",
"directory",
"where",
"the",
"file",
"is",
"located",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L124-L127 | [
"def",
"make_dir",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"dirname",
")",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"dirname",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.list_filepaths | Return the list of absolute filepaths in the directory.
Args:
wildcard: String of tokens separated by "|". Each token represents a pattern.
If wildcard is not None, we return only those files that match the given shell pattern (uses fnmatch).
Example:
... | pymatgen/io/abinit/utils.py | def list_filepaths(self, wildcard=None):
"""
Return the list of absolute filepaths in the directory.
Args:
wildcard: String of tokens separated by "|". Each token represents a pattern.
If wildcard is not None, we return only those files that match the given shell pat... | def list_filepaths(self, wildcard=None):
"""
Return the list of absolute filepaths in the directory.
Args:
wildcard: String of tokens separated by "|". Each token represents a pattern.
If wildcard is not None, we return only those files that match the given shell pat... | [
"Return",
"the",
"list",
"of",
"absolute",
"filepaths",
"in",
"the",
"directory",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L234-L252 | [
"def",
"list_filepaths",
"(",
"self",
",",
"wildcard",
"=",
"None",
")",
":",
"# Select the files in the directory.",
"fnames",
"=",
"[",
"f",
"for",
"f",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"path",
")",
"]",
"filepaths",
"=",
"filter",
"(",
"o... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.has_abiext | Returns the absolute path of the ABINIT file with extension ext.
Support both Fortran files and netcdf files. In the later case,
we check whether a file with extension ext + ".nc" is present
in the directory. Returns empty string is file is not present.
Raises:
`ValueError` ... | pymatgen/io/abinit/utils.py | def has_abiext(self, ext, single_file=True):
"""
Returns the absolute path of the ABINIT file with extension ext.
Support both Fortran files and netcdf files. In the later case,
we check whether a file with extension ext + ".nc" is present
in the directory. Returns empty string i... | def has_abiext(self, ext, single_file=True):
"""
Returns the absolute path of the ABINIT file with extension ext.
Support both Fortran files and netcdf files. In the later case,
we check whether a file with extension ext + ".nc" is present
in the directory. Returns empty string i... | [
"Returns",
"the",
"absolute",
"path",
"of",
"the",
"ABINIT",
"file",
"with",
"extension",
"ext",
".",
"Support",
"both",
"Fortran",
"files",
"and",
"netcdf",
"files",
".",
"In",
"the",
"later",
"case",
"we",
"check",
"whether",
"a",
"file",
"with",
"extens... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L254-L294 | [
"def",
"has_abiext",
"(",
"self",
",",
"ext",
",",
"single_file",
"=",
"True",
")",
":",
"if",
"ext",
"!=",
"\"abo\"",
":",
"ext",
"=",
"ext",
"if",
"ext",
".",
"startswith",
"(",
"'_'",
")",
"else",
"'_'",
"+",
"ext",
"files",
"=",
"[",
"]",
"fo... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.symlink_abiext | Create a simbolic link (outext --> inext). The file names are implicitly
given by the ABINIT file extension.
Example:
outdir.symlink_abiext('1WF', 'DDK')
creates the link out_DDK that points to out_1WF
Return: 0 if success.
Raise: RuntimeError | pymatgen/io/abinit/utils.py | def symlink_abiext(self, inext, outext):
"""
Create a simbolic link (outext --> inext). The file names are implicitly
given by the ABINIT file extension.
Example:
outdir.symlink_abiext('1WF', 'DDK')
creates the link out_DDK that points to out_1WF
Return: 0... | def symlink_abiext(self, inext, outext):
"""
Create a simbolic link (outext --> inext). The file names are implicitly
given by the ABINIT file extension.
Example:
outdir.symlink_abiext('1WF', 'DDK')
creates the link out_DDK that points to out_1WF
Return: 0... | [
"Create",
"a",
"simbolic",
"link",
"(",
"outext",
"--",
">",
"inext",
")",
".",
"The",
"file",
"names",
"are",
"implicitly",
"given",
"by",
"the",
"ABINIT",
"file",
"extension",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L296-L334 | [
"def",
"symlink_abiext",
"(",
"self",
",",
"inext",
",",
"outext",
")",
":",
"infile",
"=",
"self",
".",
"has_abiext",
"(",
"inext",
")",
"if",
"not",
"infile",
":",
"raise",
"RuntimeError",
"(",
"'no file with extension %s in %s'",
"%",
"(",
"inext",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.rename_abiext | Rename the Abinit file with extension inext with the new extension outext | pymatgen/io/abinit/utils.py | def rename_abiext(self, inext, outext):
"""Rename the Abinit file with extension inext with the new extension outext"""
infile = self.has_abiext(inext)
if not infile:
raise RuntimeError('no file with extension %s in %s' % (inext, self))
for i in range(len(infile) - 1, -1, -1... | def rename_abiext(self, inext, outext):
"""Rename the Abinit file with extension inext with the new extension outext"""
infile = self.has_abiext(inext)
if not infile:
raise RuntimeError('no file with extension %s in %s' % (inext, self))
for i in range(len(infile) - 1, -1, -1... | [
"Rename",
"the",
"Abinit",
"file",
"with",
"extension",
"inext",
"with",
"the",
"new",
"extension",
"outext"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L336-L350 | [
"def",
"rename_abiext",
"(",
"self",
",",
"inext",
",",
"outext",
")",
":",
"infile",
"=",
"self",
".",
"has_abiext",
"(",
"inext",
")",
"if",
"not",
"infile",
":",
"raise",
"RuntimeError",
"(",
"'no file with extension %s in %s'",
"%",
"(",
"inext",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.copy_abiext | Copy the Abinit file with extension inext to a new file withw extension outext | pymatgen/io/abinit/utils.py | def copy_abiext(self, inext, outext):
"""Copy the Abinit file with extension inext to a new file withw extension outext"""
infile = self.has_abiext(inext)
if not infile:
raise RuntimeError('no file with extension %s in %s' % (inext, self))
for i in range(len(infile) - 1, -1,... | def copy_abiext(self, inext, outext):
"""Copy the Abinit file with extension inext to a new file withw extension outext"""
infile = self.has_abiext(inext)
if not infile:
raise RuntimeError('no file with extension %s in %s' % (inext, self))
for i in range(len(infile) - 1, -1,... | [
"Copy",
"the",
"Abinit",
"file",
"with",
"extension",
"inext",
"to",
"a",
"new",
"file",
"withw",
"extension",
"outext"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L352-L366 | [
"def",
"copy_abiext",
"(",
"self",
",",
"inext",
",",
"outext",
")",
":",
"infile",
"=",
"self",
".",
"has_abiext",
"(",
"inext",
")",
"if",
"not",
"infile",
":",
"raise",
"RuntimeError",
"(",
"'no file with extension %s in %s'",
"%",
"(",
"inext",
",",
"s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.remove_exts | Remove the files with the given extensions. Unlike rmtree, this function preserves the directory path.
Return list with the absolute paths of the files that have been removed. | pymatgen/io/abinit/utils.py | def remove_exts(self, exts):
"""
Remove the files with the given extensions. Unlike rmtree, this function preserves the directory path.
Return list with the absolute paths of the files that have been removed.
"""
paths = []
for ext in list_strings(exts):
path... | def remove_exts(self, exts):
"""
Remove the files with the given extensions. Unlike rmtree, this function preserves the directory path.
Return list with the absolute paths of the files that have been removed.
"""
paths = []
for ext in list_strings(exts):
path... | [
"Remove",
"the",
"files",
"with",
"the",
"given",
"extensions",
".",
"Unlike",
"rmtree",
"this",
"function",
"preserves",
"the",
"directory",
"path",
".",
"Return",
"list",
"with",
"the",
"absolute",
"paths",
"of",
"the",
"files",
"that",
"have",
"been",
"re... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L368-L384 | [
"def",
"remove_exts",
"(",
"self",
",",
"exts",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"ext",
"in",
"list_strings",
"(",
"exts",
")",
":",
"path",
"=",
"self",
".",
"has_abiext",
"(",
"ext",
")",
"if",
"not",
"path",
":",
"continue",
"try",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.find_last_timden_file | ABINIT produces lots of out_TIM1_DEN files for each step and we need to find the lat
one in order to prepare the restart or to connect other tasks to the structural relaxation.
This function finds all the TIM?_DEN files in self and return a namedtuple (path, step)
where `path` is the path of th... | pymatgen/io/abinit/utils.py | def find_last_timden_file(self):
"""
ABINIT produces lots of out_TIM1_DEN files for each step and we need to find the lat
one in order to prepare the restart or to connect other tasks to the structural relaxation.
This function finds all the TIM?_DEN files in self and return a namedtupl... | def find_last_timden_file(self):
"""
ABINIT produces lots of out_TIM1_DEN files for each step and we need to find the lat
one in order to prepare the restart or to connect other tasks to the structural relaxation.
This function finds all the TIM?_DEN files in self and return a namedtupl... | [
"ABINIT",
"produces",
"lots",
"of",
"out_TIM1_DEN",
"files",
"for",
"each",
"step",
"and",
"we",
"need",
"to",
"find",
"the",
"lat",
"one",
"in",
"order",
"to",
"prepare",
"the",
"restart",
"or",
"to",
"connect",
"other",
"tasks",
"to",
"the",
"structural"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L386-L410 | [
"def",
"find_last_timden_file",
"(",
"self",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"out_TIM(\\d+)_DEN(.nc)?$\"",
")",
"timden_paths",
"=",
"[",
"f",
"for",
"f",
"in",
"self",
".",
"list_filepaths",
"(",
")",
"if",
"regex",
".",
"match",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.find_1wf_files | Abinit adds the idir-ipert index at the end of the 1WF file and this breaks the extension
e.g. out_1WF4. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the `path` of the 1FK file and the `pertcase` index. | pymatgen/io/abinit/utils.py | def find_1wf_files(self):
"""
Abinit adds the idir-ipert index at the end of the 1WF file and this breaks the extension
e.g. out_1WF4. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the `path` of the 1FK file and the `pertcase` inde... | def find_1wf_files(self):
"""
Abinit adds the idir-ipert index at the end of the 1WF file and this breaks the extension
e.g. out_1WF4. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the `path` of the 1FK file and the `pertcase` inde... | [
"Abinit",
"adds",
"the",
"idir",
"-",
"ipert",
"index",
"at",
"the",
"end",
"of",
"the",
"1WF",
"file",
"and",
"this",
"breaks",
"the",
"extension",
"e",
".",
"g",
".",
"out_1WF4",
".",
"This",
"method",
"scans",
"the",
"files",
"in",
"the",
"directori... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L412-L433 | [
"def",
"find_1wf_files",
"(",
"self",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"out_1WF(\\d+)(\\.nc)?$\"",
")",
"wf_paths",
"=",
"[",
"f",
"for",
"f",
"in",
"self",
".",
"list_filepaths",
"(",
")",
"if",
"regex",
".",
"match",
"(",
"os",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Directory.find_1den_files | Abinit adds the idir-ipert index at the end of the 1DEN file and this breaks the extension
e.g. out_DEN1. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the `path` of the 1DEN file and the `pertcase` index. | pymatgen/io/abinit/utils.py | def find_1den_files(self):
"""
Abinit adds the idir-ipert index at the end of the 1DEN file and this breaks the extension
e.g. out_DEN1. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the `path` of the 1DEN file and the `pertcase` i... | def find_1den_files(self):
"""
Abinit adds the idir-ipert index at the end of the 1DEN file and this breaks the extension
e.g. out_DEN1. This method scans the files in the directories and returns a list of namedtuple
Each named tuple gives the `path` of the 1DEN file and the `pertcase` i... | [
"Abinit",
"adds",
"the",
"idir",
"-",
"ipert",
"index",
"at",
"the",
"end",
"of",
"the",
"1DEN",
"file",
"and",
"this",
"breaks",
"the",
"extension",
"e",
".",
"g",
".",
"out_DEN1",
".",
"This",
"method",
"scans",
"the",
"files",
"in",
"the",
"director... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L435-L455 | [
"def",
"find_1den_files",
"(",
"self",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"r\"out_DEN(\\d+)(\\.nc)?$\"",
")",
"den_paths",
"=",
"[",
"f",
"for",
"f",
"in",
"self",
".",
"list_filepaths",
"(",
")",
"if",
"regex",
".",
"match",
"(",
"os",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FilepathFixer.fix_paths | Fix the filenames in the iterable paths
Returns:
old2new: Mapping old_path --> new_path | pymatgen/io/abinit/utils.py | def fix_paths(self, paths):
"""
Fix the filenames in the iterable paths
Returns:
old2new: Mapping old_path --> new_path
"""
old2new, fixed_exts = {}, []
for path in list_strings(paths):
newpath, ext = self._fix_path(path)
if newpath ... | def fix_paths(self, paths):
"""
Fix the filenames in the iterable paths
Returns:
old2new: Mapping old_path --> new_path
"""
old2new, fixed_exts = {}, []
for path in list_strings(paths):
newpath, ext = self._fix_path(path)
if newpath ... | [
"Fix",
"the",
"filenames",
"in",
"the",
"iterable",
"paths"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L588-L613 | [
"def",
"fix_paths",
"(",
"self",
",",
"paths",
")",
":",
"old2new",
",",
"fixed_exts",
"=",
"{",
"}",
",",
"[",
"]",
"for",
"path",
"in",
"list_strings",
"(",
"paths",
")",
":",
"newpath",
",",
"ext",
"=",
"self",
".",
"_fix_path",
"(",
"path",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Condition.as_condition | Convert obj into :class:`Condition` | pymatgen/io/abinit/utils.py | def as_condition(cls, obj):
"""Convert obj into :class:`Condition`"""
if isinstance(obj, cls):
return obj
else:
return cls(cmap=obj) | def as_condition(cls, obj):
"""Convert obj into :class:`Condition`"""
if isinstance(obj, cls):
return obj
else:
return cls(cmap=obj) | [
"Convert",
"obj",
"into",
":",
"class",
":",
"Condition"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L784-L789 | [
"def",
"as_condition",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"cls",
")",
":",
"return",
"obj",
"else",
":",
"return",
"cls",
"(",
"cmap",
"=",
"obj",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SparseHistogram.plot | Plot the histogram with matplotlib, returns `matplotlib` figure. | pymatgen/io/abinit/utils.py | def plot(self, ax=None, **kwargs):
"""
Plot the histogram with matplotlib, returns `matplotlib` figure.
"""
ax, fig, plt = get_ax_fig_plt(ax)
yy = [len(v) for v in self.values]
ax.plot(self.binvals, yy, **kwargs)
return fig | def plot(self, ax=None, **kwargs):
"""
Plot the histogram with matplotlib, returns `matplotlib` figure.
"""
ax, fig, plt = get_ax_fig_plt(ax)
yy = [len(v) for v in self.values]
ax.plot(self.binvals, yy, **kwargs)
return fig | [
"Plot",
"the",
"histogram",
"with",
"matplotlib",
"returns",
"matplotlib",
"figure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L880-L889 | [
"def",
"plot",
"(",
"self",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
",",
"fig",
",",
"plt",
"=",
"get_ax_fig_plt",
"(",
"ax",
")",
"yy",
"=",
"[",
"len",
"(",
"v",
")",
"for",
"v",
"in",
"self",
".",
"values",
"]",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dirviz.get_cluster_graph | Generate directory graph in the DOT language. Directories are shown as clusters
.. warning::
This function scans the entire directory tree starting from top so the resulting
graph can be really big.
Args:
engine: Layout command used. ['dot', 'neato', 'twopi', 'circ... | pymatgen/io/abinit/utils.py | def get_cluster_graph(self, engine="fdp", graph_attr=None, node_attr=None, edge_attr=None):
"""
Generate directory graph in the DOT language. Directories are shown as clusters
.. warning::
This function scans the entire directory tree starting from top so the resulting
... | def get_cluster_graph(self, engine="fdp", graph_attr=None, node_attr=None, edge_attr=None):
"""
Generate directory graph in the DOT language. Directories are shown as clusters
.. warning::
This function scans the entire directory tree starting from top so the resulting
... | [
"Generate",
"directory",
"graph",
"in",
"the",
"DOT",
"language",
".",
"Directories",
"are",
"shown",
"as",
"clusters"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L902-L988 | [
"def",
"get_cluster_graph",
"(",
"self",
",",
"engine",
"=",
"\"fdp\"",
",",
"graph_attr",
"=",
"None",
",",
"node_attr",
"=",
"None",
",",
"edge_attr",
"=",
"None",
")",
":",
"# https://www.graphviz.org/doc/info/",
"from",
"graphviz",
"import",
"Digraph",
"g",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InterfacialReactivity._get_entry_energy | Finds the lowest entry energy for entries matching the composition.
Entries with non-negative formation energies are excluded. If no
entry is found, use the convex hull energy for the composition.
Args:
pd (PhaseDiagram): PhaseDiagram object.
composition (Composition): C... | pymatgen/analysis/interface_reactions.py | def _get_entry_energy(pd, composition):
"""
Finds the lowest entry energy for entries matching the composition.
Entries with non-negative formation energies are excluded. If no
entry is found, use the convex hull energy for the composition.
Args:
pd (PhaseDiagram): P... | def _get_entry_energy(pd, composition):
"""
Finds the lowest entry energy for entries matching the composition.
Entries with non-negative formation energies are excluded. If no
entry is found, use the convex hull energy for the composition.
Args:
pd (PhaseDiagram): P... | [
"Finds",
"the",
"lowest",
"entry",
"energy",
"for",
"entries",
"matching",
"the",
"composition",
".",
"Entries",
"with",
"non",
"-",
"negative",
"formation",
"energies",
"are",
"excluded",
".",
"If",
"no",
"entry",
"is",
"found",
"use",
"the",
"convex",
"hul... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/interface_reactions.py#L141-L168 | [
"def",
"_get_entry_energy",
"(",
"pd",
",",
"composition",
")",
":",
"candidate",
"=",
"[",
"i",
".",
"energy_per_atom",
"for",
"i",
"in",
"pd",
".",
"qhull_entries",
"if",
"i",
".",
"composition",
".",
"fractional_composition",
"==",
"composition",
".",
"fr... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.