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 | estimate_band_connection | A function to order the phonon eigenvectors taken from phonopy | pymatgen/phonon/bandstructure.py | def estimate_band_connection(prev_eigvecs, eigvecs, prev_band_order):
"""
A function to order the phonon eigenvectors taken from phonopy
"""
metric = np.abs(np.dot(prev_eigvecs.conjugate().T, eigvecs))
connection_order = []
for overlaps in metric:
maxval = 0
for i in reversed(ran... | def estimate_band_connection(prev_eigvecs, eigvecs, prev_band_order):
"""
A function to order the phonon eigenvectors taken from phonopy
"""
metric = np.abs(np.dot(prev_eigvecs.conjugate().T, eigvecs))
connection_order = []
for overlaps in metric:
maxval = 0
for i in reversed(ran... | [
"A",
"function",
"to",
"order",
"the",
"phonon",
"eigenvectors",
"taken",
"from",
"phonopy"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L36-L55 | [
"def",
"estimate_band_connection",
"(",
"prev_eigvecs",
",",
"eigvecs",
",",
"prev_band_order",
")",
":",
"metric",
"=",
"np",
".",
"abs",
"(",
"np",
".",
"dot",
"(",
"prev_eigvecs",
".",
"conjugate",
"(",
")",
".",
"T",
",",
"eigvecs",
")",
")",
"connec... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructure.min_freq | Returns the point where the minimum frequency is reached and its value | pymatgen/phonon/bandstructure.py | def min_freq(self):
"""
Returns the point where the minimum frequency is reached and its value
"""
i = np.unravel_index(np.argmin(self.bands), self.bands.shape)
return self.qpoints[i[1]], self.bands[i] | def min_freq(self):
"""
Returns the point where the minimum frequency is reached and its value
"""
i = np.unravel_index(np.argmin(self.bands), self.bands.shape)
return self.qpoints[i[1]], self.bands[i] | [
"Returns",
"the",
"point",
"where",
"the",
"minimum",
"frequency",
"is",
"reached",
"and",
"its",
"value"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L138-L144 | [
"def",
"min_freq",
"(",
"self",
")",
":",
"i",
"=",
"np",
".",
"unravel_index",
"(",
"np",
".",
"argmin",
"(",
"self",
".",
"bands",
")",
",",
"self",
".",
"bands",
".",
"shape",
")",
"return",
"self",
".",
"qpoints",
"[",
"i",
"[",
"1",
"]",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructure.get_nac_frequencies_along_dir | Returns the nac_frequencies for the given direction (not necessarily a versor).
None if the direction is not present or nac_frequencies has not been calculated.
Args:
direction: the direction as a list of 3 elements
Returns:
the frequencies as a numpy array o(3*len(struc... | pymatgen/phonon/bandstructure.py | def get_nac_frequencies_along_dir(self, direction):
"""
Returns the nac_frequencies for the given direction (not necessarily a versor).
None if the direction is not present or nac_frequencies has not been calculated.
Args:
direction: the direction as a list of 3 elements
... | def get_nac_frequencies_along_dir(self, direction):
"""
Returns the nac_frequencies for the given direction (not necessarily a versor).
None if the direction is not present or nac_frequencies has not been calculated.
Args:
direction: the direction as a list of 3 elements
... | [
"Returns",
"the",
"nac_frequencies",
"for",
"the",
"given",
"direction",
"(",
"not",
"necessarily",
"a",
"versor",
")",
".",
"None",
"if",
"the",
"direction",
"is",
"not",
"present",
"or",
"nac_frequencies",
"has",
"not",
"been",
"calculated",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L167-L183 | [
"def",
"get_nac_frequencies_along_dir",
"(",
"self",
",",
"direction",
")",
":",
"versor",
"=",
"[",
"i",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
"direction",
")",
"for",
"i",
"in",
"direction",
"]",
"for",
"d",
",",
"f",
"in",
"self",
".",
"nac_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructure.get_nac_eigendisplacements_along_dir | Returns the nac_eigendisplacements for the given direction (not necessarily a versor).
None if the direction is not present or nac_eigendisplacements has not been calculated.
Args:
direction: the direction as a list of 3 elements
Returns:
the eigendisplacements as a nump... | pymatgen/phonon/bandstructure.py | def get_nac_eigendisplacements_along_dir(self, direction):
"""
Returns the nac_eigendisplacements for the given direction (not necessarily a versor).
None if the direction is not present or nac_eigendisplacements has not been calculated.
Args:
direction: the direction as a l... | def get_nac_eigendisplacements_along_dir(self, direction):
"""
Returns the nac_eigendisplacements for the given direction (not necessarily a versor).
None if the direction is not present or nac_eigendisplacements has not been calculated.
Args:
direction: the direction as a l... | [
"Returns",
"the",
"nac_eigendisplacements",
"for",
"the",
"given",
"direction",
"(",
"not",
"necessarily",
"a",
"versor",
")",
".",
"None",
"if",
"the",
"direction",
"is",
"not",
"present",
"or",
"nac_eigendisplacements",
"has",
"not",
"been",
"calculated",
"."
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L185-L201 | [
"def",
"get_nac_eigendisplacements_along_dir",
"(",
"self",
",",
"direction",
")",
":",
"versor",
"=",
"[",
"i",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
"direction",
")",
"for",
"i",
"in",
"direction",
"]",
"for",
"d",
",",
"e",
"in",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructure.asr_breaking | Returns the breaking of the acoustic sum rule for the three acoustic modes,
if Gamma is present. None otherwise.
If eigendisplacements are available they are used to determine the acoustic
modes: selects the bands corresponding to the eigendisplacements that
represent to a translation w... | pymatgen/phonon/bandstructure.py | def asr_breaking(self, tol_eigendisplacements=1e-5):
"""
Returns the breaking of the acoustic sum rule for the three acoustic modes,
if Gamma is present. None otherwise.
If eigendisplacements are available they are used to determine the acoustic
modes: selects the bands correspon... | def asr_breaking(self, tol_eigendisplacements=1e-5):
"""
Returns the breaking of the acoustic sum rule for the three acoustic modes,
if Gamma is present. None otherwise.
If eigendisplacements are available they are used to determine the acoustic
modes: selects the bands correspon... | [
"Returns",
"the",
"breaking",
"of",
"the",
"acoustic",
"sum",
"rule",
"for",
"the",
"three",
"acoustic",
"modes",
"if",
"Gamma",
"is",
"present",
".",
"None",
"otherwise",
".",
"If",
"eigendisplacements",
"are",
"available",
"they",
"are",
"used",
"to",
"det... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L203-L231 | [
"def",
"asr_breaking",
"(",
"self",
",",
"tol_eigendisplacements",
"=",
"1e-5",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nb_qpoints",
")",
":",
"if",
"np",
".",
"allclose",
"(",
"self",
".",
"qpoints",
"[",
"i",
"]",
".",
"frac_coords",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructureSymmLine.get_equivalent_qpoints | Returns the list of qpoint indices equivalent (meaning they are the
same frac coords) to the given one.
Args:
index: the qpoint index
Returns:
a list of equivalent indices
TODO: now it uses the label we might want to use coordinates instead
(in case the... | pymatgen/phonon/bandstructure.py | def get_equivalent_qpoints(self, index):
"""
Returns the list of qpoint indices equivalent (meaning they are the
same frac coords) to the given one.
Args:
index: the qpoint index
Returns:
a list of equivalent indices
TODO: now it uses the label ... | def get_equivalent_qpoints(self, index):
"""
Returns the list of qpoint indices equivalent (meaning they are the
same frac coords) to the given one.
Args:
index: the qpoint index
Returns:
a list of equivalent indices
TODO: now it uses the label ... | [
"Returns",
"the",
"list",
"of",
"qpoint",
"indices",
"equivalent",
"(",
"meaning",
"they",
"are",
"the",
"same",
"frac",
"coords",
")",
"to",
"the",
"given",
"one",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L367-L392 | [
"def",
"get_equivalent_qpoints",
"(",
"self",
",",
"index",
")",
":",
"#if the qpoint has no label it can\"t have a repetition along the band",
"#structure line object",
"if",
"self",
".",
"qpoints",
"[",
"index",
"]",
".",
"label",
"is",
"None",
":",
"return",
"[",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructureSymmLine.get_branch | Returns in what branch(es) is the qpoint. There can be several
branches.
Args:
index: the qpoint index
Returns:
A list of dictionaries [{"name","start_index","end_index","index"}]
indicating all branches in which the qpoint is. It takes into
acco... | pymatgen/phonon/bandstructure.py | def get_branch(self, index):
"""
Returns in what branch(es) is the qpoint. There can be several
branches.
Args:
index: the qpoint index
Returns:
A list of dictionaries [{"name","start_index","end_index","index"}]
indicating all branches in wh... | def get_branch(self, index):
"""
Returns in what branch(es) is the qpoint. There can be several
branches.
Args:
index: the qpoint index
Returns:
A list of dictionaries [{"name","start_index","end_index","index"}]
indicating all branches in wh... | [
"Returns",
"in",
"what",
"branch",
"(",
"es",
")",
"is",
"the",
"qpoint",
".",
"There",
"can",
"be",
"several",
"branches",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L394-L416 | [
"def",
"get_branch",
"(",
"self",
",",
"index",
")",
":",
"to_return",
"=",
"[",
"]",
"for",
"i",
"in",
"self",
".",
"get_equivalent_qpoints",
"(",
"index",
")",
":",
"for",
"b",
"in",
"self",
".",
"branches",
":",
"if",
"b",
"[",
"\"start_index\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructureSymmLine.write_phononwebsite | Write a json file for the phononwebsite:
http://henriquemiranda.github.io/phononwebsite | pymatgen/phonon/bandstructure.py | def write_phononwebsite(self,filename):
"""
Write a json file for the phononwebsite:
http://henriquemiranda.github.io/phononwebsite
"""
import json
with open(filename,'w') as f:
phononwebsite_json = json.dump(self.as_phononwebsite(),f) | def write_phononwebsite(self,filename):
"""
Write a json file for the phononwebsite:
http://henriquemiranda.github.io/phononwebsite
"""
import json
with open(filename,'w') as f:
phononwebsite_json = json.dump(self.as_phononwebsite(),f) | [
"Write",
"a",
"json",
"file",
"for",
"the",
"phononwebsite",
":",
"http",
":",
"//",
"henriquemiranda",
".",
"github",
".",
"io",
"/",
"phononwebsite"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L418-L425 | [
"def",
"write_phononwebsite",
"(",
"self",
",",
"filename",
")",
":",
"import",
"json",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",
":",
"phononwebsite_json",
"=",
"json",
".",
"dump",
"(",
"self",
".",
"as_phononwebsite",
"(",
")",
",",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructureSymmLine.as_phononwebsite | Return a dictionary with the phononwebsite format:
http://henriquemiranda.github.io/phononwebsite | pymatgen/phonon/bandstructure.py | def as_phononwebsite(self):
"""
Return a dictionary with the phononwebsite format:
http://henriquemiranda.github.io/phononwebsite
"""
d = {}
#define the lattice
d["lattice"] = self.structure.lattice._matrix.tolist()
#define atoms
atom_pos_c... | def as_phononwebsite(self):
"""
Return a dictionary with the phononwebsite format:
http://henriquemiranda.github.io/phononwebsite
"""
d = {}
#define the lattice
d["lattice"] = self.structure.lattice._matrix.tolist()
#define atoms
atom_pos_c... | [
"Return",
"a",
"dictionary",
"with",
"the",
"phononwebsite",
"format",
":",
"http",
":",
"//",
"henriquemiranda",
".",
"github",
".",
"io",
"/",
"phononwebsite"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L427-L505 | [
"def",
"as_phononwebsite",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"#define the lattice",
"d",
"[",
"\"lattice\"",
"]",
"=",
"self",
".",
"structure",
".",
"lattice",
".",
"_matrix",
".",
"tolist",
"(",
")",
"#define atoms",
"atom_pos_car",
"=",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBandStructureSymmLine.band_reorder | Re-order the eigenvalues according to the similarity of the eigenvectors | pymatgen/phonon/bandstructure.py | def band_reorder(self):
"""
Re-order the eigenvalues according to the similarity of the eigenvectors
"""
eiv = self.eigendisplacements
eig = self.bands
nphonons,nqpoints = self.bands.shape
order = np.zeros([nqpoints,nphonons],dtype=int)
order[0] = np.... | def band_reorder(self):
"""
Re-order the eigenvalues according to the similarity of the eigenvectors
"""
eiv = self.eigendisplacements
eig = self.bands
nphonons,nqpoints = self.bands.shape
order = np.zeros([nqpoints,nphonons],dtype=int)
order[0] = np.... | [
"Re",
"-",
"order",
"the",
"eigenvalues",
"according",
"to",
"the",
"similarity",
"of",
"the",
"eigenvectors"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L507-L534 | [
"def",
"band_reorder",
"(",
"self",
")",
":",
"eiv",
"=",
"self",
".",
"eigendisplacements",
"eig",
"=",
"self",
".",
"bands",
"nphonons",
",",
"nqpoints",
"=",
"self",
".",
"bands",
".",
"shape",
"order",
"=",
"np",
".",
"zeros",
"(",
"[",
"nqpoints",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | batch_write_vasp_input | Batch write vasp input for a sequence of transformed structures to
output_dir, following the format output_dir/{group}/{formula}_{number}.
Args:
transformed_structures: Sequence of TransformedStructures.
vasp_input_set: pymatgen.io.vaspio_set.VaspInputSet to creates
vasp input files... | pymatgen/alchemy/transmuters.py | def batch_write_vasp_input(transformed_structures, vasp_input_set=MPRelaxSet,
output_dir=".", create_directory=True,
subfolder=None,
include_cif=False, **kwargs):
"""
Batch write vasp input for a sequence of transformed structures ... | def batch_write_vasp_input(transformed_structures, vasp_input_set=MPRelaxSet,
output_dir=".", create_directory=True,
subfolder=None,
include_cif=False, **kwargs):
"""
Batch write vasp input for a sequence of transformed structures ... | [
"Batch",
"write",
"vasp",
"input",
"for",
"a",
"sequence",
"of",
"transformed",
"structures",
"to",
"output_dir",
"following",
"the",
"format",
"output_dir",
"/",
"{",
"group",
"}",
"/",
"{",
"formula",
"}",
"_",
"{",
"number",
"}",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L350-L387 | [
"def",
"batch_write_vasp_input",
"(",
"transformed_structures",
",",
"vasp_input_set",
"=",
"MPRelaxSet",
",",
"output_dir",
"=",
"\".\"",
",",
"create_directory",
"=",
"True",
",",
"subfolder",
"=",
"None",
",",
"include_cif",
"=",
"False",
",",
"*",
"*",
"kwar... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _apply_transformation | Helper method for multiprocessing of apply_transformation. Must not be
in the class so that it can be pickled.
Args:
inputs: Tuple containing the transformed structure, the transformation
to be applied, a boolean indicating whether to extend the
collection, and a boolean indicat... | pymatgen/alchemy/transmuters.py | def _apply_transformation(inputs):
"""
Helper method for multiprocessing of apply_transformation. Must not be
in the class so that it can be pickled.
Args:
inputs: Tuple containing the transformed structure, the transformation
to be applied, a boolean indicating whether to extend th... | def _apply_transformation(inputs):
"""
Helper method for multiprocessing of apply_transformation. Must not be
in the class so that it can be pickled.
Args:
inputs: Tuple containing the transformed structure, the transformation
to be applied, a boolean indicating whether to extend th... | [
"Helper",
"method",
"for",
"multiprocessing",
"of",
"apply_transformation",
".",
"Must",
"not",
"be",
"in",
"the",
"class",
"so",
"that",
"it",
"can",
"be",
"pickled",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L390-L410 | [
"def",
"_apply_transformation",
"(",
"inputs",
")",
":",
"ts",
",",
"transformation",
",",
"extend_collection",
",",
"clear_redo",
"=",
"inputs",
"new",
"=",
"ts",
".",
"append_transformation",
"(",
"transformation",
",",
"extend_collection",
",",
"clear_redo",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StandardTransmuter.append_transformation | Appends a transformation to all TransformedStructures.
Args:
transformation: Transformation to append
extend_collection: Whether to use more than one output structure
from one-to-many transformations. extend_collection can be a
number, which determines th... | pymatgen/alchemy/transmuters.py | def append_transformation(self, transformation, extend_collection=False,
clear_redo=True):
"""
Appends a transformation to all TransformedStructures.
Args:
transformation: Transformation to append
extend_collection: Whether to use more than ... | def append_transformation(self, transformation, extend_collection=False,
clear_redo=True):
"""
Appends a transformation to all TransformedStructures.
Args:
transformation: Transformation to append
extend_collection: Whether to use more than ... | [
"Appends",
"a",
"transformation",
"to",
"all",
"TransformedStructures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L99-L139 | [
"def",
"append_transformation",
"(",
"self",
",",
"transformation",
",",
"extend_collection",
"=",
"False",
",",
"clear_redo",
"=",
"True",
")",
":",
"if",
"self",
".",
"ncores",
"and",
"transformation",
".",
"use_multiprocessing",
":",
"p",
"=",
"Pool",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StandardTransmuter.apply_filter | Applies a structure_filter to the list of TransformedStructures
in the transmuter.
Args:
structure_filter: StructureFilter to apply. | pymatgen/alchemy/transmuters.py | def apply_filter(self, structure_filter):
"""
Applies a structure_filter to the list of TransformedStructures
in the transmuter.
Args:
structure_filter: StructureFilter to apply.
"""
def test_transformed_structure(ts):
return structure_filter.tes... | def apply_filter(self, structure_filter):
"""
Applies a structure_filter to the list of TransformedStructures
in the transmuter.
Args:
structure_filter: StructureFilter to apply.
"""
def test_transformed_structure(ts):
return structure_filter.tes... | [
"Applies",
"a",
"structure_filter",
"to",
"the",
"list",
"of",
"TransformedStructures",
"in",
"the",
"transmuter",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L151-L166 | [
"def",
"apply_filter",
"(",
"self",
",",
"structure_filter",
")",
":",
"def",
"test_transformed_structure",
"(",
"ts",
")",
":",
"return",
"structure_filter",
".",
"test",
"(",
"ts",
".",
"final_structure",
")",
"self",
".",
"transformed_structures",
"=",
"list"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StandardTransmuter.set_parameter | Add parameters to the transmuter. Additional parameters are stored in
the as_dict() output.
Args:
key: The key for the parameter.
value: The value for the parameter. | pymatgen/alchemy/transmuters.py | def set_parameter(self, key, value):
"""
Add parameters to the transmuter. Additional parameters are stored in
the as_dict() output.
Args:
key: The key for the parameter.
value: The value for the parameter.
"""
for x in self.transformed_structures... | def set_parameter(self, key, value):
"""
Add parameters to the transmuter. Additional parameters are stored in
the as_dict() output.
Args:
key: The key for the parameter.
value: The value for the parameter.
"""
for x in self.transformed_structures... | [
"Add",
"parameters",
"to",
"the",
"transmuter",
".",
"Additional",
"parameters",
"are",
"stored",
"in",
"the",
"as_dict",
"()",
"output",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L178-L188 | [
"def",
"set_parameter",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"for",
"x",
"in",
"self",
".",
"transformed_structures",
":",
"x",
".",
"other_parameters",
"[",
"key",
"]",
"=",
"value"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StandardTransmuter.append_transformed_structures | Method is overloaded to accept either a list of transformed structures
or transmuter, it which case it appends the second transmuter"s
structures.
Args:
tstructs_or_transmuter: A list of transformed structures or a
transmuter. | pymatgen/alchemy/transmuters.py | def append_transformed_structures(self, tstructs_or_transmuter):
"""
Method is overloaded to accept either a list of transformed structures
or transmuter, it which case it appends the second transmuter"s
structures.
Args:
tstructs_or_transmuter: A list of transformed... | def append_transformed_structures(self, tstructs_or_transmuter):
"""
Method is overloaded to accept either a list of transformed structures
or transmuter, it which case it appends the second transmuter"s
structures.
Args:
tstructs_or_transmuter: A list of transformed... | [
"Method",
"is",
"overloaded",
"to",
"accept",
"either",
"a",
"list",
"of",
"transformed",
"structures",
"or",
"transmuter",
"it",
"which",
"case",
"it",
"appends",
"the",
"second",
"transmuter",
"s",
"structures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L206-L222 | [
"def",
"append_transformed_structures",
"(",
"self",
",",
"tstructs_or_transmuter",
")",
":",
"if",
"isinstance",
"(",
"tstructs_or_transmuter",
",",
"self",
".",
"__class__",
")",
":",
"self",
".",
"transformed_structures",
".",
"extend",
"(",
"tstructs_or_transmuter... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StandardTransmuter.from_structures | Alternative constructor from structures rather than
TransformedStructures.
Args:
structures: Sequence of structures
transformations: New transformations to be applied to all
structures
extend_collection: Whether to use more than one output structure
... | pymatgen/alchemy/transmuters.py | def from_structures(structures, transformations=None, extend_collection=0):
"""
Alternative constructor from structures rather than
TransformedStructures.
Args:
structures: Sequence of structures
transformations: New transformations to be applied to all
... | def from_structures(structures, transformations=None, extend_collection=0):
"""
Alternative constructor from structures rather than
TransformedStructures.
Args:
structures: Sequence of structures
transformations: New transformations to be applied to all
... | [
"Alternative",
"constructor",
"from",
"structures",
"rather",
"than",
"TransformedStructures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L225-L243 | [
"def",
"from_structures",
"(",
"structures",
",",
"transformations",
"=",
"None",
",",
"extend_collection",
"=",
"0",
")",
":",
"tstruct",
"=",
"[",
"TransformedStructure",
"(",
"s",
",",
"[",
"]",
")",
"for",
"s",
"in",
"structures",
"]",
"return",
"Stand... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CifTransmuter.from_filenames | Generates a TransformedStructureCollection from a cif, possibly
containing multiple structures.
Args:
filenames: List of strings of the cif files
transformations: New transformations to be applied to all
structures
primitive: Same meaning as in __init... | pymatgen/alchemy/transmuters.py | def from_filenames(filenames, transformations=None, primitive=True,
extend_collection=False):
"""
Generates a TransformedStructureCollection from a cif, possibly
containing multiple structures.
Args:
filenames: List of strings of the cif files
... | def from_filenames(filenames, transformations=None, primitive=True,
extend_collection=False):
"""
Generates a TransformedStructureCollection from a cif, possibly
containing multiple structures.
Args:
filenames: List of strings of the cif files
... | [
"Generates",
"a",
"TransformedStructureCollection",
"from",
"a",
"cif",
"possibly",
"containing",
"multiple",
"structures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L286-L306 | [
"def",
"from_filenames",
"(",
"filenames",
",",
"transformations",
"=",
"None",
",",
"primitive",
"=",
"True",
",",
"extend_collection",
"=",
"False",
")",
":",
"allcifs",
"=",
"[",
"]",
"for",
"fname",
"in",
"filenames",
":",
"with",
"open",
"(",
"fname",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PoscarTransmuter.from_filenames | Convenient constructor to generates a POSCAR transmuter from a list of
POSCAR filenames.
Args:
poscar_filenames: List of POSCAR filenames
transformations: New transformations to be applied to all
structures.
extend_collection:
Same mea... | pymatgen/alchemy/transmuters.py | def from_filenames(poscar_filenames, transformations=None,
extend_collection=False):
"""
Convenient constructor to generates a POSCAR transmuter from a list of
POSCAR filenames.
Args:
poscar_filenames: List of POSCAR filenames
transformatio... | def from_filenames(poscar_filenames, transformations=None,
extend_collection=False):
"""
Convenient constructor to generates a POSCAR transmuter from a list of
POSCAR filenames.
Args:
poscar_filenames: List of POSCAR filenames
transformatio... | [
"Convenient",
"constructor",
"to",
"generates",
"a",
"POSCAR",
"transmuter",
"from",
"a",
"list",
"of",
"POSCAR",
"filenames",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/alchemy/transmuters.py#L328-L347 | [
"def",
"from_filenames",
"(",
"poscar_filenames",
",",
"transformations",
"=",
"None",
",",
"extend_collection",
"=",
"False",
")",
":",
"tstructs",
"=",
"[",
"]",
"for",
"filename",
"in",
"poscar_filenames",
":",
"with",
"open",
"(",
"filename",
",",
"\"r\"",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _magic_parser | Parse the section with the SCF cycle
Returns:
dict where the key are the name of columns and
the values are list of numbers. Note if no section was found.
.. warning::
The parser is very fragile and should be replaced by YAML. | pymatgen/io/abinit/abiinspect.py | def _magic_parser(stream, magic):
"""
Parse the section with the SCF cycle
Returns:
dict where the key are the name of columns and
the values are list of numbers. Note if no section was found.
.. warning::
The parser is very fragile and should be replaced by YAML.
"""
... | def _magic_parser(stream, magic):
"""
Parse the section with the SCF cycle
Returns:
dict where the key are the name of columns and
the values are list of numbers. Note if no section was found.
.. warning::
The parser is very fragile and should be replaced by YAML.
"""
... | [
"Parse",
"the",
"section",
"with",
"the",
"SCF",
"cycle"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L27-L72 | [
"def",
"_magic_parser",
"(",
"stream",
",",
"magic",
")",
":",
"#Example (SCF cycle, similar format is used for phonons):",
"#",
"# iter Etot(hartree) deltaE(h) residm vres2",
"# ETOT 1 -8.8604027880849 -8.860E+00 2.458E-02 3.748E+00",
"# At SCF step 5 vres2 = ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | yaml_read_kpoints | Read the K-points from file. | pymatgen/io/abinit/abiinspect.py | def yaml_read_kpoints(filename, doc_tag="!Kpoints"):
"""Read the K-points from file."""
with YamlTokenizer(filename) as r:
doc = r.next_doc_with_tag(doc_tag)
d = yaml.safe_load(doc.text_notag)
return np.array(d["reduced_coordinates_of_qpoints"]) | def yaml_read_kpoints(filename, doc_tag="!Kpoints"):
"""Read the K-points from file."""
with YamlTokenizer(filename) as r:
doc = r.next_doc_with_tag(doc_tag)
d = yaml.safe_load(doc.text_notag)
return np.array(d["reduced_coordinates_of_qpoints"]) | [
"Read",
"the",
"K",
"-",
"points",
"from",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L657-L663 | [
"def",
"yaml_read_kpoints",
"(",
"filename",
",",
"doc_tag",
"=",
"\"!Kpoints\"",
")",
":",
"with",
"YamlTokenizer",
"(",
"filename",
")",
"as",
"r",
":",
"doc",
"=",
"r",
".",
"next_doc_with_tag",
"(",
"doc_tag",
")",
"d",
"=",
"yaml",
".",
"safe_load",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | yaml_read_irred_perts | Read the list of irreducible perturbations from file. | pymatgen/io/abinit/abiinspect.py | def yaml_read_irred_perts(filename, doc_tag="!IrredPerts"):
"""Read the list of irreducible perturbations from file."""
with YamlTokenizer(filename) as r:
doc = r.next_doc_with_tag(doc_tag)
d = yaml.safe_load(doc.text_notag)
return [AttrDict(**pert) for pert in d["irred_perts"]] | def yaml_read_irred_perts(filename, doc_tag="!IrredPerts"):
"""Read the list of irreducible perturbations from file."""
with YamlTokenizer(filename) as r:
doc = r.next_doc_with_tag(doc_tag)
d = yaml.safe_load(doc.text_notag)
return [AttrDict(**pert) for pert in d["irred_perts"]] | [
"Read",
"the",
"list",
"of",
"irreducible",
"perturbations",
"from",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L666-L672 | [
"def",
"yaml_read_irred_perts",
"(",
"filename",
",",
"doc_tag",
"=",
"\"!IrredPerts\"",
")",
":",
"with",
"YamlTokenizer",
"(",
"filename",
")",
"as",
"r",
":",
"doc",
"=",
"r",
".",
"next_doc_with_tag",
"(",
"doc_tag",
")",
"d",
"=",
"yaml",
".",
"safe_l... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ScfCycle.to_string | String representation. | pymatgen/io/abinit/abiinspect.py | def to_string(self, verbose=0):
"""String representation."""
rows = [[it + 1] + list(map(str, (self[k][it] for k in self.keys())))
for it in range(self.num_iterations)]
return tabulate(rows, headers=["Iter"] + list(self.keys())) | def to_string(self, verbose=0):
"""String representation."""
rows = [[it + 1] + list(map(str, (self[k][it] for k in self.keys())))
for it in range(self.num_iterations)]
return tabulate(rows, headers=["Iter"] + list(self.keys())) | [
"String",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L137-L142 | [
"def",
"to_string",
"(",
"self",
",",
"verbose",
"=",
"0",
")",
":",
"rows",
"=",
"[",
"[",
"it",
"+",
"1",
"]",
"+",
"list",
"(",
"map",
"(",
"str",
",",
"(",
"self",
"[",
"k",
"]",
"[",
"it",
"]",
"for",
"k",
"in",
"self",
".",
"keys",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ScfCycle.from_stream | Read the first occurrence of ScfCycle from stream.
Returns:
None if no `ScfCycle` entry is found. | pymatgen/io/abinit/abiinspect.py | def from_stream(cls, stream):
"""
Read the first occurrence of ScfCycle from stream.
Returns:
None if no `ScfCycle` entry is found.
"""
fields = _magic_parser(stream, magic=cls.MAGIC)
if fields:
fields.pop("iter")
return cls(fields)
... | def from_stream(cls, stream):
"""
Read the first occurrence of ScfCycle from stream.
Returns:
None if no `ScfCycle` entry is found.
"""
fields = _magic_parser(stream, magic=cls.MAGIC)
if fields:
fields.pop("iter")
return cls(fields)
... | [
"Read",
"the",
"first",
"occurrence",
"of",
"ScfCycle",
"from",
"stream",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L156-L169 | [
"def",
"from_stream",
"(",
"cls",
",",
"stream",
")",
":",
"fields",
"=",
"_magic_parser",
"(",
"stream",
",",
"magic",
"=",
"cls",
".",
"MAGIC",
")",
"if",
"fields",
":",
"fields",
".",
"pop",
"(",
"\"iter\"",
")",
"return",
"cls",
"(",
"fields",
")... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CyclesPlotter.add_label_cycle | Add new cycle to the plotter with label `label`. | pymatgen/io/abinit/abiinspect.py | def add_label_cycle(self, label, cycle):
"""Add new cycle to the plotter with label `label`."""
self.labels.append(label)
self.cycles.append(cycle) | def add_label_cycle(self, label, cycle):
"""Add new cycle to the plotter with label `label`."""
self.labels.append(label)
self.cycles.append(cycle) | [
"Add",
"new",
"cycle",
"to",
"the",
"plotter",
"with",
"label",
"label",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L267-L270 | [
"def",
"add_label_cycle",
"(",
"self",
",",
"label",
",",
"cycle",
")",
":",
"self",
".",
"labels",
".",
"append",
"(",
"label",
")",
"self",
".",
"cycles",
".",
"append",
"(",
"cycle",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CyclesPlotter.combiplot | Compare multiple cycels on a grid: one subplot per quantity,
all cycles on the same subplot.
Args:
fontsize: Legend fontsize. | pymatgen/io/abinit/abiinspect.py | def combiplot(self, fontsize=8, **kwargs):
"""
Compare multiple cycels on a grid: one subplot per quantity,
all cycles on the same subplot.
Args:
fontsize: Legend fontsize.
"""
ax_list = None
for i, (label, cycle) in enumerate(self.items()):
... | def combiplot(self, fontsize=8, **kwargs):
"""
Compare multiple cycels on a grid: one subplot per quantity,
all cycles on the same subplot.
Args:
fontsize: Legend fontsize.
"""
ax_list = None
for i, (label, cycle) in enumerate(self.items()):
... | [
"Compare",
"multiple",
"cycels",
"on",
"a",
"grid",
":",
"one",
"subplot",
"per",
"quantity",
"all",
"cycles",
"on",
"the",
"same",
"subplot",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L273-L287 | [
"def",
"combiplot",
"(",
"self",
",",
"fontsize",
"=",
"8",
",",
"*",
"*",
"kwargs",
")",
":",
"ax_list",
"=",
"None",
"for",
"i",
",",
"(",
"label",
",",
"cycle",
")",
"in",
"enumerate",
"(",
"self",
".",
"items",
"(",
")",
")",
":",
"fig",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CyclesPlotter.slideshow | Produce slides show of the different cycles. One plot per cycle. | pymatgen/io/abinit/abiinspect.py | def slideshow(self, **kwargs):
"""
Produce slides show of the different cycles. One plot per cycle.
"""
for label, cycle in self.items():
cycle.plot(title=label, tight_layout=True) | def slideshow(self, **kwargs):
"""
Produce slides show of the different cycles. One plot per cycle.
"""
for label, cycle in self.items():
cycle.plot(title=label, tight_layout=True) | [
"Produce",
"slides",
"show",
"of",
"the",
"different",
"cycles",
".",
"One",
"plot",
"per",
"cycle",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L289-L294 | [
"def",
"slideshow",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"label",
",",
"cycle",
"in",
"self",
".",
"items",
"(",
")",
":",
"cycle",
".",
"plot",
"(",
"title",
"=",
"label",
",",
"tight_layout",
"=",
"True",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Relaxation.to_string | String representation. | pymatgen/io/abinit/abiinspect.py | def to_string(self, verbose=0):
"""String representation."""
lines = []
app = lines.append
for i, cycle in enumerate(self):
app("")
app("RELAXATION STEP: %d" % (i + 1))
app(cycle.to_string(verbose=verbose))
return "\n".join(lines) | def to_string(self, verbose=0):
"""String representation."""
lines = []
app = lines.append
for i, cycle in enumerate(self):
app("")
app("RELAXATION STEP: %d" % (i + 1))
app(cycle.to_string(verbose=verbose))
return "\n".join(lines) | [
"String",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L328-L337 | [
"def",
"to_string",
"(",
"self",
",",
"verbose",
"=",
"0",
")",
":",
"lines",
"=",
"[",
"]",
"app",
"=",
"lines",
".",
"append",
"for",
"i",
",",
"cycle",
"in",
"enumerate",
"(",
"self",
")",
":",
"app",
"(",
"\"\"",
")",
"app",
"(",
"\"RELAXATIO... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Relaxation.from_stream | Extract data from stream. Returns None if some error occurred. | pymatgen/io/abinit/abiinspect.py | def from_stream(cls, stream):
"""
Extract data from stream. Returns None if some error occurred.
"""
cycles = []
while True:
scf_cycle = GroundStateScfCycle.from_stream(stream)
if scf_cycle is None: break
cycles.append(scf_cycle)
retur... | def from_stream(cls, stream):
"""
Extract data from stream. Returns None if some error occurred.
"""
cycles = []
while True:
scf_cycle = GroundStateScfCycle.from_stream(stream)
if scf_cycle is None: break
cycles.append(scf_cycle)
retur... | [
"Extract",
"data",
"from",
"stream",
".",
"Returns",
"None",
"if",
"some",
"error",
"occurred",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L346-L356 | [
"def",
"from_stream",
"(",
"cls",
",",
"stream",
")",
":",
"cycles",
"=",
"[",
"]",
"while",
"True",
":",
"scf_cycle",
"=",
"GroundStateScfCycle",
".",
"from_stream",
"(",
"stream",
")",
"if",
"scf_cycle",
"is",
"None",
":",
"break",
"cycles",
".",
"appe... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Relaxation.history | Ordered Dictionary of lists with the evolution of
the data as function of the relaxation step. | pymatgen/io/abinit/abiinspect.py | def history(self):
"""
Ordered Dictionary of lists with the evolution of
the data as function of the relaxation step.
"""
history = OrderedDict()
for cycle in self:
d = cycle.last_iteration
for k, v in d.items():
if k in history:
... | def history(self):
"""
Ordered Dictionary of lists with the evolution of
the data as function of the relaxation step.
"""
history = OrderedDict()
for cycle in self:
d = cycle.last_iteration
for k, v in d.items():
if k in history:
... | [
"Ordered",
"Dictionary",
"of",
"lists",
"with",
"the",
"evolution",
"of",
"the",
"data",
"as",
"function",
"of",
"the",
"relaxation",
"step",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L359-L377 | [
"def",
"history",
"(",
"self",
")",
":",
"history",
"=",
"OrderedDict",
"(",
")",
"for",
"cycle",
"in",
"self",
":",
"d",
"=",
"cycle",
".",
"last_iteration",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"history... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Relaxation.slideshow | Uses matplotlib to plot the evolution of the structural relaxation.
Args:
ax_list: List of axes. If None a new figure is produced.
Returns:
`matplotlib` figure | pymatgen/io/abinit/abiinspect.py | def slideshow(self, **kwargs):
"""
Uses matplotlib to plot the evolution of the structural relaxation.
Args:
ax_list: List of axes. If None a new figure is produced.
Returns:
`matplotlib` figure
"""
for i, cycle in enumerate(self.cycles):
... | def slideshow(self, **kwargs):
"""
Uses matplotlib to plot the evolution of the structural relaxation.
Args:
ax_list: List of axes. If None a new figure is produced.
Returns:
`matplotlib` figure
"""
for i, cycle in enumerate(self.cycles):
... | [
"Uses",
"matplotlib",
"to",
"plot",
"the",
"evolution",
"of",
"the",
"structural",
"relaxation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L379-L392 | [
"def",
"slideshow",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"i",
",",
"cycle",
"in",
"enumerate",
"(",
"self",
".",
"cycles",
")",
":",
"cycle",
".",
"plot",
"(",
"title",
"=",
"\"Relaxation step %s\"",
"%",
"(",
"i",
"+",
"1",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Relaxation.plot | Plot relaxation history i.e. the results of the last iteration of each SCF cycle.
Args:
ax_list: List of axes. If None a new figure is produced.
fontsize: legend fontsize.
kwargs: keyword arguments are passed to ax.plot
Returns: matplotlib figure | pymatgen/io/abinit/abiinspect.py | def plot(self, ax_list=None, fontsize=12, **kwargs):
"""
Plot relaxation history i.e. the results of the last iteration of each SCF cycle.
Args:
ax_list: List of axes. If None a new figure is produced.
fontsize: legend fontsize.
kwargs: keyword arguments are ... | def plot(self, ax_list=None, fontsize=12, **kwargs):
"""
Plot relaxation history i.e. the results of the last iteration of each SCF cycle.
Args:
ax_list: List of axes. If None a new figure is produced.
fontsize: legend fontsize.
kwargs: keyword arguments are ... | [
"Plot",
"relaxation",
"history",
"i",
".",
"e",
".",
"the",
"results",
"of",
"the",
"last",
"iteration",
"of",
"each",
"SCF",
"cycle",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L395-L450 | [
"def",
"plot",
"(",
"self",
",",
"ax_list",
"=",
"None",
",",
"fontsize",
"=",
"12",
",",
"*",
"*",
"kwargs",
")",
":",
"history",
"=",
"self",
".",
"history",
"# Build grid of plots.",
"num_plots",
",",
"ncols",
",",
"nrows",
"=",
"len",
"(",
"history... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | YamlTokenizer.seek | seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, positive or negative), and 2 (move
relative to ... | pymatgen/io/abinit/abiinspect.py | def seek(self, offset, whence=0):
"""
seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, p... | def seek(self, offset, whence=0):
"""
seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, p... | [
"seek",
"(",
"offset",
"[",
"whence",
"]",
")",
"-",
">",
"None",
".",
"Move",
"to",
"new",
"file",
"position",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L549-L564 | [
"def",
"seek",
"(",
"self",
",",
"offset",
",",
"whence",
"=",
"0",
")",
":",
"assert",
"offset",
"==",
"0",
"self",
".",
"linepos",
"=",
"0",
"return",
"self",
".",
"stream",
".",
"seek",
"(",
"offset",
",",
"whence",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | YamlTokenizer.next | Returns the first YAML document in stream.
.. warning::
Assume that the YAML document are closed explicitely with the sentinel '...' | pymatgen/io/abinit/abiinspect.py | def next(self):
"""
Returns the first YAML document in stream.
.. warning::
Assume that the YAML document are closed explicitely with the sentinel '...'
"""
in_doc, lines, doc_tag = None, [], None
for i, line in enumerate(self.stream):
self.line... | def next(self):
"""
Returns the first YAML document in stream.
.. warning::
Assume that the YAML document are closed explicitely with the sentinel '...'
"""
in_doc, lines, doc_tag = None, [], None
for i, line in enumerate(self.stream):
self.line... | [
"Returns",
"the",
"first",
"YAML",
"document",
"in",
"stream",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L570-L610 | [
"def",
"next",
"(",
"self",
")",
":",
"in_doc",
",",
"lines",
",",
"doc_tag",
"=",
"None",
",",
"[",
"]",
",",
"None",
"for",
"i",
",",
"line",
"in",
"enumerate",
"(",
"self",
".",
"stream",
")",
":",
"self",
".",
"linepos",
"+=",
"1",
"#print(i,... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | YamlTokenizer.next_doc_with_tag | Returns the next document with the specified tag. Empty string is no doc is found. | pymatgen/io/abinit/abiinspect.py | def next_doc_with_tag(self, doc_tag):
"""
Returns the next document with the specified tag. Empty string is no doc is found.
"""
while True:
try:
doc = next(self)
if doc.tag == doc_tag:
return doc
except StopIte... | def next_doc_with_tag(self, doc_tag):
"""
Returns the next document with the specified tag. Empty string is no doc is found.
"""
while True:
try:
doc = next(self)
if doc.tag == doc_tag:
return doc
except StopIte... | [
"Returns",
"the",
"next",
"document",
"with",
"the",
"specified",
"tag",
".",
"Empty",
"string",
"is",
"no",
"doc",
"is",
"found",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L626-L637 | [
"def",
"next_doc_with_tag",
"(",
"self",
",",
"doc_tag",
")",
":",
"while",
"True",
":",
"try",
":",
"doc",
"=",
"next",
"(",
"self",
")",
"if",
"doc",
".",
"tag",
"==",
"doc_tag",
":",
"return",
"doc",
"except",
"StopIteration",
":",
"raise"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | YamlTokenizer.all_docs_with_tag | Returns all the documents with the specified tag. | pymatgen/io/abinit/abiinspect.py | def all_docs_with_tag(self, doc_tag):
"""
Returns all the documents with the specified tag.
"""
docs = []
while True:
try:
doc = self.next_doc_with(doc_tag)
docs.append(doc)
except StopIteration:
break
... | def all_docs_with_tag(self, doc_tag):
"""
Returns all the documents with the specified tag.
"""
docs = []
while True:
try:
doc = self.next_doc_with(doc_tag)
docs.append(doc)
except StopIteration:
break
... | [
"Returns",
"all",
"the",
"documents",
"with",
"the",
"specified",
"tag",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L639-L654 | [
"def",
"all_docs_with_tag",
"(",
"self",
",",
"doc_tag",
")",
":",
"docs",
"=",
"[",
"]",
"while",
"True",
":",
"try",
":",
"doc",
"=",
"self",
".",
"next_doc_with",
"(",
"doc_tag",
")",
"docs",
".",
"append",
"(",
"doc",
")",
"except",
"StopIteration"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | YamlDoc.text_notag | Returns the YAML text without the tag.
Useful if we don't have any constructor registered for the tag
(we used the tag just to locate the document). | pymatgen/io/abinit/abiinspect.py | def text_notag(self):
"""
Returns the YAML text without the tag.
Useful if we don't have any constructor registered for the tag
(we used the tag just to locate the document).
"""
if self.tag is not None:
return self.text.replace(self.tag, "")
else:
... | def text_notag(self):
"""
Returns the YAML text without the tag.
Useful if we don't have any constructor registered for the tag
(we used the tag just to locate the document).
"""
if self.tag is not None:
return self.text.replace(self.tag, "")
else:
... | [
"Returns",
"the",
"YAML",
"text",
"without",
"the",
"tag",
".",
"Useful",
"if",
"we",
"don",
"t",
"have",
"any",
"constructor",
"registered",
"for",
"the",
"tag",
"(",
"we",
"used",
"the",
"tag",
"just",
"to",
"locate",
"the",
"document",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abiinspect.py#L717-L726 | [
"def",
"text_notag",
"(",
"self",
")",
":",
"if",
"self",
".",
"tag",
"is",
"not",
"None",
":",
"return",
"self",
".",
"text",
".",
"replace",
"(",
"self",
".",
"tag",
",",
"\"\"",
")",
"else",
":",
"return",
"self",
".",
"text"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ExecWrapper._execute | Execute the executable in a subprocess inside workdir.
Some executables fail if we try to launch them with mpirun.
Use with_mpirun=False to run the binary without it. | pymatgen/io/abinit/wrappers.py | def _execute(self, workdir, with_mpirun=False, exec_args=None):
"""
Execute the executable in a subprocess inside workdir.
Some executables fail if we try to launch them with mpirun.
Use with_mpirun=False to run the binary without it.
"""
qadapter = self.manager.qadapter... | def _execute(self, workdir, with_mpirun=False, exec_args=None):
"""
Execute the executable in a subprocess inside workdir.
Some executables fail if we try to launch them with mpirun.
Use with_mpirun=False to run the binary without it.
"""
qadapter = self.manager.qadapter... | [
"Execute",
"the",
"executable",
"in",
"a",
"subprocess",
"inside",
"workdir",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/wrappers.py#L68-L103 | [
"def",
"_execute",
"(",
"self",
",",
"workdir",
",",
"with_mpirun",
"=",
"False",
",",
"exec_args",
"=",
"None",
")",
":",
"qadapter",
"=",
"self",
".",
"manager",
".",
"qadapter",
"if",
"not",
"with_mpirun",
":",
"qadapter",
".",
"name",
"=",
"None",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Mrgscr.merge_qpoints | Execute mrgscr inside directory `workdir` to merge `files_to_merge`.
Produce new file with prefix `out_prefix` | pymatgen/io/abinit/wrappers.py | def merge_qpoints(self, workdir, files_to_merge, out_prefix):
"""
Execute mrgscr inside directory `workdir` to merge `files_to_merge`.
Produce new file with prefix `out_prefix`
"""
# We work with absolute paths.
files_to_merge = [os.path.abspath(s) for s in list_strings(f... | def merge_qpoints(self, workdir, files_to_merge, out_prefix):
"""
Execute mrgscr inside directory `workdir` to merge `files_to_merge`.
Produce new file with prefix `out_prefix`
"""
# We work with absolute paths.
files_to_merge = [os.path.abspath(s) for s in list_strings(f... | [
"Execute",
"mrgscr",
"inside",
"directory",
"workdir",
"to",
"merge",
"files_to_merge",
".",
"Produce",
"new",
"file",
"with",
"prefix",
"out_prefix"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/wrappers.py#L109-L146 | [
"def",
"merge_qpoints",
"(",
"self",
",",
"workdir",
",",
"files_to_merge",
",",
"out_prefix",
")",
":",
"# We work with absolute paths.",
"files_to_merge",
"=",
"[",
"os",
".",
"path",
".",
"abspath",
"(",
"s",
")",
"for",
"s",
"in",
"list_strings",
"(",
"f... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Mrggkk.merge | Merge GGK files, return the absolute path of the new database.
Args:
gswfk_file: Ground-state WFK filename
dfpt_files: List of 1WFK files to merge.
gkk_files: List of GKK files to merge.
out_gkk: Name of the output GKK file
binascii: Integer flat. 0 -... | pymatgen/io/abinit/wrappers.py | def merge(self, workdir, gswfk_file, dfpt_files, gkk_files, out_gkk, binascii=0):
"""
Merge GGK files, return the absolute path of the new database.
Args:
gswfk_file: Ground-state WFK filename
dfpt_files: List of 1WFK files to merge.
gkk_files: List of GKK fi... | def merge(self, workdir, gswfk_file, dfpt_files, gkk_files, out_gkk, binascii=0):
"""
Merge GGK files, return the absolute path of the new database.
Args:
gswfk_file: Ground-state WFK filename
dfpt_files: List of 1WFK files to merge.
gkk_files: List of GKK fi... | [
"Merge",
"GGK",
"files",
"return",
"the",
"absolute",
"path",
"of",
"the",
"new",
"database",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/wrappers.py#L152-L208 | [
"def",
"merge",
"(",
"self",
",",
"workdir",
",",
"gswfk_file",
",",
"dfpt_files",
",",
"gkk_files",
",",
"out_gkk",
",",
"binascii",
"=",
"0",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This method should be tested\"",
")",
"#out_gkk = out_gkk if cwd is None... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Mrgddb.merge | Merge DDB file, return the absolute path of the new database in workdir. | pymatgen/io/abinit/wrappers.py | def merge(self, workdir, ddb_files, out_ddb, description, delete_source_ddbs=True):
"""Merge DDB file, return the absolute path of the new database in workdir."""
# We work with absolute paths.
ddb_files = [os.path.abspath(s) for s in list_strings(ddb_files)]
if not os.path.isabs(out_ddb... | def merge(self, workdir, ddb_files, out_ddb, description, delete_source_ddbs=True):
"""Merge DDB file, return the absolute path of the new database in workdir."""
# We work with absolute paths.
ddb_files = [os.path.abspath(s) for s in list_strings(ddb_files)]
if not os.path.isabs(out_ddb... | [
"Merge",
"DDB",
"file",
"return",
"the",
"absolute",
"path",
"of",
"the",
"new",
"database",
"in",
"workdir",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/wrappers.py#L214-L262 | [
"def",
"merge",
"(",
"self",
",",
"workdir",
",",
"ddb_files",
",",
"out_ddb",
",",
"description",
",",
"delete_source_ddbs",
"=",
"True",
")",
":",
"# We work with absolute paths.",
"ddb_files",
"=",
"[",
"os",
".",
"path",
".",
"abspath",
"(",
"s",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Mrgdvdb.merge | Merge POT files containing 1st order DFPT potential
return the absolute path of the new database in workdir.
Args:
delete_source: True if POT1 files should be removed after (successful) merge. | pymatgen/io/abinit/wrappers.py | def merge(self, workdir, pot_files, out_dvdb, delete_source=True):
"""
Merge POT files containing 1st order DFPT potential
return the absolute path of the new database in workdir.
Args:
delete_source: True if POT1 files should be removed after (successful) merge.
"""... | def merge(self, workdir, pot_files, out_dvdb, delete_source=True):
"""
Merge POT files containing 1st order DFPT potential
return the absolute path of the new database in workdir.
Args:
delete_source: True if POT1 files should be removed after (successful) merge.
"""... | [
"Merge",
"POT",
"files",
"containing",
"1st",
"order",
"DFPT",
"potential",
"return",
"the",
"absolute",
"path",
"of",
"the",
"new",
"database",
"in",
"workdir",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/wrappers.py#L268-L321 | [
"def",
"merge",
"(",
"self",
",",
"workdir",
",",
"pot_files",
",",
"out_dvdb",
",",
"delete_source",
"=",
"True",
")",
":",
"# We work with absolute paths.",
"pot_files",
"=",
"[",
"os",
".",
"path",
".",
"abspath",
"(",
"s",
")",
"for",
"s",
"in",
"lis... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Cut3D.cut3d | Runs cut3d with a Cut3DInput
Args:
cut3d_input: a Cut3DInput object.
workdir: directory where cut3d is executed.
Returns:
(string) absolute path to the standard output of the cut3d execution.
(string) absolute path to the output filepath. None if output ... | pymatgen/io/abinit/wrappers.py | def cut3d(self, cut3d_input, workdir):
"""
Runs cut3d with a Cut3DInput
Args:
cut3d_input: a Cut3DInput object.
workdir: directory where cut3d is executed.
Returns:
(string) absolute path to the standard output of the cut3d execution.
(st... | def cut3d(self, cut3d_input, workdir):
"""
Runs cut3d with a Cut3DInput
Args:
cut3d_input: a Cut3DInput object.
workdir: directory where cut3d is executed.
Returns:
(string) absolute path to the standard output of the cut3d execution.
(st... | [
"Runs",
"cut3d",
"with",
"a",
"Cut3DInput"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/wrappers.py#L327-L358 | [
"def",
"cut3d",
"(",
"self",
",",
"cut3d_input",
",",
"workdir",
")",
":",
"self",
".",
"stdin_fname",
",",
"self",
".",
"stdout_fname",
",",
"self",
".",
"stderr_fname",
"=",
"map",
"(",
"os",
".",
"path",
".",
"join",
",",
"3",
"*",
"[",
"os",
".... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Critic2Caller.from_path | Convenience method to run critic2 analysis on a folder containing
typical VASP output files.
This method will:
1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped
counterparts.
2. If AECCAR* files are present, constructs a temporary reference
file as AECCAR0... | pymatgen/command_line/critic2_caller.py | def from_path(cls, path, suffix=''):
"""
Convenience method to run critic2 analysis on a folder containing
typical VASP output files.
This method will:
1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped
counterparts.
2. If AECCAR* files are present,... | def from_path(cls, path, suffix=''):
"""
Convenience method to run critic2 analysis on a folder containing
typical VASP output files.
This method will:
1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped
counterparts.
2. If AECCAR* files are present,... | [
"Convenience",
"method",
"to",
"run",
"critic2",
"analysis",
"on",
"a",
"folder",
"containing",
"typical",
"VASP",
"output",
"files",
".",
"This",
"method",
"will",
":",
"1",
".",
"Look",
"for",
"files",
"CHGCAR",
"AECAR0",
"AECAR2",
"POTCAR",
"or",
"their",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/critic2_caller.py#L196-L239 | [
"def",
"from_path",
"(",
"cls",
",",
"path",
",",
"suffix",
"=",
"''",
")",
":",
"def",
"_get_filepath",
"(",
"filename",
",",
"warning",
",",
"path",
"=",
"path",
",",
"suffix",
"=",
"suffix",
")",
":",
"paths",
"=",
"glob",
".",
"glob",
"(",
"os"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CriticalPoint.ellipticity | Most meaningful for bond critical points,
can be physically interpreted as e.g. degree
of pi-bonding in organic molecules. Consult
literature for more information.
:return: | pymatgen/command_line/critic2_caller.py | def ellipticity(self):
'''
Most meaningful for bond critical points,
can be physically interpreted as e.g. degree
of pi-bonding in organic molecules. Consult
literature for more information.
:return:
'''
eig = np.linalg.eig(self.field_hessian)
eig.... | def ellipticity(self):
'''
Most meaningful for bond critical points,
can be physically interpreted as e.g. degree
of pi-bonding in organic molecules. Consult
literature for more information.
:return:
'''
eig = np.linalg.eig(self.field_hessian)
eig.... | [
"Most",
"meaningful",
"for",
"bond",
"critical",
"points",
"can",
"be",
"physically",
"interpreted",
"as",
"e",
".",
"g",
".",
"degree",
"of",
"pi",
"-",
"bonding",
"in",
"organic",
"molecules",
".",
"Consult",
"literature",
"for",
"more",
"information",
"."... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/critic2_caller.py#L294-L304 | [
"def",
"ellipticity",
"(",
"self",
")",
":",
"eig",
"=",
"np",
".",
"linalg",
".",
"eig",
"(",
"self",
".",
"field_hessian",
")",
"eig",
".",
"sort",
"(",
")",
"return",
"eig",
"[",
"0",
"]",
"/",
"eig",
"[",
"1",
"]",
"-",
"1"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Critic2Output.structure_graph | A StructureGraph object describing bonding information
in the crystal. Lazily constructed.
:param edge_weight: a value to store on the Graph edges,
by default this is "bond_length" but other supported
values are any of the attributes of CriticalPoint
:return: | pymatgen/command_line/critic2_caller.py | def structure_graph(self, edge_weight="bond_length", edge_weight_units="Å"):
"""
A StructureGraph object describing bonding information
in the crystal. Lazily constructed.
:param edge_weight: a value to store on the Graph edges,
by default this is "bond_length" but other support... | def structure_graph(self, edge_weight="bond_length", edge_weight_units="Å"):
"""
A StructureGraph object describing bonding information
in the crystal. Lazily constructed.
:param edge_weight: a value to store on the Graph edges,
by default this is "bond_length" but other support... | [
"A",
"StructureGraph",
"object",
"describing",
"bonding",
"information",
"in",
"the",
"crystal",
".",
"Lazily",
"constructed",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/critic2_caller.py#L346-L406 | [
"def",
"structure_graph",
"(",
"self",
",",
"edge_weight",
"=",
"\"bond_length\"",
",",
"edge_weight_units",
"=",
"\"Å\")",
":",
"",
"sg",
"=",
"StructureGraph",
".",
"with_empty_graph",
"(",
"self",
".",
"structure",
",",
"name",
"=",
"\"bonds\"",
",",
"edge_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Critic2Output._add_node | Add information about a node describing a critical point.
:param idx: unique index
:param unique_idx: index of unique CriticalPoint,
used to look up more information of point (field etc.)
:param frac_coord: fractional co-ordinates of point
:return: | pymatgen/command_line/critic2_caller.py | def _add_node(self, idx, unique_idx, frac_coords):
"""
Add information about a node describing a critical point.
:param idx: unique index
:param unique_idx: index of unique CriticalPoint,
used to look up more information of point (field etc.)
:param frac_coord: fractiona... | def _add_node(self, idx, unique_idx, frac_coords):
"""
Add information about a node describing a critical point.
:param idx: unique index
:param unique_idx: index of unique CriticalPoint,
used to look up more information of point (field etc.)
:param frac_coord: fractiona... | [
"Add",
"information",
"about",
"a",
"node",
"describing",
"a",
"critical",
"point",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/critic2_caller.py#L529-L539 | [
"def",
"_add_node",
"(",
"self",
",",
"idx",
",",
"unique_idx",
",",
"frac_coords",
")",
":",
"self",
".",
"nodes",
"[",
"idx",
"]",
"=",
"{",
"'unique_idx'",
":",
"unique_idx",
",",
"'frac_coords'",
":",
"frac_coords",
"}"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Critic2Output._add_edge | Add information about an edge linking two critical points.
This actually describes two edges:
from_idx ------ idx ------ to_idx
However, in practice, from_idx and to_idx will typically be
atom nuclei, with the center node (idx) referring to a bond
critical point. Thus, it will... | pymatgen/command_line/critic2_caller.py | def _add_edge(self, idx, from_idx, from_lvec, to_idx, to_lvec):
"""
Add information about an edge linking two critical points.
This actually describes two edges:
from_idx ------ idx ------ to_idx
However, in practice, from_idx and to_idx will typically be
atom nuclei, ... | def _add_edge(self, idx, from_idx, from_lvec, to_idx, to_lvec):
"""
Add information about an edge linking two critical points.
This actually describes two edges:
from_idx ------ idx ------ to_idx
However, in practice, from_idx and to_idx will typically be
atom nuclei, ... | [
"Add",
"information",
"about",
"an",
"edge",
"linking",
"two",
"critical",
"points",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/critic2_caller.py#L541-L565 | [
"def",
"_add_edge",
"(",
"self",
",",
"idx",
",",
"from_idx",
",",
"from_lvec",
",",
"to_idx",
",",
"to_lvec",
")",
":",
"self",
".",
"edges",
"[",
"idx",
"]",
"=",
"{",
"'from_idx'",
":",
"from_idx",
",",
"'from_lvec'",
":",
"from_lvec",
",",
"'to_idx... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | calculate_bv_sum | Calculates the BV sum of a site.
Args:
site:
The site
nn_list:
List of nearest neighbors in the format [(nn_site, dist), ...].
scale_factor:
A scale factor to be applied. This is useful for scaling distance,
esp in the case of calculation-rela... | pymatgen/analysis/bond_valence.py | def calculate_bv_sum(site, nn_list, scale_factor=1.0):
"""
Calculates the BV sum of a site.
Args:
site:
The site
nn_list:
List of nearest neighbors in the format [(nn_site, dist), ...].
scale_factor:
A scale factor to be applied. This is useful fo... | def calculate_bv_sum(site, nn_list, scale_factor=1.0):
"""
Calculates the BV sum of a site.
Args:
site:
The site
nn_list:
List of nearest neighbors in the format [(nn_site, dist), ...].
scale_factor:
A scale factor to be applied. This is useful fo... | [
"Calculates",
"the",
"BV",
"sum",
"of",
"a",
"site",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/bond_valence.py#L55-L82 | [
"def",
"calculate_bv_sum",
"(",
"site",
",",
"nn_list",
",",
"scale_factor",
"=",
"1.0",
")",
":",
"el1",
"=",
"Element",
"(",
"site",
".",
"specie",
".",
"symbol",
")",
"bvsum",
"=",
"0",
"for",
"(",
"nn",
",",
"dist",
")",
"in",
"nn_list",
":",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | calculate_bv_sum_unordered | Calculates the BV sum of a site for unordered structures.
Args:
site:
The site
nn_list:
List of nearest neighbors in the format [(nn_site, dist), ...].
scale_factor:
A scale factor to be applied. This is useful for scaling distance,
esp in the... | pymatgen/analysis/bond_valence.py | def calculate_bv_sum_unordered(site, nn_list, scale_factor=1):
"""
Calculates the BV sum of a site for unordered structures.
Args:
site:
The site
nn_list:
List of nearest neighbors in the format [(nn_site, dist), ...].
scale_factor:
A scale factor... | def calculate_bv_sum_unordered(site, nn_list, scale_factor=1):
"""
Calculates the BV sum of a site for unordered structures.
Args:
site:
The site
nn_list:
List of nearest neighbors in the format [(nn_site, dist), ...].
scale_factor:
A scale factor... | [
"Calculates",
"the",
"BV",
"sum",
"of",
"a",
"site",
"for",
"unordered",
"structures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/bond_valence.py#L85-L122 | [
"def",
"calculate_bv_sum_unordered",
"(",
"site",
",",
"nn_list",
",",
"scale_factor",
"=",
"1",
")",
":",
"# If the site \"site\" has N partial occupations as : f_{site}_0,",
"# f_{site}_1, ... f_{site}_N of elements",
"# X_{site}_0, X_{site}_1, ... X_{site}_N, and each neighbors nn_i i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | add_oxidation_state_by_site_fraction | Add oxidation states to a structure by fractional site.
Args:
oxidation_states (list): List of list of oxidation states for each
site fraction for each site.
E.g., [[2, 4], [3], [-2], [-2], [-2]] | pymatgen/analysis/bond_valence.py | def add_oxidation_state_by_site_fraction(structure, oxidation_states):
"""
Add oxidation states to a structure by fractional site.
Args:
oxidation_states (list): List of list of oxidation states for each
site fraction for each site.
E.g., [[2, 4], [3]... | def add_oxidation_state_by_site_fraction(structure, oxidation_states):
"""
Add oxidation states to a structure by fractional site.
Args:
oxidation_states (list): List of list of oxidation states for each
site fraction for each site.
E.g., [[2, 4], [3]... | [
"Add",
"oxidation",
"states",
"to",
"a",
"structure",
"by",
"fractional",
"site",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/bond_valence.py#L508-L528 | [
"def",
"add_oxidation_state_by_site_fraction",
"(",
"structure",
",",
"oxidation_states",
")",
":",
"try",
":",
"for",
"i",
",",
"site",
"in",
"enumerate",
"(",
"structure",
")",
":",
"new_sp",
"=",
"collections",
".",
"defaultdict",
"(",
"float",
")",
"for",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BVAnalyzer.get_valences | Returns a list of valences for the structure. This currently works only
for ordered structures only.
Args:
structure: Structure to analyze
Returns:
A list of valences for each site in the structure (for an ordered
structure), e.g., [1, 1, -2] or a list of li... | pymatgen/analysis/bond_valence.py | def get_valences(self, structure):
"""
Returns a list of valences for the structure. This currently works only
for ordered structures only.
Args:
structure: Structure to analyze
Returns:
A list of valences for each site in the structure (for an ordered
... | def get_valences(self, structure):
"""
Returns a list of valences for the structure. This currently works only
for ordered structures only.
Args:
structure: Structure to analyze
Returns:
A list of valences for each site in the structure (for an ordered
... | [
"Returns",
"a",
"list",
"of",
"valences",
"for",
"the",
"structure",
".",
"This",
"currently",
"works",
"only",
"for",
"ordered",
"structures",
"only",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/bond_valence.py#L233-L466 | [
"def",
"get_valences",
"(",
"self",
",",
"structure",
")",
":",
"els",
"=",
"[",
"Element",
"(",
"el",
".",
"symbol",
")",
"for",
"el",
"in",
"structure",
".",
"composition",
".",
"elements",
"]",
"if",
"not",
"set",
"(",
"els",
")",
".",
"issubset",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BVAnalyzer.get_oxi_state_decorated_structure | Get an oxidation state decorated structure. This currently works only
for ordered structures only.
Args:
structure: Structure to analyze
Returns:
A modified structure that is oxidation state decorated.
Raises:
ValueError if the valences cannot be de... | pymatgen/analysis/bond_valence.py | def get_oxi_state_decorated_structure(self, structure):
"""
Get an oxidation state decorated structure. This currently works only
for ordered structures only.
Args:
structure: Structure to analyze
Returns:
A modified structure that is oxidation state dec... | def get_oxi_state_decorated_structure(self, structure):
"""
Get an oxidation state decorated structure. This currently works only
for ordered structures only.
Args:
structure: Structure to analyze
Returns:
A modified structure that is oxidation state dec... | [
"Get",
"an",
"oxidation",
"state",
"decorated",
"structure",
".",
"This",
"currently",
"works",
"only",
"for",
"ordered",
"structures",
"only",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/bond_valence.py#L468-L489 | [
"def",
"get_oxi_state_decorated_structure",
"(",
"self",
",",
"structure",
")",
":",
"s",
"=",
"structure",
".",
"copy",
"(",
")",
"if",
"s",
".",
"is_ordered",
":",
"valences",
"=",
"self",
".",
"get_valences",
"(",
"s",
")",
"s",
".",
"add_oxidation_stat... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Trajectory.to_positions | Converts fractional coordinates of trajectory into positions | pymatgen/core/trajectory.py | def to_positions(self):
"""
Converts fractional coordinates of trajectory into positions
"""
if self.coords_are_displacement:
cumulative_displacements = np.cumsum(self.frac_coords, axis=0)
positions = self.base_positions + cumulative_displacements
self... | def to_positions(self):
"""
Converts fractional coordinates of trajectory into positions
"""
if self.coords_are_displacement:
cumulative_displacements = np.cumsum(self.frac_coords, axis=0)
positions = self.base_positions + cumulative_displacements
self... | [
"Converts",
"fractional",
"coordinates",
"of",
"trajectory",
"into",
"positions"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/trajectory.py#L98-L107 | [
"def",
"to_positions",
"(",
"self",
")",
":",
"if",
"self",
".",
"coords_are_displacement",
":",
"cumulative_displacements",
"=",
"np",
".",
"cumsum",
"(",
"self",
".",
"frac_coords",
",",
"axis",
"=",
"0",
")",
"positions",
"=",
"self",
".",
"base_positions... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Trajectory.to_displacements | Converts position coordinates of trajectory into displacements between consecutive frames | pymatgen/core/trajectory.py | def to_displacements(self):
"""
Converts position coordinates of trajectory into displacements between consecutive frames
"""
if not self.coords_are_displacement:
displacements = np.subtract(self.frac_coords, np.roll(self.frac_coords, 1, axis=0))
displacements[0] ... | def to_displacements(self):
"""
Converts position coordinates of trajectory into displacements between consecutive frames
"""
if not self.coords_are_displacement:
displacements = np.subtract(self.frac_coords, np.roll(self.frac_coords, 1, axis=0))
displacements[0] ... | [
"Converts",
"position",
"coordinates",
"of",
"trajectory",
"into",
"displacements",
"between",
"consecutive",
"frames"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/trajectory.py#L109-L121 | [
"def",
"to_displacements",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"coords_are_displacement",
":",
"displacements",
"=",
"np",
".",
"subtract",
"(",
"self",
".",
"frac_coords",
",",
"np",
".",
"roll",
"(",
"self",
".",
"frac_coords",
",",
"1",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Trajectory.extend | Concatenate another trajectory
Args:
trajectory (Trajectory): Trajectory to add | pymatgen/core/trajectory.py | def extend(self, trajectory):
"""
Concatenate another trajectory
Args:
trajectory (Trajectory): Trajectory to add
"""
if self.time_step != trajectory.time_step:
raise ValueError('Trajectory not extended: Time steps of trajectories is incompatible')
... | def extend(self, trajectory):
"""
Concatenate another trajectory
Args:
trajectory (Trajectory): Trajectory to add
"""
if self.time_step != trajectory.time_step:
raise ValueError('Trajectory not extended: Time steps of trajectories is incompatible')
... | [
"Concatenate",
"another",
"trajectory"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/trajectory.py#L123-L145 | [
"def",
"extend",
"(",
"self",
",",
"trajectory",
")",
":",
"if",
"self",
".",
"time_step",
"!=",
"trajectory",
".",
"time_step",
":",
"raise",
"ValueError",
"(",
"'Trajectory not extended: Time steps of trajectories is incompatible'",
")",
"if",
"len",
"(",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Trajectory.from_structures | Convenience constructor to obtain trajectory from a list of structures.
Note: Assumes no atoms removed during simulation
Args:
structures (list): list of pymatgen Structure objects.
constant_lattice (bool): Whether the lattice changes during the simulation, such as in an NPT MD
... | pymatgen/core/trajectory.py | def from_structures(cls, structures, constant_lattice=True, **kwargs):
"""
Convenience constructor to obtain trajectory from a list of structures.
Note: Assumes no atoms removed during simulation
Args:
structures (list): list of pymatgen Structure objects.
consta... | def from_structures(cls, structures, constant_lattice=True, **kwargs):
"""
Convenience constructor to obtain trajectory from a list of structures.
Note: Assumes no atoms removed during simulation
Args:
structures (list): list of pymatgen Structure objects.
consta... | [
"Convenience",
"constructor",
"to",
"obtain",
"trajectory",
"from",
"a",
"list",
"of",
"structures",
".",
"Note",
":",
"Assumes",
"no",
"atoms",
"removed",
"during",
"simulation"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/trajectory.py#L195-L216 | [
"def",
"from_structures",
"(",
"cls",
",",
"structures",
",",
"constant_lattice",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"frac_coords",
"=",
"[",
"structure",
".",
"frac_coords",
"for",
"structure",
"in",
"structures",
"]",
"if",
"constant_lattice",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Trajectory.from_file | Convenience constructor to obtain trajectory from XDATCAR or vasprun.xml file
Args:
filename (str): The filename to read from.
constant_lattice (bool): Whether the lattice changes during the simulation, such as in an NPT MD
simulation. True results in
Returns:
... | pymatgen/core/trajectory.py | def from_file(cls, filename, constant_lattice=True, **kwargs):
"""
Convenience constructor to obtain trajectory from XDATCAR or vasprun.xml file
Args:
filename (str): The filename to read from.
constant_lattice (bool): Whether the lattice changes during the simulation, s... | def from_file(cls, filename, constant_lattice=True, **kwargs):
"""
Convenience constructor to obtain trajectory from XDATCAR or vasprun.xml file
Args:
filename (str): The filename to read from.
constant_lattice (bool): Whether the lattice changes during the simulation, s... | [
"Convenience",
"constructor",
"to",
"obtain",
"trajectory",
"from",
"XDATCAR",
"or",
"vasprun",
".",
"xml",
"file"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/trajectory.py#L219-L241 | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
",",
"constant_lattice",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: Support other filetypes",
"fname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"if",
"fnmatch",
"(",
"fnam... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Trajectory._combine_attribute | Helper function to combine trajectory properties such as site_properties or lattice | pymatgen/core/trajectory.py | def _combine_attribute(attr_1, attr_2, len_1, len_2):
"""
Helper function to combine trajectory properties such as site_properties or lattice
"""
if isinstance(attr_1, list) or isinstance(attr_2, list):
attribute = np.concatenate((attr_1, attr_2), axis=0)
attribut... | def _combine_attribute(attr_1, attr_2, len_1, len_2):
"""
Helper function to combine trajectory properties such as site_properties or lattice
"""
if isinstance(attr_1, list) or isinstance(attr_2, list):
attribute = np.concatenate((attr_1, attr_2), axis=0)
attribut... | [
"Helper",
"function",
"to",
"combine",
"trajectory",
"properties",
"such",
"as",
"site_properties",
"or",
"lattice"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/trajectory.py#L257-L272 | [
"def",
"_combine_attribute",
"(",
"attr_1",
",",
"attr_2",
",",
"len_1",
",",
"len_2",
")",
":",
"if",
"isinstance",
"(",
"attr_1",
",",
"list",
")",
"or",
"isinstance",
"(",
"attr_2",
",",
"list",
")",
":",
"attribute",
"=",
"np",
".",
"concatenate",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FreysoldtCorrection.get_correction | Gets the Freysoldt correction for a defect entry
Args:
entry (DefectEntry): defect entry to compute Freysoldt correction on.
Requires following parameters in the DefectEntry to exist:
axis_grid (3 x NGX where NGX is the length of the NGX grid
... | pymatgen/analysis/defects/corrections.py | def get_correction(self, entry):
"""
Gets the Freysoldt correction for a defect entry
Args:
entry (DefectEntry): defect entry to compute Freysoldt correction on.
Requires following parameters in the DefectEntry to exist:
axis_grid (3 x NGX where N... | def get_correction(self, entry):
"""
Gets the Freysoldt correction for a defect entry
Args:
entry (DefectEntry): defect entry to compute Freysoldt correction on.
Requires following parameters in the DefectEntry to exist:
axis_grid (3 x NGX where N... | [
"Gets",
"the",
"Freysoldt",
"correction",
"for",
"a",
"defect",
"entry",
"Args",
":",
"entry",
"(",
"DefectEntry",
")",
":",
"defect",
"entry",
"to",
"compute",
"Freysoldt",
"correction",
"on",
".",
"Requires",
"following",
"parameters",
"in",
"the",
"DefectEn... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L56-L121 | [
"def",
"get_correction",
"(",
"self",
",",
"entry",
")",
":",
"if",
"not",
"self",
".",
"axis",
":",
"list_axis_grid",
"=",
"np",
".",
"array",
"(",
"entry",
".",
"parameters",
"[",
"\"axis_grid\"",
"]",
")",
"list_bulk_plnr_avg_esp",
"=",
"np",
".",
"ar... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FreysoldtCorrection.perform_es_corr | Peform Electrostatic Freysoldt Correction | pymatgen/analysis/defects/corrections.py | def perform_es_corr(self, lattice, q, step=1e-4):
"""
Peform Electrostatic Freysoldt Correction
"""
logger.info("Running Freysoldt 2011 PC calculation (should be " "equivalent to sxdefectalign)")
logger.debug("defect lattice constants are (in angstroms)" + str(lattice.abc))
... | def perform_es_corr(self, lattice, q, step=1e-4):
"""
Peform Electrostatic Freysoldt Correction
"""
logger.info("Running Freysoldt 2011 PC calculation (should be " "equivalent to sxdefectalign)")
logger.debug("defect lattice constants are (in angstroms)" + str(lattice.abc))
... | [
"Peform",
"Electrostatic",
"Freysoldt",
"Correction"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L123-L158 | [
"def",
"perform_es_corr",
"(",
"self",
",",
"lattice",
",",
"q",
",",
"step",
"=",
"1e-4",
")",
":",
"logger",
".",
"info",
"(",
"\"Running Freysoldt 2011 PC calculation (should be \"",
"\"equivalent to sxdefectalign)\"",
")",
"logger",
".",
"debug",
"(",
"\"defect ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FreysoldtCorrection.perform_pot_corr | For performing planar averaging potential alignment
title is for name of plot, if you dont want a plot then leave it as None
widthsample is the width (in Angstroms) of the region in between defects where the potential alignment correction is averaged | pymatgen/analysis/defects/corrections.py | def perform_pot_corr(self,
axis_grid,
pureavg,
defavg,
lattice,
q,
defect_position,
axis,
madetol=0.0001,
... | def perform_pot_corr(self,
axis_grid,
pureavg,
defavg,
lattice,
q,
defect_position,
axis,
madetol=0.0001,
... | [
"For",
"performing",
"planar",
"averaging",
"potential",
"alignment"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L160-L247 | [
"def",
"perform_pot_corr",
"(",
"self",
",",
"axis_grid",
",",
"pureavg",
",",
"defavg",
",",
"lattice",
",",
"q",
",",
"defect_position",
",",
"axis",
",",
"madetol",
"=",
"0.0001",
",",
"widthsample",
"=",
"1.0",
")",
":",
"logging",
".",
"debug",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FreysoldtCorrection.plot | Plots the planar average electrostatic potential against the Long range and short range models from Freysoldt | pymatgen/analysis/defects/corrections.py | def plot(self, axis, title=None, saved=False):
"""
Plots the planar average electrostatic potential against the Long range and short range models from Freysoldt
"""
x = self.metadata['pot_plot_data'][axis]['x']
v_R = self.metadata['pot_plot_data'][axis]['Vr']
dft_diff =... | def plot(self, axis, title=None, saved=False):
"""
Plots the planar average electrostatic potential against the Long range and short range models from Freysoldt
"""
x = self.metadata['pot_plot_data'][axis]['x']
v_R = self.metadata['pot_plot_data'][axis]['Vr']
dft_diff =... | [
"Plots",
"the",
"planar",
"average",
"electrostatic",
"potential",
"against",
"the",
"Long",
"range",
"and",
"short",
"range",
"models",
"from",
"Freysoldt"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L249-L283 | [
"def",
"plot",
"(",
"self",
",",
"axis",
",",
"title",
"=",
"None",
",",
"saved",
"=",
"False",
")",
":",
"x",
"=",
"self",
".",
"metadata",
"[",
"'pot_plot_data'",
"]",
"[",
"axis",
"]",
"[",
"'x'",
"]",
"v_R",
"=",
"self",
".",
"metadata",
"[",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandFillingCorrection.get_correction | Gets the BandFilling correction for a defect entry | pymatgen/analysis/defects/corrections.py | def get_correction(self, entry):
"""
Gets the BandFilling correction for a defect entry
"""
eigenvalues = entry.parameters["eigenvalues"]
kpoint_weights = entry.parameters["kpoint_weights"]
potalign = entry.parameters["potalign"]
vbm = entry.parameters["vbm"]
... | def get_correction(self, entry):
"""
Gets the BandFilling correction for a defect entry
"""
eigenvalues = entry.parameters["eigenvalues"]
kpoint_weights = entry.parameters["kpoint_weights"]
potalign = entry.parameters["potalign"]
vbm = entry.parameters["vbm"]
... | [
"Gets",
"the",
"BandFilling",
"correction",
"for",
"a",
"defect",
"entry"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L329-L343 | [
"def",
"get_correction",
"(",
"self",
",",
"entry",
")",
":",
"eigenvalues",
"=",
"entry",
".",
"parameters",
"[",
"\"eigenvalues\"",
"]",
"kpoint_weights",
"=",
"entry",
".",
"parameters",
"[",
"\"kpoint_weights\"",
"]",
"potalign",
"=",
"entry",
".",
"parame... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandFillingCorrection.perform_bandfill_corr | This calculates the band filling correction based on excess of electrons/holes in CB/VB...
Note that the total free holes and electrons may also be used for a "shallow donor/acceptor"
correction with specified band shifts: +num_elec_cbm * Delta E_CBM (or -num_hole_vbm * Delta E_VBM)
... | pymatgen/analysis/defects/corrections.py | def perform_bandfill_corr(self, eigenvalues, kpoint_weights, potalign, vbm, cbm):
"""
This calculates the band filling correction based on excess of electrons/holes in CB/VB...
Note that the total free holes and electrons may also be used for a "shallow donor/acceptor"
correction... | def perform_bandfill_corr(self, eigenvalues, kpoint_weights, potalign, vbm, cbm):
"""
This calculates the band filling correction based on excess of electrons/holes in CB/VB...
Note that the total free holes and electrons may also be used for a "shallow donor/acceptor"
correction... | [
"This",
"calculates",
"the",
"band",
"filling",
"correction",
"based",
"on",
"excess",
"of",
"electrons",
"/",
"holes",
"in",
"CB",
"/",
"VB",
"..."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L345-L407 | [
"def",
"perform_bandfill_corr",
"(",
"self",
",",
"eigenvalues",
",",
"kpoint_weights",
",",
"potalign",
",",
"vbm",
",",
"cbm",
")",
":",
"bf_corr",
"=",
"0.",
"self",
".",
"metadata",
"[",
"\"potalign\"",
"]",
"=",
"potalign",
"self",
".",
"metadata",
"[... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandEdgeShiftingCorrection.get_correction | Gets the BandEdge correction for a defect entry | pymatgen/analysis/defects/corrections.py | def get_correction(self, entry):
"""
Gets the BandEdge correction for a defect entry
"""
# TODO: add smarter defect level shifting based on defect level projection onto host bands
hybrid_cbm = entry.parameters["hybrid_cbm"]
hybrid_vbm = entry.parameters["hybrid_vbm"]
... | def get_correction(self, entry):
"""
Gets the BandEdge correction for a defect entry
"""
# TODO: add smarter defect level shifting based on defect level projection onto host bands
hybrid_cbm = entry.parameters["hybrid_cbm"]
hybrid_vbm = entry.parameters["hybrid_vbm"]
... | [
"Gets",
"the",
"BandEdge",
"correction",
"for",
"a",
"defect",
"entry"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L445-L472 | [
"def",
"get_correction",
"(",
"self",
",",
"entry",
")",
":",
"# TODO: add smarter defect level shifting based on defect level projection onto host bands",
"hybrid_cbm",
"=",
"entry",
".",
"parameters",
"[",
"\"hybrid_cbm\"",
"]",
"hybrid_vbm",
"=",
"entry",
".",
"parameter... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | JobStatus.from_string | Return a :class:`JobStatus` instance from its string representation. | pymatgen/io/abinit/qjobs.py | def from_string(cls, s):
"""Return a :class:`JobStatus` instance from its string representation."""
for num, text in cls._STATUS_TABLE.items():
if text == s: return cls(num)
else:
#raise ValueError("Wrong string %s" % s)
logger.warning("Got unknown status: %s"... | def from_string(cls, s):
"""Return a :class:`JobStatus` instance from its string representation."""
for num, text in cls._STATUS_TABLE.items():
if text == s: return cls(num)
else:
#raise ValueError("Wrong string %s" % s)
logger.warning("Got unknown status: %s"... | [
"Return",
"a",
":",
"class",
":",
"JobStatus",
"instance",
"from",
"its",
"string",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qjobs.py#L71-L78 | [
"def",
"from_string",
"(",
"cls",
",",
"s",
")",
":",
"for",
"num",
",",
"text",
"in",
"cls",
".",
"_STATUS_TABLE",
".",
"items",
"(",
")",
":",
"if",
"text",
"==",
"s",
":",
"return",
"cls",
"(",
"num",
")",
"else",
":",
"#raise ValueError(\"Wrong s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueJob.from_qtype_and_id | Return a new istance of the appropriate subclass.
Args:
qtype: String specifying the Resource manager type.
queue_id: Job identifier.
qname: Name of the queue (optional). | pymatgen/io/abinit/qjobs.py | def from_qtype_and_id(qtype, queue_id, qname=None):
"""
Return a new istance of the appropriate subclass.
Args:
qtype: String specifying the Resource manager type.
queue_id: Job identifier.
qname: Name of the queue (optional).
"""
for cls in a... | def from_qtype_and_id(qtype, queue_id, qname=None):
"""
Return a new istance of the appropriate subclass.
Args:
qtype: String specifying the Resource manager type.
queue_id: Job identifier.
qname: Name of the queue (optional).
"""
for cls in a... | [
"Return",
"a",
"new",
"istance",
"of",
"the",
"appropriate",
"subclass",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qjobs.py#L103-L118 | [
"def",
"from_qtype_and_id",
"(",
"qtype",
",",
"queue_id",
",",
"qname",
"=",
"None",
")",
":",
"for",
"cls",
"in",
"all_subclasses",
"(",
"QueueJob",
")",
":",
"if",
"cls",
".",
"QTYPE",
"==",
"qtype",
":",
"break",
"else",
":",
"logger",
".",
"critic... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_stable_entries | Get the stable entries.
Args:
charge_to_discharge: order from most charge to most discharged
state? Default to True.
Returns:
A list of stable entries in the electrode, ordered by amount of the
working ion. | pymatgen/apps/battery/insertion_battery.py | def get_stable_entries(self, charge_to_discharge=True):
"""
Get the stable entries.
Args:
charge_to_discharge: order from most charge to most discharged
state? Default to True.
Returns:
A list of stable entries in the electrode, ordered by amount... | def get_stable_entries(self, charge_to_discharge=True):
"""
Get the stable entries.
Args:
charge_to_discharge: order from most charge to most discharged
state? Default to True.
Returns:
A list of stable entries in the electrode, ordered by amount... | [
"Get",
"the",
"stable",
"entries",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L103-L116 | [
"def",
"get_stable_entries",
"(",
"self",
",",
"charge_to_discharge",
"=",
"True",
")",
":",
"list_copy",
"=",
"list",
"(",
"self",
".",
"_stable_entries",
")",
"return",
"list_copy",
"if",
"charge_to_discharge",
"else",
"list_copy",
".",
"reverse",
"(",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_unstable_entries | Returns the unstable entries for the electrode.
Args:
charge_to_discharge: Order from most charge to most discharged
state? Defaults to True.
Returns:
A list of unstable entries in the electrode, ordered by amount of
the working ion. | pymatgen/apps/battery/insertion_battery.py | def get_unstable_entries(self, charge_to_discharge=True):
"""
Returns the unstable entries for the electrode.
Args:
charge_to_discharge: Order from most charge to most discharged
state? Defaults to True.
Returns:
A list of unstable entries in the... | def get_unstable_entries(self, charge_to_discharge=True):
"""
Returns the unstable entries for the electrode.
Args:
charge_to_discharge: Order from most charge to most discharged
state? Defaults to True.
Returns:
A list of unstable entries in the... | [
"Returns",
"the",
"unstable",
"entries",
"for",
"the",
"electrode",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L118-L131 | [
"def",
"get_unstable_entries",
"(",
"self",
",",
"charge_to_discharge",
"=",
"True",
")",
":",
"list_copy",
"=",
"list",
"(",
"self",
".",
"_unstable_entries",
")",
"return",
"list_copy",
"if",
"charge_to_discharge",
"else",
"list_copy",
".",
"reverse",
"(",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_all_entries | Return all entries input for the electrode.
Args:
charge_to_discharge:
order from most charge to most discharged state? Defaults to
True.
Returns:
A list of all entries in the electrode (both stable and unstable),
ordered by amount of... | pymatgen/apps/battery/insertion_battery.py | def get_all_entries(self, charge_to_discharge=True):
"""
Return all entries input for the electrode.
Args:
charge_to_discharge:
order from most charge to most discharged state? Defaults to
True.
Returns:
A list of all entries in t... | def get_all_entries(self, charge_to_discharge=True):
"""
Return all entries input for the electrode.
Args:
charge_to_discharge:
order from most charge to most discharged state? Defaults to
True.
Returns:
A list of all entries in t... | [
"Return",
"all",
"entries",
"input",
"for",
"the",
"electrode",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L133-L152 | [
"def",
"get_all_entries",
"(",
"self",
",",
"charge_to_discharge",
"=",
"True",
")",
":",
"all_entries",
"=",
"list",
"(",
"self",
".",
"get_stable_entries",
"(",
")",
")",
"all_entries",
".",
"extend",
"(",
"self",
".",
"get_unstable_entries",
"(",
")",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_max_instability | The maximum instability along a path for a specific voltage range.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Maximum decomposition energy of all compounds along the insertion
path (a subset of ... | pymatgen/apps/battery/insertion_battery.py | def get_max_instability(self, min_voltage=None, max_voltage=None):
"""
The maximum instability along a path for a specific voltage range.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Maximum d... | def get_max_instability(self, min_voltage=None, max_voltage=None):
"""
The maximum instability along a path for a specific voltage range.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Maximum d... | [
"The",
"maximum",
"instability",
"along",
"a",
"path",
"for",
"a",
"specific",
"voltage",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L168-L186 | [
"def",
"get_max_instability",
"(",
"self",
",",
"min_voltage",
"=",
"None",
",",
"max_voltage",
"=",
"None",
")",
":",
"data",
"=",
"[",
"]",
"for",
"pair",
"in",
"self",
".",
"_select_in_voltage_range",
"(",
"min_voltage",
",",
"max_voltage",
")",
":",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_min_instability | The minimum instability along a path for a specific voltage range.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Minimum decomposition energy of all compounds along the insertion
path (a subset of ... | pymatgen/apps/battery/insertion_battery.py | def get_min_instability(self, min_voltage=None, max_voltage=None):
"""
The minimum instability along a path for a specific voltage range.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Minimum d... | def get_min_instability(self, min_voltage=None, max_voltage=None):
"""
The minimum instability along a path for a specific voltage range.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Minimum d... | [
"The",
"minimum",
"instability",
"along",
"a",
"path",
"for",
"a",
"specific",
"voltage",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L188-L206 | [
"def",
"get_min_instability",
"(",
"self",
",",
"min_voltage",
"=",
"None",
",",
"max_voltage",
"=",
"None",
")",
":",
"data",
"=",
"[",
"]",
"for",
"pair",
"in",
"self",
".",
"_select_in_voltage_range",
"(",
"min_voltage",
",",
"max_voltage",
")",
":",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_max_muO2 | Maximum critical oxygen chemical potential along path.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Maximum critical oxygen chemical of all compounds along the
insertion path (a subset of the path... | pymatgen/apps/battery/insertion_battery.py | def get_max_muO2(self, min_voltage=None, max_voltage=None):
"""
Maximum critical oxygen chemical potential along path.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Maximum critical oxygen chem... | def get_max_muO2(self, min_voltage=None, max_voltage=None):
"""
Maximum critical oxygen chemical potential along path.
Args:
min_voltage: The minimum allowable voltage.
max_voltage: The maximum allowable voltage.
Returns:
Maximum critical oxygen chem... | [
"Maximum",
"critical",
"oxygen",
"chemical",
"potential",
"along",
"path",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L208-L227 | [
"def",
"get_max_muO2",
"(",
"self",
",",
"min_voltage",
"=",
"None",
",",
"max_voltage",
"=",
"None",
")",
":",
"data",
"=",
"[",
"]",
"for",
"pair",
"in",
"self",
".",
"_select_in_voltage_range",
"(",
"min_voltage",
",",
"max_voltage",
")",
":",
"if",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_min_muO2 | Minimum critical oxygen chemical potential along path.
Args:
min_voltage: The minimum allowable voltage for a given step
max_voltage: The maximum allowable voltage allowable for a given
step
Returns:
Minimum critical oxygen chemical of all compounds ... | pymatgen/apps/battery/insertion_battery.py | def get_min_muO2(self, min_voltage=None, max_voltage=None):
"""
Minimum critical oxygen chemical potential along path.
Args:
min_voltage: The minimum allowable voltage for a given step
max_voltage: The maximum allowable voltage allowable for a given
step
... | def get_min_muO2(self, min_voltage=None, max_voltage=None):
"""
Minimum critical oxygen chemical potential along path.
Args:
min_voltage: The minimum allowable voltage for a given step
max_voltage: The maximum allowable voltage allowable for a given
step
... | [
"Minimum",
"critical",
"oxygen",
"chemical",
"potential",
"along",
"path",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L229-L249 | [
"def",
"get_min_muO2",
"(",
"self",
",",
"min_voltage",
"=",
"None",
",",
"max_voltage",
"=",
"None",
")",
":",
"data",
"=",
"[",
"]",
"for",
"pair",
"in",
"self",
".",
"_select_in_voltage_range",
"(",
"min_voltage",
",",
"max_voltage",
")",
":",
"if",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.get_sub_electrodes | If this electrode contains multiple voltage steps, then it is possible
to use only a subset of the voltage steps to define other electrodes.
For example, an LiTiO2 electrode might contain three subelectrodes:
[LiTiO2 --> TiO2, LiTiO2 --> Li0.5TiO2, Li0.5TiO2 --> TiO2]
This method can be ... | pymatgen/apps/battery/insertion_battery.py | def get_sub_electrodes(self, adjacent_only=True, include_myself=True):
"""
If this electrode contains multiple voltage steps, then it is possible
to use only a subset of the voltage steps to define other electrodes.
For example, an LiTiO2 electrode might contain three subelectrodes:
... | def get_sub_electrodes(self, adjacent_only=True, include_myself=True):
"""
If this electrode contains multiple voltage steps, then it is possible
to use only a subset of the voltage steps to define other electrodes.
For example, an LiTiO2 electrode might contain three subelectrodes:
... | [
"If",
"this",
"electrode",
"contains",
"multiple",
"voltage",
"steps",
"then",
"it",
"is",
"possible",
"to",
"use",
"only",
"a",
"subset",
"of",
"the",
"voltage",
"steps",
"to",
"define",
"other",
"electrodes",
".",
"For",
"example",
"an",
"LiTiO2",
"electro... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L251-L298 | [
"def",
"get_sub_electrodes",
"(",
"self",
",",
"adjacent_only",
"=",
"True",
",",
"include_myself",
"=",
"True",
")",
":",
"battery_list",
"=",
"[",
"]",
"pair_it",
"=",
"self",
".",
"_vpairs",
"if",
"adjacent_only",
"else",
"itertools",
".",
"combinations_wit... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | InsertionElectrode.as_dict_summary | Generate a summary dict.
Args:
print_subelectrodes: Also print data on all the possible
subelectrodes.
Returns:
A summary of this electrode"s properties in dict format. | pymatgen/apps/battery/insertion_battery.py | def as_dict_summary(self, print_subelectrodes=True):
"""
Generate a summary dict.
Args:
print_subelectrodes: Also print data on all the possible
subelectrodes.
Returns:
A summary of this electrode"s properties in dict format.
"""
... | def as_dict_summary(self, print_subelectrodes=True):
"""
Generate a summary dict.
Args:
print_subelectrodes: Also print data on all the possible
subelectrodes.
Returns:
A summary of this electrode"s properties in dict format.
"""
... | [
"Generate",
"a",
"summary",
"dict",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/insertion_battery.py#L300-L355 | [
"def",
"as_dict_summary",
"(",
"self",
",",
"print_subelectrodes",
"=",
"True",
")",
":",
"chg_comp",
"=",
"self",
".",
"fully_charged_entry",
".",
"composition",
"dischg_comp",
"=",
"self",
".",
"fully_discharged_entry",
".",
"composition",
"ion",
"=",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | zval_dict_from_potcar | Creates zval_dictionary for calculating the ionic polarization from
Potcar object
potcar: Potcar object | pymatgen/analysis/ferroelectricity/polarization.py | def zval_dict_from_potcar(potcar):
"""
Creates zval_dictionary for calculating the ionic polarization from
Potcar object
potcar: Potcar object
"""
zval_dict = {}
for p in potcar:
zval_dict.update({p.element: p.ZVAL})
return zval_dict | def zval_dict_from_potcar(potcar):
"""
Creates zval_dictionary for calculating the ionic polarization from
Potcar object
potcar: Potcar object
"""
zval_dict = {}
for p in potcar:
zval_dict.update({p.element: p.ZVAL})
return zval_dict | [
"Creates",
"zval_dictionary",
"for",
"calculating",
"the",
"ionic",
"polarization",
"from",
"Potcar",
"object"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L68-L78 | [
"def",
"zval_dict_from_potcar",
"(",
"potcar",
")",
":",
"zval_dict",
"=",
"{",
"}",
"for",
"p",
"in",
"potcar",
":",
"zval_dict",
".",
"update",
"(",
"{",
"p",
".",
"element",
":",
"p",
".",
"ZVAL",
"}",
")",
"return",
"zval_dict"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | calc_ionic | Calculate the ionic dipole moment using ZVAL from pseudopotential
site: PeriodicSite
structure: Structure
zval: Charge value for ion (ZVAL for VASP pseudopotential)
Returns polarization in electron Angstroms. | pymatgen/analysis/ferroelectricity/polarization.py | def calc_ionic(site, structure, zval):
"""
Calculate the ionic dipole moment using ZVAL from pseudopotential
site: PeriodicSite
structure: Structure
zval: Charge value for ion (ZVAL for VASP pseudopotential)
Returns polarization in electron Angstroms.
"""
norms = structure.lattice.leng... | def calc_ionic(site, structure, zval):
"""
Calculate the ionic dipole moment using ZVAL from pseudopotential
site: PeriodicSite
structure: Structure
zval: Charge value for ion (ZVAL for VASP pseudopotential)
Returns polarization in electron Angstroms.
"""
norms = structure.lattice.leng... | [
"Calculate",
"the",
"ionic",
"dipole",
"moment",
"using",
"ZVAL",
"from",
"pseudopotential"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L81-L92 | [
"def",
"calc_ionic",
"(",
"site",
",",
"structure",
",",
"zval",
")",
":",
"norms",
"=",
"structure",
".",
"lattice",
".",
"lengths_and_angles",
"[",
"0",
"]",
"return",
"np",
".",
"multiply",
"(",
"norms",
",",
"-",
"site",
".",
"frac_coords",
"*",
"z... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_total_ionic_dipole | Get the total ionic dipole moment for a structure.
structure: pymatgen Structure
zval_dict: specie, zval dictionary pairs
center (np.array with shape [3,1]) : dipole center used by VASP
tiny (float) : tolerance for determining boundary of calculation. | pymatgen/analysis/ferroelectricity/polarization.py | def get_total_ionic_dipole(structure, zval_dict):
"""
Get the total ionic dipole moment for a structure.
structure: pymatgen Structure
zval_dict: specie, zval dictionary pairs
center (np.array with shape [3,1]) : dipole center used by VASP
tiny (float) : tolerance for determining boundary of ca... | def get_total_ionic_dipole(structure, zval_dict):
"""
Get the total ionic dipole moment for a structure.
structure: pymatgen Structure
zval_dict: specie, zval dictionary pairs
center (np.array with shape [3,1]) : dipole center used by VASP
tiny (float) : tolerance for determining boundary of ca... | [
"Get",
"the",
"total",
"ionic",
"dipole",
"moment",
"for",
"a",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L95-L109 | [
"def",
"get_total_ionic_dipole",
"(",
"structure",
",",
"zval_dict",
")",
":",
"tot_ionic",
"=",
"[",
"]",
"for",
"site",
"in",
"structure",
":",
"zval",
"=",
"zval_dict",
"[",
"str",
"(",
"site",
".",
"specie",
")",
"]",
"tot_ionic",
".",
"append",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PolarizationLattice.get_nearest_site | Given coords and a site, find closet site to coords.
Args:
coords (3x1 array): cartesian coords of center of sphere
site: site to find closest to coords
r: radius of sphere. Defaults to diagonal of unit cell
Returns:
Closest site and distance. | pymatgen/analysis/ferroelectricity/polarization.py | def get_nearest_site(self, coords, site, r=None):
"""
Given coords and a site, find closet site to coords.
Args:
coords (3x1 array): cartesian coords of center of sphere
site: site to find closest to coords
r: radius of sphere. Defaults to diagonal of unit cel... | def get_nearest_site(self, coords, site, r=None):
"""
Given coords and a site, find closet site to coords.
Args:
coords (3x1 array): cartesian coords of center of sphere
site: site to find closest to coords
r: radius of sphere. Defaults to diagonal of unit cel... | [
"Given",
"coords",
"and",
"a",
"site",
"find",
"closet",
"site",
"to",
"coords",
".",
"Args",
":",
"coords",
"(",
"3x1",
"array",
")",
":",
"cartesian",
"coords",
"of",
"center",
"of",
"sphere",
"site",
":",
"site",
"to",
"find",
"closest",
"to",
"coor... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L113-L133 | [
"def",
"get_nearest_site",
"(",
"self",
",",
"coords",
",",
"site",
",",
"r",
"=",
"None",
")",
":",
"index",
"=",
"self",
".",
"index",
"(",
"site",
")",
"if",
"r",
"is",
"None",
":",
"r",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"np",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.from_outcars_and_structures | Create Polarization object from list of Outcars and Structures in order
of nonpolar to polar.
Note, we recommend calculating the ionic dipole moment using calc_ionic
than using the values in Outcar (see module comments). To do this set
calc_ionic_from_zval = True | pymatgen/analysis/ferroelectricity/polarization.py | def from_outcars_and_structures(cls, outcars, structures,
calc_ionic_from_zval=False):
"""
Create Polarization object from list of Outcars and Structures in order
of nonpolar to polar.
Note, we recommend calculating the ionic dipole moment using calc_... | def from_outcars_and_structures(cls, outcars, structures,
calc_ionic_from_zval=False):
"""
Create Polarization object from list of Outcars and Structures in order
of nonpolar to polar.
Note, we recommend calculating the ionic dipole moment using calc_... | [
"Create",
"Polarization",
"object",
"from",
"list",
"of",
"Outcars",
"and",
"Structures",
"in",
"order",
"of",
"nonpolar",
"to",
"polar",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L177-L197 | [
"def",
"from_outcars_and_structures",
"(",
"cls",
",",
"outcars",
",",
"structures",
",",
"calc_ionic_from_zval",
"=",
"False",
")",
":",
"p_elecs",
"=",
"[",
"]",
"p_ions",
"=",
"[",
"]",
"for",
"i",
",",
"o",
"in",
"enumerate",
"(",
"outcars",
")",
":"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.get_pelecs_and_pions | Get the electronic and ionic dipole moments / polarizations.
convert_to_muC_per_cm2: Convert from electron * Angstroms to microCoulomb
per centimeter**2 | pymatgen/analysis/ferroelectricity/polarization.py | def get_pelecs_and_pions(self, convert_to_muC_per_cm2=False):
"""
Get the electronic and ionic dipole moments / polarizations.
convert_to_muC_per_cm2: Convert from electron * Angstroms to microCoulomb
per centimeter**2
"""
if not convert_to_muC_per_cm2:
... | def get_pelecs_and_pions(self, convert_to_muC_per_cm2=False):
"""
Get the electronic and ionic dipole moments / polarizations.
convert_to_muC_per_cm2: Convert from electron * Angstroms to microCoulomb
per centimeter**2
"""
if not convert_to_muC_per_cm2:
... | [
"Get",
"the",
"electronic",
"and",
"ionic",
"dipole",
"moments",
"/",
"polarizations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L199-L225 | [
"def",
"get_pelecs_and_pions",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"False",
")",
":",
"if",
"not",
"convert_to_muC_per_cm2",
":",
"return",
"self",
".",
"p_elecs",
",",
"self",
".",
"p_ions",
"if",
"convert_to_muC_per_cm2",
":",
"p_elecs",
"=",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.get_same_branch_polarization_data | Get same branch dipole moment (convert_to_muC_per_cm2=False)
or polarization for given polarization data (convert_to_muC_per_cm2=True).
Polarization is a lattice vector, meaning it is only defined modulo the
quantum of polarization:
P = P_0 + \\sum_i \\frac{n_i e R_i}{\\Omega}
... | pymatgen/analysis/ferroelectricity/polarization.py | def get_same_branch_polarization_data(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get same branch dipole moment (convert_to_muC_per_cm2=False)
or polarization for given polarization data (convert_to_muC_per_cm2=True).
Polarization is a lattice vector, meaning it is only d... | def get_same_branch_polarization_data(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get same branch dipole moment (convert_to_muC_per_cm2=False)
or polarization for given polarization data (convert_to_muC_per_cm2=True).
Polarization is a lattice vector, meaning it is only d... | [
"Get",
"same",
"branch",
"dipole",
"moment",
"(",
"convert_to_muC_per_cm2",
"=",
"False",
")",
"or",
"polarization",
"for",
"given",
"polarization",
"data",
"(",
"convert_to_muC_per_cm2",
"=",
"True",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L227-L328 | [
"def",
"get_same_branch_polarization_data",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"p_elec",
",",
"p_ion",
"=",
"self",
".",
"get_pelecs_and_pions",
"(",
")",
"p_tot",
"=",
"p_elec",
"+",
"p_ion",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.get_lattice_quanta | Returns the dipole / polarization quanta along a, b, and c for
all structures. | pymatgen/analysis/ferroelectricity/polarization.py | def get_lattice_quanta(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Returns the dipole / polarization quanta along a, b, and c for
all structures.
"""
lattices = [s.lattice for s in self.structures]
volumes = np.array([s.lattice.volume for s in self.structur... | def get_lattice_quanta(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Returns the dipole / polarization quanta along a, b, and c for
all structures.
"""
lattices = [s.lattice for s in self.structures]
volumes = np.array([s.lattice.volume for s in self.structur... | [
"Returns",
"the",
"dipole",
"/",
"polarization",
"quanta",
"along",
"a",
"b",
"and",
"c",
"for",
"all",
"structures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L330-L363 | [
"def",
"get_lattice_quanta",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"lattices",
"=",
"[",
"s",
".",
"lattice",
"for",
"s",
"in",
"self",
".",
"structures",
"]",
"volumes",
"=",
"np",
".",
"arr... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.get_polarization_change | Get difference between nonpolar and polar same branch polarization. | pymatgen/analysis/ferroelectricity/polarization.py | def get_polarization_change(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get difference between nonpolar and polar same branch polarization.
"""
tot = self.get_same_branch_polarization_data(
convert_to_muC_per_cm2=convert_to_muC_per_cm2, all_in_polar=all_in_pola... | def get_polarization_change(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get difference between nonpolar and polar same branch polarization.
"""
tot = self.get_same_branch_polarization_data(
convert_to_muC_per_cm2=convert_to_muC_per_cm2, all_in_polar=all_in_pola... | [
"Get",
"difference",
"between",
"nonpolar",
"and",
"polar",
"same",
"branch",
"polarization",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L365-L373 | [
"def",
"get_polarization_change",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"tot",
"=",
"self",
".",
"get_same_branch_polarization_data",
"(",
"convert_to_muC_per_cm2",
"=",
"convert_to_muC_per_cm2",
",",
"all... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.get_polarization_change_norm | Get magnitude of difference between nonpolar and polar same branch
polarization. | pymatgen/analysis/ferroelectricity/polarization.py | def get_polarization_change_norm(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get magnitude of difference between nonpolar and polar same branch
polarization.
"""
polar = self.structures[-1]
a, b, c = polar.lattice.matrix
a, b, c = a / np.linalg.norm... | def get_polarization_change_norm(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get magnitude of difference between nonpolar and polar same branch
polarization.
"""
polar = self.structures[-1]
a, b, c = polar.lattice.matrix
a, b, c = a / np.linalg.norm... | [
"Get",
"magnitude",
"of",
"difference",
"between",
"nonpolar",
"and",
"polar",
"same",
"branch",
"polarization",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L375-L387 | [
"def",
"get_polarization_change_norm",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"polar",
"=",
"self",
".",
"structures",
"[",
"-",
"1",
"]",
"a",
",",
"b",
",",
"c",
"=",
"polar",
".",
"lattice"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.same_branch_splines | Fit splines to same branch polarization. This is used to assess any jumps
in the same branch polarizaiton. | pymatgen/analysis/ferroelectricity/polarization.py | def same_branch_splines(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Fit splines to same branch polarization. This is used to assess any jumps
in the same branch polarizaiton.
"""
from scipy.interpolate import UnivariateSpline
tot = self.get_same_branch_pola... | def same_branch_splines(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Fit splines to same branch polarization. This is used to assess any jumps
in the same branch polarizaiton.
"""
from scipy.interpolate import UnivariateSpline
tot = self.get_same_branch_pola... | [
"Fit",
"splines",
"to",
"same",
"branch",
"polarization",
".",
"This",
"is",
"used",
"to",
"assess",
"any",
"jumps",
"in",
"the",
"same",
"branch",
"polarizaiton",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L389-L410 | [
"def",
"same_branch_splines",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"from",
"scipy",
".",
"interpolate",
"import",
"UnivariateSpline",
"tot",
"=",
"self",
".",
"get_same_branch_polarization_data",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.max_spline_jumps | Get maximum difference between spline and same branch polarization data. | pymatgen/analysis/ferroelectricity/polarization.py | def max_spline_jumps(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get maximum difference between spline and same branch polarization data.
"""
tot = self.get_same_branch_polarization_data(
convert_to_muC_per_cm2=convert_to_muC_per_cm2, all_in_polar=all_in_polar)... | def max_spline_jumps(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get maximum difference between spline and same branch polarization data.
"""
tot = self.get_same_branch_polarization_data(
convert_to_muC_per_cm2=convert_to_muC_per_cm2, all_in_polar=all_in_polar)... | [
"Get",
"maximum",
"difference",
"between",
"spline",
"and",
"same",
"branch",
"polarization",
"data",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L412-L424 | [
"def",
"max_spline_jumps",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"tot",
"=",
"self",
".",
"get_same_branch_polarization_data",
"(",
"convert_to_muC_per_cm2",
"=",
"convert_to_muC_per_cm2",
",",
"all_in_pol... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Polarization.smoothness | Get rms average difference between spline and same branch polarization data. | pymatgen/analysis/ferroelectricity/polarization.py | def smoothness(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get rms average difference between spline and same branch polarization data.
"""
tot = self.get_same_branch_polarization_data(
convert_to_muC_per_cm2=convert_to_muC_per_cm2, all_in_polar=all_in_polar)
... | def smoothness(self, convert_to_muC_per_cm2=True, all_in_polar=True):
"""
Get rms average difference between spline and same branch polarization data.
"""
tot = self.get_same_branch_polarization_data(
convert_to_muC_per_cm2=convert_to_muC_per_cm2, all_in_polar=all_in_polar)
... | [
"Get",
"rms",
"average",
"difference",
"between",
"spline",
"and",
"same",
"branch",
"polarization",
"data",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L426-L442 | [
"def",
"smoothness",
"(",
"self",
",",
"convert_to_muC_per_cm2",
"=",
"True",
",",
"all_in_polar",
"=",
"True",
")",
":",
"tot",
"=",
"self",
".",
"get_same_branch_polarization_data",
"(",
"convert_to_muC_per_cm2",
"=",
"convert_to_muC_per_cm2",
",",
"all_in_polar",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EnergyTrend.spline | Fit spline to energy trend data. | pymatgen/analysis/ferroelectricity/polarization.py | def spline(self):
"""
Fit spline to energy trend data.
"""
from scipy.interpolate import UnivariateSpline
sp = UnivariateSpline(range(len(self.energies)), self.energies, k=4)
return sp | def spline(self):
"""
Fit spline to energy trend data.
"""
from scipy.interpolate import UnivariateSpline
sp = UnivariateSpline(range(len(self.energies)), self.energies, k=4)
return sp | [
"Fit",
"spline",
"to",
"energy",
"trend",
"data",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L449-L455 | [
"def",
"spline",
"(",
"self",
")",
":",
"from",
"scipy",
".",
"interpolate",
"import",
"UnivariateSpline",
"sp",
"=",
"UnivariateSpline",
"(",
"range",
"(",
"len",
"(",
"self",
".",
"energies",
")",
")",
",",
"self",
".",
"energies",
",",
"k",
"=",
"4"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EnergyTrend.smoothness | Get rms average difference between spline and energy trend. | pymatgen/analysis/ferroelectricity/polarization.py | def smoothness(self):
"""
Get rms average difference between spline and energy trend.
"""
energies = self.energies
try:
sp = self.spline()
except:
print("Energy spline failed.")
return None
spline_energies = sp(range(len(energie... | def smoothness(self):
"""
Get rms average difference between spline and energy trend.
"""
energies = self.energies
try:
sp = self.spline()
except:
print("Energy spline failed.")
return None
spline_energies = sp(range(len(energie... | [
"Get",
"rms",
"average",
"difference",
"between",
"spline",
"and",
"energy",
"trend",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L457-L470 | [
"def",
"smoothness",
"(",
"self",
")",
":",
"energies",
"=",
"self",
".",
"energies",
"try",
":",
"sp",
"=",
"self",
".",
"spline",
"(",
")",
"except",
":",
"print",
"(",
"\"Energy spline failed.\"",
")",
"return",
"None",
"spline_energies",
"=",
"sp",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EnergyTrend.max_spline_jump | Get maximum difference between spline and energy trend. | pymatgen/analysis/ferroelectricity/polarization.py | def max_spline_jump(self):
"""
Get maximum difference between spline and energy trend.
"""
sp = self.spline()
return max(self.energies - sp(range(len(self.energies)))) | def max_spline_jump(self):
"""
Get maximum difference between spline and energy trend.
"""
sp = self.spline()
return max(self.energies - sp(range(len(self.energies)))) | [
"Get",
"maximum",
"difference",
"between",
"spline",
"and",
"energy",
"trend",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L472-L477 | [
"def",
"max_spline_jump",
"(",
"self",
")",
":",
"sp",
"=",
"self",
".",
"spline",
"(",
")",
"return",
"max",
"(",
"self",
".",
"energies",
"-",
"sp",
"(",
"range",
"(",
"len",
"(",
"self",
".",
"energies",
")",
")",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EnergyTrend.endpoints_minima | Test if spline endpoints are at minima for a given slope cutoff. | pymatgen/analysis/ferroelectricity/polarization.py | def endpoints_minima(self, slope_cutoff=5e-3):
"""
Test if spline endpoints are at minima for a given slope cutoff.
"""
energies = self.energies
try:
sp = self.spline()
except:
print("Energy spline failed.")
return None
der = sp... | def endpoints_minima(self, slope_cutoff=5e-3):
"""
Test if spline endpoints are at minima for a given slope cutoff.
"""
energies = self.energies
try:
sp = self.spline()
except:
print("Energy spline failed.")
return None
der = sp... | [
"Test",
"if",
"spline",
"endpoints",
"are",
"at",
"minima",
"for",
"a",
"given",
"slope",
"cutoff",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ferroelectricity/polarization.py#L479-L492 | [
"def",
"endpoints_minima",
"(",
"self",
",",
"slope_cutoff",
"=",
"5e-3",
")",
":",
"energies",
"=",
"self",
".",
"energies",
"try",
":",
"sp",
"=",
"self",
".",
"spline",
"(",
")",
"except",
":",
"print",
"(",
"\"Energy spline failed.\"",
")",
"return",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Compatibility.process_entry | Process a single entry with the chosen Corrections.
Args:
entry: A ComputedEntry object.
Returns:
An adjusted entry if entry is compatible, otherwise None is
returned. | pymatgen/entries/compatibility.py | def process_entry(self, entry):
"""
Process a single entry with the chosen Corrections.
Args:
entry: A ComputedEntry object.
Returns:
An adjusted entry if entry is compatible, otherwise None is
returned.
"""
try:
correctio... | def process_entry(self, entry):
"""
Process a single entry with the chosen Corrections.
Args:
entry: A ComputedEntry object.
Returns:
An adjusted entry if entry is compatible, otherwise None is
returned.
"""
try:
correctio... | [
"Process",
"a",
"single",
"entry",
"with",
"the",
"chosen",
"Corrections",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/entries/compatibility.py#L407-L423 | [
"def",
"process_entry",
"(",
"self",
",",
"entry",
")",
":",
"try",
":",
"corrections",
"=",
"self",
".",
"get_corrections_dict",
"(",
"entry",
")",
"except",
"CompatibilityError",
":",
"return",
"None",
"entry",
".",
"correction",
"=",
"sum",
"(",
"correcti... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Compatibility.get_corrections_dict | Returns the corrections applied to a particular entry.
Args:
entry: A ComputedEntry object.
Returns:
({correction_name: value}) | pymatgen/entries/compatibility.py | def get_corrections_dict(self, entry):
"""
Returns the corrections applied to a particular entry.
Args:
entry: A ComputedEntry object.
Returns:
({correction_name: value})
"""
corrections = {}
for c in self.corrections:
val = c... | def get_corrections_dict(self, entry):
"""
Returns the corrections applied to a particular entry.
Args:
entry: A ComputedEntry object.
Returns:
({correction_name: value})
"""
corrections = {}
for c in self.corrections:
val = c... | [
"Returns",
"the",
"corrections",
"applied",
"to",
"a",
"particular",
"entry",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/entries/compatibility.py#L425-L440 | [
"def",
"get_corrections_dict",
"(",
"self",
",",
"entry",
")",
":",
"corrections",
"=",
"{",
"}",
"for",
"c",
"in",
"self",
".",
"corrections",
":",
"val",
"=",
"c",
".",
"get_correction",
"(",
"entry",
")",
"if",
"val",
"!=",
"0",
":",
"corrections",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Compatibility.get_explanation_dict | Provides an explanation dict of the corrections that are being applied
for a given compatibility scheme. Inspired by the "explain" methods
in many database methodologies.
Args:
entry: A ComputedEntry.
Returns:
(dict) of the form
{"Compatibility": "st... | pymatgen/entries/compatibility.py | def get_explanation_dict(self, entry):
"""
Provides an explanation dict of the corrections that are being applied
for a given compatibility scheme. Inspired by the "explain" methods
in many database methodologies.
Args:
entry: A ComputedEntry.
Returns:
... | def get_explanation_dict(self, entry):
"""
Provides an explanation dict of the corrections that are being applied
for a given compatibility scheme. Inspired by the "explain" methods
in many database methodologies.
Args:
entry: A ComputedEntry.
Returns:
... | [
"Provides",
"an",
"explanation",
"dict",
"of",
"the",
"corrections",
"that",
"are",
"being",
"applied",
"for",
"a",
"given",
"compatibility",
"scheme",
".",
"Inspired",
"by",
"the",
"explain",
"methods",
"in",
"many",
"database",
"methodologies",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/entries/compatibility.py#L455-L490 | [
"def",
"get_explanation_dict",
"(",
"self",
",",
"entry",
")",
":",
"centry",
"=",
"self",
".",
"process_entry",
"(",
"entry",
")",
"if",
"centry",
"is",
"None",
":",
"uncorrected_energy",
"=",
"entry",
".",
"uncorrected_energy",
"corrected_energy",
"=",
"None... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Compatibility.explain | Prints an explanation of the corrections that are being applied for a
given compatibility scheme. Inspired by the "explain" methods in many
database methodologies.
Args:
entry: A ComputedEntry. | pymatgen/entries/compatibility.py | def explain(self, entry):
"""
Prints an explanation of the corrections that are being applied for a
given compatibility scheme. Inspired by the "explain" methods in many
database methodologies.
Args:
entry: A ComputedEntry.
"""
d = self.get_explanatio... | def explain(self, entry):
"""
Prints an explanation of the corrections that are being applied for a
given compatibility scheme. Inspired by the "explain" methods in many
database methodologies.
Args:
entry: A ComputedEntry.
"""
d = self.get_explanatio... | [
"Prints",
"an",
"explanation",
"of",
"the",
"corrections",
"that",
"are",
"being",
"applied",
"for",
"a",
"given",
"compatibility",
"scheme",
".",
"Inspired",
"by",
"the",
"explain",
"methods",
"in",
"many",
"database",
"methodologies",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/entries/compatibility.py#L492-L514 | [
"def",
"explain",
"(",
"self",
",",
"entry",
")",
":",
"d",
"=",
"self",
".",
"get_explanation_dict",
"(",
"entry",
")",
"print",
"(",
"\"The uncorrected value of the energy of %s is %f eV\"",
"%",
"(",
"entry",
".",
"composition",
",",
"d",
"[",
"\"uncorrected_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Cssr.from_string | Reads a string representation to a Cssr object.
Args:
string (str): A string representation of a CSSR.
Returns:
Cssr object. | pymatgen/io/cssr.py | def from_string(string):
"""
Reads a string representation to a Cssr object.
Args:
string (str): A string representation of a CSSR.
Returns:
Cssr object.
"""
lines = string.split("\n")
toks = lines[0].split()
lengths = [float(i) f... | def from_string(string):
"""
Reads a string representation to a Cssr object.
Args:
string (str): A string representation of a CSSR.
Returns:
Cssr object.
"""
lines = string.split("\n")
toks = lines[0].split()
lengths = [float(i) f... | [
"Reads",
"a",
"string",
"representation",
"to",
"a",
"Cssr",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/cssr.py#L62-L87 | [
"def",
"from_string",
"(",
"string",
")",
":",
"lines",
"=",
"string",
".",
"split",
"(",
"\"\\n\"",
")",
"toks",
"=",
"lines",
"[",
"0",
"]",
".",
"split",
"(",
")",
"lengths",
"=",
"[",
"float",
"(",
"i",
")",
"for",
"i",
"in",
"toks",
"]",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | freq_units | Returns conversion factor from THz to the requred units and the label in the form of a namedtuple
Accepted values: thz, ev, mev, ha, cm-1, cm^-1 | pymatgen/phonon/plotter.py | def freq_units(units):
"""
Returns conversion factor from THz to the requred units and the label in the form of a namedtuple
Accepted values: thz, ev, mev, ha, cm-1, cm^-1
"""
d = {"thz": FreqUnits(1, "THz"),
"ev": FreqUnits(const.value("hertz-electron volt relationship") * const.tera, "eV... | def freq_units(units):
"""
Returns conversion factor from THz to the requred units and the label in the form of a namedtuple
Accepted values: thz, ev, mev, ha, cm-1, cm^-1
"""
d = {"thz": FreqUnits(1, "THz"),
"ev": FreqUnits(const.value("hertz-electron volt relationship") * const.tera, "eV... | [
"Returns",
"conversion",
"factor",
"from",
"THz",
"to",
"the",
"requred",
"units",
"and",
"the",
"label",
"in",
"the",
"form",
"of",
"a",
"namedtuple",
"Accepted",
"values",
":",
"thz",
"ev",
"mev",
"ha",
"cm",
"-",
"1",
"cm^",
"-",
"1"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L25-L41 | [
"def",
"freq_units",
"(",
"units",
")",
":",
"d",
"=",
"{",
"\"thz\"",
":",
"FreqUnits",
"(",
"1",
",",
"\"THz\"",
")",
",",
"\"ev\"",
":",
"FreqUnits",
"(",
"const",
".",
"value",
"(",
"\"hertz-electron volt relationship\"",
")",
"*",
"const",
".",
"ter... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.