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 | PointGroupAnalyzer._find_mirror | Looks for mirror symmetry of specified type about axis. Possible
types are "h" or "vd". Horizontal (h) mirrors are perpendicular to
the axis while vertical (v) or diagonal (d) mirrors are parallel. v
mirrors has atoms lying on the mirror plane while d mirrors do
not. | pymatgen/symmetry/analyzer.py | def _find_mirror(self, axis):
"""
Looks for mirror symmetry of specified type about axis. Possible
types are "h" or "vd". Horizontal (h) mirrors are perpendicular to
the axis while vertical (v) or diagonal (d) mirrors are parallel. v
mirrors has atoms lying on the mirror plane... | def _find_mirror(self, axis):
"""
Looks for mirror symmetry of specified type about axis. Possible
types are "h" or "vd". Horizontal (h) mirrors are perpendicular to
the axis while vertical (v) or diagonal (d) mirrors are parallel. v
mirrors has atoms lying on the mirror plane... | [
"Looks",
"for",
"mirror",
"symmetry",
"of",
"specified",
"type",
"about",
"axis",
".",
"Possible",
"types",
"are",
"h",
"or",
"vd",
".",
"Horizontal",
"(",
"h",
")",
"mirrors",
"are",
"perpendicular",
"to",
"the",
"axis",
"while",
"vertical",
"(",
"v",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1022-L1056 | [
"def",
"_find_mirror",
"(",
"self",
",",
"axis",
")",
":",
"mirror_type",
"=",
"\"\"",
"# First test whether the axis itself is the normal to a mirror plane.",
"if",
"self",
".",
"is_valid_op",
"(",
"SymmOp",
".",
"reflection",
"(",
"axis",
")",
")",
":",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._get_smallest_set_not_on_axis | Returns the smallest list of atoms with the same species and
distance from origin AND does not lie on the specified axis. This
maximal set limits the possible rotational symmetry operations,
since atoms lying on a test axis is irrelevant in testing rotational
symmetryOperations. | pymatgen/symmetry/analyzer.py | def _get_smallest_set_not_on_axis(self, axis):
"""
Returns the smallest list of atoms with the same species and
distance from origin AND does not lie on the specified axis. This
maximal set limits the possible rotational symmetry operations,
since atoms lying on a test axis is i... | def _get_smallest_set_not_on_axis(self, axis):
"""
Returns the smallest list of atoms with the same species and
distance from origin AND does not lie on the specified axis. This
maximal set limits the possible rotational symmetry operations,
since atoms lying on a test axis is i... | [
"Returns",
"the",
"smallest",
"list",
"of",
"atoms",
"with",
"the",
"same",
"species",
"and",
"distance",
"from",
"origin",
"AND",
"does",
"not",
"lie",
"on",
"the",
"specified",
"axis",
".",
"This",
"maximal",
"set",
"limits",
"the",
"possible",
"rotational... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1058-L1078 | [
"def",
"_get_smallest_set_not_on_axis",
"(",
"self",
",",
"axis",
")",
":",
"def",
"not_on_axis",
"(",
"site",
")",
":",
"v",
"=",
"np",
".",
"cross",
"(",
"site",
".",
"coords",
",",
"axis",
")",
"return",
"np",
".",
"linalg",
".",
"norm",
"(",
"v",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._check_rot_sym | Determines the rotational symmetry about supplied axis. Used only for
symmetric top molecules which has possible rotational symmetry
operations > 2. | pymatgen/symmetry/analyzer.py | def _check_rot_sym(self, axis):
"""
Determines the rotational symmetry about supplied axis. Used only for
symmetric top molecules which has possible rotational symmetry
operations > 2.
"""
min_set = self._get_smallest_set_not_on_axis(axis)
max_sym = len(min_set)
... | def _check_rot_sym(self, axis):
"""
Determines the rotational symmetry about supplied axis. Used only for
symmetric top molecules which has possible rotational symmetry
operations > 2.
"""
min_set = self._get_smallest_set_not_on_axis(axis)
max_sym = len(min_set)
... | [
"Determines",
"the",
"rotational",
"symmetry",
"about",
"supplied",
"axis",
".",
"Used",
"only",
"for",
"symmetric",
"top",
"molecules",
"which",
"has",
"possible",
"rotational",
"symmetry",
"operations",
">",
"2",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1080-L1097 | [
"def",
"_check_rot_sym",
"(",
"self",
",",
"axis",
")",
":",
"min_set",
"=",
"self",
".",
"_get_smallest_set_not_on_axis",
"(",
"axis",
")",
"max_sym",
"=",
"len",
"(",
"min_set",
")",
"for",
"i",
"in",
"range",
"(",
"max_sym",
",",
"0",
",",
"-",
"1",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._check_perpendicular_r2_axis | Checks for R2 axes perpendicular to unique axis. For handling
symmetric top molecules. | pymatgen/symmetry/analyzer.py | def _check_perpendicular_r2_axis(self, axis):
"""
Checks for R2 axes perpendicular to unique axis. For handling
symmetric top molecules.
"""
min_set = self._get_smallest_set_not_on_axis(axis)
for s1, s2 in itertools.combinations(min_set, 2):
test_axis = np.cr... | def _check_perpendicular_r2_axis(self, axis):
"""
Checks for R2 axes perpendicular to unique axis. For handling
symmetric top molecules.
"""
min_set = self._get_smallest_set_not_on_axis(axis)
for s1, s2 in itertools.combinations(min_set, 2):
test_axis = np.cr... | [
"Checks",
"for",
"R2",
"axes",
"perpendicular",
"to",
"unique",
"axis",
".",
"For",
"handling",
"symmetric",
"top",
"molecules",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1099-L1113 | [
"def",
"_check_perpendicular_r2_axis",
"(",
"self",
",",
"axis",
")",
":",
"min_set",
"=",
"self",
".",
"_get_smallest_set_not_on_axis",
"(",
"axis",
")",
"for",
"s1",
",",
"s2",
"in",
"itertools",
".",
"combinations",
"(",
"min_set",
",",
"2",
")",
":",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._proc_sph_top | Handles Sperhical Top Molecules, which belongs to the T, O or I point
groups. | pymatgen/symmetry/analyzer.py | def _proc_sph_top(self):
"""
Handles Sperhical Top Molecules, which belongs to the T, O or I point
groups.
"""
self._find_spherical_axes()
if len(self.rot_sym) == 0:
logger.debug("Accidental speherical top!")
self._proc_sym_top()
main_axis,... | def _proc_sph_top(self):
"""
Handles Sperhical Top Molecules, which belongs to the T, O or I point
groups.
"""
self._find_spherical_axes()
if len(self.rot_sym) == 0:
logger.debug("Accidental speherical top!")
self._proc_sym_top()
main_axis,... | [
"Handles",
"Sperhical",
"Top",
"Molecules",
"which",
"belongs",
"to",
"the",
"T",
"O",
"or",
"I",
"point",
"groups",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1115-L1149 | [
"def",
"_proc_sph_top",
"(",
"self",
")",
":",
"self",
".",
"_find_spherical_axes",
"(",
")",
"if",
"len",
"(",
"self",
".",
"rot_sym",
")",
"==",
"0",
":",
"logger",
".",
"debug",
"(",
"\"Accidental speherical top!\"",
")",
"self",
".",
"_proc_sym_top",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._find_spherical_axes | Looks for R5, R4, R3 and R2 axes in spherical top molecules. Point
group T molecules have only one unique 3-fold and one unique 2-fold
axis. O molecules have one unique 4, 3 and 2-fold axes. I molecules
have a unique 5-fold axis. | pymatgen/symmetry/analyzer.py | def _find_spherical_axes(self):
"""
Looks for R5, R4, R3 and R2 axes in spherical top molecules. Point
group T molecules have only one unique 3-fold and one unique 2-fold
axis. O molecules have one unique 4, 3 and 2-fold axes. I molecules
have a unique 5-fold axis.
"""
... | def _find_spherical_axes(self):
"""
Looks for R5, R4, R3 and R2 axes in spherical top molecules. Point
group T molecules have only one unique 3-fold and one unique 2-fold
axis. O molecules have one unique 4, 3 and 2-fold axes. I molecules
have a unique 5-fold axis.
"""
... | [
"Looks",
"for",
"R5",
"R4",
"R3",
"and",
"R2",
"axes",
"in",
"spherical",
"top",
"molecules",
".",
"Point",
"group",
"T",
"molecules",
"have",
"only",
"one",
"unique",
"3",
"-",
"fold",
"and",
"one",
"unique",
"2",
"-",
"fold",
"axis",
".",
"O",
"mol... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1151-L1187 | [
"def",
"_find_spherical_axes",
"(",
"self",
")",
":",
"rot_present",
"=",
"defaultdict",
"(",
"bool",
")",
"origin_site",
",",
"dist_el_sites",
"=",
"cluster_sites",
"(",
"self",
".",
"centered_mol",
",",
"self",
".",
"tol",
")",
"test_set",
"=",
"min",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer.is_valid_op | Check if a particular symmetry operation is a valid symmetry operation
for a molecule, i.e., the operation maps all atoms to another
equivalent atom.
Args:
symmop (SymmOp): Symmetry operation to test.
Returns:
(bool): Whether SymmOp is valid for Molecule. | pymatgen/symmetry/analyzer.py | def is_valid_op(self, symmop):
"""
Check if a particular symmetry operation is a valid symmetry operation
for a molecule, i.e., the operation maps all atoms to another
equivalent atom.
Args:
symmop (SymmOp): Symmetry operation to test.
Returns:
(... | def is_valid_op(self, symmop):
"""
Check if a particular symmetry operation is a valid symmetry operation
for a molecule, i.e., the operation maps all atoms to another
equivalent atom.
Args:
symmop (SymmOp): Symmetry operation to test.
Returns:
(... | [
"Check",
"if",
"a",
"particular",
"symmetry",
"operation",
"is",
"a",
"valid",
"symmetry",
"operation",
"for",
"a",
"molecule",
"i",
".",
"e",
".",
"the",
"operation",
"maps",
"all",
"atoms",
"to",
"another",
"equivalent",
"atom",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1206-L1226 | [
"def",
"is_valid_op",
"(",
"self",
",",
"symmop",
")",
":",
"coords",
"=",
"self",
".",
"centered_mol",
".",
"cart_coords",
"for",
"site",
"in",
"self",
".",
"centered_mol",
":",
"coord",
"=",
"symmop",
".",
"operate",
"(",
"site",
".",
"coords",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._get_eq_sets | Calculates the dictionary for mapping equivalent atoms onto each other.
Args:
None
Returns:
dict: The returned dictionary has two possible keys:
``eq_sets``:
A dictionary of indices mapping to sets of indices,
each key maps to indices of all... | pymatgen/symmetry/analyzer.py | def _get_eq_sets(self):
"""
Calculates the dictionary for mapping equivalent atoms onto each other.
Args:
None
Returns:
dict: The returned dictionary has two possible keys:
``eq_sets``:
A dictionary of indices mapping to sets of indices,... | def _get_eq_sets(self):
"""
Calculates the dictionary for mapping equivalent atoms onto each other.
Args:
None
Returns:
dict: The returned dictionary has two possible keys:
``eq_sets``:
A dictionary of indices mapping to sets of indices,... | [
"Calculates",
"the",
"dictionary",
"for",
"mapping",
"equivalent",
"atoms",
"onto",
"each",
"other",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1228-L1286 | [
"def",
"_get_eq_sets",
"(",
"self",
")",
":",
"UNIT",
"=",
"np",
".",
"eye",
"(",
"3",
")",
"eq_sets",
",",
"operations",
"=",
"defaultdict",
"(",
"set",
")",
",",
"defaultdict",
"(",
"dict",
")",
"symm_ops",
"=",
"[",
"op",
".",
"rotation_matrix",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._combine_eq_sets | Combines the dicts of _get_equivalent_atom_dicts into one
Args:
eq_sets (dict)
operations (dict)
Returns:
dict: The returned dictionary has two possible keys:
``eq_sets``:
A dictionary of indices mapping to sets of indices,
each ... | pymatgen/symmetry/analyzer.py | def _combine_eq_sets(eq_sets, operations):
"""Combines the dicts of _get_equivalent_atom_dicts into one
Args:
eq_sets (dict)
operations (dict)
Returns:
dict: The returned dictionary has two possible keys:
``eq_sets``:
A dictionary of... | def _combine_eq_sets(eq_sets, operations):
"""Combines the dicts of _get_equivalent_atom_dicts into one
Args:
eq_sets (dict)
operations (dict)
Returns:
dict: The returned dictionary has two possible keys:
``eq_sets``:
A dictionary of... | [
"Combines",
"the",
"dicts",
"of",
"_get_equivalent_atom_dicts",
"into",
"one"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1289-L1345 | [
"def",
"_combine_eq_sets",
"(",
"eq_sets",
",",
"operations",
")",
":",
"UNIT",
"=",
"np",
".",
"eye",
"(",
"3",
")",
"def",
"all_equivalent_atoms_of_i",
"(",
"i",
",",
"eq_sets",
",",
"ops",
")",
":",
"\"\"\"WORKS INPLACE on operations\n \"\"\"",
"vi... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer.symmetrize_molecule | Returns a symmetrized molecule
The equivalent atoms obtained via
:meth:`~pymatgen.symmetry.analyzer.PointGroupAnalyzer.get_equivalent_atoms`
are rotated, mirrored... unto one position.
Then the average position is calculated.
The average position is rotated, mirrored... back wit... | pymatgen/symmetry/analyzer.py | def symmetrize_molecule(self):
"""Returns a symmetrized molecule
The equivalent atoms obtained via
:meth:`~pymatgen.symmetry.analyzer.PointGroupAnalyzer.get_equivalent_atoms`
are rotated, mirrored... unto one position.
Then the average position is calculated.
The average... | def symmetrize_molecule(self):
"""Returns a symmetrized molecule
The equivalent atoms obtained via
:meth:`~pymatgen.symmetry.analyzer.PointGroupAnalyzer.get_equivalent_atoms`
are rotated, mirrored... unto one position.
Then the average position is calculated.
The average... | [
"Returns",
"a",
"symmetrized",
"molecule"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1370-L1416 | [
"def",
"symmetrize_molecule",
"(",
"self",
")",
":",
"eq",
"=",
"self",
".",
"get_equivalent_atoms",
"(",
")",
"eq_sets",
",",
"ops",
"=",
"eq",
"[",
"'eq_sets'",
"]",
",",
"eq",
"[",
"'sym_ops'",
"]",
"coords",
"=",
"self",
".",
"centered_mol",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupOperations.are_symmetrically_equivalent | Given two sets of PeriodicSites, test if they are actually
symmetrically equivalent under this space group. Useful, for example,
if you want to test if selecting atoms 1 and 2 out of a set of 4 atoms
are symmetrically the same as selecting atoms 3 and 4, etc.
One use is in PartialRemov... | pymatgen/symmetry/analyzer.py | def are_symmetrically_equivalent(self, sites1, sites2, symm_prec=1e-3):
"""
Given two sets of PeriodicSites, test if they are actually
symmetrically equivalent under this space group. Useful, for example,
if you want to test if selecting atoms 1 and 2 out of a set of 4 atoms
are... | def are_symmetrically_equivalent(self, sites1, sites2, symm_prec=1e-3):
"""
Given two sets of PeriodicSites, test if they are actually
symmetrically equivalent under this space group. Useful, for example,
if you want to test if selecting atoms 1 and 2 out of a set of 4 atoms
are... | [
"Given",
"two",
"sets",
"of",
"PeriodicSites",
"test",
"if",
"they",
"are",
"actually",
"symmetrically",
"equivalent",
"under",
"this",
"space",
"group",
".",
"Useful",
"for",
"example",
"if",
"you",
"want",
"to",
"test",
"if",
"selecting",
"atoms",
"1",
"an... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1566-L1601 | [
"def",
"are_symmetrically_equivalent",
"(",
"self",
",",
"sites1",
",",
"sites2",
",",
"symm_prec",
"=",
"1e-3",
")",
":",
"def",
"in_sites",
"(",
"site",
")",
":",
"for",
"test_site",
"in",
"sites1",
":",
"if",
"test_site",
".",
"is_periodic_image",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | find_in_coord_list | Find the indices of matches of a particular coord in a coord_list.
Args:
coord_list: List of coords to test
coord: Specific coordinates
atol: Absolute tolerance. Defaults to 1e-8. Accepts both scalar and
array.
Returns:
Indices of matches, e.g., [0, 1, 2, 3]. Empty ... | pymatgen/util/coord.py | def find_in_coord_list(coord_list, coord, atol=1e-8):
"""
Find the indices of matches of a particular coord in a coord_list.
Args:
coord_list: List of coords to test
coord: Specific coordinates
atol: Absolute tolerance. Defaults to 1e-8. Accepts both scalar and
array.
... | def find_in_coord_list(coord_list, coord, atol=1e-8):
"""
Find the indices of matches of a particular coord in a coord_list.
Args:
coord_list: List of coords to test
coord: Specific coordinates
atol: Absolute tolerance. Defaults to 1e-8. Accepts both scalar and
array.
... | [
"Find",
"the",
"indices",
"of",
"matches",
"of",
"a",
"particular",
"coord",
"in",
"a",
"coord_list",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L29-L45 | [
"def",
"find_in_coord_list",
"(",
"coord_list",
",",
"coord",
",",
"atol",
"=",
"1e-8",
")",
":",
"if",
"len",
"(",
"coord_list",
")",
"==",
"0",
":",
"return",
"[",
"]",
"diff",
"=",
"np",
".",
"array",
"(",
"coord_list",
")",
"-",
"np",
".",
"arr... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | in_coord_list | Tests if a particular coord is within a coord_list.
Args:
coord_list: List of coords to test
coord: Specific coordinates
atol: Absolute tolerance. Defaults to 1e-8. Accepts both scalar and
array.
Returns:
True if coord is in the coord list. | pymatgen/util/coord.py | def in_coord_list(coord_list, coord, atol=1e-8):
"""
Tests if a particular coord is within a coord_list.
Args:
coord_list: List of coords to test
coord: Specific coordinates
atol: Absolute tolerance. Defaults to 1e-8. Accepts both scalar and
array.
Returns:
... | def in_coord_list(coord_list, coord, atol=1e-8):
"""
Tests if a particular coord is within a coord_list.
Args:
coord_list: List of coords to test
coord: Specific coordinates
atol: Absolute tolerance. Defaults to 1e-8. Accepts both scalar and
array.
Returns:
... | [
"Tests",
"if",
"a",
"particular",
"coord",
"is",
"within",
"a",
"coord_list",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L48-L61 | [
"def",
"in_coord_list",
"(",
"coord_list",
",",
"coord",
",",
"atol",
"=",
"1e-8",
")",
":",
"return",
"len",
"(",
"find_in_coord_list",
"(",
"coord_list",
",",
"coord",
",",
"atol",
"=",
"atol",
")",
")",
">",
"0"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | is_coord_subset | Tests if all coords in subset are contained in superset.
Doesn't use periodic boundary conditions
Args:
subset, superset: List of coords
Returns:
True if all of subset is in superset. | pymatgen/util/coord.py | def is_coord_subset(subset, superset, atol=1e-8):
"""
Tests if all coords in subset are contained in superset.
Doesn't use periodic boundary conditions
Args:
subset, superset: List of coords
Returns:
True if all of subset is in superset.
"""
c1 = np.array(subset)
c2 = n... | def is_coord_subset(subset, superset, atol=1e-8):
"""
Tests if all coords in subset are contained in superset.
Doesn't use periodic boundary conditions
Args:
subset, superset: List of coords
Returns:
True if all of subset is in superset.
"""
c1 = np.array(subset)
c2 = n... | [
"Tests",
"if",
"all",
"coords",
"in",
"subset",
"are",
"contained",
"in",
"superset",
".",
"Doesn",
"t",
"use",
"periodic",
"boundary",
"conditions"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L64-L79 | [
"def",
"is_coord_subset",
"(",
"subset",
",",
"superset",
",",
"atol",
"=",
"1e-8",
")",
":",
"c1",
"=",
"np",
".",
"array",
"(",
"subset",
")",
"c2",
"=",
"np",
".",
"array",
"(",
"superset",
")",
"is_close",
"=",
"np",
".",
"all",
"(",
"np",
".... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | coord_list_mapping | Gives the index mapping from a subset to a superset.
Subset and superset cannot contain duplicate rows
Args:
subset, superset: List of coords
Returns:
list of indices such that superset[indices] = subset | pymatgen/util/coord.py | def coord_list_mapping(subset, superset, atol=1e-8):
"""
Gives the index mapping from a subset to a superset.
Subset and superset cannot contain duplicate rows
Args:
subset, superset: List of coords
Returns:
list of indices such that superset[indices] = subset
"""
c1 = np.a... | def coord_list_mapping(subset, superset, atol=1e-8):
"""
Gives the index mapping from a subset to a superset.
Subset and superset cannot contain duplicate rows
Args:
subset, superset: List of coords
Returns:
list of indices such that superset[indices] = subset
"""
c1 = np.a... | [
"Gives",
"the",
"index",
"mapping",
"from",
"a",
"subset",
"to",
"a",
"superset",
".",
"Subset",
"and",
"superset",
"cannot",
"contain",
"duplicate",
"rows"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L82-L104 | [
"def",
"coord_list_mapping",
"(",
"subset",
",",
"superset",
",",
"atol",
"=",
"1e-8",
")",
":",
"c1",
"=",
"np",
".",
"array",
"(",
"subset",
")",
"c2",
"=",
"np",
".",
"array",
"(",
"superset",
")",
"inds",
"=",
"np",
".",
"where",
"(",
"np",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | coord_list_mapping_pbc | Gives the index mapping from a subset to a superset.
Superset cannot contain duplicate matching rows
Args:
subset, superset: List of frac_coords
Returns:
list of indices such that superset[indices] = subset | pymatgen/util/coord.py | def coord_list_mapping_pbc(subset, superset, atol=1e-8):
"""
Gives the index mapping from a subset to a superset.
Superset cannot contain duplicate matching rows
Args:
subset, superset: List of frac_coords
Returns:
list of indices such that superset[indices] = subset
"""
at... | def coord_list_mapping_pbc(subset, superset, atol=1e-8):
"""
Gives the index mapping from a subset to a superset.
Superset cannot contain duplicate matching rows
Args:
subset, superset: List of frac_coords
Returns:
list of indices such that superset[indices] = subset
"""
at... | [
"Gives",
"the",
"index",
"mapping",
"from",
"a",
"subset",
"to",
"a",
"superset",
".",
"Superset",
"cannot",
"contain",
"duplicate",
"matching",
"rows"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L107-L119 | [
"def",
"coord_list_mapping_pbc",
"(",
"subset",
",",
"superset",
",",
"atol",
"=",
"1e-8",
")",
":",
"atol",
"=",
"np",
".",
"array",
"(",
"[",
"1.",
",",
"1.",
",",
"1.",
"]",
")",
"*",
"atol",
"return",
"cuc",
".",
"coord_list_mapping_pbc",
"(",
"s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_linear_interpolated_value | Returns an interpolated value by linear interpolation between two values.
This method is written to avoid dependency on scipy, which causes issues on
threading servers.
Args:
x_values: Sequence of x values.
y_values: Corresponding sequence of y values
x: Get value at particular x
... | pymatgen/util/coord.py | def get_linear_interpolated_value(x_values, y_values, x):
"""
Returns an interpolated value by linear interpolation between two values.
This method is written to avoid dependency on scipy, which causes issues on
threading servers.
Args:
x_values: Sequence of x values.
y_values: Corr... | def get_linear_interpolated_value(x_values, y_values, x):
"""
Returns an interpolated value by linear interpolation between two values.
This method is written to avoid dependency on scipy, which causes issues on
threading servers.
Args:
x_values: Sequence of x values.
y_values: Corr... | [
"Returns",
"an",
"interpolated",
"value",
"by",
"linear",
"interpolation",
"between",
"two",
"values",
".",
"This",
"method",
"is",
"written",
"to",
"avoid",
"dependency",
"on",
"scipy",
"which",
"causes",
"issues",
"on",
"threading",
"servers",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L122-L147 | [
"def",
"get_linear_interpolated_value",
"(",
"x_values",
",",
"y_values",
",",
"x",
")",
":",
"a",
"=",
"np",
".",
"array",
"(",
"sorted",
"(",
"zip",
"(",
"x_values",
",",
"y_values",
")",
",",
"key",
"=",
"lambda",
"d",
":",
"d",
"[",
"0",
"]",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | all_distances | Returns the distances between two lists of coordinates
Args:
coords1: First set of cartesian coordinates.
coords2: Second set of cartesian coordinates.
Returns:
2d array of cartesian distances. E.g the distance between
coords1[i] and coords2[j] is distances[i,j] | pymatgen/util/coord.py | def all_distances(coords1, coords2):
"""
Returns the distances between two lists of coordinates
Args:
coords1: First set of cartesian coordinates.
coords2: Second set of cartesian coordinates.
Returns:
2d array of cartesian distances. E.g the distance between
coords1[i]... | def all_distances(coords1, coords2):
"""
Returns the distances between two lists of coordinates
Args:
coords1: First set of cartesian coordinates.
coords2: Second set of cartesian coordinates.
Returns:
2d array of cartesian distances. E.g the distance between
coords1[i]... | [
"Returns",
"the",
"distances",
"between",
"two",
"lists",
"of",
"coordinates"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L150-L165 | [
"def",
"all_distances",
"(",
"coords1",
",",
"coords2",
")",
":",
"c1",
"=",
"np",
".",
"array",
"(",
"coords1",
")",
"c2",
"=",
"np",
".",
"array",
"(",
"coords2",
")",
"z",
"=",
"(",
"c1",
"[",
":",
",",
"None",
",",
":",
"]",
"-",
"c2",
"[... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | pbc_diff | Returns the 'fractional distance' between two coordinates taking into
account periodic boundary conditions.
Args:
fcoords1: First set of fractional coordinates. e.g., [0.5, 0.6,
0.7] or [[1.1, 1.2, 4.3], [0.5, 0.6, 0.7]]. It can be a single
coord or any array of coords.
... | pymatgen/util/coord.py | def pbc_diff(fcoords1, fcoords2):
"""
Returns the 'fractional distance' between two coordinates taking into
account periodic boundary conditions.
Args:
fcoords1: First set of fractional coordinates. e.g., [0.5, 0.6,
0.7] or [[1.1, 1.2, 4.3], [0.5, 0.6, 0.7]]. It can be a single
... | def pbc_diff(fcoords1, fcoords2):
"""
Returns the 'fractional distance' between two coordinates taking into
account periodic boundary conditions.
Args:
fcoords1: First set of fractional coordinates. e.g., [0.5, 0.6,
0.7] or [[1.1, 1.2, 4.3], [0.5, 0.6, 0.7]]. It can be a single
... | [
"Returns",
"the",
"fractional",
"distance",
"between",
"two",
"coordinates",
"taking",
"into",
"account",
"periodic",
"boundary",
"conditions",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L168-L186 | [
"def",
"pbc_diff",
"(",
"fcoords1",
",",
"fcoords2",
")",
":",
"fdist",
"=",
"np",
".",
"subtract",
"(",
"fcoords1",
",",
"fcoords2",
")",
"return",
"fdist",
"-",
"np",
".",
"round",
"(",
"fdist",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | find_in_coord_list_pbc | Get the indices of all points in a fractional coord list that are
equal to a fractional coord (with a tolerance), taking into account
periodic boundary conditions.
Args:
fcoord_list: List of fractional coords
fcoord: A specific fractional coord to test.
atol: Absolute tolerance. Def... | pymatgen/util/coord.py | def find_in_coord_list_pbc(fcoord_list, fcoord, atol=1e-8):
"""
Get the indices of all points in a fractional coord list that are
equal to a fractional coord (with a tolerance), taking into account
periodic boundary conditions.
Args:
fcoord_list: List of fractional coords
fcoord: A ... | def find_in_coord_list_pbc(fcoord_list, fcoord, atol=1e-8):
"""
Get the indices of all points in a fractional coord list that are
equal to a fractional coord (with a tolerance), taking into account
periodic boundary conditions.
Args:
fcoord_list: List of fractional coords
fcoord: A ... | [
"Get",
"the",
"indices",
"of",
"all",
"points",
"in",
"a",
"fractional",
"coord",
"list",
"that",
"are",
"equal",
"to",
"a",
"fractional",
"coord",
"(",
"with",
"a",
"tolerance",
")",
"taking",
"into",
"account",
"periodic",
"boundary",
"conditions",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L214-L233 | [
"def",
"find_in_coord_list_pbc",
"(",
"fcoord_list",
",",
"fcoord",
",",
"atol",
"=",
"1e-8",
")",
":",
"if",
"len",
"(",
"fcoord_list",
")",
"==",
"0",
":",
"return",
"[",
"]",
"fcoords",
"=",
"np",
".",
"tile",
"(",
"fcoord",
",",
"(",
"len",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | in_coord_list_pbc | Tests if a particular fractional coord is within a fractional coord_list.
Args:
fcoord_list: List of fractional coords to test
fcoord: A specific fractional coord to test.
atol: Absolute tolerance. Defaults to 1e-8.
Returns:
True if coord is in the coord list. | pymatgen/util/coord.py | def in_coord_list_pbc(fcoord_list, fcoord, atol=1e-8):
"""
Tests if a particular fractional coord is within a fractional coord_list.
Args:
fcoord_list: List of fractional coords to test
fcoord: A specific fractional coord to test.
atol: Absolute tolerance. Defaults to 1e-8.
Ret... | def in_coord_list_pbc(fcoord_list, fcoord, atol=1e-8):
"""
Tests if a particular fractional coord is within a fractional coord_list.
Args:
fcoord_list: List of fractional coords to test
fcoord: A specific fractional coord to test.
atol: Absolute tolerance. Defaults to 1e-8.
Ret... | [
"Tests",
"if",
"a",
"particular",
"fractional",
"coord",
"is",
"within",
"a",
"fractional",
"coord_list",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L236-L248 | [
"def",
"in_coord_list_pbc",
"(",
"fcoord_list",
",",
"fcoord",
",",
"atol",
"=",
"1e-8",
")",
":",
"return",
"len",
"(",
"find_in_coord_list_pbc",
"(",
"fcoord_list",
",",
"fcoord",
",",
"atol",
"=",
"atol",
")",
")",
">",
"0"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | is_coord_subset_pbc | Tests if all fractional coords in subset are contained in superset.
Args:
subset, superset: List of fractional coords
atol (float or size 3 array): Tolerance for matching
mask (boolean array): Mask of matches that are not allowed.
i.e. if mask[1,2] == True, then subset[1] cannot... | pymatgen/util/coord.py | def is_coord_subset_pbc(subset, superset, atol=1e-8, mask=None):
"""
Tests if all fractional coords in subset are contained in superset.
Args:
subset, superset: List of fractional coords
atol (float or size 3 array): Tolerance for matching
mask (boolean array): Mask of matches that ... | def is_coord_subset_pbc(subset, superset, atol=1e-8, mask=None):
"""
Tests if all fractional coords in subset are contained in superset.
Args:
subset, superset: List of fractional coords
atol (float or size 3 array): Tolerance for matching
mask (boolean array): Mask of matches that ... | [
"Tests",
"if",
"all",
"fractional",
"coords",
"in",
"subset",
"are",
"contained",
"in",
"superset",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L251-L272 | [
"def",
"is_coord_subset_pbc",
"(",
"subset",
",",
"superset",
",",
"atol",
"=",
"1e-8",
",",
"mask",
"=",
"None",
")",
":",
"c1",
"=",
"np",
".",
"array",
"(",
"subset",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"c2",
"=",
"np",
".",
"array",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | lattice_points_in_supercell | Returns the list of points on the original lattice contained in the
supercell in fractional coordinates (with the supercell basis).
e.g. [[2,0,0],[0,1,0],[0,0,1]] returns [[0,0,0],[0.5,0,0]]
Args:
supercell_matrix: 3x3 matrix describing the supercell
Returns:
numpy array of the fractio... | pymatgen/util/coord.py | def lattice_points_in_supercell(supercell_matrix):
"""
Returns the list of points on the original lattice contained in the
supercell in fractional coordinates (with the supercell basis).
e.g. [[2,0,0],[0,1,0],[0,0,1]] returns [[0,0,0],[0.5,0,0]]
Args:
supercell_matrix: 3x3 matrix describing... | def lattice_points_in_supercell(supercell_matrix):
"""
Returns the list of points on the original lattice contained in the
supercell in fractional coordinates (with the supercell basis).
e.g. [[2,0,0],[0,1,0],[0,0,1]] returns [[0,0,0],[0.5,0,0]]
Args:
supercell_matrix: 3x3 matrix describing... | [
"Returns",
"the",
"list",
"of",
"points",
"on",
"the",
"original",
"lattice",
"contained",
"in",
"the",
"supercell",
"in",
"fractional",
"coordinates",
"(",
"with",
"the",
"supercell",
"basis",
")",
".",
"e",
".",
"g",
".",
"[[",
"2",
"0",
"0",
"]",
"[... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L275-L310 | [
"def",
"lattice_points_in_supercell",
"(",
"supercell_matrix",
")",
":",
"diagonals",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
",",
"1",
"]",
",",
"[",
"0",
",",
"1",
",",
"0",
"]",
",",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | barycentric_coords | Converts a list of coordinates to barycentric coordinates, given a
simplex with d+1 points. Only works for d >= 2.
Args:
coords: list of n coords to transform, shape should be (n,d)
simplex: list of coordinates that form the simplex, shape should be
(d+1, d)
Returns:
a ... | pymatgen/util/coord.py | def barycentric_coords(coords, simplex):
"""
Converts a list of coordinates to barycentric coordinates, given a
simplex with d+1 points. Only works for d >= 2.
Args:
coords: list of n coords to transform, shape should be (n,d)
simplex: list of coordinates that form the simplex, shape sh... | def barycentric_coords(coords, simplex):
"""
Converts a list of coordinates to barycentric coordinates, given a
simplex with d+1 points. Only works for d >= 2.
Args:
coords: list of n coords to transform, shape should be (n,d)
simplex: list of coordinates that form the simplex, shape sh... | [
"Converts",
"a",
"list",
"of",
"coordinates",
"to",
"barycentric",
"coordinates",
"given",
"a",
"simplex",
"with",
"d",
"+",
"1",
"points",
".",
"Only",
"works",
"for",
"d",
">",
"=",
"2",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L313-L332 | [
"def",
"barycentric_coords",
"(",
"coords",
",",
"simplex",
")",
":",
"coords",
"=",
"np",
".",
"atleast_2d",
"(",
"coords",
")",
"t",
"=",
"np",
".",
"transpose",
"(",
"simplex",
"[",
":",
"-",
"1",
",",
":",
"]",
")",
"-",
"np",
".",
"transpose",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_angle | Calculates the angle between two vectors.
Args:
v1: Vector 1
v2: Vector 2
units: "degrees" or "radians". Defaults to "degrees".
Returns:
Angle between them in degrees. | pymatgen/util/coord.py | def get_angle(v1, v2, units="degrees"):
"""
Calculates the angle between two vectors.
Args:
v1: Vector 1
v2: Vector 2
units: "degrees" or "radians". Defaults to "degrees".
Returns:
Angle between them in degrees.
"""
d = np.dot(v1, v2) / np.linalg.norm(v1) / np.l... | def get_angle(v1, v2, units="degrees"):
"""
Calculates the angle between two vectors.
Args:
v1: Vector 1
v2: Vector 2
units: "degrees" or "radians". Defaults to "degrees".
Returns:
Angle between them in degrees.
"""
d = np.dot(v1, v2) / np.linalg.norm(v1) / np.l... | [
"Calculates",
"the",
"angle",
"between",
"two",
"vectors",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L335-L356 | [
"def",
"get_angle",
"(",
"v1",
",",
"v2",
",",
"units",
"=",
"\"degrees\"",
")",
":",
"d",
"=",
"np",
".",
"dot",
"(",
"v1",
",",
"v2",
")",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
"v1",
")",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Simplex.volume | Volume of the simplex. | pymatgen/util/coord.py | def volume(self):
"""
Volume of the simplex.
"""
return abs(np.linalg.det(self._aug)) / math.factorial(self.simplex_dim) | def volume(self):
"""
Volume of the simplex.
"""
return abs(np.linalg.det(self._aug)) / math.factorial(self.simplex_dim) | [
"Volume",
"of",
"the",
"simplex",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L390-L394 | [
"def",
"volume",
"(",
"self",
")",
":",
"return",
"abs",
"(",
"np",
".",
"linalg",
".",
"det",
"(",
"self",
".",
"_aug",
")",
")",
"/",
"math",
".",
"factorial",
"(",
"self",
".",
"simplex_dim",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Simplex.line_intersection | Computes the intersection points of a line with a simplex
Args:
point1, point2 ([float]): Points that determine the line
Returns:
points where the line intersects the simplex (0, 1, or 2) | pymatgen/util/coord.py | def line_intersection(self, point1, point2, tolerance=1e-8):
"""
Computes the intersection points of a line with a simplex
Args:
point1, point2 ([float]): Points that determine the line
Returns:
points where the line intersects the simplex (0, 1, or 2)
"""... | def line_intersection(self, point1, point2, tolerance=1e-8):
"""
Computes the intersection points of a line with a simplex
Args:
point1, point2 ([float]): Points that determine the line
Returns:
points where the line intersects the simplex (0, 1, or 2)
"""... | [
"Computes",
"the",
"intersection",
"points",
"of",
"a",
"line",
"with",
"a",
"simplex",
"Args",
":",
"point1",
"point2",
"(",
"[",
"float",
"]",
")",
":",
"Points",
"that",
"determine",
"the",
"line",
"Returns",
":",
"points",
"where",
"the",
"line",
"in... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/coord.py#L426-L455 | [
"def",
"line_intersection",
"(",
"self",
",",
"point1",
",",
"point2",
",",
"tolerance",
"=",
"1e-8",
")",
":",
"b1",
"=",
"self",
".",
"bary_coords",
"(",
"point1",
")",
"b2",
"=",
"self",
".",
"bary_coords",
"(",
"point2",
")",
"l",
"=",
"b1",
"-",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | is_valid_bibtex | Use pybtex to validate that a reference is in proper BibTeX format
Args:
reference: A String reference in BibTeX format.
Returns:
Boolean indicating if reference is valid bibtex. | pymatgen/util/provenance.py | def is_valid_bibtex(reference):
"""
Use pybtex to validate that a reference is in proper BibTeX format
Args:
reference: A String reference in BibTeX format.
Returns:
Boolean indicating if reference is valid bibtex.
"""
# str is necessary since pybtex seems to have an issue with... | def is_valid_bibtex(reference):
"""
Use pybtex to validate that a reference is in proper BibTeX format
Args:
reference: A String reference in BibTeX format.
Returns:
Boolean indicating if reference is valid bibtex.
"""
# str is necessary since pybtex seems to have an issue with... | [
"Use",
"pybtex",
"to",
"validate",
"that",
"a",
"reference",
"is",
"in",
"proper",
"BibTeX",
"format"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/provenance.py#L38-L54 | [
"def",
"is_valid_bibtex",
"(",
"reference",
")",
":",
"# str is necessary since pybtex seems to have an issue with unicode. The",
"# filter expression removes all non-ASCII characters.",
"sio",
"=",
"StringIO",
"(",
"remove_non_ascii",
"(",
"reference",
")",
")",
"parser",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | HistoryNode.parse_history_node | Parses a History Node object from either a dict or a tuple.
Args:
h_node: A dict with name/url/description fields or a 3-element
tuple.
Returns:
History node. | pymatgen/util/provenance.py | def parse_history_node(h_node):
"""
Parses a History Node object from either a dict or a tuple.
Args:
h_node: A dict with name/url/description fields or a 3-element
tuple.
Returns:
History node.
"""
if isinstance(h_node, dict):
... | def parse_history_node(h_node):
"""
Parses a History Node object from either a dict or a tuple.
Args:
h_node: A dict with name/url/description fields or a 3-element
tuple.
Returns:
History node.
"""
if isinstance(h_node, dict):
... | [
"Parses",
"a",
"History",
"Node",
"object",
"from",
"either",
"a",
"dict",
"or",
"a",
"tuple",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/provenance.py#L94-L113 | [
"def",
"parse_history_node",
"(",
"h_node",
")",
":",
"if",
"isinstance",
"(",
"h_node",
",",
"dict",
")",
":",
"return",
"HistoryNode",
".",
"from_dict",
"(",
"h_node",
")",
"else",
":",
"if",
"len",
"(",
"h_node",
")",
"!=",
"3",
":",
"raise",
"Value... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Author.parse_author | Parses an Author object from either a String, dict, or tuple
Args:
author: A String formatted as "NAME <email@domain.com>",
(name, email) tuple, or a dict with name and email keys.
Returns:
An Author object. | pymatgen/util/provenance.py | def parse_author(author):
"""
Parses an Author object from either a String, dict, or tuple
Args:
author: A String formatted as "NAME <email@domain.com>",
(name, email) tuple, or a dict with name and email keys.
Returns:
An Author object.
... | def parse_author(author):
"""
Parses an Author object from either a String, dict, or tuple
Args:
author: A String formatted as "NAME <email@domain.com>",
(name, email) tuple, or a dict with name and email keys.
Returns:
An Author object.
... | [
"Parses",
"an",
"Author",
"object",
"from",
"either",
"a",
"String",
"dict",
"or",
"tuple"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/provenance.py#L143-L167 | [
"def",
"parse_author",
"(",
"author",
")",
":",
"if",
"isinstance",
"(",
"author",
",",
"str",
")",
":",
"# Regex looks for whitespace, (any name), whitespace, <, (email),",
"# >, whitespace",
"m",
"=",
"re",
".",
"match",
"(",
"r'\\s*(.*?)\\s*<(.*?@.*?)>\\s*'",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | StructureNL.from_structures | A convenience method for getting a list of StructureNL objects by
specifying structures and metadata separately. Some of the metadata
is applied to all of the structures for ease of use.
Args:
structures: A list of Structure objects
authors: *List* of {"name":'', "email"... | pymatgen/util/provenance.py | def from_structures(cls, structures, authors, projects=None,
references='', remarks=None, data=None,
histories=None, created_at=None):
"""
A convenience method for getting a list of StructureNL objects by
specifying structures and metadata separate... | def from_structures(cls, structures, authors, projects=None,
references='', remarks=None, data=None,
histories=None, created_at=None):
"""
A convenience method for getting a list of StructureNL objects by
specifying structures and metadata separate... | [
"A",
"convenience",
"method",
"for",
"getting",
"a",
"list",
"of",
"StructureNL",
"objects",
"by",
"specifying",
"structures",
"and",
"metadata",
"separately",
".",
"Some",
"of",
"the",
"metadata",
"is",
"applied",
"to",
"all",
"of",
"the",
"structures",
"for"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/provenance.py#L300-L340 | [
"def",
"from_structures",
"(",
"cls",
",",
"structures",
",",
"authors",
",",
"projects",
"=",
"None",
",",
"references",
"=",
"''",
",",
"remarks",
"=",
"None",
",",
"data",
"=",
"None",
",",
"histories",
"=",
"None",
",",
"created_at",
"=",
"None",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | convert_strain_to_deformation | This function converts a strain to a deformation gradient that will
produce that strain. Supports three methods:
Args:
strain (3x3 array-like): strain matrix
shape: (string): method for determining deformation, supports
"upper" produces an upper triangular defo
"lower" ... | pymatgen/analysis/elasticity/strain.py | def convert_strain_to_deformation(strain, shape="upper"):
"""
This function converts a strain to a deformation gradient that will
produce that strain. Supports three methods:
Args:
strain (3x3 array-like): strain matrix
shape: (string): method for determining deformation, supports
... | def convert_strain_to_deformation(strain, shape="upper"):
"""
This function converts a strain to a deformation gradient that will
produce that strain. Supports three methods:
Args:
strain (3x3 array-like): strain matrix
shape: (string): method for determining deformation, supports
... | [
"This",
"function",
"converts",
"a",
"strain",
"to",
"a",
"deformation",
"gradient",
"that",
"will",
"produce",
"that",
"strain",
".",
"Supports",
"three",
"methods",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L252-L272 | [
"def",
"convert_strain_to_deformation",
"(",
"strain",
",",
"shape",
"=",
"\"upper\"",
")",
":",
"strain",
"=",
"SquareTensor",
"(",
"strain",
")",
"ftdotf",
"=",
"2",
"*",
"strain",
"+",
"np",
".",
"eye",
"(",
"3",
")",
"if",
"shape",
"==",
"\"upper\"",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Deformation.get_perturbed_indices | Gets indices of perturbed elements of the deformation gradient,
i. e. those that differ from the identity | pymatgen/analysis/elasticity/strain.py | def get_perturbed_indices(self, tol=1e-8):
"""
Gets indices of perturbed elements of the deformation gradient,
i. e. those that differ from the identity
"""
indices = list(zip(*np.where(abs(self - np.eye(3)) > tol)))
return indices | def get_perturbed_indices(self, tol=1e-8):
"""
Gets indices of perturbed elements of the deformation gradient,
i. e. those that differ from the identity
"""
indices = list(zip(*np.where(abs(self - np.eye(3)) > tol)))
return indices | [
"Gets",
"indices",
"of",
"perturbed",
"elements",
"of",
"the",
"deformation",
"gradient",
"i",
".",
"e",
".",
"those",
"that",
"differ",
"from",
"the",
"identity"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L57-L63 | [
"def",
"get_perturbed_indices",
"(",
"self",
",",
"tol",
"=",
"1e-8",
")",
":",
"indices",
"=",
"list",
"(",
"zip",
"(",
"*",
"np",
".",
"where",
"(",
"abs",
"(",
"self",
"-",
"np",
".",
"eye",
"(",
"3",
")",
")",
">",
"tol",
")",
")",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Deformation.apply_to_structure | Apply the deformation gradient to a structure.
Args:
structure (Structure object): the structure object to
be modified by the deformation | pymatgen/analysis/elasticity/strain.py | def apply_to_structure(self, structure):
"""
Apply the deformation gradient to a structure.
Args:
structure (Structure object): the structure object to
be modified by the deformation
"""
def_struct = structure.copy()
old_latt = def_struct.latt... | def apply_to_structure(self, structure):
"""
Apply the deformation gradient to a structure.
Args:
structure (Structure object): the structure object to
be modified by the deformation
"""
def_struct = structure.copy()
old_latt = def_struct.latt... | [
"Apply",
"the",
"deformation",
"gradient",
"to",
"a",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L73-L85 | [
"def",
"apply_to_structure",
"(",
"self",
",",
"structure",
")",
":",
"def_struct",
"=",
"structure",
".",
"copy",
"(",
")",
"old_latt",
"=",
"def_struct",
".",
"lattice",
".",
"matrix",
"new_latt",
"=",
"np",
".",
"transpose",
"(",
"np",
".",
"dot",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Deformation.from_index_amount | Factory method for constructing a Deformation object
from a matrix position and amount
Args:
matrixpos (tuple): tuple corresponding the matrix position to
have a perturbation added
amt (float): amount to add to the identity matrix at position
matr... | pymatgen/analysis/elasticity/strain.py | def from_index_amount(cls, matrixpos, amt):
"""
Factory method for constructing a Deformation object
from a matrix position and amount
Args:
matrixpos (tuple): tuple corresponding the matrix position to
have a perturbation added
amt (float): amoun... | def from_index_amount(cls, matrixpos, amt):
"""
Factory method for constructing a Deformation object
from a matrix position and amount
Args:
matrixpos (tuple): tuple corresponding the matrix position to
have a perturbation added
amt (float): amoun... | [
"Factory",
"method",
"for",
"constructing",
"a",
"Deformation",
"object",
"from",
"a",
"matrix",
"position",
"and",
"amount"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L88-L101 | [
"def",
"from_index_amount",
"(",
"cls",
",",
"matrixpos",
",",
"amt",
")",
":",
"f",
"=",
"np",
".",
"identity",
"(",
"3",
")",
"f",
"[",
"matrixpos",
"]",
"+=",
"amt",
"return",
"cls",
"(",
"f",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Strain.from_deformation | Factory method that returns a Strain object from a deformation
gradient
Args:
deformation (3x3 array-like): | pymatgen/analysis/elasticity/strain.py | def from_deformation(cls, deformation):
"""
Factory method that returns a Strain object from a deformation
gradient
Args:
deformation (3x3 array-like):
"""
dfm = Deformation(deformation)
return cls(0.5 * (np.dot(dfm.trans, dfm) - np.eye(3))) | def from_deformation(cls, deformation):
"""
Factory method that returns a Strain object from a deformation
gradient
Args:
deformation (3x3 array-like):
"""
dfm = Deformation(deformation)
return cls(0.5 * (np.dot(dfm.trans, dfm) - np.eye(3))) | [
"Factory",
"method",
"that",
"returns",
"a",
"Strain",
"object",
"from",
"a",
"deformation",
"gradient"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L192-L201 | [
"def",
"from_deformation",
"(",
"cls",
",",
"deformation",
")",
":",
"dfm",
"=",
"Deformation",
"(",
"deformation",
")",
"return",
"cls",
"(",
"0.5",
"*",
"(",
"np",
".",
"dot",
"(",
"dfm",
".",
"trans",
",",
"dfm",
")",
"-",
"np",
".",
"eye",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Strain.from_index_amount | Like Deformation.from_index_amount, except generates
a strain from the zero 3x3 tensor or voigt vector with
the amount specified in the index location. Ensures
symmetric strain.
Args:
idx (tuple or integer): index to be perturbed, can be voigt or
full-tensor... | pymatgen/analysis/elasticity/strain.py | def from_index_amount(cls, idx, amount):
"""
Like Deformation.from_index_amount, except generates
a strain from the zero 3x3 tensor or voigt vector with
the amount specified in the index location. Ensures
symmetric strain.
Args:
idx (tuple or integer): index... | def from_index_amount(cls, idx, amount):
"""
Like Deformation.from_index_amount, except generates
a strain from the zero 3x3 tensor or voigt vector with
the amount specified in the index location. Ensures
symmetric strain.
Args:
idx (tuple or integer): index... | [
"Like",
"Deformation",
".",
"from_index_amount",
"except",
"generates",
"a",
"strain",
"from",
"the",
"zero",
"3x3",
"tensor",
"or",
"voigt",
"vector",
"with",
"the",
"amount",
"specified",
"in",
"the",
"index",
"location",
".",
"Ensures",
"symmetric",
"strain",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L204-L227 | [
"def",
"from_index_amount",
"(",
"cls",
",",
"idx",
",",
"amount",
")",
":",
"if",
"np",
".",
"array",
"(",
"idx",
")",
".",
"ndim",
"==",
"0",
":",
"v",
"=",
"np",
".",
"zeros",
"(",
"6",
")",
"v",
"[",
"idx",
"]",
"=",
"amount",
"return",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Strain.von_mises_strain | Equivalent strain to Von Mises Stress | pymatgen/analysis/elasticity/strain.py | def von_mises_strain(self):
"""
Equivalent strain to Von Mises Stress
"""
eps = self - 1/3 * np.trace(self) * np.identity(3)
return np.sqrt(np.sum(eps * eps) * 2/3) | def von_mises_strain(self):
"""
Equivalent strain to Von Mises Stress
"""
eps = self - 1/3 * np.trace(self) * np.identity(3)
return np.sqrt(np.sum(eps * eps) * 2/3) | [
"Equivalent",
"strain",
"to",
"Von",
"Mises",
"Stress"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/strain.py#L243-L249 | [
"def",
"von_mises_strain",
"(",
"self",
")",
":",
"eps",
"=",
"self",
"-",
"1",
"/",
"3",
"*",
"np",
".",
"trace",
"(",
"self",
")",
"*",
"np",
".",
"identity",
"(",
"3",
")",
"return",
"np",
".",
"sqrt",
"(",
"np",
".",
"sum",
"(",
"eps",
"*... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | hkl_tuple_to_str | Prepare for display on plots
"(hkl)" for surfaces
Agrs:
hkl: in the form of [h, k, l] or (h, k, l) | pymatgen/analysis/wulff.py | def hkl_tuple_to_str(hkl):
"""
Prepare for display on plots
"(hkl)" for surfaces
Agrs:
hkl: in the form of [h, k, l] or (h, k, l)
"""
str_format = '($'
for x in hkl:
if x < 0:
str_format += '\\overline{' + str(-x) + '}'
else:
str_format += str(... | def hkl_tuple_to_str(hkl):
"""
Prepare for display on plots
"(hkl)" for surfaces
Agrs:
hkl: in the form of [h, k, l] or (h, k, l)
"""
str_format = '($'
for x in hkl:
if x < 0:
str_format += '\\overline{' + str(-x) + '}'
else:
str_format += str(... | [
"Prepare",
"for",
"display",
"on",
"plots",
"(",
"hkl",
")",
"for",
"surfaces",
"Agrs",
":",
"hkl",
":",
"in",
"the",
"form",
"of",
"[",
"h",
"k",
"l",
"]",
"or",
"(",
"h",
"k",
"l",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L41-L55 | [
"def",
"hkl_tuple_to_str",
"(",
"hkl",
")",
":",
"str_format",
"=",
"'($'",
"for",
"x",
"in",
"hkl",
":",
"if",
"x",
"<",
"0",
":",
"str_format",
"+=",
"'\\\\overline{'",
"+",
"str",
"(",
"-",
"x",
")",
"+",
"'}'",
"else",
":",
"str_format",
"+=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_tri_area | Given a list of coords for 3 points,
Compute the area of this triangle.
Args:
pts: [a, b, c] three points | pymatgen/analysis/wulff.py | def get_tri_area(pts):
"""
Given a list of coords for 3 points,
Compute the area of this triangle.
Args:
pts: [a, b, c] three points
"""
a, b, c = pts[0], pts[1], pts[2]
v1 = np.array(b) - np.array(a)
v2 = np.array(c) - np.array(a)
area_tri = abs(sp.linalg.norm(sp.cross(v1, ... | def get_tri_area(pts):
"""
Given a list of coords for 3 points,
Compute the area of this triangle.
Args:
pts: [a, b, c] three points
"""
a, b, c = pts[0], pts[1], pts[2]
v1 = np.array(b) - np.array(a)
v2 = np.array(c) - np.array(a)
area_tri = abs(sp.linalg.norm(sp.cross(v1, ... | [
"Given",
"a",
"list",
"of",
"coords",
"for",
"3",
"points",
"Compute",
"the",
"area",
"of",
"this",
"triangle",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L58-L70 | [
"def",
"get_tri_area",
"(",
"pts",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"pts",
"[",
"0",
"]",
",",
"pts",
"[",
"1",
"]",
",",
"pts",
"[",
"2",
"]",
"v1",
"=",
"np",
".",
"array",
"(",
"b",
")",
"-",
"np",
".",
"array",
"(",
"a",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape._get_all_miller_e | from self:
get miller_list(unique_miller), e_surf_list and symmetry
operations(symmops) according to lattice
apply symmops to get all the miller index, then get normal,
get all the facets functions for wulff shape calculation:
|normal| = 1, e_surf is plane's distance ... | pymatgen/analysis/wulff.py | def _get_all_miller_e(self):
"""
from self:
get miller_list(unique_miller), e_surf_list and symmetry
operations(symmops) according to lattice
apply symmops to get all the miller index, then get normal,
get all the facets functions for wulff shape calculation:
... | def _get_all_miller_e(self):
"""
from self:
get miller_list(unique_miller), e_surf_list and symmetry
operations(symmops) according to lattice
apply symmops to get all the miller index, then get normal,
get all the facets functions for wulff shape calculation:
... | [
"from",
"self",
":",
"get",
"miller_list",
"(",
"unique_miller",
")",
"e_surf_list",
"and",
"symmetry",
"operations",
"(",
"symmops",
")",
"according",
"to",
"lattice",
"apply",
"symmops",
"to",
"get",
"all",
"the",
"miller",
"index",
"then",
"get",
"normal",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L218-L253 | [
"def",
"_get_all_miller_e",
"(",
"self",
")",
":",
"all_hkl",
"=",
"[",
"]",
"color_ind",
"=",
"self",
".",
"color_ind",
"planes",
"=",
"[",
"]",
"recp",
"=",
"self",
".",
"structure",
".",
"lattice",
".",
"reciprocal_lattice_crystallographic",
"recp_symmops",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape._get_cross_pt_dual_simp | |normal| = 1, e_surf is plane's distance to (0, 0, 0),
plane function:
normal[0]x + normal[1]y + normal[2]z = e_surf
from self:
normal_e_m to get the plane functions
dual_simp: (i, j, k) simplices from the dual convex hull
i, j, k: plane index(same or... | pymatgen/analysis/wulff.py | def _get_cross_pt_dual_simp(self, dual_simp):
"""
|normal| = 1, e_surf is plane's distance to (0, 0, 0),
plane function:
normal[0]x + normal[1]y + normal[2]z = e_surf
from self:
normal_e_m to get the plane functions
dual_simp: (i, j, k) simplices from... | def _get_cross_pt_dual_simp(self, dual_simp):
"""
|normal| = 1, e_surf is plane's distance to (0, 0, 0),
plane function:
normal[0]x + normal[1]y + normal[2]z = e_surf
from self:
normal_e_m to get the plane functions
dual_simp: (i, j, k) simplices from... | [
"|normal|",
"=",
"1",
"e_surf",
"is",
"plane",
"s",
"distance",
"to",
"(",
"0",
"0",
"0",
")",
"plane",
"function",
":",
"normal",
"[",
"0",
"]",
"x",
"+",
"normal",
"[",
"1",
"]",
"y",
"+",
"normal",
"[",
"2",
"]",
"z",
"=",
"e_surf"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L255-L269 | [
"def",
"_get_cross_pt_dual_simp",
"(",
"self",
",",
"dual_simp",
")",
":",
"matrix_surfs",
"=",
"[",
"self",
".",
"facets",
"[",
"dual_simp",
"[",
"i",
"]",
"]",
".",
"normal",
"for",
"i",
"in",
"range",
"(",
"3",
")",
"]",
"matrix_e",
"=",
"[",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape._get_simpx_plane | Locate the plane for simpx of on wulff_cv, by comparing the center of
the simpx triangle with the plane functions. | pymatgen/analysis/wulff.py | def _get_simpx_plane(self):
"""
Locate the plane for simpx of on wulff_cv, by comparing the center of
the simpx triangle with the plane functions.
"""
on_wulff = [False] * len(self.miller_list)
surface_area = [0.0] * len(self.miller_list)
for simpx in self.wulff_c... | def _get_simpx_plane(self):
"""
Locate the plane for simpx of on wulff_cv, by comparing the center of
the simpx triangle with the plane functions.
"""
on_wulff = [False] * len(self.miller_list)
surface_area = [0.0] * len(self.miller_list)
for simpx in self.wulff_c... | [
"Locate",
"the",
"plane",
"for",
"simpx",
"of",
"on",
"wulff_cv",
"by",
"comparing",
"the",
"center",
"of",
"the",
"simpx",
"triangle",
"with",
"the",
"plane",
"functions",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L271-L298 | [
"def",
"_get_simpx_plane",
"(",
"self",
")",
":",
"on_wulff",
"=",
"[",
"False",
"]",
"*",
"len",
"(",
"self",
".",
"miller_list",
")",
"surface_area",
"=",
"[",
"0.0",
"]",
"*",
"len",
"(",
"self",
".",
"miller_list",
")",
"for",
"simpx",
"in",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape._get_colors | assign colors according to the surface energies of on_wulff facets.
return:
(color_list, color_proxy, color_proxy_on_wulff, miller_on_wulff,
e_surf_on_wulff_list) | pymatgen/analysis/wulff.py | def _get_colors(self, color_set, alpha, off_color, custom_colors={}):
"""
assign colors according to the surface energies of on_wulff facets.
return:
(color_list, color_proxy, color_proxy_on_wulff, miller_on_wulff,
e_surf_on_wulff_list)
"""
import matplot... | def _get_colors(self, color_set, alpha, off_color, custom_colors={}):
"""
assign colors according to the surface energies of on_wulff facets.
return:
(color_list, color_proxy, color_proxy_on_wulff, miller_on_wulff,
e_surf_on_wulff_list)
"""
import matplot... | [
"assign",
"colors",
"according",
"to",
"the",
"surface",
"energies",
"of",
"on_wulff",
"facets",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L300-L341 | [
"def",
"_get_colors",
"(",
"self",
",",
"color_set",
",",
"alpha",
",",
"off_color",
",",
"custom_colors",
"=",
"{",
"}",
")",
":",
"import",
"matplotlib",
"as",
"mpl",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"color_list",
"=",
"[",
"off_color"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape.get_line_in_facet | Returns the sorted pts in a facet used to draw a line | pymatgen/analysis/wulff.py | def get_line_in_facet(self, facet):
"""
Returns the sorted pts in a facet used to draw a line
"""
lines = list(facet.outer_lines)
pt = []
prev = None
while len(lines) > 0:
if prev is None:
l = lines.pop(0)
else:
... | def get_line_in_facet(self, facet):
"""
Returns the sorted pts in a facet used to draw a line
"""
lines = list(facet.outer_lines)
pt = []
prev = None
while len(lines) > 0:
if prev is None:
l = lines.pop(0)
else:
... | [
"Returns",
"the",
"sorted",
"pts",
"in",
"a",
"facet",
"used",
"to",
"draw",
"a",
"line"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L353-L377 | [
"def",
"get_line_in_facet",
"(",
"self",
",",
"facet",
")",
":",
"lines",
"=",
"list",
"(",
"facet",
".",
"outer_lines",
")",
"pt",
"=",
"[",
"]",
"prev",
"=",
"None",
"while",
"len",
"(",
"lines",
")",
">",
"0",
":",
"if",
"prev",
"is",
"None",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape.get_plot | Get the Wulff shape plot.
Args:
color_set: default is 'PuBu'
grid_off (bool): default is True
axis_off (bool): default is Ture
show_area (bool): default is False
alpha (float): chosen from 0 to 1 (float), default is 1
off_color: Default co... | pymatgen/analysis/wulff.py | def get_plot(self, color_set='PuBu', grid_off=True, axis_off=True,
show_area=False, alpha=1, off_color='red', direction=None,
bar_pos=(0.75, 0.15, 0.05, 0.65), bar_on=False, units_in_JPERM2=True,
legend_on=True, aspect_ratio=(8, 8), custom_colors={}):
"""
... | def get_plot(self, color_set='PuBu', grid_off=True, axis_off=True,
show_area=False, alpha=1, off_color='red', direction=None,
bar_pos=(0.75, 0.15, 0.05, 0.65), bar_on=False, units_in_JPERM2=True,
legend_on=True, aspect_ratio=(8, 8), custom_colors={}):
"""
... | [
"Get",
"the",
"Wulff",
"shape",
"plot",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L379-L487 | [
"def",
"get_plot",
"(",
"self",
",",
"color_set",
"=",
"'PuBu'",
",",
"grid_off",
"=",
"True",
",",
"axis_off",
"=",
"True",
",",
"show_area",
"=",
"False",
",",
"alpha",
"=",
"1",
",",
"off_color",
"=",
"'red'",
",",
"direction",
"=",
"None",
",",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape._get_azimuth_elev | Args:
miller_index: viewing direction
Returns:
azim, elev for plotting | pymatgen/analysis/wulff.py | def _get_azimuth_elev(self, miller_index):
"""
Args:
miller_index: viewing direction
Returns:
azim, elev for plotting
"""
if miller_index == (0, 0, 1) or miller_index == (0, 0, 0, 1):
return 0, 90
else:
cart = self.lattice.... | def _get_azimuth_elev(self, miller_index):
"""
Args:
miller_index: viewing direction
Returns:
azim, elev for plotting
"""
if miller_index == (0, 0, 1) or miller_index == (0, 0, 0, 1):
return 0, 90
else:
cart = self.lattice.... | [
"Args",
":",
"miller_index",
":",
"viewing",
"direction"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L489-L504 | [
"def",
"_get_azimuth_elev",
"(",
"self",
",",
"miller_index",
")",
":",
"if",
"miller_index",
"==",
"(",
"0",
",",
"0",
",",
"1",
")",
"or",
"miller_index",
"==",
"(",
"0",
",",
"0",
",",
"0",
",",
"1",
")",
":",
"return",
"0",
",",
"90",
"else",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape.area_fraction_dict | Returns:
(dict): {hkl: area_hkl/total area on wulff} | pymatgen/analysis/wulff.py | def area_fraction_dict(self):
"""
Returns:
(dict): {hkl: area_hkl/total area on wulff}
"""
return {hkl: self.miller_area_dict[hkl] / self.surface_area
for hkl in self.miller_area_dict.keys()} | def area_fraction_dict(self):
"""
Returns:
(dict): {hkl: area_hkl/total area on wulff}
"""
return {hkl: self.miller_area_dict[hkl] / self.surface_area
for hkl in self.miller_area_dict.keys()} | [
"Returns",
":",
"(",
"dict",
")",
":",
"{",
"hkl",
":",
"area_hkl",
"/",
"total",
"area",
"on",
"wulff",
"}"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L543-L549 | [
"def",
"area_fraction_dict",
"(",
"self",
")",
":",
"return",
"{",
"hkl",
":",
"self",
".",
"miller_area_dict",
"[",
"hkl",
"]",
"/",
"self",
".",
"surface_area",
"for",
"hkl",
"in",
"self",
".",
"miller_area_dict",
".",
"keys",
"(",
")",
"}"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape.anisotropy | Returns:
(float) Coefficient of Variation from weighted surface energy
The ideal sphere is 0. | pymatgen/analysis/wulff.py | def anisotropy(self):
"""
Returns:
(float) Coefficient of Variation from weighted surface energy
The ideal sphere is 0.
"""
square_diff_energy = 0
weighted_energy = self.weighted_surface_energy
area_frac_dict = self.area_fraction_dict
mille... | def anisotropy(self):
"""
Returns:
(float) Coefficient of Variation from weighted surface energy
The ideal sphere is 0.
"""
square_diff_energy = 0
weighted_energy = self.weighted_surface_energy
area_frac_dict = self.area_fraction_dict
mille... | [
"Returns",
":",
"(",
"float",
")",
"Coefficient",
"of",
"Variation",
"from",
"weighted",
"surface",
"energy",
"The",
"ideal",
"sphere",
"is",
"0",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L552-L566 | [
"def",
"anisotropy",
"(",
"self",
")",
":",
"square_diff_energy",
"=",
"0",
"weighted_energy",
"=",
"self",
".",
"weighted_surface_energy",
"area_frac_dict",
"=",
"self",
".",
"area_fraction_dict",
"miller_energy_dict",
"=",
"self",
".",
"miller_energy_dict",
"for",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape.total_surface_energy | Total surface energy of the Wulff shape.
Returns:
(float) sum(surface_energy_hkl * area_hkl) | pymatgen/analysis/wulff.py | def total_surface_energy(self):
"""
Total surface energy of the Wulff shape.
Returns:
(float) sum(surface_energy_hkl * area_hkl)
"""
tot_surface_energy = 0
for hkl in self.miller_energy_dict.keys():
tot_surface_energy += self.miller_energy_dict[hk... | def total_surface_energy(self):
"""
Total surface energy of the Wulff shape.
Returns:
(float) sum(surface_energy_hkl * area_hkl)
"""
tot_surface_energy = 0
for hkl in self.miller_energy_dict.keys():
tot_surface_energy += self.miller_energy_dict[hk... | [
"Total",
"surface",
"energy",
"of",
"the",
"Wulff",
"shape",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L594-L605 | [
"def",
"total_surface_energy",
"(",
"self",
")",
":",
"tot_surface_energy",
"=",
"0",
"for",
"hkl",
"in",
"self",
".",
"miller_energy_dict",
".",
"keys",
"(",
")",
":",
"tot_surface_energy",
"+=",
"self",
".",
"miller_energy_dict",
"[",
"hkl",
"]",
"*",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | WulffShape.tot_edges | Returns the number of edges in the convex hull.
Useful for identifying catalytically active sites. | pymatgen/analysis/wulff.py | def tot_edges(self):
"""
Returns the number of edges in the convex hull.
Useful for identifying catalytically active sites.
"""
all_edges = []
for facet in self.facets:
edges = []
pt = self.get_line_in_facet(facet)
lines = []
... | def tot_edges(self):
"""
Returns the number of edges in the convex hull.
Useful for identifying catalytically active sites.
"""
all_edges = []
for facet in self.facets:
edges = []
pt = self.get_line_in_facet(facet)
lines = []
... | [
"Returns",
"the",
"number",
"of",
"edges",
"in",
"the",
"convex",
"hull",
".",
"Useful",
"for",
"identifying",
"catalytically",
"active",
"sites",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L616-L638 | [
"def",
"tot_edges",
"(",
"self",
")",
":",
"all_edges",
"=",
"[",
"]",
"for",
"facet",
"in",
"self",
".",
"facets",
":",
"edges",
"=",
"[",
"]",
"pt",
"=",
"self",
".",
"get_line_in_facet",
"(",
"facet",
")",
"lines",
"=",
"[",
"]",
"for",
"i",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | JonesFaithfulTransformation.from_transformation_string | Construct SpaceGroupTransformation from its transformation string.
:param P: matrix
:param p: origin shift vector
:return: | pymatgen/symmetry/settings.py | def from_transformation_string(cls, transformation_string="a,b,c;0,0,0"):
"""
Construct SpaceGroupTransformation from its transformation string.
:param P: matrix
:param p: origin shift vector
:return:
"""
P, p = JonesFaithfulTransformation.parse_transformation_str... | def from_transformation_string(cls, transformation_string="a,b,c;0,0,0"):
"""
Construct SpaceGroupTransformation from its transformation string.
:param P: matrix
:param p: origin shift vector
:return:
"""
P, p = JonesFaithfulTransformation.parse_transformation_str... | [
"Construct",
"SpaceGroupTransformation",
"from",
"its",
"transformation",
"string",
".",
":",
"param",
"P",
":",
"matrix",
":",
"param",
"p",
":",
"origin",
"shift",
"vector",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/settings.py#L61-L70 | [
"def",
"from_transformation_string",
"(",
"cls",
",",
"transformation_string",
"=",
"\"a,b,c;0,0,0\"",
")",
":",
"P",
",",
"p",
"=",
"JonesFaithfulTransformation",
".",
"parse_transformation_string",
"(",
"transformation_string",
")",
"return",
"cls",
"(",
"P",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | JonesFaithfulTransformation.inverse | :return: JonesFaithfulTransformation | pymatgen/symmetry/settings.py | def inverse(self):
# type: () -> JonesFaithfulTransformation
"""
:return: JonesFaithfulTransformation
"""
Q = np.linalg.inv(self.P)
return JonesFaithfulTransformation(Q, -np.matmul(Q, self.p)) | def inverse(self):
# type: () -> JonesFaithfulTransformation
"""
:return: JonesFaithfulTransformation
"""
Q = np.linalg.inv(self.P)
return JonesFaithfulTransformation(Q, -np.matmul(Q, self.p)) | [
":",
"return",
":",
"JonesFaithfulTransformation"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/settings.py#L123-L130 | [
"def",
"inverse",
"(",
"self",
")",
":",
"# type: () -> JonesFaithfulTransformation",
"Q",
"=",
"np",
".",
"linalg",
".",
"inv",
"(",
"self",
".",
"P",
")",
"return",
"JonesFaithfulTransformation",
"(",
"Q",
",",
"-",
"np",
".",
"matmul",
"(",
"Q",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | JonesFaithfulTransformation.transform_symmop | Takes a symmetry operation and transforms it.
:param symmop: SymmOp or MagSymmOp
:return: | pymatgen/symmetry/settings.py | def transform_symmop(self, symmop):
# type: (Union[SymmOp, MagSymmOp]) -> Union[SymmOp, MagSymmOp]
"""
Takes a symmetry operation and transforms it.
:param symmop: SymmOp or MagSymmOp
:return:
"""
W = symmop.rotation_matrix
w = symmop.translation_vector
... | def transform_symmop(self, symmop):
# type: (Union[SymmOp, MagSymmOp]) -> Union[SymmOp, MagSymmOp]
"""
Takes a symmetry operation and transforms it.
:param symmop: SymmOp or MagSymmOp
:return:
"""
W = symmop.rotation_matrix
w = symmop.translation_vector
... | [
"Takes",
"a",
"symmetry",
"operation",
"and",
"transforms",
"it",
".",
":",
"param",
"symmop",
":",
"SymmOp",
"or",
"MagSymmOp",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/settings.py#L148-L167 | [
"def",
"transform_symmop",
"(",
"self",
",",
"symmop",
")",
":",
"# type: (Union[SymmOp, MagSymmOp]) -> Union[SymmOp, MagSymmOp]",
"W",
"=",
"symmop",
".",
"rotation_matrix",
"w",
"=",
"symmop",
".",
"translation_vector",
"Q",
"=",
"np",
".",
"linalg",
".",
"inv",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | JonesFaithfulTransformation.transform_coords | Takes a list of co-ordinates and transforms them.
:param coords: List of coords
:return: | pymatgen/symmetry/settings.py | def transform_coords(self, coords):
# type: (List[List[float]]) -> List[List[float]]
"""
Takes a list of co-ordinates and transforms them.
:param coords: List of coords
:return:
"""
new_coords = []
for x in coords:
x = np.array(x)
... | def transform_coords(self, coords):
# type: (List[List[float]]) -> List[List[float]]
"""
Takes a list of co-ordinates and transforms them.
:param coords: List of coords
:return:
"""
new_coords = []
for x in coords:
x = np.array(x)
... | [
"Takes",
"a",
"list",
"of",
"co",
"-",
"ordinates",
"and",
"transforms",
"them",
".",
":",
"param",
"coords",
":",
"List",
"of",
"coords",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/settings.py#L169-L182 | [
"def",
"transform_coords",
"(",
"self",
",",
"coords",
")",
":",
"# type: (List[List[float]]) -> List[List[float]]",
"new_coords",
"=",
"[",
"]",
"for",
"x",
"in",
"coords",
":",
"x",
"=",
"np",
".",
"array",
"(",
"x",
")",
"Q",
"=",
"np",
".",
"linalg",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | JonesFaithfulTransformation.transform_lattice | Takes a Lattice object and transforms it.
:param lattice: Lattice
:return: | pymatgen/symmetry/settings.py | def transform_lattice(self, lattice):
# type: (Lattice) -> Lattice
"""
Takes a Lattice object and transforms it.
:param lattice: Lattice
:return:
"""
return Lattice(np.matmul(lattice.matrix, self.P)) | def transform_lattice(self, lattice):
# type: (Lattice) -> Lattice
"""
Takes a Lattice object and transforms it.
:param lattice: Lattice
:return:
"""
return Lattice(np.matmul(lattice.matrix, self.P)) | [
"Takes",
"a",
"Lattice",
"object",
"and",
"transforms",
"it",
".",
":",
"param",
"lattice",
":",
"Lattice",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/settings.py#L184-L191 | [
"def",
"transform_lattice",
"(",
"self",
",",
"lattice",
")",
":",
"# type: (Lattice) -> Lattice",
"return",
"Lattice",
"(",
"np",
".",
"matmul",
"(",
"lattice",
".",
"matrix",
",",
"self",
".",
"P",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _find_codopant | Finds the element from "allowed elements" that (i) possesses the desired
"oxidation state" and (ii) is closest in ionic radius to the target specie
Args:
target: (Specie) provides target ionic radius.
oxidation_state: (float) codopant oxidation state.
allowed_elements: ([str]) List of a... | pymatgen/transformations/advanced_transformations.py | def _find_codopant(target, oxidation_state, allowed_elements=None):
"""
Finds the element from "allowed elements" that (i) possesses the desired
"oxidation state" and (ii) is closest in ionic radius to the target specie
Args:
target: (Specie) provides target ionic radius.
oxidation_stat... | def _find_codopant(target, oxidation_state, allowed_elements=None):
"""
Finds the element from "allowed elements" that (i) possesses the desired
"oxidation state" and (ii) is closest in ionic radius to the target specie
Args:
target: (Specie) provides target ionic radius.
oxidation_stat... | [
"Finds",
"the",
"element",
"from",
"allowed",
"elements",
"that",
"(",
"i",
")",
"possesses",
"the",
"desired",
"oxidation",
"state",
"and",
"(",
"ii",
")",
"is",
"closest",
"in",
"ionic",
"radius",
"to",
"the",
"target",
"specie"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L854-L882 | [
"def",
"_find_codopant",
"(",
"target",
",",
"oxidation_state",
",",
"allowed_elements",
"=",
"None",
")",
":",
"ref_radius",
"=",
"target",
".",
"ionic_radius",
"candidates",
"=",
"[",
"]",
"symbols",
"=",
"allowed_elements",
"or",
"[",
"el",
".",
"symbol",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EnumerateStructureTransformation.apply_transformation | Return either a single ordered structure or a sequence of all ordered
structures.
Args:
structure: Structure to order.
return_ranked_list (bool): Whether or not multiple structures are
returned. If return_ranked_list is a number, that number of
st... | pymatgen/transformations/advanced_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
Return either a single ordered structure or a sequence of all ordered
structures.
Args:
structure: Structure to order.
return_ranked_list (bool): Whether or not multiple structures are
... | def apply_transformation(self, structure, return_ranked_list=False):
"""
Return either a single ordered structure or a sequence of all ordered
structures.
Args:
structure: Structure to order.
return_ranked_list (bool): Whether or not multiple structures are
... | [
"Return",
"either",
"a",
"single",
"ordered",
"structure",
"or",
"a",
"sequence",
"of",
"all",
"ordered",
"structures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L304-L409 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"try",
":",
"num_to_return",
"=",
"int",
"(",
"return_ranked_list",
")",
"except",
"ValueError",
":",
"num_to_return",
"=",
"1",
"if",
"self",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagOrderParameterConstraint.satisfies_constraint | Checks if a periodic site satisfies the constraint. | pymatgen/transformations/advanced_transformations.py | def satisfies_constraint(self, site):
"""
Checks if a periodic site satisfies the constraint.
"""
if not site.is_ordered:
return False
if self.species_constraints \
and str(site.specie) in self.species_constraints:
satisfies_constraints = ... | def satisfies_constraint(self, site):
"""
Checks if a periodic site satisfies the constraint.
"""
if not site.is_ordered:
return False
if self.species_constraints \
and str(site.specie) in self.species_constraints:
satisfies_constraints = ... | [
"Checks",
"if",
"a",
"periodic",
"site",
"satisfies",
"the",
"constraint",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L526-L547 | [
"def",
"satisfies_constraint",
"(",
"self",
",",
"site",
")",
":",
"if",
"not",
"site",
".",
"is_ordered",
":",
"return",
"False",
"if",
"self",
".",
"species_constraints",
"and",
"str",
"(",
"site",
".",
"specie",
")",
"in",
"self",
".",
"species_constrai... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagOrderingTransformation.determine_min_cell | Determine the smallest supercell that is able to enumerate
the provided structure with the given order parameter | pymatgen/transformations/advanced_transformations.py | def determine_min_cell(disordered_structure):
"""
Determine the smallest supercell that is able to enumerate
the provided structure with the given order parameter
"""
def lcm(n1, n2):
"""
Find least common multiple of two numbers
"""
... | def determine_min_cell(disordered_structure):
"""
Determine the smallest supercell that is able to enumerate
the provided structure with the given order parameter
"""
def lcm(n1, n2):
"""
Find least common multiple of two numbers
"""
... | [
"Determine",
"the",
"smallest",
"supercell",
"that",
"is",
"able",
"to",
"enumerate",
"the",
"provided",
"structure",
"with",
"the",
"given",
"order",
"parameter"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L597-L633 | [
"def",
"determine_min_cell",
"(",
"disordered_structure",
")",
":",
"def",
"lcm",
"(",
"n1",
",",
"n2",
")",
":",
"\"\"\"\n Find least common multiple of two numbers\n \"\"\"",
"return",
"n1",
"*",
"n2",
"/",
"gcd",
"(",
"n1",
",",
"n2",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagOrderingTransformation._add_dummy_species | :param structure: ordered Structure
:param order_parameters: list of MagOrderParameterConstraints
:return: A structure decorated with disordered
DummySpecies on which to perform the enumeration.
Note that the DummySpecies are super-imposed on
to the original sites, to make it eas... | pymatgen/transformations/advanced_transformations.py | def _add_dummy_species(structure, order_parameters):
"""
:param structure: ordered Structure
:param order_parameters: list of MagOrderParameterConstraints
:return: A structure decorated with disordered
DummySpecies on which to perform the enumeration.
Note that the DummyS... | def _add_dummy_species(structure, order_parameters):
"""
:param structure: ordered Structure
:param order_parameters: list of MagOrderParameterConstraints
:return: A structure decorated with disordered
DummySpecies on which to perform the enumeration.
Note that the DummyS... | [
":",
"param",
"structure",
":",
"ordered",
"Structure",
":",
"param",
"order_parameters",
":",
"list",
"of",
"MagOrderParameterConstraints",
":",
"return",
":",
"A",
"structure",
"decorated",
"with",
"disordered",
"DummySpecies",
"on",
"which",
"to",
"perform",
"t... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L636-L690 | [
"def",
"_add_dummy_species",
"(",
"structure",
",",
"order_parameters",
")",
":",
"dummy_struct",
"=",
"structure",
".",
"copy",
"(",
")",
"def",
"generate_dummy_specie",
"(",
")",
":",
"\"\"\"\n Generator which returns DummySpecie symbols Mma, Mmb, etc.\n ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagOrderingTransformation._remove_dummy_species | :return: Structure with dummy species removed, but
their corresponding spin properties merged with the
original sites. Used after performing enumeration. | pymatgen/transformations/advanced_transformations.py | def _remove_dummy_species(structure):
"""
:return: Structure with dummy species removed, but
their corresponding spin properties merged with the
original sites. Used after performing enumeration.
"""
if not structure.is_ordered:
raise Exception("Something went... | def _remove_dummy_species(structure):
"""
:return: Structure with dummy species removed, but
their corresponding spin properties merged with the
original sites. Used after performing enumeration.
"""
if not structure.is_ordered:
raise Exception("Something went... | [
":",
"return",
":",
"Structure",
"with",
"dummy",
"species",
"removed",
"but",
"their",
"corresponding",
"spin",
"properties",
"merged",
"with",
"the",
"original",
"sites",
".",
"Used",
"after",
"performing",
"enumeration",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L693-L727 | [
"def",
"_remove_dummy_species",
"(",
"structure",
")",
":",
"if",
"not",
"structure",
".",
"is_ordered",
":",
"raise",
"Exception",
"(",
"\"Something went wrong with enumeration.\"",
")",
"sites_to_remove",
"=",
"[",
"]",
"logger",
".",
"debug",
"(",
"'Dummy species... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagOrderingTransformation._add_spin_magnitudes | Replaces Spin.up/Spin.down with spin magnitudes specified
by mag_species_spin.
:param structure:
:return: | pymatgen/transformations/advanced_transformations.py | def _add_spin_magnitudes(self, structure):
"""
Replaces Spin.up/Spin.down with spin magnitudes specified
by mag_species_spin.
:param structure:
:return:
"""
for idx, site in enumerate(structure):
if getattr(site.specie, '_properties', None):
... | def _add_spin_magnitudes(self, structure):
"""
Replaces Spin.up/Spin.down with spin magnitudes specified
by mag_species_spin.
:param structure:
:return:
"""
for idx, site in enumerate(structure):
if getattr(site.specie, '_properties', None):
... | [
"Replaces",
"Spin",
".",
"up",
"/",
"Spin",
".",
"down",
"with",
"spin",
"magnitudes",
"specified",
"by",
"mag_species_spin",
".",
":",
"param",
"structure",
":",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L729-L755 | [
"def",
"_add_spin_magnitudes",
"(",
"self",
",",
"structure",
")",
":",
"for",
"idx",
",",
"site",
"in",
"enumerate",
"(",
"structure",
")",
":",
"if",
"getattr",
"(",
"site",
".",
"specie",
",",
"'_properties'",
",",
"None",
")",
":",
"spin",
"=",
"si... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagOrderingTransformation.apply_transformation | Apply MagOrderTransformation to an input structure.
:param structure: Any ordered structure.
:param return_ranked_list: As in other Transformations.
:return: | pymatgen/transformations/advanced_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply MagOrderTransformation to an input structure.
:param structure: Any ordered structure.
:param return_ranked_list: As in other Transformations.
:return:
"""
if not structure.is_ordered:... | def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply MagOrderTransformation to an input structure.
:param structure: Any ordered structure.
:param return_ranked_list: As in other Transformations.
:return:
"""
if not structure.is_ordered:... | [
"Apply",
"MagOrderTransformation",
"to",
"an",
"input",
"structure",
".",
":",
"param",
"structure",
":",
"Any",
"ordered",
"structure",
".",
":",
"param",
"return_ranked_list",
":",
"As",
"in",
"other",
"Transformations",
".",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L757-L837 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"if",
"not",
"structure",
".",
"is_ordered",
":",
"raise",
"ValueError",
"(",
"\"Create an ordered approximation of \"",
"\"your input structure first.\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DopingTransformation.apply_transformation | Args:
structure (Structure): Input structure to dope
Returns:
[{"structure": Structure, "energy": float}] | pymatgen/transformations/advanced_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
Args:
structure (Structure): Input structure to dope
Returns:
[{"structure": Structure, "energy": float}]
"""
comp = structure.composition
logger.info("Composition: %s" % com... | def apply_transformation(self, structure, return_ranked_list=False):
"""
Args:
structure (Structure): Input structure to dope
Returns:
[{"structure": Structure, "energy": float}]
"""
comp = structure.composition
logger.info("Composition: %s" % com... | [
"Args",
":",
"structure",
"(",
"Structure",
")",
":",
"Input",
"structure",
"to",
"dope"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L928-L1065 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"comp",
"=",
"structure",
".",
"composition",
"logger",
".",
"info",
"(",
"\"Composition: %s\"",
"%",
"comp",
")",
"for",
"sp",
"in",
"comp",
":"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DisorderOrderedTransformation.apply_transformation | Args:
structure: ordered structure
return_ranked_list: as in other pymatgen Transformations
Returns: transformed disordered structure(s) | pymatgen/transformations/advanced_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
Args:
structure: ordered structure
return_ranked_list: as in other pymatgen Transformations
Returns: transformed disordered structure(s)
"""
if not structure.is_ordered:
... | def apply_transformation(self, structure, return_ranked_list=False):
"""
Args:
structure: ordered structure
return_ranked_list: as in other pymatgen Transformations
Returns: transformed disordered structure(s)
"""
if not structure.is_ordered:
... | [
"Args",
":",
"structure",
":",
"ordered",
"structure",
"return_ranked_list",
":",
"as",
"in",
"other",
"pymatgen",
"Transformations"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L1148-L1178 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"if",
"not",
"structure",
".",
"is_ordered",
":",
"raise",
"ValueError",
"(",
"\"This transformation is for disordered structures only.\"",
")",
"partitions"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DisorderOrderedTransformation._partition_species | Private method to split a list of species into
various partitions. | pymatgen/transformations/advanced_transformations.py | def _partition_species(composition, max_components=2):
"""
Private method to split a list of species into
various partitions.
"""
def _partition(collection):
# thanks https://stackoverflow.com/a/30134039
if len(collection) == 1:
yield [co... | def _partition_species(composition, max_components=2):
"""
Private method to split a list of species into
various partitions.
"""
def _partition(collection):
# thanks https://stackoverflow.com/a/30134039
if len(collection) == 1:
yield [co... | [
"Private",
"method",
"to",
"split",
"a",
"list",
"of",
"species",
"into",
"various",
"partitions",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L1189-L1239 | [
"def",
"_partition_species",
"(",
"composition",
",",
"max_components",
"=",
"2",
")",
":",
"def",
"_partition",
"(",
"collection",
")",
":",
"# thanks https://stackoverflow.com/a/30134039",
"if",
"len",
"(",
"collection",
")",
"==",
"1",
":",
"yield",
"[",
"col... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DisorderOrderedTransformation._get_disorder_mappings | Private method to obtain the mapping to create
a disordered structure from a given partition. | pymatgen/transformations/advanced_transformations.py | def _get_disorder_mappings(composition, partitions):
"""
Private method to obtain the mapping to create
a disordered structure from a given partition.
"""
def _get_replacement_dict_from_partition(partition):
d = {} # to be passed to Structure.replace_species()
... | def _get_disorder_mappings(composition, partitions):
"""
Private method to obtain the mapping to create
a disordered structure from a given partition.
"""
def _get_replacement_dict_from_partition(partition):
d = {} # to be passed to Structure.replace_species()
... | [
"Private",
"method",
"to",
"obtain",
"the",
"mapping",
"to",
"create",
"a",
"disordered",
"structure",
"from",
"a",
"given",
"partition",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/advanced_transformations.py#L1242-L1261 | [
"def",
"_get_disorder_mappings",
"(",
"composition",
",",
"partitions",
")",
":",
"def",
"_get_replacement_dict_from_partition",
"(",
"partition",
")",
":",
"d",
"=",
"{",
"}",
"# to be passed to Structure.replace_species()",
"for",
"sp_list",
"in",
"partition",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | clean | helper to clean up an input string | pymatgen/io/abinit/helpers.py | def clean(some_string, uppercase=False):
"""
helper to clean up an input string
"""
if uppercase:
return some_string.strip().upper()
else:
return some_string.strip().lower() | def clean(some_string, uppercase=False):
"""
helper to clean up an input string
"""
if uppercase:
return some_string.strip().upper()
else:
return some_string.strip().lower() | [
"helper",
"to",
"clean",
"up",
"an",
"input",
"string"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/helpers.py#L76-L83 | [
"def",
"clean",
"(",
"some_string",
",",
"uppercase",
"=",
"False",
")",
":",
"if",
"uppercase",
":",
"return",
"some_string",
".",
"strip",
"(",
")",
".",
"upper",
"(",
")",
"else",
":",
"return",
"some_string",
".",
"strip",
"(",
")",
".",
"lower",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | read_grid_from_file | Read the results of a full set of calculations from file | pymatgen/io/abinit/helpers.py | def read_grid_from_file(filename):
"""
Read the results of a full set of calculations from file
"""
try:
f = open(filename, mode='r')
full_res = ast.literal_eval(f.read())
f.close()
except SyntaxError:
print('Problems reading ', filename)
full_res = {'grid': 0... | def read_grid_from_file(filename):
"""
Read the results of a full set of calculations from file
"""
try:
f = open(filename, mode='r')
full_res = ast.literal_eval(f.read())
f.close()
except SyntaxError:
print('Problems reading ', filename)
full_res = {'grid': 0... | [
"Read",
"the",
"results",
"of",
"a",
"full",
"set",
"of",
"calculations",
"from",
"file"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/helpers.py#L136-L149 | [
"def",
"read_grid_from_file",
"(",
"filename",
")",
":",
"try",
":",
"f",
"=",
"open",
"(",
"filename",
",",
"mode",
"=",
"'r'",
")",
"full_res",
"=",
"ast",
".",
"literal_eval",
"(",
"f",
".",
"read",
"(",
")",
")",
"f",
".",
"close",
"(",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitutor.pred_from_structures | performs a structure prediction targeting compounds containing all of
the target_species, based on a list of structure (those structures
can for instance come from a database like the ICSD). It will return
all the structures formed by ionic substitutions with a probability
higher than th... | pymatgen/analysis/structure_prediction/substitutor.py | def pred_from_structures(self, target_species, structures_list,
remove_duplicates=True, remove_existing=False):
"""
performs a structure prediction targeting compounds containing all of
the target_species, based on a list of structure (those structures
can fo... | def pred_from_structures(self, target_species, structures_list,
remove_duplicates=True, remove_existing=False):
"""
performs a structure prediction targeting compounds containing all of
the target_species, based on a list of structure (those structures
can fo... | [
"performs",
"a",
"structure",
"prediction",
"targeting",
"compounds",
"containing",
"all",
"of",
"the",
"target_species",
"based",
"on",
"a",
"list",
"of",
"structure",
"(",
"those",
"structures",
"can",
"for",
"instance",
"come",
"from",
"a",
"database",
"like"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitutor.py#L69-L161 | [
"def",
"pred_from_structures",
"(",
"self",
",",
"target_species",
",",
"structures_list",
",",
"remove_duplicates",
"=",
"True",
",",
"remove_existing",
"=",
"False",
")",
":",
"target_species",
"=",
"get_el_sp",
"(",
"target_species",
")",
"result",
"=",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitutor._is_charge_balanced | checks if the structure object is charge balanced | pymatgen/analysis/structure_prediction/substitutor.py | def _is_charge_balanced(struct):
"""
checks if the structure object is charge balanced
"""
if sum([s.specie.oxi_state for s in struct.sites]) == 0.0:
return True
else:
return False | def _is_charge_balanced(struct):
"""
checks if the structure object is charge balanced
"""
if sum([s.specie.oxi_state for s in struct.sites]) == 0.0:
return True
else:
return False | [
"checks",
"if",
"the",
"structure",
"object",
"is",
"charge",
"balanced"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitutor.py#L164-L171 | [
"def",
"_is_charge_balanced",
"(",
"struct",
")",
":",
"if",
"sum",
"(",
"[",
"s",
".",
"specie",
".",
"oxi_state",
"for",
"s",
"in",
"struct",
".",
"sites",
"]",
")",
"==",
"0.0",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitutor._is_from_chemical_system | checks if the structure object is from the given chemical system | pymatgen/analysis/structure_prediction/substitutor.py | def _is_from_chemical_system(chemical_system, struct):
"""
checks if the structure object is from the given chemical system
"""
chemsys = list(set([sp.symbol for sp in struct.composition]))
if len(chemsys) != len(chemical_system):
return False
for el in chemsy... | def _is_from_chemical_system(chemical_system, struct):
"""
checks if the structure object is from the given chemical system
"""
chemsys = list(set([sp.symbol for sp in struct.composition]))
if len(chemsys) != len(chemical_system):
return False
for el in chemsy... | [
"checks",
"if",
"the",
"structure",
"object",
"is",
"from",
"the",
"given",
"chemical",
"system"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitutor.py#L174-L184 | [
"def",
"_is_from_chemical_system",
"(",
"chemical_system",
",",
"struct",
")",
":",
"chemsys",
"=",
"list",
"(",
"set",
"(",
"[",
"sp",
".",
"symbol",
"for",
"sp",
"in",
"struct",
".",
"composition",
"]",
")",
")",
"if",
"len",
"(",
"chemsys",
")",
"!=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitutor.pred_from_list | There are an exceptionally large number of substitutions to
look at (260^n), where n is the number of species in the
list. We need a more efficient than brute force way of going
through these possibilities. The brute force method would be::
output = []
for p in itertools... | pymatgen/analysis/structure_prediction/substitutor.py | def pred_from_list(self, species_list):
"""
There are an exceptionally large number of substitutions to
look at (260^n), where n is the number of species in the
list. We need a more efficient than brute force way of going
through these possibilities. The brute force method would ... | def pred_from_list(self, species_list):
"""
There are an exceptionally large number of substitutions to
look at (260^n), where n is the number of species in the
list. We need a more efficient than brute force way of going
through these possibilities. The brute force method would ... | [
"There",
"are",
"an",
"exceptionally",
"large",
"number",
"of",
"substitutions",
"to",
"look",
"at",
"(",
"260^n",
")",
"where",
"n",
"is",
"the",
"number",
"of",
"species",
"in",
"the",
"list",
".",
"We",
"need",
"a",
"more",
"efficient",
"than",
"brute... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitutor.py#L186-L239 | [
"def",
"pred_from_list",
"(",
"self",
",",
"species_list",
")",
":",
"species_list",
"=",
"get_el_sp",
"(",
"species_list",
")",
"# calculate the highest probabilities to help us stop the recursion",
"max_probabilities",
"=",
"[",
"]",
"for",
"s2",
"in",
"species_list",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitutor.pred_from_comp | Similar to pred_from_list except this method returns a list after
checking that compositions are charge balanced. | pymatgen/analysis/structure_prediction/substitutor.py | def pred_from_comp(self, composition):
"""
Similar to pred_from_list except this method returns a list after
checking that compositions are charge balanced.
"""
output = []
predictions = self.pred_from_list(composition.elements)
for p in predictions:
s... | def pred_from_comp(self, composition):
"""
Similar to pred_from_list except this method returns a list after
checking that compositions are charge balanced.
"""
output = []
predictions = self.pred_from_list(composition.elements)
for p in predictions:
s... | [
"Similar",
"to",
"pred_from_list",
"except",
"this",
"method",
"returns",
"a",
"list",
"after",
"checking",
"that",
"compositions",
"are",
"charge",
"balanced",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitutor.py#L241-L258 | [
"def",
"pred_from_comp",
"(",
"self",
",",
"composition",
")",
":",
"output",
"=",
"[",
"]",
"predictions",
"=",
"self",
".",
"pred_from_list",
"(",
"composition",
".",
"elements",
")",
"for",
"p",
"in",
"predictions",
":",
"subs",
"=",
"p",
"[",
"'subst... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | pretty_plot | Provides a publication quality plot, with nice defaults for font sizes etc.
Args:
width (float): Width of plot in inches. Defaults to 8in.
height (float): Height of plot in inches. Defaults to width * golden
ratio.
plt (matplotlib.pyplot): If plt is supplied, changes will be mad... | pymatgen/util/plotting.py | def pretty_plot(width=8, height=None, plt=None, dpi=None,
color_cycle=("qualitative", "Set1_9")):
"""
Provides a publication quality plot, with nice defaults for font sizes etc.
Args:
width (float): Width of plot in inches. Defaults to 8in.
height (float): Height of plot in ... | def pretty_plot(width=8, height=None, plt=None, dpi=None,
color_cycle=("qualitative", "Set1_9")):
"""
Provides a publication quality plot, with nice defaults for font sizes etc.
Args:
width (float): Width of plot in inches. Defaults to 8in.
height (float): Height of plot in ... | [
"Provides",
"a",
"publication",
"quality",
"plot",
"with",
"nice",
"defaults",
"for",
"font",
"sizes",
"etc",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L24-L74 | [
"def",
"pretty_plot",
"(",
"width",
"=",
"8",
",",
"height",
"=",
"None",
",",
"plt",
"=",
"None",
",",
"dpi",
"=",
"None",
",",
"color_cycle",
"=",
"(",
"\"qualitative\"",
",",
"\"Set1_9\"",
")",
")",
":",
"ticksize",
"=",
"int",
"(",
"width",
"*",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | pretty_plot_two_axis | Variant of pretty_plot that does a dual axis plot. Adapted from matplotlib
examples. Makes it easier to create plots with different axes.
Args:
x (np.ndarray/list): Data for x-axis.
y1 (dict/np.ndarray/list): Data for y1 axis (left). If a dict, it will
be interpreted as a {label: se... | pymatgen/util/plotting.py | def pretty_plot_two_axis(x, y1, y2, xlabel=None, y1label=None, y2label=None,
width=8, height=None, dpi=300):
"""
Variant of pretty_plot that does a dual axis plot. Adapted from matplotlib
examples. Makes it easier to create plots with different axes.
Args:
x (np.ndarray... | def pretty_plot_two_axis(x, y1, y2, xlabel=None, y1label=None, y2label=None,
width=8, height=None, dpi=300):
"""
Variant of pretty_plot that does a dual axis plot. Adapted from matplotlib
examples. Makes it easier to create plots with different axes.
Args:
x (np.ndarray... | [
"Variant",
"of",
"pretty_plot",
"that",
"does",
"a",
"dual",
"axis",
"plot",
".",
"Adapted",
"from",
"matplotlib",
"examples",
".",
"Makes",
"it",
"easier",
"to",
"create",
"plots",
"with",
"different",
"axes",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L77-L154 | [
"def",
"pretty_plot_two_axis",
"(",
"x",
",",
"y1",
",",
"y2",
",",
"xlabel",
"=",
"None",
",",
"y1label",
"=",
"None",
",",
"y2label",
"=",
"None",
",",
"width",
"=",
"8",
",",
"height",
"=",
"None",
",",
"dpi",
"=",
"300",
")",
":",
"import",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | pretty_polyfit_plot | Convenience method to plot data with trend lines based on polynomial fit.
Args:
x: Sequence of x data.
y: Sequence of y data.
deg (int): Degree of polynomial. Defaults to 1.
xlabel (str): Label for x-axis.
ylabel (str): Label for y-axis.
\\*\\*kwargs: Keyword args pa... | pymatgen/util/plotting.py | def pretty_polyfit_plot(x, y, deg=1, xlabel=None, ylabel=None, **kwargs):
"""
Convenience method to plot data with trend lines based on polynomial fit.
Args:
x: Sequence of x data.
y: Sequence of y data.
deg (int): Degree of polynomial. Defaults to 1.
xlabel (str): Label for... | def pretty_polyfit_plot(x, y, deg=1, xlabel=None, ylabel=None, **kwargs):
"""
Convenience method to plot data with trend lines based on polynomial fit.
Args:
x: Sequence of x data.
y: Sequence of y data.
deg (int): Degree of polynomial. Defaults to 1.
xlabel (str): Label for... | [
"Convenience",
"method",
"to",
"plot",
"data",
"with",
"trend",
"lines",
"based",
"on",
"polynomial",
"fit",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L157-L180 | [
"def",
"pretty_polyfit_plot",
"(",
"x",
",",
"y",
",",
"deg",
"=",
"1",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
"=",
"pretty_plot",
"(",
"*",
"*",
"kwargs",
")",
"pp",
"=",
"np",
".",
"p... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | periodic_table_heatmap | A static method that generates a heat map overlapped on a periodic table.
Args:
elemental_data (dict): A dictionary with the element as a key and a
value assigned to it, e.g. surface energy and frequency, etc.
Elements missing in the elemental_data will be grey by default
... | pymatgen/util/plotting.py | def periodic_table_heatmap(elemental_data, cbar_label="",
show_plot=False, cmap="YlOrRd", blank_color="grey",
value_format=None, max_row=9):
"""
A static method that generates a heat map overlapped on a periodic table.
Args:
elemental_data (dic... | def periodic_table_heatmap(elemental_data, cbar_label="",
show_plot=False, cmap="YlOrRd", blank_color="grey",
value_format=None, max_row=9):
"""
A static method that generates a heat map overlapped on a periodic table.
Args:
elemental_data (dic... | [
"A",
"static",
"method",
"that",
"generates",
"a",
"heat",
"map",
"overlapped",
"on",
"a",
"periodic",
"table",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L183-L262 | [
"def",
"periodic_table_heatmap",
"(",
"elemental_data",
",",
"cbar_label",
"=",
"\"\"",
",",
"show_plot",
"=",
"False",
",",
"cmap",
"=",
"\"YlOrRd\"",
",",
"blank_color",
"=",
"\"grey\"",
",",
"value_format",
"=",
"None",
",",
"max_row",
"=",
"9",
")",
":",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | format_formula | Converts str of chemical formula into
latex format for labelling purposes
Args:
formula (str): Chemical formula | pymatgen/util/plotting.py | def format_formula(formula):
"""
Converts str of chemical formula into
latex format for labelling purposes
Args:
formula (str): Chemical formula
"""
formatted_formula = ""
number_format = ""
for i, s in enumerate(formula):
if s.isdigit():
if not number_forma... | def format_formula(formula):
"""
Converts str of chemical formula into
latex format for labelling purposes
Args:
formula (str): Chemical formula
"""
formatted_formula = ""
number_format = ""
for i, s in enumerate(formula):
if s.isdigit():
if not number_forma... | [
"Converts",
"str",
"of",
"chemical",
"formula",
"into",
"latex",
"format",
"for",
"labelling",
"purposes"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L265-L291 | [
"def",
"format_formula",
"(",
"formula",
")",
":",
"formatted_formula",
"=",
"\"\"",
"number_format",
"=",
"\"\"",
"for",
"i",
",",
"s",
"in",
"enumerate",
"(",
"formula",
")",
":",
"if",
"s",
".",
"isdigit",
"(",
")",
":",
"if",
"not",
"number_format",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | van_arkel_triangle | A static method that generates a binary van Arkel-Ketelaar triangle to
quantify the ionic, metallic and covalent character of a compound
by plotting the electronegativity difference (y) vs average (x).
See:
A.E. van Arkel, Molecules and Crystals in Inorganic Chemistry,
... | pymatgen/util/plotting.py | def van_arkel_triangle(list_of_materials, annotate=True):
"""
A static method that generates a binary van Arkel-Ketelaar triangle to
quantify the ionic, metallic and covalent character of a compound
by plotting the electronegativity difference (y) vs average (x).
See:
A.E. va... | def van_arkel_triangle(list_of_materials, annotate=True):
"""
A static method that generates a binary van Arkel-Ketelaar triangle to
quantify the ionic, metallic and covalent character of a compound
by plotting the electronegativity difference (y) vs average (x).
See:
A.E. va... | [
"A",
"static",
"method",
"that",
"generates",
"a",
"binary",
"van",
"Arkel",
"-",
"Ketelaar",
"triangle",
"to",
"quantify",
"the",
"ionic",
"metallic",
"and",
"covalent",
"character",
"of",
"a",
"compound",
"by",
"plotting",
"the",
"electronegativity",
"differen... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L294-L394 | [
"def",
"van_arkel_triangle",
"(",
"list_of_materials",
",",
"annotate",
"=",
"True",
")",
":",
"# F-Fr has the largest X difference. We set this",
"# as our top corner of the triangle (most ionic)",
"pt1",
"=",
"np",
".",
"array",
"(",
"[",
"(",
"Element",
"(",
"\"F\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_ax_fig_plt | Helper function used in plot functions supporting an optional Axes argument.
If ax is None, we build the `matplotlib` figure and create the Axes else
we return the current active figure.
Args:
kwargs: keyword arguments are passed to plt.figure if ax is not None.
Returns:
ax: :class:`Ax... | pymatgen/util/plotting.py | def get_ax_fig_plt(ax=None, **kwargs):
"""
Helper function used in plot functions supporting an optional Axes argument.
If ax is None, we build the `matplotlib` figure and create the Axes else
we return the current active figure.
Args:
kwargs: keyword arguments are passed to plt.figure if a... | def get_ax_fig_plt(ax=None, **kwargs):
"""
Helper function used in plot functions supporting an optional Axes argument.
If ax is None, we build the `matplotlib` figure and create the Axes else
we return the current active figure.
Args:
kwargs: keyword arguments are passed to plt.figure if a... | [
"Helper",
"function",
"used",
"in",
"plot",
"functions",
"supporting",
"an",
"optional",
"Axes",
"argument",
".",
"If",
"ax",
"is",
"None",
"we",
"build",
"the",
"matplotlib",
"figure",
"and",
"create",
"the",
"Axes",
"else",
"we",
"return",
"the",
"current"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L397-L418 | [
"def",
"get_ax_fig_plt",
"(",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"if",
"ax",
"is",
"None",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"*",
"*",
"kwargs",
")",
"ax",
"=",
"fig... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_ax3d_fig_plt | Helper function used in plot functions supporting an optional Axes3D
argument. If ax is None, we build the `matplotlib` figure and create the
Axes3D else we return the current active figure.
Args:
kwargs: keyword arguments are passed to plt.figure if ax is not None.
Returns:
ax: :class... | pymatgen/util/plotting.py | def get_ax3d_fig_plt(ax=None, **kwargs):
"""
Helper function used in plot functions supporting an optional Axes3D
argument. If ax is None, we build the `matplotlib` figure and create the
Axes3D else we return the current active figure.
Args:
kwargs: keyword arguments are passed to plt.figur... | def get_ax3d_fig_plt(ax=None, **kwargs):
"""
Helper function used in plot functions supporting an optional Axes3D
argument. If ax is None, we build the `matplotlib` figure and create the
Axes3D else we return the current active figure.
Args:
kwargs: keyword arguments are passed to plt.figur... | [
"Helper",
"function",
"used",
"in",
"plot",
"functions",
"supporting",
"an",
"optional",
"Axes3D",
"argument",
".",
"If",
"ax",
"is",
"None",
"we",
"build",
"the",
"matplotlib",
"figure",
"and",
"create",
"the",
"Axes3D",
"else",
"we",
"return",
"the",
"curr... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L421-L443 | [
"def",
"get_ax3d_fig_plt",
"(",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"from",
"mpl_toolkits",
".",
"mplot3d",
"import",
"axes3d",
"if",
"ax",
"is",
"None",
":",
"fig",
"=",
"plt",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_axarray_fig_plt | Helper function used in plot functions that accept an optional array of Axes
as argument. If ax_array is None, we build the `matplotlib` figure and
create the array of Axes by calling plt.subplots else we return the
current active figure.
Returns:
ax: Array of :class:`Axes` objects
figu... | pymatgen/util/plotting.py | def get_axarray_fig_plt(ax_array, nrows=1, ncols=1, sharex=False, sharey=False,
squeeze=True, subplot_kw=None, gridspec_kw=None,
**fig_kw):
"""
Helper function used in plot functions that accept an optional array of Axes
as argument. If ax_array is None, we bu... | def get_axarray_fig_plt(ax_array, nrows=1, ncols=1, sharex=False, sharey=False,
squeeze=True, subplot_kw=None, gridspec_kw=None,
**fig_kw):
"""
Helper function used in plot functions that accept an optional array of Axes
as argument. If ax_array is None, we bu... | [
"Helper",
"function",
"used",
"in",
"plot",
"functions",
"that",
"accept",
"an",
"optional",
"array",
"of",
"Axes",
"as",
"argument",
".",
"If",
"ax_array",
"is",
"None",
"we",
"build",
"the",
"matplotlib",
"figure",
"and",
"create",
"the",
"array",
"of",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L446-L476 | [
"def",
"get_axarray_fig_plt",
"(",
"ax_array",
",",
"nrows",
"=",
"1",
",",
"ncols",
"=",
"1",
",",
"sharex",
"=",
"False",
",",
"sharey",
"=",
"False",
",",
"squeeze",
"=",
"True",
",",
"subplot_kw",
"=",
"None",
",",
"gridspec_kw",
"=",
"None",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | add_fig_kwargs | Decorator that adds keyword arguments for functions returning matplotlib
figures.
The function should return either a matplotlib figure or None to signal
some sort of error/unexpected event.
See doc string below for the list of supported options. | pymatgen/util/plotting.py | def add_fig_kwargs(func):
"""
Decorator that adds keyword arguments for functions returning matplotlib
figures.
The function should return either a matplotlib figure or None to signal
some sort of error/unexpected event.
See doc string below for the list of supported options.
"""
from f... | def add_fig_kwargs(func):
"""
Decorator that adds keyword arguments for functions returning matplotlib
figures.
The function should return either a matplotlib figure or None to signal
some sort of error/unexpected event.
See doc string below for the list of supported options.
"""
from f... | [
"Decorator",
"that",
"adds",
"keyword",
"arguments",
"for",
"functions",
"returning",
"matplotlib",
"figures",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/plotting.py#L479-L571 | [
"def",
"add_fig_kwargs",
"(",
"func",
")",
":",
"from",
"functools",
"import",
"wraps",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pop the kwds used by the decorator.",
"title",
"=",
"kwargs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | add_densities | Method to sum two densities.
Args:
density1: First density.
density2: Second density.
Returns:
Dict of {spin: density}. | pymatgen/electronic_structure/dos.py | def add_densities(density1, density2):
"""
Method to sum two densities.
Args:
density1: First density.
density2: Second density.
Returns:
Dict of {spin: density}.
"""
return {spin: np.array(density1[spin]) + np.array(density2[spin])
for spin in density1.keys... | def add_densities(density1, density2):
"""
Method to sum two densities.
Args:
density1: First density.
density2: Second density.
Returns:
Dict of {spin: density}.
"""
return {spin: np.array(density1[spin]) + np.array(density2[spin])
for spin in density1.keys... | [
"Method",
"to",
"sum",
"two",
"densities",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L916-L928 | [
"def",
"add_densities",
"(",
"density1",
",",
"density2",
")",
":",
"return",
"{",
"spin",
":",
"np",
".",
"array",
"(",
"density1",
"[",
"spin",
"]",
")",
"+",
"np",
".",
"array",
"(",
"density2",
"[",
"spin",
"]",
")",
"for",
"spin",
"in",
"densi... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | f0 | Returns the equilibrium fermi-dirac.
Args:
E (float): energy in eV
fermi (float): the fermi level in eV
T (float): the temperature in kelvin | pymatgen/electronic_structure/dos.py | def f0(E, fermi, T):
"""
Returns the equilibrium fermi-dirac.
Args:
E (float): energy in eV
fermi (float): the fermi level in eV
T (float): the temperature in kelvin
"""
return 1. / (1. + np.exp((E - fermi) / (_cd("Boltzmann constant in eV/K") * T))) | def f0(E, fermi, T):
"""
Returns the equilibrium fermi-dirac.
Args:
E (float): energy in eV
fermi (float): the fermi level in eV
T (float): the temperature in kelvin
"""
return 1. / (1. + np.exp((E - fermi) / (_cd("Boltzmann constant in eV/K") * T))) | [
"Returns",
"the",
"equilibrium",
"fermi",
"-",
"dirac",
".",
"Args",
":",
"E",
"(",
"float",
")",
":",
"energy",
"in",
"eV",
"fermi",
"(",
"float",
")",
":",
"the",
"fermi",
"level",
"in",
"eV",
"T",
"(",
"float",
")",
":",
"the",
"temperature",
"i... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L938-L946 | [
"def",
"f0",
"(",
"E",
",",
"fermi",
",",
"T",
")",
":",
"return",
"1.",
"/",
"(",
"1.",
"+",
"np",
".",
"exp",
"(",
"(",
"E",
"-",
"fermi",
")",
"/",
"(",
"_cd",
"(",
"\"Boltzmann constant in eV/K\"",
")",
"*",
"T",
")",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _get_orb_type_lobster | Args:
orb: string representation of orbital
Returns:
OrbitalType | pymatgen/electronic_structure/dos.py | def _get_orb_type_lobster(orb):
"""
Args:
orb: string representation of orbital
Returns:
OrbitalType
"""
orb_labs = ["s", "p_y", "p_z", "p_x", "d_xy", "d_yz", "d_z^2",
"d_xz", "d_x^2-y^2", "f_y(3x^2-y^2)", "f_xyz",
"f_yz^2", "f_z^3", "f_xz^2", "f_z(x^2-y^2)"... | def _get_orb_type_lobster(orb):
"""
Args:
orb: string representation of orbital
Returns:
OrbitalType
"""
orb_labs = ["s", "p_y", "p_z", "p_x", "d_xy", "d_yz", "d_z^2",
"d_xz", "d_x^2-y^2", "f_y(3x^2-y^2)", "f_xyz",
"f_yz^2", "f_z^3", "f_xz^2", "f_z(x^2-y^2)"... | [
"Args",
":",
"orb",
":",
"string",
"representation",
"of",
"orbital",
"Returns",
":",
"OrbitalType"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L949-L964 | [
"def",
"_get_orb_type_lobster",
"(",
"orb",
")",
":",
"orb_labs",
"=",
"[",
"\"s\"",
",",
"\"p_y\"",
",",
"\"p_z\"",
",",
"\"p_x\"",
",",
"\"d_xy\"",
",",
"\"d_yz\"",
",",
"\"d_z^2\"",
",",
"\"d_xz\"",
",",
"\"d_x^2-y^2\"",
",",
"\"f_y(3x^2-y^2)\"",
",",
"\"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _get_orb_lobster | Args:
orb: string representation of orbital
Returns:
Orbital | pymatgen/electronic_structure/dos.py | def _get_orb_lobster(orb):
"""
Args:
orb: string representation of orbital
Returns:
Orbital
"""
orb_labs = ["s", "p_y", "p_z", "p_x", "d_xy", "d_yz", "d_z^2",
"d_xz", "d_x^2-y^2", "f_y(3x^2-y^2)", "f_xyz",
"f_yz^2", "f_z^3", "f_xz^2", "f_z(x^2-y^2)", ... | def _get_orb_lobster(orb):
"""
Args:
orb: string representation of orbital
Returns:
Orbital
"""
orb_labs = ["s", "p_y", "p_z", "p_x", "d_xy", "d_yz", "d_z^2",
"d_xz", "d_x^2-y^2", "f_y(3x^2-y^2)", "f_xyz",
"f_yz^2", "f_z^3", "f_xz^2", "f_z(x^2-y^2)", ... | [
"Args",
":",
"orb",
":",
"string",
"representation",
"of",
"orbital",
"Returns",
":",
"Orbital"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L967-L982 | [
"def",
"_get_orb_lobster",
"(",
"orb",
")",
":",
"orb_labs",
"=",
"[",
"\"s\"",
",",
"\"p_y\"",
",",
"\"p_z\"",
",",
"\"p_x\"",
",",
"\"d_xy\"",
",",
"\"d_yz\"",
",",
"\"d_z^2\"",
",",
"\"d_xz\"",
",",
"\"d_x^2-y^2\"",
",",
"\"f_y(3x^2-y^2)\"",
",",
"\"f_xyz... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DOS.get_interpolated_gap | Expects a DOS object and finds the gap
Args:
tol: tolerance in occupations for determining the gap
abs_tol: Set to True for an absolute tolerance and False for a
relative one.
spin: Possible values are None - finds the gap in the summed
densit... | pymatgen/electronic_structure/dos.py | def get_interpolated_gap(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the gap
Args:
tol: tolerance in occupations for determining the gap
abs_tol: Set to True for an absolute tolerance and False for a
relative one.
... | def get_interpolated_gap(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the gap
Args:
tol: tolerance in occupations for determining the gap
abs_tol: Set to True for an absolute tolerance and False for a
relative one.
... | [
"Expects",
"a",
"DOS",
"object",
"and",
"finds",
"the",
"gap"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L60-L99 | [
"def",
"get_interpolated_gap",
"(",
"self",
",",
"tol",
"=",
"0.001",
",",
"abs_tol",
"=",
"False",
",",
"spin",
"=",
"None",
")",
":",
"tdos",
"=",
"self",
".",
"y",
"if",
"len",
"(",
"self",
".",
"ydim",
")",
"==",
"1",
"else",
"np",
".",
"sum"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DOS.get_cbm_vbm | Expects a DOS object and finds the cbm and vbm.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values are None - finds the gap in the summed
densities, Up - finds the... | pymatgen/electronic_structure/dos.py | def get_cbm_vbm(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the cbm and vbm.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values ... | def get_cbm_vbm(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the cbm and vbm.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values ... | [
"Expects",
"a",
"DOS",
"object",
"and",
"finds",
"the",
"cbm",
"and",
"vbm",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L101-L141 | [
"def",
"get_cbm_vbm",
"(",
"self",
",",
"tol",
"=",
"0.001",
",",
"abs_tol",
"=",
"False",
",",
"spin",
"=",
"None",
")",
":",
"# determine tolerance",
"if",
"spin",
"is",
"None",
":",
"tdos",
"=",
"self",
".",
"y",
"if",
"len",
"(",
"self",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DOS.get_gap | Expects a DOS object and finds the gap.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values are None - finds the gap in the summed
densities, Up - finds the gap in ... | pymatgen/electronic_structure/dos.py | def get_gap(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the gap.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values are None - f... | def get_gap(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the gap.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values are None - f... | [
"Expects",
"a",
"DOS",
"object",
"and",
"finds",
"the",
"gap",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L143-L158 | [
"def",
"get_gap",
"(",
"self",
",",
"tol",
"=",
"0.001",
",",
"abs_tol",
"=",
"False",
",",
"spin",
"=",
"None",
")",
":",
"(",
"cbm",
",",
"vbm",
")",
"=",
"self",
".",
"get_cbm_vbm",
"(",
"tol",
",",
"abs_tol",
",",
"spin",
")",
"return",
"max"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dos.get_densities | Returns the density of states for a particular spin.
Args:
spin: Spin
Returns:
Returns the density of states for a particular spin. If Spin is
None, the sum of all spins is returned. | pymatgen/electronic_structure/dos.py | def get_densities(self, spin=None):
"""
Returns the density of states for a particular spin.
Args:
spin: Spin
Returns:
Returns the density of states for a particular spin. If Spin is
None, the sum of all spins is returned.
"""
if self... | def get_densities(self, spin=None):
"""
Returns the density of states for a particular spin.
Args:
spin: Spin
Returns:
Returns the density of states for a particular spin. If Spin is
None, the sum of all spins is returned.
"""
if self... | [
"Returns",
"the",
"density",
"of",
"states",
"for",
"a",
"particular",
"spin",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L209-L229 | [
"def",
"get_densities",
"(",
"self",
",",
"spin",
"=",
"None",
")",
":",
"if",
"self",
".",
"densities",
"is",
"None",
":",
"result",
"=",
"None",
"elif",
"spin",
"is",
"None",
":",
"if",
"Spin",
".",
"down",
"in",
"self",
".",
"densities",
":",
"r... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dos.get_smeared_densities | Returns the Dict representation of the densities, {Spin: densities},
but with a Gaussian smearing of std dev sigma applied about the fermi
level.
Args:
sigma: Std dev of Gaussian smearing function.
Returns:
Dict of Gaussian-smeared densities. | pymatgen/electronic_structure/dos.py | def get_smeared_densities(self, sigma):
"""
Returns the Dict representation of the densities, {Spin: densities},
but with a Gaussian smearing of std dev sigma applied about the fermi
level.
Args:
sigma: Std dev of Gaussian smearing function.
Returns:
... | def get_smeared_densities(self, sigma):
"""
Returns the Dict representation of the densities, {Spin: densities},
but with a Gaussian smearing of std dev sigma applied about the fermi
level.
Args:
sigma: Std dev of Gaussian smearing function.
Returns:
... | [
"Returns",
"the",
"Dict",
"representation",
"of",
"the",
"densities",
"{",
"Spin",
":",
"densities",
"}",
"but",
"with",
"a",
"Gaussian",
"smearing",
"of",
"std",
"dev",
"sigma",
"applied",
"about",
"the",
"fermi",
"level",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L231-L250 | [
"def",
"get_smeared_densities",
"(",
"self",
",",
"sigma",
")",
":",
"from",
"scipy",
".",
"ndimage",
".",
"filters",
"import",
"gaussian_filter1d",
"smeared_dens",
"=",
"{",
"}",
"diff",
"=",
"[",
"self",
".",
"energies",
"[",
"i",
"+",
"1",
"]",
"-",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dos.get_interpolated_value | Returns interpolated density for a particular energy.
Args:
energy: Energy to return the density for. | pymatgen/electronic_structure/dos.py | def get_interpolated_value(self, energy):
"""
Returns interpolated density for a particular energy.
Args:
energy: Energy to return the density for.
"""
f = {}
for spin in self.densities.keys():
f[spin] = get_linear_interpolated_value(self.energies... | def get_interpolated_value(self, energy):
"""
Returns interpolated density for a particular energy.
Args:
energy: Energy to return the density for.
"""
f = {}
for spin in self.densities.keys():
f[spin] = get_linear_interpolated_value(self.energies... | [
"Returns",
"interpolated",
"density",
"for",
"a",
"particular",
"energy",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L269-L281 | [
"def",
"get_interpolated_value",
"(",
"self",
",",
"energy",
")",
":",
"f",
"=",
"{",
"}",
"for",
"spin",
"in",
"self",
".",
"densities",
".",
"keys",
"(",
")",
":",
"f",
"[",
"spin",
"]",
"=",
"get_linear_interpolated_value",
"(",
"self",
".",
"energi... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dos.get_cbm_vbm | Expects a DOS object and finds the cbm and vbm.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values are None - finds the gap in the summed
densities, Up - finds the... | pymatgen/electronic_structure/dos.py | def get_cbm_vbm(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the cbm and vbm.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values ... | def get_cbm_vbm(self, tol=0.001, abs_tol=False, spin=None):
"""
Expects a DOS object and finds the cbm and vbm.
Args:
tol: tolerance in occupations for determining the gap
abs_tol: An absolute tolerance (True) and a relative one (False)
spin: Possible values ... | [
"Expects",
"a",
"DOS",
"object",
"and",
"finds",
"the",
"cbm",
"and",
"vbm",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L324-L358 | [
"def",
"get_cbm_vbm",
"(",
"self",
",",
"tol",
"=",
"0.001",
",",
"abs_tol",
"=",
"False",
",",
"spin",
"=",
"None",
")",
":",
"# determine tolerance",
"tdos",
"=",
"self",
".",
"get_densities",
"(",
"spin",
")",
"if",
"not",
"abs_tol",
":",
"tol",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dos.from_dict | Returns Dos object from dict representation of Dos. | pymatgen/electronic_structure/dos.py | def from_dict(cls, d):
"""
Returns Dos object from dict representation of Dos.
"""
return Dos(d["efermi"], d["energies"],
{Spin(int(k)): v
for k, v in d["densities"].items()}) | def from_dict(cls, d):
"""
Returns Dos object from dict representation of Dos.
"""
return Dos(d["efermi"], d["energies"],
{Spin(int(k)): v
for k, v in d["densities"].items()}) | [
"Returns",
"Dos",
"object",
"from",
"dict",
"representation",
"of",
"Dos",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L397-L403 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"return",
"Dos",
"(",
"d",
"[",
"\"efermi\"",
"]",
",",
"d",
"[",
"\"energies\"",
"]",
",",
"{",
"Spin",
"(",
"int",
"(",
"k",
")",
")",
":",
"v",
"for",
"k",
",",
"v",
"in",
"d",
"[",
"\"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dos.as_dict | Json-serializable dict representation of Dos. | pymatgen/electronic_structure/dos.py | def as_dict(self):
"""
Json-serializable dict representation of Dos.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__, "efermi": self.efermi,
"energies": list(self.energies),
"densities": {str(spin): list(... | def as_dict(self):
"""
Json-serializable dict representation of Dos.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__, "efermi": self.efermi,
"energies": list(self.energies),
"densities": {str(spin): list(... | [
"Json",
"-",
"serializable",
"dict",
"representation",
"of",
"Dos",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L405-L413 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"efermi\"",
":",
"self",
".",
"efermi",
",",
"\"energies\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FermiDos.get_doping | Calculate the doping (majority carrier concentration) at a given fermi
level and temperature. A simple Left Riemann sum is used for integrating
the density of states over energy & equilibrium Fermi-Dirac distribution
Args:
fermi (float): the fermi level in eV
T (float): ... | pymatgen/electronic_structure/dos.py | def get_doping(self, fermi, T):
"""
Calculate the doping (majority carrier concentration) at a given fermi
level and temperature. A simple Left Riemann sum is used for integrating
the density of states over energy & equilibrium Fermi-Dirac distribution
Args:
fermi (f... | def get_doping(self, fermi, T):
"""
Calculate the doping (majority carrier concentration) at a given fermi
level and temperature. A simple Left Riemann sum is used for integrating
the density of states over energy & equilibrium Fermi-Dirac distribution
Args:
fermi (f... | [
"Calculate",
"the",
"doping",
"(",
"majority",
"carrier",
"concentration",
")",
"at",
"a",
"given",
"fermi",
"level",
"and",
"temperature",
".",
"A",
"simple",
"Left",
"Riemann",
"sum",
"is",
"used",
"for",
"integrating",
"the",
"density",
"of",
"states",
"o... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L465-L484 | [
"def",
"get_doping",
"(",
"self",
",",
"fermi",
",",
"T",
")",
":",
"cb_integral",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"tdos",
"[",
"self",
".",
"idx_cbm",
":",
"]",
"*",
"f0",
"(",
"self",
".",
"energies",
"[",
"self",
".",
"idx_cbm",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FermiDos.get_fermi_interextrapolated | Similar to get_fermi except that when get_fermi fails to converge,
an interpolated or extrapolated fermi (depending on c) is returned with
the assumption that the fermi level changes linearly with log(abs(c)).
Args:
c (float): doping concentration in 1/cm3. c<0 represents n-type
... | pymatgen/electronic_structure/dos.py | def get_fermi_interextrapolated(self, c, T, warn=True, c_ref=1e10, **kwargs):
"""
Similar to get_fermi except that when get_fermi fails to converge,
an interpolated or extrapolated fermi (depending on c) is returned with
the assumption that the fermi level changes linearly with log(abs(c... | def get_fermi_interextrapolated(self, c, T, warn=True, c_ref=1e10, **kwargs):
"""
Similar to get_fermi except that when get_fermi fails to converge,
an interpolated or extrapolated fermi (depending on c) is returned with
the assumption that the fermi level changes linearly with log(abs(c... | [
"Similar",
"to",
"get_fermi",
"except",
"that",
"when",
"get_fermi",
"fails",
"to",
"converge",
"an",
"interpolated",
"or",
"extrapolated",
"fermi",
"(",
"depending",
"on",
"c",
")",
"is",
"returned",
"with",
"the",
"assumption",
"that",
"the",
"fermi",
"level... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/dos.py#L486-L526 | [
"def",
"get_fermi_interextrapolated",
"(",
"self",
",",
"c",
",",
"T",
",",
"warn",
"=",
"True",
",",
"c_ref",
"=",
"1e10",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"self",
".",
"get_fermi",
"(",
"c",
",",
"T",
",",
"*",
"*",
"kwa... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.