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 | get_recp_symmetry_operation | Find the symmetric operations of the reciprocal lattice,
to be used for hkl transformations
Args:
structure (Structure): conventional unit cell
symprec: default is 0.001 | pymatgen/core/surface.py | def get_recp_symmetry_operation(structure, symprec=0.01):
"""
Find the symmetric operations of the reciprocal lattice,
to be used for hkl transformations
Args:
structure (Structure): conventional unit cell
symprec: default is 0.001
"""
recp_lattice = structure.lattice.reciprocal... | def get_recp_symmetry_operation(structure, symprec=0.01):
"""
Find the symmetric operations of the reciprocal lattice,
to be used for hkl transformations
Args:
structure (Structure): conventional unit cell
symprec: default is 0.001
"""
recp_lattice = structure.lattice.reciprocal... | [
"Find",
"the",
"symmetric",
"operations",
"of",
"the",
"reciprocal",
"lattice",
"to",
"be",
"used",
"for",
"hkl",
"transformations",
"Args",
":",
"structure",
"(",
"Structure",
")",
":",
"conventional",
"unit",
"cell",
"symprec",
":",
"default",
"is",
"0",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1538-L1558 | [
"def",
"get_recp_symmetry_operation",
"(",
"structure",
",",
"symprec",
"=",
"0.01",
")",
":",
"recp_lattice",
"=",
"structure",
".",
"lattice",
".",
"reciprocal_lattice_crystallographic",
"# get symmetry operations from input conventional unit cell",
"# Need to make sure recp la... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_symmetrically_distinct_miller_indices | Returns all symmetrically distinct indices below a certain max-index for
a given structure. Analysis is based on the symmetry of the reciprocal
lattice of the structure.
Args:
structure (Structure): input structure.
max_index (int): The maximum index. For example, a max_index of 1
... | pymatgen/core/surface.py | def get_symmetrically_distinct_miller_indices(structure, max_index):
"""
Returns all symmetrically distinct indices below a certain max-index for
a given structure. Analysis is based on the symmetry of the reciprocal
lattice of the structure.
Args:
structure (Structure): input structure.
... | def get_symmetrically_distinct_miller_indices(structure, max_index):
"""
Returns all symmetrically distinct indices below a certain max-index for
a given structure. Analysis is based on the symmetry of the reciprocal
lattice of the structure.
Args:
structure (Structure): input structure.
... | [
"Returns",
"all",
"symmetrically",
"distinct",
"indices",
"below",
"a",
"certain",
"max",
"-",
"index",
"for",
"a",
"given",
"structure",
".",
"Analysis",
"is",
"based",
"on",
"the",
"symmetry",
"of",
"the",
"reciprocal",
"lattice",
"of",
"the",
"structure",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1561-L1614 | [
"def",
"get_symmetrically_distinct_miller_indices",
"(",
"structure",
",",
"max_index",
")",
":",
"r",
"=",
"list",
"(",
"range",
"(",
"-",
"max_index",
",",
"max_index",
"+",
"1",
")",
")",
"r",
".",
"reverse",
"(",
")",
"# First we get a list of all hkls for c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | hkl_transformation | Returns the Miller index from setting
A to B using a transformation matrix
Args:
transf (3x3 array): The transformation matrix
that transforms a lattice of A to B
miller_index ([h, k, l]): Miller index to transform to setting B | pymatgen/core/surface.py | def hkl_transformation(transf, miller_index):
"""
Returns the Miller index from setting
A to B using a transformation matrix
Args:
transf (3x3 array): The transformation matrix
that transforms a lattice of A to B
miller_index ([h, k, l]): Miller index to transform to setting ... | def hkl_transformation(transf, miller_index):
"""
Returns the Miller index from setting
A to B using a transformation matrix
Args:
transf (3x3 array): The transformation matrix
that transforms a lattice of A to B
miller_index ([h, k, l]): Miller index to transform to setting ... | [
"Returns",
"the",
"Miller",
"index",
"from",
"setting",
"A",
"to",
"B",
"using",
"a",
"transformation",
"matrix",
"Args",
":",
"transf",
"(",
"3x3",
"array",
")",
":",
"The",
"transformation",
"matrix",
"that",
"transforms",
"a",
"lattice",
"of",
"A",
"to"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1617-L1640 | [
"def",
"hkl_transformation",
"(",
"transf",
",",
"miller_index",
")",
":",
"# Get a matrix of whole numbers (ints)",
"lcm",
"=",
"lambda",
"a",
",",
"b",
":",
"a",
"*",
"b",
"//",
"math",
".",
"gcd",
"(",
"a",
",",
"b",
")",
"reduced_transf",
"=",
"reduce"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | generate_all_slabs | A function that finds all different slabs up to a certain miller index.
Slabs oriented under certain Miller indices that are equivalent to other
slabs in other Miller indices are filtered out using symmetry operations
to get rid of any repetitive slabs. For example, under symmetry operations,
CsCl has e... | pymatgen/core/surface.py | def generate_all_slabs(structure, max_index, min_slab_size, min_vacuum_size,
bonds=None, tol=1e-3, max_broken_bonds=0,
lll_reduce=False, center_slab=False, primitive=True,
max_normal_search=None, symmetrize=False, repair=False,
... | def generate_all_slabs(structure, max_index, min_slab_size, min_vacuum_size,
bonds=None, tol=1e-3, max_broken_bonds=0,
lll_reduce=False, center_slab=False, primitive=True,
max_normal_search=None, symmetrize=False, repair=False,
... | [
"A",
"function",
"that",
"finds",
"all",
"different",
"slabs",
"up",
"to",
"a",
"certain",
"miller",
"index",
".",
"Slabs",
"oriented",
"under",
"certain",
"Miller",
"indices",
"that",
"are",
"equivalent",
"to",
"other",
"slabs",
"in",
"other",
"Miller",
"in... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1643-L1735 | [
"def",
"generate_all_slabs",
"(",
"structure",
",",
"max_index",
",",
"min_slab_size",
",",
"min_vacuum_size",
",",
"bonds",
"=",
"None",
",",
"tol",
"=",
"1e-3",
",",
"max_broken_bonds",
"=",
"0",
",",
"lll_reduce",
"=",
"False",
",",
"center_slab",
"=",
"F... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_slab_regions | Function to get the ranges of the slab regions. Useful for discerning where
the slab ends and vacuum begins if the slab is not fully within the cell
Args:
slab (Structure): Structure object modelling the surface
blength (float, Ang): The bondlength between atoms. You generally
want t... | pymatgen/core/surface.py | def get_slab_regions(slab, blength=3.5):
"""
Function to get the ranges of the slab regions. Useful for discerning where
the slab ends and vacuum begins if the slab is not fully within the cell
Args:
slab (Structure): Structure object modelling the surface
blength (float, Ang): The bondl... | def get_slab_regions(slab, blength=3.5):
"""
Function to get the ranges of the slab regions. Useful for discerning where
the slab ends and vacuum begins if the slab is not fully within the cell
Args:
slab (Structure): Structure object modelling the surface
blength (float, Ang): The bondl... | [
"Function",
"to",
"get",
"the",
"ranges",
"of",
"the",
"slab",
"regions",
".",
"Useful",
"for",
"discerning",
"where",
"the",
"slab",
"ends",
"and",
"vacuum",
"begins",
"if",
"the",
"slab",
"is",
"not",
"fully",
"within",
"the",
"cell",
"Args",
":",
"sla... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1738-L1798 | [
"def",
"get_slab_regions",
"(",
"slab",
",",
"blength",
"=",
"3.5",
")",
":",
"fcoords",
",",
"indices",
",",
"all_indices",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"for",
"site",
"in",
"slab",
":",
"# find sites with c < 0 (noncontiguous)",
"neighbor... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | miller_index_from_sites | Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 sets of coordinates are required. If more than 3 sets of
coordinates are given, the best plane that minimises the distance to all
points will be calculated.
Args:
lattice (list or Lattice): A 3x3 lattice matrix or ... | pymatgen/core/surface.py | def miller_index_from_sites(lattice, coords, coords_are_cartesian=True,
round_dp=4, verbose=True):
"""
Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 sets of coordinates are required. If more than 3 sets of
coordinates are given, the best pla... | def miller_index_from_sites(lattice, coords, coords_are_cartesian=True,
round_dp=4, verbose=True):
"""
Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 sets of coordinates are required. If more than 3 sets of
coordinates are given, the best pla... | [
"Get",
"the",
"Miller",
"index",
"of",
"a",
"plane",
"from",
"a",
"list",
"of",
"site",
"coordinates",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1801-L1831 | [
"def",
"miller_index_from_sites",
"(",
"lattice",
",",
"coords",
",",
"coords_are_cartesian",
"=",
"True",
",",
"round_dp",
"=",
"4",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"lattice",
",",
"Lattice",
")",
":",
"lattice",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | center_slab | The goal here is to ensure the center of the slab region
is centered close to c=0.5. This makes it easier to
find the surface sites and apply operations like doping.
There are three cases where the slab in not centered:
1. The slab region is completely between two vacuums in the
box but... | pymatgen/core/surface.py | def center_slab(slab):
"""
The goal here is to ensure the center of the slab region
is centered close to c=0.5. This makes it easier to
find the surface sites and apply operations like doping.
There are three cases where the slab in not centered:
1. The slab region is completely between... | def center_slab(slab):
"""
The goal here is to ensure the center of the slab region
is centered close to c=0.5. This makes it easier to
find the surface sites and apply operations like doping.
There are three cases where the slab in not centered:
1. The slab region is completely between... | [
"The",
"goal",
"here",
"is",
"to",
"ensure",
"the",
"center",
"of",
"the",
"slab",
"region",
"is",
"centered",
"close",
"to",
"c",
"=",
"0",
".",
"5",
".",
"This",
"makes",
"it",
"easier",
"to",
"find",
"the",
"surface",
"sites",
"and",
"apply",
"ope... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1834-L1880 | [
"def",
"center_slab",
"(",
"slab",
")",
":",
"# get a reasonable r cutoff to sample neighbors",
"bdists",
"=",
"sorted",
"(",
"[",
"nn",
"[",
"1",
"]",
"for",
"nn",
"in",
"slab",
".",
"get_neighbors",
"(",
"slab",
"[",
"0",
"]",
",",
"10",
")",
"if",
"nn... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.get_orthogonal_c_slab | This method returns a Slab where the normal (c lattice vector) is
"forced" to be exactly orthogonal to the surface a and b lattice
vectors. **Note that this breaks inherent symmetries in the slab.**
It should be pointed out that orthogonality is not required to get good
surface energies,... | pymatgen/core/surface.py | def get_orthogonal_c_slab(self):
"""
This method returns a Slab where the normal (c lattice vector) is
"forced" to be exactly orthogonal to the surface a and b lattice
vectors. **Note that this breaks inherent symmetries in the slab.**
It should be pointed out that orthogonality ... | def get_orthogonal_c_slab(self):
"""
This method returns a Slab where the normal (c lattice vector) is
"forced" to be exactly orthogonal to the surface a and b lattice
vectors. **Note that this breaks inherent symmetries in the slab.**
It should be pointed out that orthogonality ... | [
"This",
"method",
"returns",
"a",
"Slab",
"where",
"the",
"normal",
"(",
"c",
"lattice",
"vector",
")",
"is",
"forced",
"to",
"be",
"exactly",
"orthogonal",
"to",
"the",
"surface",
"a",
"and",
"b",
"lattice",
"vectors",
".",
"**",
"Note",
"that",
"this",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L153-L174 | [
"def",
"get_orthogonal_c_slab",
"(",
"self",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"self",
".",
"lattice",
".",
"matrix",
"new_c",
"=",
"np",
".",
"cross",
"(",
"a",
",",
"b",
")",
"new_c",
"/=",
"np",
".",
"linalg",
".",
"norm",
"(",
"new_c",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.get_tasker2_slabs | Get a list of slabs that have been Tasker 2 corrected.
Args:
tol (float): Tolerance to determine if atoms are within same plane.
This is a fractional tolerance, not an absolute one.
same_species_only (bool): If True, only that are of the exact same
specie... | pymatgen/core/surface.py | def get_tasker2_slabs(self, tol=0.01, same_species_only=True):
"""
Get a list of slabs that have been Tasker 2 corrected.
Args:
tol (float): Tolerance to determine if atoms are within same plane.
This is a fractional tolerance, not an absolute one.
same_s... | def get_tasker2_slabs(self, tol=0.01, same_species_only=True):
"""
Get a list of slabs that have been Tasker 2 corrected.
Args:
tol (float): Tolerance to determine if atoms are within same plane.
This is a fractional tolerance, not an absolute one.
same_s... | [
"Get",
"a",
"list",
"of",
"slabs",
"that",
"have",
"been",
"Tasker",
"2",
"corrected",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L176-L268 | [
"def",
"get_tasker2_slabs",
"(",
"self",
",",
"tol",
"=",
"0.01",
",",
"same_species_only",
"=",
"True",
")",
":",
"sites",
"=",
"list",
"(",
"self",
".",
"sites",
")",
"slabs",
"=",
"[",
"]",
"sortedcsites",
"=",
"sorted",
"(",
"sites",
",",
"key",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.is_symmetric | Checks if slab is symmetric, i.e., contains inversion symmetry.
Args:
symprec (float): Symmetry precision used for SpaceGroup analyzer.
Returns:
(bool) Whether slab contains inversion symmetry. | pymatgen/core/surface.py | def is_symmetric(self, symprec=0.1):
"""
Checks if slab is symmetric, i.e., contains inversion symmetry.
Args:
symprec (float): Symmetry precision used for SpaceGroup analyzer.
Returns:
(bool) Whether slab contains inversion symmetry.
"""
sg = S... | def is_symmetric(self, symprec=0.1):
"""
Checks if slab is symmetric, i.e., contains inversion symmetry.
Args:
symprec (float): Symmetry precision used for SpaceGroup analyzer.
Returns:
(bool) Whether slab contains inversion symmetry.
"""
sg = S... | [
"Checks",
"if",
"slab",
"is",
"symmetric",
"i",
".",
"e",
".",
"contains",
"inversion",
"symmetry",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L270-L282 | [
"def",
"is_symmetric",
"(",
"self",
",",
"symprec",
"=",
"0.1",
")",
":",
"sg",
"=",
"SpacegroupAnalyzer",
"(",
"self",
",",
"symprec",
"=",
"symprec",
")",
"return",
"sg",
".",
"is_laue",
"(",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.get_sorted_structure | Get a sorted copy of the structure. The parameters have the same
meaning as in list.sort. By default, sites are sorted by the
electronegativity of the species. Note that Slab has to override this
because of the different __init__ args.
Args:
key: Specifies a function of one ... | pymatgen/core/surface.py | def get_sorted_structure(self, key=None, reverse=False):
"""
Get a sorted copy of the structure. The parameters have the same
meaning as in list.sort. By default, sites are sorted by the
electronegativity of the species. Note that Slab has to override this
because of the differen... | def get_sorted_structure(self, key=None, reverse=False):
"""
Get a sorted copy of the structure. The parameters have the same
meaning as in list.sort. By default, sites are sorted by the
electronegativity of the species. Note that Slab has to override this
because of the differen... | [
"Get",
"a",
"sorted",
"copy",
"of",
"the",
"structure",
".",
"The",
"parameters",
"have",
"the",
"same",
"meaning",
"as",
"in",
"list",
".",
"sort",
".",
"By",
"default",
"sites",
"are",
"sorted",
"by",
"the",
"electronegativity",
"of",
"the",
"species",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L284-L303 | [
"def",
"get_sorted_structure",
"(",
"self",
",",
"key",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"sites",
"=",
"sorted",
"(",
"self",
",",
"key",
"=",
"key",
",",
"reverse",
"=",
"reverse",
")",
"s",
"=",
"Structure",
".",
"from_sites",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.copy | Convenience method to get a copy of the structure, with options to add
site properties.
Args:
site_properties (dict): Properties to add or override. The
properties are specified in the same way as the constructor,
i.e., as a dict of the form {property: [value... | pymatgen/core/surface.py | def copy(self, site_properties=None, sanitize=False):
"""
Convenience method to get a copy of the structure, with options to add
site properties.
Args:
site_properties (dict): Properties to add or override. The
properties are specified in the same way as the ... | def copy(self, site_properties=None, sanitize=False):
"""
Convenience method to get a copy of the structure, with options to add
site properties.
Args:
site_properties (dict): Properties to add or override. The
properties are specified in the same way as the ... | [
"Convenience",
"method",
"to",
"get",
"a",
"copy",
"of",
"the",
"structure",
"with",
"options",
"to",
"add",
"site",
"properties",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L305-L333 | [
"def",
"copy",
"(",
"self",
",",
"site_properties",
"=",
"None",
",",
"sanitize",
"=",
"False",
")",
":",
"props",
"=",
"self",
".",
"site_properties",
"if",
"site_properties",
":",
"props",
".",
"update",
"(",
"site_properties",
")",
"return",
"Slab",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.dipole | Calculates the dipole of the Slab in the direction of the surface
normal. Note that the Slab must be oxidation state-decorated for this
to work properly. Otherwise, the Slab will always have a dipole of 0. | pymatgen/core/surface.py | def dipole(self):
"""
Calculates the dipole of the Slab in the direction of the surface
normal. Note that the Slab must be oxidation state-decorated for this
to work properly. Otherwise, the Slab will always have a dipole of 0.
"""
dipole = np.zeros(3)
mid_pt = np... | def dipole(self):
"""
Calculates the dipole of the Slab in the direction of the surface
normal. Note that the Slab must be oxidation state-decorated for this
to work properly. Otherwise, the Slab will always have a dipole of 0.
"""
dipole = np.zeros(3)
mid_pt = np... | [
"Calculates",
"the",
"dipole",
"of",
"the",
"Slab",
"in",
"the",
"direction",
"of",
"the",
"surface",
"normal",
".",
"Note",
"that",
"the",
"Slab",
"must",
"be",
"oxidation",
"state",
"-",
"decorated",
"for",
"this",
"to",
"work",
"properly",
".",
"Otherwi... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L336-L349 | [
"def",
"dipole",
"(",
"self",
")",
":",
"dipole",
"=",
"np",
".",
"zeros",
"(",
"3",
")",
"mid_pt",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"cart_coords",
",",
"axis",
"=",
"0",
")",
"/",
"len",
"(",
"self",
")",
"normal",
"=",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.is_polar | Checks whether the surface is polar by computing the dipole per unit
area. Note that the Slab must be oxidation state-decorated for this
to work properly. Otherwise, the Slab will always be non-polar.
Args:
tol_dipole_per_unit_area (float): A tolerance. If the dipole
... | pymatgen/core/surface.py | def is_polar(self, tol_dipole_per_unit_area=1e-3):
"""
Checks whether the surface is polar by computing the dipole per unit
area. Note that the Slab must be oxidation state-decorated for this
to work properly. Otherwise, the Slab will always be non-polar.
Args:
tol_d... | def is_polar(self, tol_dipole_per_unit_area=1e-3):
"""
Checks whether the surface is polar by computing the dipole per unit
area. Note that the Slab must be oxidation state-decorated for this
to work properly. Otherwise, the Slab will always be non-polar.
Args:
tol_d... | [
"Checks",
"whether",
"the",
"surface",
"is",
"polar",
"by",
"computing",
"the",
"dipole",
"per",
"unit",
"area",
".",
"Note",
"that",
"the",
"Slab",
"must",
"be",
"oxidation",
"state",
"-",
"decorated",
"for",
"this",
"to",
"work",
"properly",
".",
"Otherw... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L351-L366 | [
"def",
"is_polar",
"(",
"self",
",",
"tol_dipole_per_unit_area",
"=",
"1e-3",
")",
":",
"dip_per_unit_area",
"=",
"self",
".",
"dipole",
"/",
"self",
".",
"surface_area",
"return",
"np",
".",
"linalg",
".",
"norm",
"(",
"dip_per_unit_area",
")",
">",
"tol_di... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.normal | Calculates the surface normal vector of the slab | pymatgen/core/surface.py | def normal(self):
"""
Calculates the surface normal vector of the slab
"""
normal = np.cross(self.lattice.matrix[0], self.lattice.matrix[1])
normal /= np.linalg.norm(normal)
return normal | def normal(self):
"""
Calculates the surface normal vector of the slab
"""
normal = np.cross(self.lattice.matrix[0], self.lattice.matrix[1])
normal /= np.linalg.norm(normal)
return normal | [
"Calculates",
"the",
"surface",
"normal",
"vector",
"of",
"the",
"slab"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L369-L375 | [
"def",
"normal",
"(",
"self",
")",
":",
"normal",
"=",
"np",
".",
"cross",
"(",
"self",
".",
"lattice",
".",
"matrix",
"[",
"0",
"]",
",",
"self",
".",
"lattice",
".",
"matrix",
"[",
"1",
"]",
")",
"normal",
"/=",
"np",
".",
"linalg",
".",
"nor... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.surface_area | Calculates the surface area of the slab | pymatgen/core/surface.py | def surface_area(self):
"""
Calculates the surface area of the slab
"""
m = self.lattice.matrix
return np.linalg.norm(np.cross(m[0], m[1])) | def surface_area(self):
"""
Calculates the surface area of the slab
"""
m = self.lattice.matrix
return np.linalg.norm(np.cross(m[0], m[1])) | [
"Calculates",
"the",
"surface",
"area",
"of",
"the",
"slab"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L378-L383 | [
"def",
"surface_area",
"(",
"self",
")",
":",
"m",
"=",
"self",
".",
"lattice",
".",
"matrix",
"return",
"np",
".",
"linalg",
".",
"norm",
"(",
"np",
".",
"cross",
"(",
"m",
"[",
"0",
"]",
",",
"m",
"[",
"1",
"]",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.center_of_mass | Calculates the center of mass of the slab | pymatgen/core/surface.py | def center_of_mass(self):
"""
Calculates the center of mass of the slab
"""
weights = [s.species.weight for s in self]
center_of_mass = np.average(self.frac_coords,
weights=weights, axis=0)
return center_of_mass | def center_of_mass(self):
"""
Calculates the center of mass of the slab
"""
weights = [s.species.weight for s in self]
center_of_mass = np.average(self.frac_coords,
weights=weights, axis=0)
return center_of_mass | [
"Calculates",
"the",
"center",
"of",
"mass",
"of",
"the",
"slab"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L386-L393 | [
"def",
"center_of_mass",
"(",
"self",
")",
":",
"weights",
"=",
"[",
"s",
".",
"species",
".",
"weight",
"for",
"s",
"in",
"self",
"]",
"center_of_mass",
"=",
"np",
".",
"average",
"(",
"self",
".",
"frac_coords",
",",
"weights",
"=",
"weights",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.add_adsorbate_atom | Gets the structure of single atom adsorption.
slab structure from the Slab class(in [0, 0, 1])
Args:
indices ([int]): Indices of sites on which to put the absorbate.
Absorbed atom will be displaced relative to the center of
these sites.
specie (Sp... | pymatgen/core/surface.py | def add_adsorbate_atom(self, indices, specie, distance):
"""
Gets the structure of single atom adsorption.
slab structure from the Slab class(in [0, 0, 1])
Args:
indices ([int]): Indices of sites on which to put the absorbate.
Absorbed atom will be displaced ... | def add_adsorbate_atom(self, indices, specie, distance):
"""
Gets the structure of single atom adsorption.
slab structure from the Slab class(in [0, 0, 1])
Args:
indices ([int]): Indices of sites on which to put the absorbate.
Absorbed atom will be displaced ... | [
"Gets",
"the",
"structure",
"of",
"single",
"atom",
"adsorption",
".",
"slab",
"structure",
"from",
"the",
"Slab",
"class",
"(",
"in",
"[",
"0",
"0",
"1",
"]",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L395-L414 | [
"def",
"add_adsorbate_atom",
"(",
"self",
",",
"indices",
",",
"specie",
",",
"distance",
")",
":",
"# Let's do the work in cartesian coords",
"center",
"=",
"np",
".",
"sum",
"(",
"[",
"self",
"[",
"i",
"]",
".",
"coords",
"for",
"i",
"in",
"indices",
"]"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.get_surface_sites | Returns the surface sites and their indices in a dictionary. The
oriented unit cell of the slab will determine the coordination number
of a typical site. We use VoronoiNN to determine the
coordination number of bulk sites and slab sites. Due to the
pathological error resulting from some ... | pymatgen/core/surface.py | def get_surface_sites(self, tag=False):
"""
Returns the surface sites and their indices in a dictionary. The
oriented unit cell of the slab will determine the coordination number
of a typical site. We use VoronoiNN to determine the
coordination number of bulk sites and slab sites... | def get_surface_sites(self, tag=False):
"""
Returns the surface sites and their indices in a dictionary. The
oriented unit cell of the slab will determine the coordination number
of a typical site. We use VoronoiNN to determine the
coordination number of bulk sites and slab sites... | [
"Returns",
"the",
"surface",
"sites",
"and",
"their",
"indices",
"in",
"a",
"dictionary",
".",
"The",
"oriented",
"unit",
"cell",
"of",
"the",
"slab",
"will",
"determine",
"the",
"coordination",
"number",
"of",
"a",
"typical",
"site",
".",
"We",
"use",
"Vo... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L463-L539 | [
"def",
"get_surface_sites",
"(",
"self",
",",
"tag",
"=",
"False",
")",
":",
"from",
"pymatgen",
".",
"analysis",
".",
"local_env",
"import",
"VoronoiNN",
"# Get a dictionary of coordination numbers",
"# for each distinct site in the structure",
"a",
"=",
"SpacegroupAnaly... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.have_equivalent_surfaces | Check if we have same number of equivalent sites on both surfaces.
This is an alternative to checking Laue symmetry (is_symmetric())
if we want to ensure both surfaces in the slab are the same | pymatgen/core/surface.py | def have_equivalent_surfaces(self):
"""
Check if we have same number of equivalent sites on both surfaces.
This is an alternative to checking Laue symmetry (is_symmetric())
if we want to ensure both surfaces in the slab are the same
"""
# tag the sites as either surface ... | def have_equivalent_surfaces(self):
"""
Check if we have same number of equivalent sites on both surfaces.
This is an alternative to checking Laue symmetry (is_symmetric())
if we want to ensure both surfaces in the slab are the same
"""
# tag the sites as either surface ... | [
"Check",
"if",
"we",
"have",
"same",
"number",
"of",
"equivalent",
"sites",
"on",
"both",
"surfaces",
".",
"This",
"is",
"an",
"alternative",
"to",
"checking",
"Laue",
"symmetry",
"(",
"is_symmetric",
"()",
")",
"if",
"we",
"want",
"to",
"ensure",
"both",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L541-L571 | [
"def",
"have_equivalent_surfaces",
"(",
"self",
")",
":",
"# tag the sites as either surface sites or not",
"surf_sites_dict",
"=",
"self",
".",
"get_surface_sites",
"(",
"tag",
"=",
"True",
")",
"a",
"=",
"SpacegroupAnalyzer",
"(",
"self",
")",
"symm_structure",
"=",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.get_symmetric_site | This method uses symmetry operations to find equivalent sites on
both sides of the slab. Works mainly for slabs with Laue
symmetry. This is useful for retaining the non-polar and
symmetric properties of a slab when creating adsorbed
structures or symmetric reconstructions... | pymatgen/core/surface.py | def get_symmetric_site(self, point, cartesian=False):
"""
This method uses symmetry operations to find equivalent sites on
both sides of the slab. Works mainly for slabs with Laue
symmetry. This is useful for retaining the non-polar and
symmetric properties of a slab ... | def get_symmetric_site(self, point, cartesian=False):
"""
This method uses symmetry operations to find equivalent sites on
both sides of the slab. Works mainly for slabs with Laue
symmetry. This is useful for retaining the non-polar and
symmetric properties of a slab ... | [
"This",
"method",
"uses",
"symmetry",
"operations",
"to",
"find",
"equivalent",
"sites",
"on",
"both",
"sides",
"of",
"the",
"slab",
".",
"Works",
"mainly",
"for",
"slabs",
"with",
"Laue",
"symmetry",
".",
"This",
"is",
"useful",
"for",
"retaining",
"the",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L573-L612 | [
"def",
"get_symmetric_site",
"(",
"self",
",",
"point",
",",
"cartesian",
"=",
"False",
")",
":",
"sg",
"=",
"SpacegroupAnalyzer",
"(",
"self",
")",
"ops",
"=",
"sg",
".",
"get_symmetry_operations",
"(",
"cartesian",
"=",
"cartesian",
")",
"# Each operation on... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.symmetrically_add_atom | Class method for adding a site at a specified point in a slab.
Will add the corresponding site on the other side of the
slab to maintain equivalent surfaces.
Arg:
specie (str): The specie to add
point (coords): The coordinate of the site in the slab to add.
... | pymatgen/core/surface.py | def symmetrically_add_atom(self, specie, point, coords_are_cartesian=False):
"""
Class method for adding a site at a specified point in a slab.
Will add the corresponding site on the other side of the
slab to maintain equivalent surfaces.
Arg:
specie (str): ... | def symmetrically_add_atom(self, specie, point, coords_are_cartesian=False):
"""
Class method for adding a site at a specified point in a slab.
Will add the corresponding site on the other side of the
slab to maintain equivalent surfaces.
Arg:
specie (str): ... | [
"Class",
"method",
"for",
"adding",
"a",
"site",
"at",
"a",
"specified",
"point",
"in",
"a",
"slab",
".",
"Will",
"add",
"the",
"corresponding",
"site",
"on",
"the",
"other",
"side",
"of",
"the",
"slab",
"to",
"maintain",
"equivalent",
"surfaces",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L614-L637 | [
"def",
"symmetrically_add_atom",
"(",
"self",
",",
"specie",
",",
"point",
",",
"coords_are_cartesian",
"=",
"False",
")",
":",
"# For now just use the species of the",
"# surface atom as the element to add",
"# Get the index of the corresponding site at the bottom",
"point2",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Slab.symmetrically_remove_atoms | Class method for removing sites corresponding to a list of indices.
Will remove the corresponding site on the other side of the
slab to maintain equivalent surfaces.
Arg:
indices ([indices]): The indices of the sites
in the slab to remove. | pymatgen/core/surface.py | def symmetrically_remove_atoms(self, indices):
"""
Class method for removing sites corresponding to a list of indices.
Will remove the corresponding site on the other side of the
slab to maintain equivalent surfaces.
Arg:
indices ([indices]): The indices of ... | def symmetrically_remove_atoms(self, indices):
"""
Class method for removing sites corresponding to a list of indices.
Will remove the corresponding site on the other side of the
slab to maintain equivalent surfaces.
Arg:
indices ([indices]): The indices of ... | [
"Class",
"method",
"for",
"removing",
"sites",
"corresponding",
"to",
"a",
"list",
"of",
"indices",
".",
"Will",
"remove",
"the",
"corresponding",
"site",
"on",
"the",
"other",
"side",
"of",
"the",
"slab",
"to",
"maintain",
"equivalent",
"surfaces",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L639-L684 | [
"def",
"symmetrically_remove_atoms",
"(",
"self",
",",
"indices",
")",
":",
"slabcopy",
"=",
"SpacegroupAnalyzer",
"(",
"self",
".",
"copy",
"(",
")",
")",
".",
"get_symmetrized_structure",
"(",
")",
"points",
"=",
"[",
"slabcopy",
"[",
"i",
"]",
".",
"fra... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SlabGenerator.get_slab | This method takes in shift value for the c lattice direction and
generates a slab based on the given shift. You should rarely use this
method. Instead, it is used by other generation algorithms to obtain
all slabs.
Arg:
shift (float): A shift value in Angstrom that determine... | pymatgen/core/surface.py | def get_slab(self, shift=0, tol=0.1, energy=None):
"""
This method takes in shift value for the c lattice direction and
generates a slab based on the given shift. You should rarely use this
method. Instead, it is used by other generation algorithms to obtain
all slabs.
A... | def get_slab(self, shift=0, tol=0.1, energy=None):
"""
This method takes in shift value for the c lattice direction and
generates a slab based on the given shift. You should rarely use this
method. Instead, it is used by other generation algorithms to obtain
all slabs.
A... | [
"This",
"method",
"takes",
"in",
"shift",
"value",
"for",
"the",
"c",
"lattice",
"direction",
"and",
"generates",
"a",
"slab",
"based",
"on",
"the",
"given",
"shift",
".",
"You",
"should",
"rarely",
"use",
"this",
"method",
".",
"Instead",
"it",
"is",
"u... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L880-L958 | [
"def",
"get_slab",
"(",
"self",
",",
"shift",
"=",
"0",
",",
"tol",
"=",
"0.1",
",",
"energy",
"=",
"None",
")",
":",
"h",
"=",
"self",
".",
"_proj_height",
"p",
"=",
"h",
"/",
"self",
".",
"parent",
".",
"lattice",
".",
"d_hkl",
"(",
"self",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SlabGenerator.get_slabs | This method returns a list of slabs that are generated using the list of
shift values from the method, _calculate_possible_shifts(). Before the
shifts are used to create the slabs however, if the user decides to take
into account whether or not a termination will break any polyhedral
str... | pymatgen/core/surface.py | def get_slabs(self, bonds=None, ftol=0.1, tol=0.1, max_broken_bonds=0,
symmetrize=False, repair=False):
"""
This method returns a list of slabs that are generated using the list of
shift values from the method, _calculate_possible_shifts(). Before the
shifts are used to... | def get_slabs(self, bonds=None, ftol=0.1, tol=0.1, max_broken_bonds=0,
symmetrize=False, repair=False):
"""
This method returns a list of slabs that are generated using the list of
shift values from the method, _calculate_possible_shifts(). Before the
shifts are used to... | [
"This",
"method",
"returns",
"a",
"list",
"of",
"slabs",
"that",
"are",
"generated",
"using",
"the",
"list",
"of",
"shift",
"values",
"from",
"the",
"method",
"_calculate_possible_shifts",
"()",
".",
"Before",
"the",
"shifts",
"are",
"used",
"to",
"create",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1035-L1103 | [
"def",
"get_slabs",
"(",
"self",
",",
"bonds",
"=",
"None",
",",
"ftol",
"=",
"0.1",
",",
"tol",
"=",
"0.1",
",",
"max_broken_bonds",
"=",
"0",
",",
"symmetrize",
"=",
"False",
",",
"repair",
"=",
"False",
")",
":",
"c_ranges",
"=",
"set",
"(",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SlabGenerator.repair_broken_bonds | This method will find undercoordinated atoms due to slab
cleaving specified by the bonds parameter and move them
to the other surface to make sure the bond is kept intact.
In a future release of surface.py, the ghost_sites will be
used to tell us how the repair bonds should look like.
... | pymatgen/core/surface.py | def repair_broken_bonds(self, slab, bonds):
"""
This method will find undercoordinated atoms due to slab
cleaving specified by the bonds parameter and move them
to the other surface to make sure the bond is kept intact.
In a future release of surface.py, the ghost_sites will be
... | def repair_broken_bonds(self, slab, bonds):
"""
This method will find undercoordinated atoms due to slab
cleaving specified by the bonds parameter and move them
to the other surface to make sure the bond is kept intact.
In a future release of surface.py, the ghost_sites will be
... | [
"This",
"method",
"will",
"find",
"undercoordinated",
"atoms",
"due",
"to",
"slab",
"cleaving",
"specified",
"by",
"the",
"bonds",
"parameter",
"and",
"move",
"them",
"to",
"the",
"other",
"surface",
"to",
"make",
"sure",
"the",
"bond",
"is",
"kept",
"intact... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1105-L1175 | [
"def",
"repair_broken_bonds",
"(",
"self",
",",
"slab",
",",
"bonds",
")",
":",
"for",
"pair",
"in",
"bonds",
".",
"keys",
"(",
")",
":",
"blength",
"=",
"bonds",
"[",
"pair",
"]",
"# First lets determine which element should be the",
"# reference (center element)... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SlabGenerator.move_to_other_side | This method will Move a set of sites to the
other side of the slab (opposite surface).
Arg:
init_slab (structure): A structure object representing a slab.
index_of_sites (list of ints): The list of indices representing
the sites we want to move to the other side.... | pymatgen/core/surface.py | def move_to_other_side(self, init_slab, index_of_sites):
"""
This method will Move a set of sites to the
other side of the slab (opposite surface).
Arg:
init_slab (structure): A structure object representing a slab.
index_of_sites (list of ints): The list of indi... | def move_to_other_side(self, init_slab, index_of_sites):
"""
This method will Move a set of sites to the
other side of the slab (opposite surface).
Arg:
init_slab (structure): A structure object representing a slab.
index_of_sites (list of ints): The list of indi... | [
"This",
"method",
"will",
"Move",
"a",
"set",
"of",
"sites",
"to",
"the",
"other",
"side",
"of",
"the",
"slab",
"(",
"opposite",
"surface",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1177-L1219 | [
"def",
"move_to_other_side",
"(",
"self",
",",
"init_slab",
",",
"index_of_sites",
")",
":",
"slab",
"=",
"init_slab",
".",
"copy",
"(",
")",
"# Determine what fraction the slab is of the total cell size",
"# in the c direction. Round to nearest rational number.",
"h",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SlabGenerator.nonstoichiometric_symmetrized_slab | This method checks whether or not the two surfaces of the slab are
equivalent. If the point group of the slab has an inversion symmetry (
ie. belong to one of the Laue groups), then it is assumed that the
surfaces should be equivalent. Otherwise, sites at the bottom of the
slab will be r... | pymatgen/core/surface.py | def nonstoichiometric_symmetrized_slab(self, init_slab, tol=1e-3):
"""
This method checks whether or not the two surfaces of the slab are
equivalent. If the point group of the slab has an inversion symmetry (
ie. belong to one of the Laue groups), then it is assumed that the
sur... | def nonstoichiometric_symmetrized_slab(self, init_slab, tol=1e-3):
"""
This method checks whether or not the two surfaces of the slab are
equivalent. If the point group of the slab has an inversion symmetry (
ie. belong to one of the Laue groups), then it is assumed that the
sur... | [
"This",
"method",
"checks",
"whether",
"or",
"not",
"the",
"two",
"surfaces",
"of",
"the",
"slab",
"are",
"equivalent",
".",
"If",
"the",
"point",
"group",
"of",
"the",
"slab",
"has",
"an",
"inversion",
"symmetry",
"(",
"ie",
".",
"belong",
"to",
"one",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1221-L1276 | [
"def",
"nonstoichiometric_symmetrized_slab",
"(",
"self",
",",
"init_slab",
",",
"tol",
"=",
"1e-3",
")",
":",
"sg",
"=",
"SpacegroupAnalyzer",
"(",
"init_slab",
",",
"symprec",
"=",
"tol",
")",
"if",
"sg",
".",
"is_laue",
"(",
")",
":",
"return",
"[",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ReconstructionGenerator.build_slabs | Builds the reconstructed slab by:
(1) Obtaining the unreconstructed slab using the specified
parameters for the SlabGenerator.
(2) Applying the appropriate lattice transformation in the
a and b lattice vectors.
(3) Remove any specified sites from both ... | pymatgen/core/surface.py | def build_slabs(self):
"""
Builds the reconstructed slab by:
(1) Obtaining the unreconstructed slab using the specified
parameters for the SlabGenerator.
(2) Applying the appropriate lattice transformation in the
a and b lattice vectors.
... | def build_slabs(self):
"""
Builds the reconstructed slab by:
(1) Obtaining the unreconstructed slab using the specified
parameters for the SlabGenerator.
(2) Applying the appropriate lattice transformation in the
a and b lattice vectors.
... | [
"Builds",
"the",
"reconstructed",
"slab",
"by",
":",
"(",
"1",
")",
"Obtaining",
"the",
"unreconstructed",
"slab",
"using",
"the",
"specified",
"parameters",
"for",
"the",
"SlabGenerator",
".",
"(",
"2",
")",
"Applying",
"the",
"appropriate",
"lattice",
"trans... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1456-L1505 | [
"def",
"build_slabs",
"(",
"self",
")",
":",
"slabs",
"=",
"self",
".",
"get_unreconstructed_slabs",
"(",
")",
"recon_slabs",
"=",
"[",
"]",
"for",
"slab",
"in",
"slabs",
":",
"d",
"=",
"get_d",
"(",
"slab",
")",
"top_site",
"=",
"sorted",
"(",
"slab",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ReconstructionGenerator.get_unreconstructed_slabs | Generates the unreconstructed or pristine super slab. | pymatgen/core/surface.py | def get_unreconstructed_slabs(self):
"""
Generates the unreconstructed or pristine super slab.
"""
slabs = []
for slab in SlabGenerator(**self.slabgen_params).get_slabs():
slab.make_supercell(self.trans_matrix)
slabs.append(slab)
return slabs | def get_unreconstructed_slabs(self):
"""
Generates the unreconstructed or pristine super slab.
"""
slabs = []
for slab in SlabGenerator(**self.slabgen_params).get_slabs():
slab.make_supercell(self.trans_matrix)
slabs.append(slab)
return slabs | [
"Generates",
"the",
"unreconstructed",
"or",
"pristine",
"super",
"slab",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1507-L1517 | [
"def",
"get_unreconstructed_slabs",
"(",
"self",
")",
":",
"slabs",
"=",
"[",
"]",
"for",
"slab",
"in",
"SlabGenerator",
"(",
"*",
"*",
"self",
".",
"slabgen_params",
")",
".",
"get_slabs",
"(",
")",
":",
"slab",
".",
"make_supercell",
"(",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Poscar.from_file | Reads a Poscar from a file.
The code will try its best to determine the elements in the POSCAR in
the following order:
1. If check_for_POTCAR is True, the code will try to check if a POTCAR
is in the same directory as the POSCAR and use elements from that by
default. (This is th... | pymatgen/io/vasp/inputs.py | def from_file(filename, check_for_POTCAR=True, read_velocities=True):
"""
Reads a Poscar from a file.
The code will try its best to determine the elements in the POSCAR in
the following order:
1. If check_for_POTCAR is True, the code will try to check if a POTCAR
is in t... | def from_file(filename, check_for_POTCAR=True, read_velocities=True):
"""
Reads a Poscar from a file.
The code will try its best to determine the elements in the POSCAR in
the following order:
1. If check_for_POTCAR is True, the code will try to check if a POTCAR
is in t... | [
"Reads",
"a",
"Poscar",
"from",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L199-L243 | [
"def",
"from_file",
"(",
"filename",
",",
"check_for_POTCAR",
"=",
"True",
",",
"read_velocities",
"=",
"True",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"filename",
")",
")",
"names",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Poscar.from_string | Reads a Poscar from a string.
The code will try its best to determine the elements in the POSCAR in
the following order:
1. If default_names are supplied and valid, it will use those. Usually,
default names comes from an external source, such as a POTCAR in the
same directory.
... | pymatgen/io/vasp/inputs.py | def from_string(data, default_names=None, read_velocities=True):
"""
Reads a Poscar from a string.
The code will try its best to determine the elements in the POSCAR in
the following order:
1. If default_names are supplied and valid, it will use those. Usually,
default n... | def from_string(data, default_names=None, read_velocities=True):
"""
Reads a Poscar from a string.
The code will try its best to determine the elements in the POSCAR in
the following order:
1. If default_names are supplied and valid, it will use those. Usually,
default n... | [
"Reads",
"a",
"Poscar",
"from",
"a",
"string",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L246-L442 | [
"def",
"from_string",
"(",
"data",
",",
"default_names",
"=",
"None",
",",
"read_velocities",
"=",
"True",
")",
":",
"# \"^\\s*$\" doesn't match lines with no whitespace",
"chunks",
"=",
"re",
".",
"split",
"(",
"r\"\\n\\s*\\n\"",
",",
"data",
".",
"rstrip",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Poscar.get_string | Returns a string to be written as a POSCAR file. By default, site
symbols are written, which means compatibility is for vasp >= 5.
Args:
direct (bool): Whether coordinates are output in direct or
cartesian. Defaults to True.
vasp4_compatible (bool): Set to True t... | pymatgen/io/vasp/inputs.py | def get_string(self, direct=True, vasp4_compatible=False,
significant_figures=6):
"""
Returns a string to be written as a POSCAR file. By default, site
symbols are written, which means compatibility is for vasp >= 5.
Args:
direct (bool): Whether coordinate... | def get_string(self, direct=True, vasp4_compatible=False,
significant_figures=6):
"""
Returns a string to be written as a POSCAR file. By default, site
symbols are written, which means compatibility is for vasp >= 5.
Args:
direct (bool): Whether coordinate... | [
"Returns",
"a",
"string",
"to",
"be",
"written",
"as",
"a",
"POSCAR",
"file",
".",
"By",
"default",
"site",
"symbols",
"are",
"written",
"which",
"means",
"compatibility",
"is",
"for",
"vasp",
">",
"=",
"5",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L444-L515 | [
"def",
"get_string",
"(",
"self",
",",
"direct",
"=",
"True",
",",
"vasp4_compatible",
"=",
"False",
",",
"significant_figures",
"=",
"6",
")",
":",
"# This corrects for VASP really annoying bug of crashing on lattices",
"# which have triple product < 0. We will just invert the... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Poscar.write_file | Writes POSCAR to a file. The supported kwargs are the same as those for
the Poscar.get_string method and are passed through directly. | pymatgen/io/vasp/inputs.py | def write_file(self, filename, **kwargs):
"""
Writes POSCAR to a file. The supported kwargs are the same as those for
the Poscar.get_string method and are passed through directly.
"""
with zopen(filename, "wt") as f:
f.write(self.get_string(**kwargs)) | def write_file(self, filename, **kwargs):
"""
Writes POSCAR to a file. The supported kwargs are the same as those for
the Poscar.get_string method and are passed through directly.
"""
with zopen(filename, "wt") as f:
f.write(self.get_string(**kwargs)) | [
"Writes",
"POSCAR",
"to",
"a",
"file",
".",
"The",
"supported",
"kwargs",
"are",
"the",
"same",
"as",
"those",
"for",
"the",
"Poscar",
".",
"get_string",
"method",
"and",
"are",
"passed",
"through",
"directly",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L526-L532 | [
"def",
"write_file",
"(",
"self",
",",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"zopen",
"(",
"filename",
",",
"\"wt\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"self",
".",
"get_string",
"(",
"*",
"*",
"kwargs",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Poscar.set_temperature | Initializes the velocities based on Maxwell-Boltzmann distribution.
Removes linear, but not angular drift (same as VASP)
Scales the energies to the exact temperature (microcanonical ensemble)
Velocities are given in A/fs. This is the vasp default when
direct/cartesian is not specified (... | pymatgen/io/vasp/inputs.py | def set_temperature(self, temperature):
"""
Initializes the velocities based on Maxwell-Boltzmann distribution.
Removes linear, but not angular drift (same as VASP)
Scales the energies to the exact temperature (microcanonical ensemble)
Velocities are given in A/fs. This is the v... | def set_temperature(self, temperature):
"""
Initializes the velocities based on Maxwell-Boltzmann distribution.
Removes linear, but not angular drift (same as VASP)
Scales the energies to the exact temperature (microcanonical ensemble)
Velocities are given in A/fs. This is the v... | [
"Initializes",
"the",
"velocities",
"based",
"on",
"Maxwell",
"-",
"Boltzmann",
"distribution",
".",
"Removes",
"linear",
"but",
"not",
"angular",
"drift",
"(",
"same",
"as",
"VASP",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L554-L605 | [
"def",
"set_temperature",
"(",
"self",
",",
"temperature",
")",
":",
"# mean 0 variance 1",
"velocities",
"=",
"np",
".",
"random",
".",
"randn",
"(",
"len",
"(",
"self",
".",
"structure",
")",
",",
"3",
")",
"# in AMU, (N,1) array",
"atomic_masses",
"=",
"n... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Incar.get_string | Returns a string representation of the INCAR. The reason why this
method is different from the __str__ method is to provide options for
pretty printing.
Args:
sort_keys (bool): Set to True to sort the INCAR parameters
alphabetically. Defaults to False.
p... | pymatgen/io/vasp/inputs.py | def get_string(self, sort_keys=False, pretty=False):
"""
Returns a string representation of the INCAR. The reason why this
method is different from the __str__ method is to provide options for
pretty printing.
Args:
sort_keys (bool): Set to True to sort the INCAR pa... | def get_string(self, sort_keys=False, pretty=False):
"""
Returns a string representation of the INCAR. The reason why this
method is different from the __str__ method is to provide options for
pretty printing.
Args:
sort_keys (bool): Set to True to sort the INCAR pa... | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"INCAR",
".",
"The",
"reason",
"why",
"this",
"method",
"is",
"different",
"from",
"the",
"__str__",
"method",
"is",
"to",
"provide",
"options",
"for",
"pretty",
"printing",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L658-L700 | [
"def",
"get_string",
"(",
"self",
",",
"sort_keys",
"=",
"False",
",",
"pretty",
"=",
"False",
")",
":",
"keys",
"=",
"self",
".",
"keys",
"(",
")",
"if",
"sort_keys",
":",
"keys",
"=",
"sorted",
"(",
"keys",
")",
"lines",
"=",
"[",
"]",
"for",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Incar.from_string | Reads an Incar object from a string.
Args:
string (str): Incar string
Returns:
Incar object | pymatgen/io/vasp/inputs.py | def from_string(string):
"""
Reads an Incar object from a string.
Args:
string (str): Incar string
Returns:
Incar object
"""
lines = list(clean_lines(string.splitlines()))
params = {}
for line in lines:
for sline in li... | def from_string(string):
"""
Reads an Incar object from a string.
Args:
string (str): Incar string
Returns:
Incar object
"""
lines = list(clean_lines(string.splitlines()))
params = {}
for line in lines:
for sline in li... | [
"Reads",
"an",
"Incar",
"object",
"from",
"a",
"string",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L730-L750 | [
"def",
"from_string",
"(",
"string",
")",
":",
"lines",
"=",
"list",
"(",
"clean_lines",
"(",
"string",
".",
"splitlines",
"(",
")",
")",
")",
"params",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"for",
"sline",
"in",
"line",
".",
"split",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Incar.proc_val | Static helper method to convert INCAR parameters to proper types, e.g.,
integers, floats, lists, etc.
Args:
key: INCAR parameter key
val: Actual value of INCAR parameter. | pymatgen/io/vasp/inputs.py | def proc_val(key, val):
"""
Static helper method to convert INCAR parameters to proper types, e.g.,
integers, floats, lists, etc.
Args:
key: INCAR parameter key
val: Actual value of INCAR parameter.
"""
list_keys = ("LDAUU", "LDAUL", "LDAUJ", "MAG... | def proc_val(key, val):
"""
Static helper method to convert INCAR parameters to proper types, e.g.,
integers, floats, lists, etc.
Args:
key: INCAR parameter key
val: Actual value of INCAR parameter.
"""
list_keys = ("LDAUU", "LDAUL", "LDAUJ", "MAG... | [
"Static",
"helper",
"method",
"to",
"convert",
"INCAR",
"parameters",
"to",
"proper",
"types",
"e",
".",
"g",
".",
"integers",
"floats",
"lists",
"etc",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L753-L832 | [
"def",
"proc_val",
"(",
"key",
",",
"val",
")",
":",
"list_keys",
"=",
"(",
"\"LDAUU\"",
",",
"\"LDAUL\"",
",",
"\"LDAUJ\"",
",",
"\"MAGMOM\"",
",",
"\"DIPOL\"",
",",
"\"LANGEVIN_GAMMA\"",
",",
"\"QUAD_EFG\"",
",",
"\"EINT\"",
")",
"bool_keys",
"=",
"(",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Incar.diff | Diff function for Incar. Compares two Incars and indicates which
parameters are the same and which are not. Useful for checking whether
two runs were done using the same parameters.
Args:
other (Incar): The other Incar object to compare to.
Returns:
Dict of the... | pymatgen/io/vasp/inputs.py | def diff(self, other):
"""
Diff function for Incar. Compares two Incars and indicates which
parameters are the same and which are not. Useful for checking whether
two runs were done using the same parameters.
Args:
other (Incar): The other Incar object to compare to... | def diff(self, other):
"""
Diff function for Incar. Compares two Incars and indicates which
parameters are the same and which are not. Useful for checking whether
two runs were done using the same parameters.
Args:
other (Incar): The other Incar object to compare to... | [
"Diff",
"function",
"for",
"Incar",
".",
"Compares",
"two",
"Incars",
"and",
"indicates",
"which",
"parameters",
"are",
"the",
"same",
"and",
"which",
"are",
"not",
".",
"Useful",
"for",
"checking",
"whether",
"two",
"runs",
"were",
"done",
"using",
"the",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L834-L863 | [
"def",
"diff",
"(",
"self",
",",
"other",
")",
":",
"similar_param",
"=",
"{",
"}",
"different_param",
"=",
"{",
"}",
"for",
"k1",
",",
"v1",
"in",
"self",
".",
"items",
"(",
")",
":",
"if",
"k1",
"not",
"in",
"other",
":",
"different_param",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.gamma_automatic | Convenient static constructor for an automatic Gamma centered Kpoint
grid.
Args:
kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice
vectors. Defaults to (1,1,1)
shift: Shift to be applied to the kpoints. Defaults to (0,0,0).
Returns:
... | pymatgen/io/vasp/inputs.py | def gamma_automatic(kpts=(1, 1, 1), shift=(0, 0, 0)):
"""
Convenient static constructor for an automatic Gamma centered Kpoint
grid.
Args:
kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice
vectors. Defaults to (1,1,1)
shift: Shift to be... | def gamma_automatic(kpts=(1, 1, 1), shift=(0, 0, 0)):
"""
Convenient static constructor for an automatic Gamma centered Kpoint
grid.
Args:
kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice
vectors. Defaults to (1,1,1)
shift: Shift to be... | [
"Convenient",
"static",
"constructor",
"for",
"an",
"automatic",
"Gamma",
"centered",
"Kpoint",
"grid",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1004-L1019 | [
"def",
"gamma_automatic",
"(",
"kpts",
"=",
"(",
"1",
",",
"1",
",",
"1",
")",
",",
"shift",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"return",
"Kpoints",
"(",
"\"Automatic kpoint scheme\"",
",",
"0",
",",
"Kpoints",
".",
"supported_modes",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.monkhorst_automatic | Convenient static constructor for an automatic Monkhorst pack Kpoint
grid.
Args:
kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice
vectors. Defaults to (2,2,2)
shift: Shift to be applied to the kpoints. Defaults to (0,0,0).
Returns:
... | pymatgen/io/vasp/inputs.py | def monkhorst_automatic(kpts=(2, 2, 2), shift=(0, 0, 0)):
"""
Convenient static constructor for an automatic Monkhorst pack Kpoint
grid.
Args:
kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice
vectors. Defaults to (2,2,2)
shift: Shift t... | def monkhorst_automatic(kpts=(2, 2, 2), shift=(0, 0, 0)):
"""
Convenient static constructor for an automatic Monkhorst pack Kpoint
grid.
Args:
kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice
vectors. Defaults to (2,2,2)
shift: Shift t... | [
"Convenient",
"static",
"constructor",
"for",
"an",
"automatic",
"Monkhorst",
"pack",
"Kpoint",
"grid",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1022-L1037 | [
"def",
"monkhorst_automatic",
"(",
"kpts",
"=",
"(",
"2",
",",
"2",
",",
"2",
")",
",",
"shift",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"return",
"Kpoints",
"(",
"\"Automatic kpoint scheme\"",
",",
"0",
",",
"Kpoints",
".",
"supported_mode... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.automatic_density | Returns an automatic Kpoint object based on a structure and a kpoint
density. Uses Gamma centered meshes for hexagonal cells and
Monkhorst-Pack grids otherwise.
Algorithm:
Uses a simple approach scaling the number of divisions along each
reciprocal lattice vector proport... | pymatgen/io/vasp/inputs.py | def automatic_density(structure, kppa, force_gamma=False):
"""
Returns an automatic Kpoint object based on a structure and a kpoint
density. Uses Gamma centered meshes for hexagonal cells and
Monkhorst-Pack grids otherwise.
Algorithm:
Uses a simple approach scaling t... | def automatic_density(structure, kppa, force_gamma=False):
"""
Returns an automatic Kpoint object based on a structure and a kpoint
density. Uses Gamma centered meshes for hexagonal cells and
Monkhorst-Pack grids otherwise.
Algorithm:
Uses a simple approach scaling t... | [
"Returns",
"an",
"automatic",
"Kpoint",
"object",
"based",
"on",
"a",
"structure",
"and",
"a",
"kpoint",
"density",
".",
"Uses",
"Gamma",
"centered",
"meshes",
"for",
"hexagonal",
"cells",
"and",
"Monkhorst",
"-",
"Pack",
"grids",
"otherwise",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1040-L1078 | [
"def",
"automatic_density",
"(",
"structure",
",",
"kppa",
",",
"force_gamma",
"=",
"False",
")",
":",
"comment",
"=",
"\"pymatgen v%s with grid density = %.0f / atom\"",
"%",
"(",
"__version__",
",",
"kppa",
")",
"if",
"math",
".",
"fabs",
"(",
"(",
"math",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.automatic_gamma_density | Returns an automatic Kpoint object based on a structure and a kpoint
density. Uses Gamma centered meshes always. For GW.
Algorithm:
Uses a simple approach scaling the number of divisions along each
reciprocal lattice vector proportional to its length.
Args:
... | pymatgen/io/vasp/inputs.py | def automatic_gamma_density(structure, kppa):
"""
Returns an automatic Kpoint object based on a structure and a kpoint
density. Uses Gamma centered meshes always. For GW.
Algorithm:
Uses a simple approach scaling the number of divisions along each
reciprocal latt... | def automatic_gamma_density(structure, kppa):
"""
Returns an automatic Kpoint object based on a structure and a kpoint
density. Uses Gamma centered meshes always. For GW.
Algorithm:
Uses a simple approach scaling the number of divisions along each
reciprocal latt... | [
"Returns",
"an",
"automatic",
"Kpoint",
"object",
"based",
"on",
"a",
"structure",
"and",
"a",
"kpoint",
"density",
".",
"Uses",
"Gamma",
"centered",
"meshes",
"always",
".",
"For",
"GW",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1081-L1116 | [
"def",
"automatic_gamma_density",
"(",
"structure",
",",
"kppa",
")",
":",
"latt",
"=",
"structure",
".",
"lattice",
"lengths",
"=",
"latt",
".",
"abc",
"ngrid",
"=",
"kppa",
"/",
"structure",
".",
"num_sites",
"mult",
"=",
"(",
"ngrid",
"*",
"lengths",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.automatic_density_by_vol | Returns an automatic Kpoint object based on a structure and a kpoint
density per inverse Angstrom^3 of reciprocal cell.
Algorithm:
Same as automatic_density()
Args:
structure (Structure): Input structure
kppvol (int): Grid density per Angstrom^(-3) of recipr... | pymatgen/io/vasp/inputs.py | def automatic_density_by_vol(structure, kppvol, force_gamma=False):
"""
Returns an automatic Kpoint object based on a structure and a kpoint
density per inverse Angstrom^3 of reciprocal cell.
Algorithm:
Same as automatic_density()
Args:
structure (Struct... | def automatic_density_by_vol(structure, kppvol, force_gamma=False):
"""
Returns an automatic Kpoint object based on a structure and a kpoint
density per inverse Angstrom^3 of reciprocal cell.
Algorithm:
Same as automatic_density()
Args:
structure (Struct... | [
"Returns",
"an",
"automatic",
"Kpoint",
"object",
"based",
"on",
"a",
"structure",
"and",
"a",
"kpoint",
"density",
"per",
"inverse",
"Angstrom^3",
"of",
"reciprocal",
"cell",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1119-L1138 | [
"def",
"automatic_density_by_vol",
"(",
"structure",
",",
"kppvol",
",",
"force_gamma",
"=",
"False",
")",
":",
"vol",
"=",
"structure",
".",
"lattice",
".",
"reciprocal_lattice",
".",
"volume",
"kppa",
"=",
"kppvol",
"*",
"vol",
"*",
"structure",
".",
"num_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.automatic_linemode | Convenient static constructor for a KPOINTS in mode line_mode.
gamma centered Monkhorst-Pack grids and the number of subdivisions
along each reciprocal lattice vector determined by the scheme in the
VASP manual.
Args:
divisions: Parameter determining the number of k-points a... | pymatgen/io/vasp/inputs.py | def automatic_linemode(divisions, ibz):
"""
Convenient static constructor for a KPOINTS in mode line_mode.
gamma centered Monkhorst-Pack grids and the number of subdivisions
along each reciprocal lattice vector determined by the scheme in the
VASP manual.
Args:
... | def automatic_linemode(divisions, ibz):
"""
Convenient static constructor for a KPOINTS in mode line_mode.
gamma centered Monkhorst-Pack grids and the number of subdivisions
along each reciprocal lattice vector determined by the scheme in the
VASP manual.
Args:
... | [
"Convenient",
"static",
"constructor",
"for",
"a",
"KPOINTS",
"in",
"mode",
"line_mode",
".",
"gamma",
"centered",
"Monkhorst",
"-",
"Pack",
"grids",
"and",
"the",
"number",
"of",
"subdivisions",
"along",
"each",
"reciprocal",
"lattice",
"vector",
"determined",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1141-L1175 | [
"def",
"automatic_linemode",
"(",
"divisions",
",",
"ibz",
")",
":",
"kpoints",
"=",
"list",
"(",
")",
"labels",
"=",
"list",
"(",
")",
"for",
"path",
"in",
"ibz",
".",
"kpath",
"[",
"\"path\"",
"]",
":",
"kpoints",
".",
"append",
"(",
"ibz",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.from_string | Reads a Kpoints object from a KPOINTS string.
Args:
string (str): KPOINTS string.
Returns:
Kpoints object | pymatgen/io/vasp/inputs.py | def from_string(string):
"""
Reads a Kpoints object from a KPOINTS string.
Args:
string (str): KPOINTS string.
Returns:
Kpoints object
"""
lines = [line.strip() for line in string.splitlines()]
comment = lines[0]
num_kpts = int(l... | def from_string(string):
"""
Reads a Kpoints object from a KPOINTS string.
Args:
string (str): KPOINTS string.
Returns:
Kpoints object
"""
lines = [line.strip() for line in string.splitlines()]
comment = lines[0]
num_kpts = int(l... | [
"Reads",
"a",
"Kpoints",
"object",
"from",
"a",
"KPOINTS",
"string",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1192-L1292 | [
"def",
"from_string",
"(",
"string",
")",
":",
"lines",
"=",
"[",
"line",
".",
"strip",
"(",
")",
"for",
"line",
"in",
"string",
".",
"splitlines",
"(",
")",
"]",
"comment",
"=",
"lines",
"[",
"0",
"]",
"num_kpts",
"=",
"int",
"(",
"lines",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Kpoints.as_dict | json friendly dict representation of Kpoints | pymatgen/io/vasp/inputs.py | def as_dict(self):
"""json friendly dict representation of Kpoints"""
d = {"comment": self.comment, "nkpoints": self.num_kpts,
"generation_style": self.style.name, "kpoints": self.kpts,
"usershift": self.kpts_shift,
"kpts_weights": self.kpts_weights, "coord_type": ... | def as_dict(self):
"""json friendly dict representation of Kpoints"""
d = {"comment": self.comment, "nkpoints": self.num_kpts,
"generation_style": self.style.name, "kpoints": self.kpts,
"usershift": self.kpts_shift,
"kpts_weights": self.kpts_weights, "coord_type": ... | [
"json",
"friendly",
"dict",
"representation",
"of",
"Kpoints"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1339-L1355 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"comment\"",
":",
"self",
".",
"comment",
",",
"\"nkpoints\"",
":",
"self",
".",
"num_kpts",
",",
"\"generation_style\"",
":",
"self",
".",
"style",
".",
"name",
",",
"\"kpoints\"",
":",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PotcarSingle.element | Attempt to return the atomic symbol based on the VRHFIN keyword. | pymatgen/io/vasp/inputs.py | def element(self):
"""
Attempt to return the atomic symbol based on the VRHFIN keyword.
"""
element = self.keywords["VRHFIN"].split(":")[0].strip()
try:
return Element(element).symbol
except ValueError:
# VASP incorrectly gives the element symbol f... | def element(self):
"""
Attempt to return the atomic symbol based on the VRHFIN keyword.
"""
element = self.keywords["VRHFIN"].split(":")[0].strip()
try:
return Element(element).symbol
except ValueError:
# VASP incorrectly gives the element symbol f... | [
"Attempt",
"to",
"return",
"the",
"atomic",
"symbol",
"based",
"on",
"the",
"VRHFIN",
"keyword",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1620-L1632 | [
"def",
"element",
"(",
"self",
")",
":",
"element",
"=",
"self",
".",
"keywords",
"[",
"\"VRHFIN\"",
"]",
".",
"split",
"(",
"\":\"",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"try",
":",
"return",
"Element",
"(",
"element",
")",
".",
"symbol",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Potcar.set_symbols | Initialize the POTCAR from a set of symbols. Currently, the POTCARs can
be fetched from a location specified in .pmgrc.yaml. Use pmg config
to add this setting.
Args:
symbols ([str]): A list of element symbols
functional (str): The functional to use. If None, the setting... | pymatgen/io/vasp/inputs.py | def set_symbols(self, symbols, functional=None,
sym_potcar_map=None):
"""
Initialize the POTCAR from a set of symbols. Currently, the POTCARs can
be fetched from a location specified in .pmgrc.yaml. Use pmg config
to add this setting.
Args:
symbol... | def set_symbols(self, symbols, functional=None,
sym_potcar_map=None):
"""
Initialize the POTCAR from a set of symbols. Currently, the POTCARs can
be fetched from a location specified in .pmgrc.yaml. Use pmg config
to add this setting.
Args:
symbol... | [
"Initialize",
"the",
"POTCAR",
"from",
"a",
"set",
"of",
"symbols",
".",
"Currently",
"the",
"POTCARs",
"can",
"be",
"fetched",
"from",
"a",
"location",
"specified",
"in",
".",
"pmgrc",
".",
"yaml",
".",
"Use",
"pmg",
"config",
"to",
"add",
"this",
"sett... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1802-L1825 | [
"def",
"set_symbols",
"(",
"self",
",",
"symbols",
",",
"functional",
"=",
"None",
",",
"sym_potcar_map",
"=",
"None",
")",
":",
"del",
"self",
"[",
":",
"]",
"if",
"sym_potcar_map",
":",
"for",
"el",
"in",
"symbols",
":",
"self",
".",
"append",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VaspInput.write_input | Write VASP input to a directory.
Args:
output_dir (str): Directory to write to. Defaults to current
directory (".").
make_dir_if_not_present (bool): Create the directory if not
present. Defaults to True. | pymatgen/io/vasp/inputs.py | def write_input(self, output_dir=".", make_dir_if_not_present=True):
"""
Write VASP input to a directory.
Args:
output_dir (str): Directory to write to. Defaults to current
directory (".").
make_dir_if_not_present (bool): Create the directory if not
... | def write_input(self, output_dir=".", make_dir_if_not_present=True):
"""
Write VASP input to a directory.
Args:
output_dir (str): Directory to write to. Defaults to current
directory (".").
make_dir_if_not_present (bool): Create the directory if not
... | [
"Write",
"VASP",
"input",
"to",
"a",
"directory",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1877-L1891 | [
"def",
"write_input",
"(",
"self",
",",
"output_dir",
"=",
"\".\"",
",",
"make_dir_if_not_present",
"=",
"True",
")",
":",
"if",
"make_dir_if_not_present",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"output_dir",
")",
":",
"os",
".",
"makedirs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VaspInput.from_directory | Read in a set of VASP input from a directory. Note that only the
standard INCAR, POSCAR, POTCAR and KPOINTS files are read unless
optional_filenames is specified.
Args:
input_dir (str): Directory to read VASP input from.
optional_files (dict): Optional files to read in a... | pymatgen/io/vasp/inputs.py | def from_directory(input_dir, optional_files=None):
"""
Read in a set of VASP input from a directory. Note that only the
standard INCAR, POSCAR, POTCAR and KPOINTS files are read unless
optional_filenames is specified.
Args:
input_dir (str): Directory to read VASP in... | def from_directory(input_dir, optional_files=None):
"""
Read in a set of VASP input from a directory. Note that only the
standard INCAR, POSCAR, POTCAR and KPOINTS files are read unless
optional_filenames is specified.
Args:
input_dir (str): Directory to read VASP in... | [
"Read",
"in",
"a",
"set",
"of",
"VASP",
"input",
"from",
"a",
"directory",
".",
"Note",
"that",
"only",
"the",
"standard",
"INCAR",
"POSCAR",
"POTCAR",
"and",
"KPOINTS",
"files",
"are",
"read",
"unless",
"optional_filenames",
"is",
"specified",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1894-L1916 | [
"def",
"from_directory",
"(",
"input_dir",
",",
"optional_files",
"=",
"None",
")",
":",
"sub_d",
"=",
"{",
"}",
"for",
"fname",
",",
"ftype",
"in",
"[",
"(",
"\"INCAR\"",
",",
"Incar",
")",
",",
"(",
"\"KPOINTS\"",
",",
"Kpoints",
")",
",",
"(",
"\"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VaspInput.run_vasp | Write input files and run VASP.
:param run_dir: Where to write input files and do the run.
:param vasp_cmd: Args to be supplied to run VASP. Otherwise, the
PMG_VASP_EXE in .pmgrc.yaml is used.
:param output_file: File to write output.
:param err_file: File to write err. | pymatgen/io/vasp/inputs.py | def run_vasp(self, run_dir: PathLike = ".",
vasp_cmd: list = None,
output_file: PathLike = "vasp.out",
err_file: PathLike = "vasp.err"):
"""
Write input files and run VASP.
:param run_dir: Where to write input files and do the run.
:par... | def run_vasp(self, run_dir: PathLike = ".",
vasp_cmd: list = None,
output_file: PathLike = "vasp.out",
err_file: PathLike = "vasp.err"):
"""
Write input files and run VASP.
:param run_dir: Where to write input files and do the run.
:par... | [
"Write",
"input",
"files",
"and",
"run",
"VASP",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1918-L1939 | [
"def",
"run_vasp",
"(",
"self",
",",
"run_dir",
":",
"PathLike",
"=",
"\".\"",
",",
"vasp_cmd",
":",
"list",
"=",
"None",
",",
"output_file",
":",
"PathLike",
"=",
"\"vasp.out\"",
",",
"err_file",
":",
"PathLike",
"=",
"\"vasp.err\"",
")",
":",
"self",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_kpoints | Get kpoints object from JHU servlet, per Wisesa-McGill-Mueller
methodology. Refer to http://muellergroup.jhu.edu/K-Points.html
and P. Wisesa, K. A. McGill, T. Mueller, Phys. Rev. B 93,
155109 (2016)
Args:
structure (Structure): structure object
min_distance (float): The minimum allowe... | pymatgen/ext/jhu.py | def get_kpoints(structure, min_distance=0, min_total_kpoints=1,
kppra=None, gap_distance=7, remove_symmetry=None,
include_gamma="auto", header="simple", incar=None):
"""
Get kpoints object from JHU servlet, per Wisesa-McGill-Mueller
methodology. Refer to http://muellergrou... | def get_kpoints(structure, min_distance=0, min_total_kpoints=1,
kppra=None, gap_distance=7, remove_symmetry=None,
include_gamma="auto", header="simple", incar=None):
"""
Get kpoints object from JHU servlet, per Wisesa-McGill-Mueller
methodology. Refer to http://muellergrou... | [
"Get",
"kpoints",
"object",
"from",
"JHU",
"servlet",
"per",
"Wisesa",
"-",
"McGill",
"-",
"Mueller",
"methodology",
".",
"Refer",
"to",
"http",
":",
"//",
"muellergroup",
".",
"jhu",
".",
"edu",
"/",
"K",
"-",
"Points",
".",
"html",
"and",
"P",
".",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/ext/jhu.py#L25-L91 | [
"def",
"get_kpoints",
"(",
"structure",
",",
"min_distance",
"=",
"0",
",",
"min_total_kpoints",
"=",
"1",
",",
"kppra",
"=",
"None",
",",
"gap_distance",
"=",
"7",
",",
"remove_symmetry",
"=",
"None",
",",
"include_gamma",
"=",
"\"auto\"",
",",
"header",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_facets | Get the simplex facets for the Convex hull.
Args:
qhull_data (np.ndarray): The data from which to construct the convex
hull as a Nxd array (N being number of data points and d being the
dimension)
joggle (boolean): Whether to joggle the input to avoid precision
e... | pymatgen/analysis/phase_diagram.py | def get_facets(qhull_data, joggle=False):
"""
Get the simplex facets for the Convex hull.
Args:
qhull_data (np.ndarray): The data from which to construct the convex
hull as a Nxd array (N being number of data points and d being the
dimension)
joggle (boolean): Whethe... | def get_facets(qhull_data, joggle=False):
"""
Get the simplex facets for the Convex hull.
Args:
qhull_data (np.ndarray): The data from which to construct the convex
hull as a Nxd array (N being number of data points and d being the
dimension)
joggle (boolean): Whethe... | [
"Get",
"the",
"simplex",
"facets",
"for",
"the",
"Convex",
"hull",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1260-L1277 | [
"def",
"get_facets",
"(",
"qhull_data",
",",
"joggle",
"=",
"False",
")",
":",
"if",
"joggle",
":",
"return",
"ConvexHull",
"(",
"qhull_data",
",",
"qhull_options",
"=",
"\"QJ i\"",
")",
".",
"simplices",
"else",
":",
"return",
"ConvexHull",
"(",
"qhull_data... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | uniquelines | Given all the facets, convert it into a set of unique lines. Specifically
used for converting convex hull facets into line pairs of coordinates.
Args:
q: A 2-dim sequence, where each row represents a facet. E.g.,
[[1,2,3],[3,6,7],...]
Returns:
setoflines:
A set of ... | pymatgen/analysis/phase_diagram.py | def uniquelines(q):
"""
Given all the facets, convert it into a set of unique lines. Specifically
used for converting convex hull facets into line pairs of coordinates.
Args:
q: A 2-dim sequence, where each row represents a facet. E.g.,
[[1,2,3],[3,6,7],...]
Returns:
s... | def uniquelines(q):
"""
Given all the facets, convert it into a set of unique lines. Specifically
used for converting convex hull facets into line pairs of coordinates.
Args:
q: A 2-dim sequence, where each row represents a facet. E.g.,
[[1,2,3],[3,6,7],...]
Returns:
s... | [
"Given",
"all",
"the",
"facets",
"convert",
"it",
"into",
"a",
"set",
"of",
"unique",
"lines",
".",
"Specifically",
"used",
"for",
"converting",
"convex",
"hull",
"facets",
"into",
"line",
"pairs",
"of",
"coordinates",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1848-L1865 | [
"def",
"uniquelines",
"(",
"q",
")",
":",
"setoflines",
"=",
"set",
"(",
")",
"for",
"facets",
"in",
"q",
":",
"for",
"line",
"in",
"itertools",
".",
"combinations",
"(",
"facets",
",",
"2",
")",
":",
"setoflines",
".",
"add",
"(",
"tuple",
"(",
"s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | triangular_coord | Convert a 2D coordinate into a triangle-based coordinate system for a
prettier phase diagram.
Args:
coordinate: coordinate used in the convex hull computation.
Returns:
coordinates in a triangular-based coordinate system. | pymatgen/analysis/phase_diagram.py | def triangular_coord(coord):
"""
Convert a 2D coordinate into a triangle-based coordinate system for a
prettier phase diagram.
Args:
coordinate: coordinate used in the convex hull computation.
Returns:
coordinates in a triangular-based coordinate system.
"""
unitvec = np.ar... | def triangular_coord(coord):
"""
Convert a 2D coordinate into a triangle-based coordinate system for a
prettier phase diagram.
Args:
coordinate: coordinate used in the convex hull computation.
Returns:
coordinates in a triangular-based coordinate system.
"""
unitvec = np.ar... | [
"Convert",
"a",
"2D",
"coordinate",
"into",
"a",
"triangle",
"-",
"based",
"coordinate",
"system",
"for",
"a",
"prettier",
"phase",
"diagram",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1868-L1881 | [
"def",
"triangular_coord",
"(",
"coord",
")",
":",
"unitvec",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"1",
",",
"0",
"]",
",",
"[",
"0.5",
",",
"math",
".",
"sqrt",
"(",
"3",
")",
"/",
"2",
"]",
"]",
")",
"result",
"=",
"np",
".",
"dot",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | order_phase_diagram | Orders the entries (their coordinates) in a phase diagram plot according
to the user specified ordering.
Ordering should be given as ['Up', 'Left', 'Right'], where Up,
Left and Right are the names of the entries in the upper, left and right
corners of the triangle respectively.
Args:
lines:... | pymatgen/analysis/phase_diagram.py | def order_phase_diagram(lines, stable_entries, unstable_entries, ordering):
"""
Orders the entries (their coordinates) in a phase diagram plot according
to the user specified ordering.
Ordering should be given as ['Up', 'Left', 'Right'], where Up,
Left and Right are the names of the entries in the u... | def order_phase_diagram(lines, stable_entries, unstable_entries, ordering):
"""
Orders the entries (their coordinates) in a phase diagram plot according
to the user specified ordering.
Ordering should be given as ['Up', 'Left', 'Right'], where Up,
Left and Right are the names of the entries in the u... | [
"Orders",
"the",
"entries",
"(",
"their",
"coordinates",
")",
"in",
"a",
"phase",
"diagram",
"plot",
"according",
"to",
"the",
"user",
"specified",
"ordering",
".",
"Ordering",
"should",
"be",
"given",
"as",
"[",
"Up",
"Left",
"Right",
"]",
"where",
"Up",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1901-L2047 | [
"def",
"order_phase_diagram",
"(",
"lines",
",",
"stable_entries",
",",
"unstable_entries",
",",
"ordering",
")",
":",
"yup",
"=",
"-",
"1000.0",
"xleft",
"=",
"1000.0",
"xright",
"=",
"-",
"1000.0",
"for",
"coord",
"in",
"stable_entries",
":",
"if",
"coord"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.pd_coords | The phase diagram is generated in a reduced dimensional space
(n_elements - 1). This function returns the coordinates in that space.
These coordinates are compatible with the stored simplex objects. | pymatgen/analysis/phase_diagram.py | def pd_coords(self, comp):
"""
The phase diagram is generated in a reduced dimensional space
(n_elements - 1). This function returns the coordinates in that space.
These coordinates are compatible with the stored simplex objects.
"""
if set(comp.elements).difference(self.... | def pd_coords(self, comp):
"""
The phase diagram is generated in a reduced dimensional space
(n_elements - 1). This function returns the coordinates in that space.
These coordinates are compatible with the stored simplex objects.
"""
if set(comp.elements).difference(self.... | [
"The",
"phase",
"diagram",
"is",
"generated",
"in",
"a",
"reduced",
"dimensional",
"space",
"(",
"n_elements",
"-",
"1",
")",
".",
"This",
"function",
"returns",
"the",
"coordinates",
"in",
"that",
"space",
".",
"These",
"coordinates",
"are",
"compatible",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L387-L397 | [
"def",
"pd_coords",
"(",
"self",
",",
"comp",
")",
":",
"if",
"set",
"(",
"comp",
".",
"elements",
")",
".",
"difference",
"(",
"self",
".",
"elements",
")",
":",
"raise",
"ValueError",
"(",
"'{} has elements not in the phase diagram {}'",
"''",
".",
"format... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_form_energy | Returns the formation energy for an entry (NOT normalized) from the
elemental references.
Args:
entry: A PDEntry-like object.
Returns:
Formation energy from the elemental references. | pymatgen/analysis/phase_diagram.py | def get_form_energy(self, entry):
"""
Returns the formation energy for an entry (NOT normalized) from the
elemental references.
Args:
entry: A PDEntry-like object.
Returns:
Formation energy from the elemental references.
"""
c = entry.com... | def get_form_energy(self, entry):
"""
Returns the formation energy for an entry (NOT normalized) from the
elemental references.
Args:
entry: A PDEntry-like object.
Returns:
Formation energy from the elemental references.
"""
c = entry.com... | [
"Returns",
"the",
"formation",
"energy",
"for",
"an",
"entry",
"(",
"NOT",
"normalized",
")",
"from",
"the",
"elemental",
"references",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L424-L437 | [
"def",
"get_form_energy",
"(",
"self",
",",
"entry",
")",
":",
"c",
"=",
"entry",
".",
"composition",
"return",
"entry",
".",
"energy",
"-",
"sum",
"(",
"[",
"c",
"[",
"el",
"]",
"*",
"self",
".",
"el_refs",
"[",
"el",
"]",
".",
"energy_per_atom",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram._get_facet_and_simplex | Get any facet that a composition falls into. Cached so successive
calls at same composition are fast. | pymatgen/analysis/phase_diagram.py | def _get_facet_and_simplex(self, comp):
"""
Get any facet that a composition falls into. Cached so successive
calls at same composition are fast.
"""
c = self.pd_coords(comp)
for f, s in zip(self.facets, self.simplexes):
if s.in_simplex(c, PhaseDiagram.numeric... | def _get_facet_and_simplex(self, comp):
"""
Get any facet that a composition falls into. Cached so successive
calls at same composition are fast.
"""
c = self.pd_coords(comp)
for f, s in zip(self.facets, self.simplexes):
if s.in_simplex(c, PhaseDiagram.numeric... | [
"Get",
"any",
"facet",
"that",
"a",
"composition",
"falls",
"into",
".",
"Cached",
"so",
"successive",
"calls",
"at",
"same",
"composition",
"are",
"fast",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L476-L485 | [
"def",
"_get_facet_and_simplex",
"(",
"self",
",",
"comp",
")",
":",
"c",
"=",
"self",
".",
"pd_coords",
"(",
"comp",
")",
"for",
"f",
",",
"s",
"in",
"zip",
"(",
"self",
".",
"facets",
",",
"self",
".",
"simplexes",
")",
":",
"if",
"s",
".",
"in... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram._get_facet_chempots | Calculates the chemical potentials for each element within a facet.
Args:
facet: Facet of the phase diagram.
Returns:
{ element: chempot } for all elements in the phase diagram. | pymatgen/analysis/phase_diagram.py | def _get_facet_chempots(self, facet):
"""
Calculates the chemical potentials for each element within a facet.
Args:
facet: Facet of the phase diagram.
Returns:
{ element: chempot } for all elements in the phase diagram.
"""
complist = [self.qhull... | def _get_facet_chempots(self, facet):
"""
Calculates the chemical potentials for each element within a facet.
Args:
facet: Facet of the phase diagram.
Returns:
{ element: chempot } for all elements in the phase diagram.
"""
complist = [self.qhull... | [
"Calculates",
"the",
"chemical",
"potentials",
"for",
"each",
"element",
"within",
"a",
"facet",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L487-L502 | [
"def",
"_get_facet_chempots",
"(",
"self",
",",
"facet",
")",
":",
"complist",
"=",
"[",
"self",
".",
"qhull_entries",
"[",
"i",
"]",
".",
"composition",
"for",
"i",
"in",
"facet",
"]",
"energylist",
"=",
"[",
"self",
".",
"qhull_entries",
"[",
"i",
"]... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_decomposition | Provides the decomposition at a particular composition.
Args:
comp: A composition
Returns:
Decomposition as a dict of {Entry: amount} | pymatgen/analysis/phase_diagram.py | def get_decomposition(self, comp):
"""
Provides the decomposition at a particular composition.
Args:
comp: A composition
Returns:
Decomposition as a dict of {Entry: amount}
"""
facet, simplex = self._get_facet_and_simplex(comp)
decomp_amt... | def get_decomposition(self, comp):
"""
Provides the decomposition at a particular composition.
Args:
comp: A composition
Returns:
Decomposition as a dict of {Entry: amount}
"""
facet, simplex = self._get_facet_and_simplex(comp)
decomp_amt... | [
"Provides",
"the",
"decomposition",
"at",
"a",
"particular",
"composition",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L504-L518 | [
"def",
"get_decomposition",
"(",
"self",
",",
"comp",
")",
":",
"facet",
",",
"simplex",
"=",
"self",
".",
"_get_facet_and_simplex",
"(",
"comp",
")",
"decomp_amts",
"=",
"simplex",
".",
"bary_coords",
"(",
"self",
".",
"pd_coords",
"(",
"comp",
")",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_hull_energy | Args:
comp (Composition): Input composition
Returns:
Energy of lowest energy equilibrium at desired composition. Not
normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O) | pymatgen/analysis/phase_diagram.py | def get_hull_energy(self, comp):
"""
Args:
comp (Composition): Input composition
Returns:
Energy of lowest energy equilibrium at desired composition. Not
normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)
"""
e = 0
for k, v in self.get_d... | def get_hull_energy(self, comp):
"""
Args:
comp (Composition): Input composition
Returns:
Energy of lowest energy equilibrium at desired composition. Not
normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)
"""
e = 0
for k, v in self.get_d... | [
"Args",
":",
"comp",
"(",
"Composition",
")",
":",
"Input",
"composition"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L520-L532 | [
"def",
"get_hull_energy",
"(",
"self",
",",
"comp",
")",
":",
"e",
"=",
"0",
"for",
"k",
",",
"v",
"in",
"self",
".",
"get_decomposition",
"(",
"comp",
")",
".",
"items",
"(",
")",
":",
"e",
"+=",
"k",
".",
"energy_per_atom",
"*",
"v",
"return",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_decomp_and_e_above_hull | Provides the decomposition and energy above convex hull for an entry.
Due to caching, can be much faster if entries with the same composition
are processed together.
Args:
entry: A PDEntry like object
allow_negative: Whether to allow negative e_above_hulls. Used to
... | pymatgen/analysis/phase_diagram.py | def get_decomp_and_e_above_hull(self, entry, allow_negative=False):
"""
Provides the decomposition and energy above convex hull for an entry.
Due to caching, can be much faster if entries with the same composition
are processed together.
Args:
entry: A PDEntry like o... | def get_decomp_and_e_above_hull(self, entry, allow_negative=False):
"""
Provides the decomposition and energy above convex hull for an entry.
Due to caching, can be much faster if entries with the same composition
are processed together.
Args:
entry: A PDEntry like o... | [
"Provides",
"the",
"decomposition",
"and",
"energy",
"above",
"convex",
"hull",
"for",
"an",
"entry",
".",
"Due",
"to",
"caching",
"can",
"be",
"much",
"faster",
"if",
"entries",
"with",
"the",
"same",
"composition",
"are",
"processed",
"together",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L534-L563 | [
"def",
"get_decomp_and_e_above_hull",
"(",
"self",
",",
"entry",
",",
"allow_negative",
"=",
"False",
")",
":",
"if",
"entry",
"in",
"self",
".",
"stable_entries",
":",
"return",
"{",
"entry",
":",
"1",
"}",
",",
"0",
"comp",
"=",
"entry",
".",
"composit... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_equilibrium_reaction_energy | Provides the reaction energy of a stable entry from the neighboring
equilibrium stable entries (also known as the inverse distance to
hull).
Args:
entry: A PDEntry like object
Returns:
Equilibrium reaction energy of entry. Stable entries should have
... | pymatgen/analysis/phase_diagram.py | def get_equilibrium_reaction_energy(self, entry):
"""
Provides the reaction energy of a stable entry from the neighboring
equilibrium stable entries (also known as the inverse distance to
hull).
Args:
entry: A PDEntry like object
Returns:
Equilib... | def get_equilibrium_reaction_energy(self, entry):
"""
Provides the reaction energy of a stable entry from the neighboring
equilibrium stable entries (also known as the inverse distance to
hull).
Args:
entry: A PDEntry like object
Returns:
Equilib... | [
"Provides",
"the",
"reaction",
"energy",
"of",
"a",
"stable",
"entry",
"from",
"the",
"neighboring",
"equilibrium",
"stable",
"entries",
"(",
"also",
"known",
"as",
"the",
"inverse",
"distance",
"to",
"hull",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L578-L599 | [
"def",
"get_equilibrium_reaction_energy",
"(",
"self",
",",
"entry",
")",
":",
"if",
"entry",
"not",
"in",
"self",
".",
"stable_entries",
":",
"raise",
"ValueError",
"(",
"\"Equilibrium reaction energy is available only \"",
"\"for stable entries.\"",
")",
"if",
"entry"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_transition_chempots | Get the critical chemical potentials for an element in the Phase
Diagram.
Args:
element: An element. Has to be in the PD in the first place.
Returns:
A sorted sequence of critical chemical potentials, from less
negative to more negative. | pymatgen/analysis/phase_diagram.py | def get_transition_chempots(self, element):
"""
Get the critical chemical potentials for an element in the Phase
Diagram.
Args:
element: An element. Has to be in the PD in the first place.
Returns:
A sorted sequence of critical chemical potentials, from ... | def get_transition_chempots(self, element):
"""
Get the critical chemical potentials for an element in the Phase
Diagram.
Args:
element: An element. Has to be in the PD in the first place.
Returns:
A sorted sequence of critical chemical potentials, from ... | [
"Get",
"the",
"critical",
"chemical",
"potentials",
"for",
"an",
"element",
"in",
"the",
"Phase",
"Diagram",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L624-L653 | [
"def",
"get_transition_chempots",
"(",
"self",
",",
"element",
")",
":",
"if",
"element",
"not",
"in",
"self",
".",
"elements",
":",
"raise",
"ValueError",
"(",
"\"get_transition_chempots can only be called with \"",
"\"elements in the phase diagram.\"",
")",
"critical_ch... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_critical_compositions | Get the critical compositions along the tieline between two
compositions. I.e. where the decomposition products change.
The endpoints are also returned.
Args:
comp1, comp2 (Composition): compositions that define the tieline
Returns:
[(Composition)]: list of critic... | pymatgen/analysis/phase_diagram.py | def get_critical_compositions(self, comp1, comp2):
"""
Get the critical compositions along the tieline between two
compositions. I.e. where the decomposition products change.
The endpoints are also returned.
Args:
comp1, comp2 (Composition): compositions that define t... | def get_critical_compositions(self, comp1, comp2):
"""
Get the critical compositions along the tieline between two
compositions. I.e. where the decomposition products change.
The endpoints are also returned.
Args:
comp1, comp2 (Composition): compositions that define t... | [
"Get",
"the",
"critical",
"compositions",
"along",
"the",
"tieline",
"between",
"two",
"compositions",
".",
"I",
".",
"e",
".",
"where",
"the",
"decomposition",
"products",
"change",
".",
"The",
"endpoints",
"are",
"also",
"returned",
".",
"Args",
":",
"comp... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L655-L711 | [
"def",
"get_critical_compositions",
"(",
"self",
",",
"comp1",
",",
"comp2",
")",
":",
"n1",
"=",
"comp1",
".",
"num_atoms",
"n2",
"=",
"comp2",
".",
"num_atoms",
"pd_els",
"=",
"self",
".",
"elements",
"# the reduced dimensionality Simplexes don't use the",
"# fi... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_element_profile | Provides the element evolution data for a composition.
For example, can be used to analyze Li conversion voltages by varying
uLi and looking at the phases formed. Also can be used to analyze O2
evolution by varying uO2.
Args:
element: An element. Must be in the phase diagram... | pymatgen/analysis/phase_diagram.py | def get_element_profile(self, element, comp, comp_tol=1e-5):
"""
Provides the element evolution data for a composition.
For example, can be used to analyze Li conversion voltages by varying
uLi and looking at the phases formed. Also can be used to analyze O2
evolution by varying ... | def get_element_profile(self, element, comp, comp_tol=1e-5):
"""
Provides the element evolution data for a composition.
For example, can be used to analyze Li conversion voltages by varying
uLi and looking at the phases formed. Also can be used to analyze O2
evolution by varying ... | [
"Provides",
"the",
"element",
"evolution",
"data",
"for",
"a",
"composition",
".",
"For",
"example",
"can",
"be",
"used",
"to",
"analyze",
"Li",
"conversion",
"voltages",
"by",
"varying",
"uLi",
"and",
"looking",
"at",
"the",
"phases",
"formed",
".",
"Also",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L713-L755 | [
"def",
"get_element_profile",
"(",
"self",
",",
"element",
",",
"comp",
",",
"comp_tol",
"=",
"1e-5",
")",
":",
"element",
"=",
"get_el_sp",
"(",
"element",
")",
"element",
"=",
"Element",
"(",
"element",
".",
"symbol",
")",
"if",
"element",
"not",
"in",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_chempot_range_map | Returns a chemical potential range map for each stable entry.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges
of all Li-Co-O phases wrt to uLi and uO, you will supply
[Elem... | pymatgen/analysis/phase_diagram.py | def get_chempot_range_map(self, elements, referenced=True, joggle=True):
"""
Returns a chemical potential range map for each stable entry.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges
... | def get_chempot_range_map(self, elements, referenced=True, joggle=True):
"""
Returns a chemical potential range map for each stable entry.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges
... | [
"Returns",
"a",
"chemical",
"potential",
"range",
"map",
"for",
"each",
"stable",
"entry",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L757-L806 | [
"def",
"get_chempot_range_map",
"(",
"self",
",",
"elements",
",",
"referenced",
"=",
"True",
",",
"joggle",
"=",
"True",
")",
":",
"all_chempots",
"=",
"[",
"]",
"pd",
"=",
"self",
"facets",
"=",
"pd",
".",
"facets",
"for",
"facet",
"in",
"facets",
":... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.getmu_vertices_stability_phase | returns a set of chemical potentials corresponding to the vertices of
the simplex in the chemical potential phase diagram.
The simplex is built using all elements in the target_composition
except dep_elt.
The chemical potential of dep_elt is computed from the target
composition e... | pymatgen/analysis/phase_diagram.py | def getmu_vertices_stability_phase(self, target_comp, dep_elt, tol_en=1e-2):
"""
returns a set of chemical potentials corresponding to the vertices of
the simplex in the chemical potential phase diagram.
The simplex is built using all elements in the target_composition
except dep... | def getmu_vertices_stability_phase(self, target_comp, dep_elt, tol_en=1e-2):
"""
returns a set of chemical potentials corresponding to the vertices of
the simplex in the chemical potential phase diagram.
The simplex is built using all elements in the target_composition
except dep... | [
"returns",
"a",
"set",
"of",
"chemical",
"potentials",
"corresponding",
"to",
"the",
"vertices",
"of",
"the",
"simplex",
"in",
"the",
"chemical",
"potential",
"phase",
"diagram",
".",
"The",
"simplex",
"is",
"built",
"using",
"all",
"elements",
"in",
"the",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L808-L866 | [
"def",
"getmu_vertices_stability_phase",
"(",
"self",
",",
"target_comp",
",",
"dep_elt",
",",
"tol_en",
"=",
"1e-2",
")",
":",
"muref",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"el_refs",
"[",
"e",
"]",
".",
"energy_per_atom",
"for",
"e",
"in",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhaseDiagram.get_chempot_range_stability_phase | returns a set of chemical potentials corresponding to the max and min
chemical potential of the open element for a given composition. It is
quite common to have for instance a ternary oxide (e.g., ABO3) for
which you want to know what are the A and B chemical potential leading
to the hig... | pymatgen/analysis/phase_diagram.py | def get_chempot_range_stability_phase(self, target_comp, open_elt):
"""
returns a set of chemical potentials corresponding to the max and min
chemical potential of the open element for a given composition. It is
quite common to have for instance a ternary oxide (e.g., ABO3) for
w... | def get_chempot_range_stability_phase(self, target_comp, open_elt):
"""
returns a set of chemical potentials corresponding to the max and min
chemical potential of the open element for a given composition. It is
quite common to have for instance a ternary oxide (e.g., ABO3) for
w... | [
"returns",
"a",
"set",
"of",
"chemical",
"potentials",
"corresponding",
"to",
"the",
"max",
"and",
"min",
"chemical",
"potential",
"of",
"the",
"open",
"element",
"for",
"a",
"given",
"composition",
".",
"It",
"is",
"quite",
"common",
"to",
"have",
"for",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L868-L921 | [
"def",
"get_chempot_range_stability_phase",
"(",
"self",
",",
"target_comp",
",",
"open_elt",
")",
":",
"muref",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"el_refs",
"[",
"e",
"]",
".",
"energy_per_atom",
"for",
"e",
"in",
"self",
".",
"elements",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CompoundPhaseDiagram.transform_entries | Method to transform all entries to the composition coordinate in the
terminal compositions. If the entry does not fall within the space
defined by the terminal compositions, they are excluded. For example,
Li3PO4 is mapped into a Li2O:1.5, P2O5:0.5 composition. The terminal
compositions ... | pymatgen/analysis/phase_diagram.py | def transform_entries(self, entries, terminal_compositions):
"""
Method to transform all entries to the composition coordinate in the
terminal compositions. If the entry does not fall within the space
defined by the terminal compositions, they are excluded. For example,
Li3PO4 is... | def transform_entries(self, entries, terminal_compositions):
"""
Method to transform all entries to the composition coordinate in the
terminal compositions. If the entry does not fall within the space
defined by the terminal compositions, they are excluded. For example,
Li3PO4 is... | [
"Method",
"to",
"transform",
"all",
"entries",
"to",
"the",
"composition",
"coordinate",
"in",
"the",
"terminal",
"compositions",
".",
"If",
"the",
"entry",
"does",
"not",
"fall",
"within",
"the",
"space",
"defined",
"by",
"the",
"terminal",
"compositions",
"t... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1032-L1078 | [
"def",
"transform_entries",
"(",
"self",
",",
"entries",
",",
"terminal_compositions",
")",
":",
"new_entries",
"=",
"[",
"]",
"if",
"self",
".",
"normalize_terminals",
":",
"fractional_comp",
"=",
"[",
"c",
".",
"fractional_composition",
"for",
"c",
"in",
"te... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ReactionDiagram.get_compound_pd | Get the CompoundPhaseDiagram object, which can then be used for
plotting.
Returns:
(CompoundPhaseDiagram) | pymatgen/analysis/phase_diagram.py | def get_compound_pd(self):
"""
Get the CompoundPhaseDiagram object, which can then be used for
plotting.
Returns:
(CompoundPhaseDiagram)
"""
# For this plot, since the reactions are reported in formation
# energies, we need to set the energies of the ... | def get_compound_pd(self):
"""
Get the CompoundPhaseDiagram object, which can then be used for
plotting.
Returns:
(CompoundPhaseDiagram)
"""
# For this plot, since the reactions are reported in formation
# energies, we need to set the energies of the ... | [
"Get",
"the",
"CompoundPhaseDiagram",
"object",
"which",
"can",
"then",
"be",
"used",
"for",
"plotting",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1231-L1250 | [
"def",
"get_compound_pd",
"(",
"self",
")",
":",
"# For this plot, since the reactions are reported in formation",
"# energies, we need to set the energies of the terminal compositions",
"# to 0. So we make create copies with 0 energy.",
"entry1",
"=",
"PDEntry",
"(",
"self",
".",
"ent... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter.pd_plot_data | Plot data for phase diagram.
2-comp - Full hull with energies
3/4-comp - Projection into 2D or 3D Gibbs triangle.
Returns:
(lines, stable_entries, unstable_entries):
- lines is a list of list of coordinates for lines in the PD.
- stable_entries is a {coordina... | pymatgen/analysis/phase_diagram.py | def pd_plot_data(self):
"""
Plot data for phase diagram.
2-comp - Full hull with energies
3/4-comp - Projection into 2D or 3D Gibbs triangle.
Returns:
(lines, stable_entries, unstable_entries):
- lines is a list of list of coordinates for lines in the PD.... | def pd_plot_data(self):
"""
Plot data for phase diagram.
2-comp - Full hull with energies
3/4-comp - Projection into 2D or 3D Gibbs triangle.
Returns:
(lines, stable_entries, unstable_entries):
- lines is a list of list of coordinates for lines in the PD.... | [
"Plot",
"data",
"for",
"phase",
"diagram",
".",
"2",
"-",
"comp",
"-",
"Full",
"hull",
"with",
"energies",
"3",
"/",
"4",
"-",
"comp",
"-",
"Projection",
"into",
"2D",
"or",
"3D",
"Gibbs",
"triangle",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1318-L1376 | [
"def",
"pd_plot_data",
"(",
"self",
")",
":",
"pd",
"=",
"self",
".",
"_pd",
"entries",
"=",
"pd",
".",
"qhull_entries",
"data",
"=",
"np",
".",
"array",
"(",
"pd",
".",
"qhull_data",
")",
"lines",
"=",
"[",
"]",
"stable_entries",
"=",
"{",
"}",
"f... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter.plot_element_profile | Draw the element profile plot for a composition varying different
chemical potential of an element.
X value is the negative value of the chemical potential reference to
elemental chemical potential. For example, if choose Element("Li"),
X= -(µLi-µLi0), which corresponds to the voltage ve... | pymatgen/analysis/phase_diagram.py | def plot_element_profile(self, element, comp, show_label_index=None,
xlim=5):
"""
Draw the element profile plot for a composition varying different
chemical potential of an element.
X value is the negative value of the chemical potential reference to
... | def plot_element_profile(self, element, comp, show_label_index=None,
xlim=5):
"""
Draw the element profile plot for a composition varying different
chemical potential of an element.
X value is the negative value of the chemical potential reference to
... | [
"Draw",
"the",
"element",
"profile",
"plot",
"for",
"a",
"composition",
"varying",
"different",
"chemical",
"potential",
"of",
"an",
"element",
".",
"X",
"value",
"is",
"the",
"negative",
"value",
"of",
"the",
"chemical",
"potential",
"reference",
"to",
"eleme... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1389-L1450 | [
"def",
"plot_element_profile",
"(",
"self",
",",
"element",
",",
"comp",
",",
"show_label_index",
"=",
"None",
",",
"xlim",
"=",
"5",
")",
":",
"plt",
"=",
"pretty_plot",
"(",
"12",
",",
"8",
")",
"pd",
"=",
"self",
".",
"_pd",
"evolution",
"=",
"pd"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter._get_2d_plot | Shows the plot using pylab. Usually I won't do imports in methods,
but since plotting is a fairly expensive library to load and not all
machines have matplotlib installed, I have done it this way. | pymatgen/analysis/phase_diagram.py | def _get_2d_plot(self, label_stable=True, label_unstable=True,
ordering=None, energy_colormap=None, vmin_mev=-60.0,
vmax_mev=60.0, show_colorbar=True,
process_attributes=False, plt=None):
"""
Shows the plot using pylab. Usually I won't do i... | def _get_2d_plot(self, label_stable=True, label_unstable=True,
ordering=None, energy_colormap=None, vmin_mev=-60.0,
vmax_mev=60.0, show_colorbar=True,
process_attributes=False, plt=None):
"""
Shows the plot using pylab. Usually I won't do i... | [
"Shows",
"the",
"plot",
"using",
"pylab",
".",
"Usually",
"I",
"won",
"t",
"do",
"imports",
"in",
"methods",
"but",
"since",
"plotting",
"is",
"a",
"fairly",
"expensive",
"library",
"to",
"load",
"and",
"not",
"all",
"machines",
"have",
"matplotlib",
"inst... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1462-L1636 | [
"def",
"_get_2d_plot",
"(",
"self",
",",
"label_stable",
"=",
"True",
",",
"label_unstable",
"=",
"True",
",",
"ordering",
"=",
"None",
",",
"energy_colormap",
"=",
"None",
",",
"vmin_mev",
"=",
"-",
"60.0",
",",
"vmax_mev",
"=",
"60.0",
",",
"show_colorba... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter._get_3d_plot | Shows the plot using pylab. Usually I won"t do imports in methods,
but since plotting is a fairly expensive library to load and not all
machines have matplotlib installed, I have done it this way. | pymatgen/analysis/phase_diagram.py | def _get_3d_plot(self, label_stable=True):
"""
Shows the plot using pylab. Usually I won"t do imports in methods,
but since plotting is a fairly expensive library to load and not all
machines have matplotlib installed, I have done it this way.
"""
import matplotlib.pyplo... | def _get_3d_plot(self, label_stable=True):
"""
Shows the plot using pylab. Usually I won"t do imports in methods,
but since plotting is a fairly expensive library to load and not all
machines have matplotlib installed, I have done it this way.
"""
import matplotlib.pyplo... | [
"Shows",
"the",
"plot",
"using",
"pylab",
".",
"Usually",
"I",
"won",
"t",
"do",
"imports",
"in",
"methods",
"but",
"since",
"plotting",
"is",
"a",
"fairly",
"expensive",
"library",
"to",
"load",
"and",
"not",
"all",
"machines",
"have",
"matplotlib",
"inst... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1638-L1670 | [
"def",
"_get_3d_plot",
"(",
"self",
",",
"label_stable",
"=",
"True",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"import",
"mpl_toolkits",
".",
"mplot3d",
".",
"axes3d",
"as",
"p3",
"from",
"matplotlib",
".",
"font_manager",
"import",
"Fon... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter.write_image | Writes the phase diagram to an image in a stream.
Args:
stream:
stream to write to. Can be a file stream or a StringIO stream.
image_format
format for image. Can be any of matplotlib supported formats.
Defaults to svg for best results for ... | pymatgen/analysis/phase_diagram.py | def write_image(self, stream, image_format="svg", **kwargs):
"""
Writes the phase diagram to an image in a stream.
Args:
stream:
stream to write to. Can be a file stream or a StringIO stream.
image_format
format for image. Can be any of ma... | def write_image(self, stream, image_format="svg", **kwargs):
"""
Writes the phase diagram to an image in a stream.
Args:
stream:
stream to write to. Can be a file stream or a StringIO stream.
image_format
format for image. Can be any of ma... | [
"Writes",
"the",
"phase",
"diagram",
"to",
"an",
"image",
"in",
"a",
"stream",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1672-L1689 | [
"def",
"write_image",
"(",
"self",
",",
"stream",
",",
"image_format",
"=",
"\"svg\"",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
"=",
"self",
".",
"get_plot",
"(",
"*",
"*",
"kwargs",
")",
"f",
"=",
"plt",
".",
"gcf",
"(",
")",
"f",
".",
"set_siz... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter.plot_chempot_range_map | Plot the chemical potential range _map. Currently works only for
3-component PDs.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges of
all Li-Co-O phases wrt to uLi and uO, you will ... | pymatgen/analysis/phase_diagram.py | def plot_chempot_range_map(self, elements, referenced=True):
"""
Plot the chemical potential range _map. Currently works only for
3-component PDs.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the st... | def plot_chempot_range_map(self, elements, referenced=True):
"""
Plot the chemical potential range _map. Currently works only for
3-component PDs.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the st... | [
"Plot",
"the",
"chemical",
"potential",
"range",
"_map",
".",
"Currently",
"works",
"only",
"for",
"3",
"-",
"component",
"PDs",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1691-L1704 | [
"def",
"plot_chempot_range_map",
"(",
"self",
",",
"elements",
",",
"referenced",
"=",
"True",
")",
":",
"self",
".",
"get_chempot_range_map_plot",
"(",
"elements",
",",
"referenced",
"=",
"referenced",
")",
".",
"show",
"(",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter.get_chempot_range_map_plot | Returns a plot of the chemical potential range _map. Currently works
only for 3-component PDs.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges of
all Li-Co-O phases wrt to uLi and ... | pymatgen/analysis/phase_diagram.py | def get_chempot_range_map_plot(self, elements, referenced=True):
"""
Returns a plot of the chemical potential range _map. Currently works
only for 3-component PDs.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you wa... | def get_chempot_range_map_plot(self, elements, referenced=True):
"""
Returns a plot of the chemical potential range _map. Currently works
only for 3-component PDs.
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you wa... | [
"Returns",
"a",
"plot",
"of",
"the",
"chemical",
"potential",
"range",
"_map",
".",
"Currently",
"works",
"only",
"for",
"3",
"-",
"component",
"PDs",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1706-L1809 | [
"def",
"get_chempot_range_map_plot",
"(",
"self",
",",
"elements",
",",
"referenced",
"=",
"True",
")",
":",
"plt",
"=",
"pretty_plot",
"(",
"12",
",",
"8",
")",
"chempot_ranges",
"=",
"self",
".",
"_pd",
".",
"get_chempot_range_map",
"(",
"elements",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PDPlotter.get_contour_pd_plot | Plot a contour phase diagram plot, where phase triangles are colored
according to degree of instability by interpolation. Currently only
works for 3-component phase diagrams.
Returns:
A matplotlib plot object. | pymatgen/analysis/phase_diagram.py | def get_contour_pd_plot(self):
"""
Plot a contour phase diagram plot, where phase triangles are colored
according to degree of instability by interpolation. Currently only
works for 3-component phase diagrams.
Returns:
A matplotlib plot object.
"""
fr... | def get_contour_pd_plot(self):
"""
Plot a contour phase diagram plot, where phase triangles are colored
according to degree of instability by interpolation. Currently only
works for 3-component phase diagrams.
Returns:
A matplotlib plot object.
"""
fr... | [
"Plot",
"a",
"contour",
"phase",
"diagram",
"plot",
"where",
"phase",
"triangles",
"are",
"colored",
"according",
"to",
"degree",
"of",
"instability",
"by",
"interpolation",
".",
"Currently",
"only",
"works",
"for",
"3",
"-",
"component",
"phase",
"diagrams",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1811-L1845 | [
"def",
"get_contour_pd_plot",
"(",
"self",
")",
":",
"from",
"scipy",
"import",
"interpolate",
"from",
"matplotlib",
"import",
"cm",
"pd",
"=",
"self",
".",
"_pd",
"entries",
"=",
"pd",
".",
"qhull_entries",
"data",
"=",
"np",
".",
"array",
"(",
"pd",
".... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbstractFeffInputSet.all_input | Returns all input files as a dict of {filename: feffio object} | pymatgen/io/feff/sets.py | def all_input(self):
"""
Returns all input files as a dict of {filename: feffio object}
"""
d = {"HEADER": self.header(), "PARAMETERS": self.tags}
if "RECIPROCAL" not in self.tags:
d.update({"POTENTIALS": self.potential, "ATOMS": self.atoms})
return d | def all_input(self):
"""
Returns all input files as a dict of {filename: feffio object}
"""
d = {"HEADER": self.header(), "PARAMETERS": self.tags}
if "RECIPROCAL" not in self.tags:
d.update({"POTENTIALS": self.potential, "ATOMS": self.atoms})
return d | [
"Returns",
"all",
"input",
"files",
"as",
"a",
"dict",
"of",
"{",
"filename",
":",
"feffio",
"object",
"}"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/sets.py#L87-L96 | [
"def",
"all_input",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"HEADER\"",
":",
"self",
".",
"header",
"(",
")",
",",
"\"PARAMETERS\"",
":",
"self",
".",
"tags",
"}",
"if",
"\"RECIPROCAL\"",
"not",
"in",
"self",
".",
"tags",
":",
"d",
".",
"update",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbstractFeffInputSet.write_input | Writes a set of FEFF input to a directory.
Args:
output_dir: Directory to output the FEFF input files
make_dir_if_not_present: Set to True if you want the directory (
and the whole path) to be created if it is not present. | pymatgen/io/feff/sets.py | def write_input(self, output_dir=".", make_dir_if_not_present=True):
"""
Writes a set of FEFF input to a directory.
Args:
output_dir: Directory to output the FEFF input files
make_dir_if_not_present: Set to True if you want the directory (
and the whole p... | def write_input(self, output_dir=".", make_dir_if_not_present=True):
"""
Writes a set of FEFF input to a directory.
Args:
output_dir: Directory to output the FEFF input files
make_dir_if_not_present: Set to True if you want the directory (
and the whole p... | [
"Writes",
"a",
"set",
"of",
"FEFF",
"input",
"to",
"a",
"directory",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/sets.py#L98-L127 | [
"def",
"write_input",
"(",
"self",
",",
"output_dir",
"=",
"\".\"",
",",
"make_dir_if_not_present",
"=",
"True",
")",
":",
"if",
"make_dir_if_not_present",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"output_dir",
")",
":",
"os",
".",
"makedirs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FEFFDictSet.tags | FEFF job parameters.
Returns:
Tags | pymatgen/io/feff/sets.py | def tags(self):
"""
FEFF job parameters.
Returns:
Tags
"""
if "RECIPROCAL" in self.config_dict:
if self.small_system:
self.config_dict["CIF"] = "{}.cif".format(
self.structure.formula.replace(" ", ""))
s... | def tags(self):
"""
FEFF job parameters.
Returns:
Tags
"""
if "RECIPROCAL" in self.config_dict:
if self.small_system:
self.config_dict["CIF"] = "{}.cif".format(
self.structure.formula.replace(" ", ""))
s... | [
"FEFF",
"job",
"parameters",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/sets.py#L192-L219 | [
"def",
"tags",
"(",
"self",
")",
":",
"if",
"\"RECIPROCAL\"",
"in",
"self",
".",
"config_dict",
":",
"if",
"self",
".",
"small_system",
":",
"self",
".",
"config_dict",
"[",
"\"CIF\"",
"]",
"=",
"\"{}.cif\"",
".",
"format",
"(",
"self",
".",
"structure",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FEFFDictSet.from_directory | Read in a set of FEFF input files from a directory, which is
useful when existing FEFF input needs some adjustment. | pymatgen/io/feff/sets.py | def from_directory(input_dir):
"""
Read in a set of FEFF input files from a directory, which is
useful when existing FEFF input needs some adjustment.
"""
sub_d = {}
for fname, ftype in [("HEADER", Header), ("PARAMETERS", Tags)]:
fullzpath = zpath(os.path.join... | def from_directory(input_dir):
"""
Read in a set of FEFF input files from a directory, which is
useful when existing FEFF input needs some adjustment.
"""
sub_d = {}
for fname, ftype in [("HEADER", Header), ("PARAMETERS", Tags)]:
fullzpath = zpath(os.path.join... | [
"Read",
"in",
"a",
"set",
"of",
"FEFF",
"input",
"files",
"from",
"a",
"directory",
"which",
"is",
"useful",
"when",
"existing",
"FEFF",
"input",
"needs",
"some",
"adjustment",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/feff/sets.py#L249-L304 | [
"def",
"from_directory",
"(",
"input_dir",
")",
":",
"sub_d",
"=",
"{",
"}",
"for",
"fname",
",",
"ftype",
"in",
"[",
"(",
"\"HEADER\"",
",",
"Header",
")",
",",
"(",
"\"PARAMETERS\"",
",",
"Tags",
")",
"]",
":",
"fullzpath",
"=",
"zpath",
"(",
"os",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | function_comparison | Method that compares two functions
Args:
f1: First function to compare
f2: Second function to compare
x1: Lower bound of the interval to compare
x2: Upper bound of the interval to compare
numpoints_check: Number of points used to compare the functions... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def function_comparison(f1, f2, x1, x2, numpoints_check=500):
"""
Method that compares two functions
Args:
f1: First function to compare
f2: Second function to compare
x1: Lower bound of the interval to compare
x2: Upper bound of the interval to compa... | def function_comparison(f1, f2, x1, x2, numpoints_check=500):
"""
Method that compares two functions
Args:
f1: First function to compare
f2: Second function to compare
x1: Lower bound of the interval to compare
x2: Upper bound of the interval to compa... | [
"Method",
"that",
"compares",
"two",
"functions"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L55-L86 | [
"def",
"function_comparison",
"(",
"f1",
",",
"f2",
",",
"x1",
",",
"x2",
",",
"numpoints_check",
"=",
"500",
")",
":",
"xx",
"=",
"np",
".",
"linspace",
"(",
"x1",
",",
"x2",
",",
"num",
"=",
"numpoints_check",
")",
"y1",
"=",
"f1",
"(",
"xx",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | quarter_ellipsis_functions | Method that creates two quarter-ellipse functions based on points xx and yy. The ellipsis is supposed to
be aligned with the axes. The two ellipsis pass through the two points xx and yy.
Args:
xx:
First point
yy:
Second point
Returns:
A dictionary with the l... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def quarter_ellipsis_functions(xx, yy):
"""
Method that creates two quarter-ellipse functions based on points xx and yy. The ellipsis is supposed to
be aligned with the axes. The two ellipsis pass through the two points xx and yy.
Args:
xx:
First point
yy:
Second... | def quarter_ellipsis_functions(xx, yy):
"""
Method that creates two quarter-ellipse functions based on points xx and yy. The ellipsis is supposed to
be aligned with the axes. The two ellipsis pass through the two points xx and yy.
Args:
xx:
First point
yy:
Second... | [
"Method",
"that",
"creates",
"two",
"quarter",
"-",
"ellipse",
"functions",
"based",
"on",
"points",
"xx",
"and",
"yy",
".",
"The",
"ellipsis",
"is",
"supposed",
"to",
"be",
"aligned",
"with",
"the",
"axes",
".",
"The",
"two",
"ellipsis",
"pass",
"through"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L89-L135 | [
"def",
"quarter_ellipsis_functions",
"(",
"xx",
",",
"yy",
")",
":",
"npxx",
"=",
"np",
".",
"array",
"(",
"xx",
")",
"npyy",
"=",
"np",
".",
"array",
"(",
"yy",
")",
"if",
"np",
".",
"any",
"(",
"npxx",
"==",
"npyy",
")",
":",
"raise",
"RuntimeE... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | spline_functions | Method that creates two (upper and lower) spline functions based on points lower_points and upper_points.
Args:
lower_points:
Points defining the lower function.
upper_points:
Points defining the upper function.
degree:
Degree for the spline function
... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def spline_functions(lower_points, upper_points, degree=3):
"""
Method that creates two (upper and lower) spline functions based on points lower_points and upper_points.
Args:
lower_points:
Points defining the lower function.
upper_points:
Points defining the upper f... | def spline_functions(lower_points, upper_points, degree=3):
"""
Method that creates two (upper and lower) spline functions based on points lower_points and upper_points.
Args:
lower_points:
Points defining the lower function.
upper_points:
Points defining the upper f... | [
"Method",
"that",
"creates",
"two",
"(",
"upper",
"and",
"lower",
")",
"spline",
"functions",
"based",
"on",
"points",
"lower_points",
"and",
"upper_points",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L138-L167 | [
"def",
"spline_functions",
"(",
"lower_points",
",",
"upper_points",
",",
"degree",
"=",
"3",
")",
":",
"lower_xx",
"=",
"np",
".",
"array",
"(",
"[",
"pp",
"[",
"0",
"]",
"for",
"pp",
"in",
"lower_points",
"]",
")",
"lower_yy",
"=",
"np",
".",
"arra... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | diamond_functions | Method that creates two upper and lower functions based on points xx and yy
as well as intercepts defined by y_x0 and x_y0. The resulting functions
form kind of a distorted diamond-like structure aligned from
point xx to point yy.
Schematically :
xx is symbolized by x, yy is symbolized by y, y_x0 ... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def diamond_functions(xx, yy, y_x0, x_y0):
"""
Method that creates two upper and lower functions based on points xx and yy
as well as intercepts defined by y_x0 and x_y0. The resulting functions
form kind of a distorted diamond-like structure aligned from
point xx to point yy.
Schematically :
... | def diamond_functions(xx, yy, y_x0, x_y0):
"""
Method that creates two upper and lower functions based on points xx and yy
as well as intercepts defined by y_x0 and x_y0. The resulting functions
form kind of a distorted diamond-like structure aligned from
point xx to point yy.
Schematically :
... | [
"Method",
"that",
"creates",
"two",
"upper",
"and",
"lower",
"functions",
"based",
"on",
"points",
"xx",
"and",
"yy",
"as",
"well",
"as",
"intercepts",
"defined",
"by",
"y_x0",
"and",
"x_y0",
".",
"The",
"resulting",
"functions",
"form",
"kind",
"of",
"a",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L170-L253 | [
"def",
"diamond_functions",
"(",
"xx",
",",
"yy",
",",
"y_x0",
",",
"x_y0",
")",
":",
"npxx",
"=",
"np",
".",
"array",
"(",
"xx",
")",
"npyy",
"=",
"np",
".",
"array",
"(",
"yy",
")",
"if",
"np",
".",
"any",
"(",
"npxx",
"==",
"npyy",
")",
":... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | rectangle_surface_intersection | Method to calculate the surface of the intersection of a rectangle (aligned with axes) and another surface
defined by two functions f_lower and f_upper.
Args:
rectangle:
Rectangle defined as : ((x1, x2), (y1, y2)).
f_lower:
Function defining the lower bound of the surfac... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def rectangle_surface_intersection(rectangle, f_lower, f_upper,
bounds_lower=None, bounds_upper=None,
check=True, numpoints_check=500):
"""
Method to calculate the surface of the intersection of a rectangle (aligned with axes) and another sur... | def rectangle_surface_intersection(rectangle, f_lower, f_upper,
bounds_lower=None, bounds_upper=None,
check=True, numpoints_check=500):
"""
Method to calculate the surface of the intersection of a rectangle (aligned with axes) and another sur... | [
"Method",
"to",
"calculate",
"the",
"surface",
"of",
"the",
"intersection",
"of",
"a",
"rectangle",
"(",
"aligned",
"with",
"axes",
")",
"and",
"another",
"surface",
"defined",
"by",
"two",
"functions",
"f_lower",
"and",
"f_upper",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L256-L336 | [
"def",
"rectangle_surface_intersection",
"(",
"rectangle",
",",
"f_lower",
",",
"f_upper",
",",
"bounds_lower",
"=",
"None",
",",
"bounds_upper",
"=",
"None",
",",
"check",
"=",
"True",
",",
"numpoints_check",
"=",
"500",
")",
":",
"x1",
"=",
"np",
".",
"m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | my_solid_angle | Helper method to calculate the solid angle of a set of coords from the
center.
Args:
center:
Center to measure solid angle from.
coords:
List of coords to determine solid angle.
Returns:
The solid angle. | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def my_solid_angle(center, coords):
"""
Helper method to calculate the solid angle of a set of coords from the
center.
Args:
center:
Center to measure solid angle from.
coords:
List of coords to determine solid angle.
Returns:
The solid angle.
""... | def my_solid_angle(center, coords):
"""
Helper method to calculate the solid angle of a set of coords from the
center.
Args:
center:
Center to measure solid angle from.
coords:
List of coords to determine solid angle.
Returns:
The solid angle.
""... | [
"Helper",
"method",
"to",
"calculate",
"the",
"solid",
"angle",
"of",
"a",
"set",
"of",
"coords",
"from",
"the",
"center",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L338-L370 | [
"def",
"my_solid_angle",
"(",
"center",
",",
"coords",
")",
":",
"o",
"=",
"np",
".",
"array",
"(",
"center",
")",
"r",
"=",
"[",
"np",
".",
"array",
"(",
"c",
")",
"-",
"o",
"for",
"c",
"in",
"coords",
"]",
"r",
".",
"append",
"(",
"r",
"[",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | vectorsToMatrix | Performs the vector multiplication of the elements of two vectors, constructing the 3x3 matrix.
:param aa: One vector of size 3
:param bb: Another vector of size 3
:return: A 3x3 matrix M composed of the products of the elements of aa and bb :
M_ij = aa_i * bb_j | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def vectorsToMatrix(aa, bb):
"""
Performs the vector multiplication of the elements of two vectors, constructing the 3x3 matrix.
:param aa: One vector of size 3
:param bb: Another vector of size 3
:return: A 3x3 matrix M composed of the products of the elements of aa and bb :
M_ij = aa_i * bb_j... | def vectorsToMatrix(aa, bb):
"""
Performs the vector multiplication of the elements of two vectors, constructing the 3x3 matrix.
:param aa: One vector of size 3
:param bb: Another vector of size 3
:return: A 3x3 matrix M composed of the products of the elements of aa and bb :
M_ij = aa_i * bb_j... | [
"Performs",
"the",
"vector",
"multiplication",
"of",
"the",
"elements",
"of",
"two",
"vectors",
"constructing",
"the",
"3x3",
"matrix",
".",
":",
"param",
"aa",
":",
"One",
"vector",
"of",
"size",
"3",
":",
"param",
"bb",
":",
"Another",
"vector",
"of",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L373-L385 | [
"def",
"vectorsToMatrix",
"(",
"aa",
",",
"bb",
")",
":",
"MM",
"=",
"np",
".",
"zeros",
"(",
"[",
"3",
",",
"3",
"]",
",",
"np",
".",
"float",
")",
"for",
"ii",
"in",
"range",
"(",
"3",
")",
":",
"for",
"jj",
"in",
"range",
"(",
"3",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | rotateCoords | Rotate the list of points using rotation matrix R
:param coords: List of points to be rotated
:param R: Rotation matrix
:return: List of rotated points | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def rotateCoords(coords, R):
"""
Rotate the list of points using rotation matrix R
:param coords: List of points to be rotated
:param R: Rotation matrix
:return: List of rotated points
"""
newlist = list()
for pp in coords:
rpp = matrixTimesVector(R, pp)
newlist.append(rp... | def rotateCoords(coords, R):
"""
Rotate the list of points using rotation matrix R
:param coords: List of points to be rotated
:param R: Rotation matrix
:return: List of rotated points
"""
newlist = list()
for pp in coords:
rpp = matrixTimesVector(R, pp)
newlist.append(rp... | [
"Rotate",
"the",
"list",
"of",
"points",
"using",
"rotation",
"matrix",
"R",
":",
"param",
"coords",
":",
"List",
"of",
"points",
"to",
"be",
"rotated",
":",
"param",
"R",
":",
"Rotation",
"matrix",
":",
"return",
":",
"List",
"of",
"rotated",
"points"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L401-L412 | [
"def",
"rotateCoords",
"(",
"coords",
",",
"R",
")",
":",
"newlist",
"=",
"list",
"(",
")",
"for",
"pp",
"in",
"coords",
":",
"rpp",
"=",
"matrixTimesVector",
"(",
"R",
",",
"pp",
")",
"newlist",
".",
"append",
"(",
"rpp",
")",
"return",
"newlist"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | changebasis | For a list of points given in standard coordinates (in terms of e1, e2 and e3), returns the same list
expressed in the basis (uu, vv, nn), which is supposed to be orthonormal.
:param uu: First vector of the basis
:param vv: Second vector of the basis
:param nn: Third vector of the bais
:param pps: L... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def changebasis(uu, vv, nn, pps):
"""
For a list of points given in standard coordinates (in terms of e1, e2 and e3), returns the same list
expressed in the basis (uu, vv, nn), which is supposed to be orthonormal.
:param uu: First vector of the basis
:param vv: Second vector of the basis
:param ... | def changebasis(uu, vv, nn, pps):
"""
For a list of points given in standard coordinates (in terms of e1, e2 and e3), returns the same list
expressed in the basis (uu, vv, nn), which is supposed to be orthonormal.
:param uu: First vector of the basis
:param vv: Second vector of the basis
:param ... | [
"For",
"a",
"list",
"of",
"points",
"given",
"in",
"standard",
"coordinates",
"(",
"in",
"terms",
"of",
"e1",
"e2",
"and",
"e3",
")",
"returns",
"the",
"same",
"list",
"expressed",
"in",
"the",
"basis",
"(",
"uu",
"vv",
"nn",
")",
"which",
"is",
"sup... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L425-L444 | [
"def",
"changebasis",
"(",
"uu",
",",
"vv",
",",
"nn",
",",
"pps",
")",
":",
"MM",
"=",
"np",
".",
"zeros",
"(",
"[",
"3",
",",
"3",
"]",
",",
"np",
".",
"float",
")",
"for",
"ii",
"in",
"range",
"(",
"3",
")",
":",
"MM",
"[",
"ii",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | collinear | Checks if the three points p1, p2 and p3 are collinear or not within a given tolerance. The collinearity is
checked by computing the area of the triangle defined by the three points p1, p2 and p3. If the area of this
triangle is less than (tolerance x largest_triangle), then the three points are considered coll... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def collinear(p1, p2, p3=None, tolerance=0.25):
"""
Checks if the three points p1, p2 and p3 are collinear or not within a given tolerance. The collinearity is
checked by computing the area of the triangle defined by the three points p1, p2 and p3. If the area of this
triangle is less than (tolerance x ... | def collinear(p1, p2, p3=None, tolerance=0.25):
"""
Checks if the three points p1, p2 and p3 are collinear or not within a given tolerance. The collinearity is
checked by computing the area of the triangle defined by the three points p1, p2 and p3. If the area of this
triangle is less than (tolerance x ... | [
"Checks",
"if",
"the",
"three",
"points",
"p1",
"p2",
"and",
"p3",
"are",
"collinear",
"or",
"not",
"within",
"a",
"given",
"tolerance",
".",
"The",
"collinearity",
"is",
"checked",
"by",
"computing",
"the",
"area",
"of",
"the",
"triangle",
"defined",
"by"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L447-L467 | [
"def",
"collinear",
"(",
"p1",
",",
"p2",
",",
"p3",
"=",
"None",
",",
"tolerance",
"=",
"0.25",
")",
":",
"if",
"p3",
"is",
"None",
":",
"triangle_area",
"=",
"0.5",
"*",
"np",
".",
"linalg",
".",
"norm",
"(",
"np",
".",
"cross",
"(",
"p1",
",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | anticlockwise_sort | Sort a list of 2D points in anticlockwise order
:param pps: List of points to be sorted
:return: Sorted list of points | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def anticlockwise_sort(pps):
"""
Sort a list of 2D points in anticlockwise order
:param pps: List of points to be sorted
:return: Sorted list of points
"""
newpps = list()
angles = np.zeros(len(pps), np.float)
for ipp, pp in enumerate(pps):
angles[ipp] = np.arctan2(pp[1], pp[0])
... | def anticlockwise_sort(pps):
"""
Sort a list of 2D points in anticlockwise order
:param pps: List of points to be sorted
:return: Sorted list of points
"""
newpps = list()
angles = np.zeros(len(pps), np.float)
for ipp, pp in enumerate(pps):
angles[ipp] = np.arctan2(pp[1], pp[0])
... | [
"Sort",
"a",
"list",
"of",
"2D",
"points",
"in",
"anticlockwise",
"order",
":",
"param",
"pps",
":",
"List",
"of",
"points",
"to",
"be",
"sorted",
":",
"return",
":",
"Sorted",
"list",
"of",
"points"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L470-L483 | [
"def",
"anticlockwise_sort",
"(",
"pps",
")",
":",
"newpps",
"=",
"list",
"(",
")",
"angles",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"pps",
")",
",",
"np",
".",
"float",
")",
"for",
"ipp",
",",
"pp",
"in",
"enumerate",
"(",
"pps",
")",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | anticlockwise_sort_indices | Returns the indices that would sort a list of 2D points in anticlockwise order
:param pps: List of points to be sorted
:return: Indices of the sorted list of points | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def anticlockwise_sort_indices(pps):
"""
Returns the indices that would sort a list of 2D points in anticlockwise order
:param pps: List of points to be sorted
:return: Indices of the sorted list of points
"""
angles = np.zeros(len(pps), np.float)
for ipp, pp in enumerate(pps):
angle... | def anticlockwise_sort_indices(pps):
"""
Returns the indices that would sort a list of 2D points in anticlockwise order
:param pps: List of points to be sorted
:return: Indices of the sorted list of points
"""
angles = np.zeros(len(pps), np.float)
for ipp, pp in enumerate(pps):
angle... | [
"Returns",
"the",
"indices",
"that",
"would",
"sort",
"a",
"list",
"of",
"2D",
"points",
"in",
"anticlockwise",
"order",
":",
"param",
"pps",
":",
"List",
"of",
"points",
"to",
"be",
"sorted",
":",
"return",
":",
"Indices",
"of",
"the",
"sorted",
"list",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L486-L495 | [
"def",
"anticlockwise_sort_indices",
"(",
"pps",
")",
":",
"angles",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"pps",
")",
",",
"np",
".",
"float",
")",
"for",
"ipp",
",",
"pp",
"in",
"enumerate",
"(",
"pps",
")",
":",
"angles",
"[",
"ipp",
"]",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | separation_in_list | Checks if the separation indices of a plane are already in the list
:param separation_indices: list of separation indices (three arrays of integers)
:param separation_indices_list: list of the list of separation indices to be compared to
:return: True if the separation indices are already in the list, False... | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def separation_in_list(separation_indices, separation_indices_list):
"""
Checks if the separation indices of a plane are already in the list
:param separation_indices: list of separation indices (three arrays of integers)
:param separation_indices_list: list of the list of separation indices to be compa... | def separation_in_list(separation_indices, separation_indices_list):
"""
Checks if the separation indices of a plane are already in the list
:param separation_indices: list of separation indices (three arrays of integers)
:param separation_indices_list: list of the list of separation indices to be compa... | [
"Checks",
"if",
"the",
"separation",
"indices",
"of",
"a",
"plane",
"are",
"already",
"in",
"the",
"list",
":",
"param",
"separation_indices",
":",
"list",
"of",
"separation",
"indices",
"(",
"three",
"arrays",
"of",
"integers",
")",
":",
"param",
"separatio... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L510-L521 | [
"def",
"separation_in_list",
"(",
"separation_indices",
",",
"separation_indices_list",
")",
":",
"sorted_separation",
"=",
"sort_separation",
"(",
"separation_indices",
")",
"for",
"sep",
"in",
"separation_indices_list",
":",
"if",
"len",
"(",
"sep",
"[",
"1",
"]",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | is_anion_cation_bond | Checks if two given sites are an anion and a cation.
:param valences: list of site valences
:param ii: index of a site
:param jj: index of another site
:return: True if one site is an anion and the other is a cation (from the valences) | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def is_anion_cation_bond(valences, ii, jj):
"""
Checks if two given sites are an anion and a cation.
:param valences: list of site valences
:param ii: index of a site
:param jj: index of another site
:return: True if one site is an anion and the other is a cation (from the valences)
"""
... | def is_anion_cation_bond(valences, ii, jj):
"""
Checks if two given sites are an anion and a cation.
:param valences: list of site valences
:param ii: index of a site
:param jj: index of another site
:return: True if one site is an anion and the other is a cation (from the valences)
"""
... | [
"Checks",
"if",
"two",
"given",
"sites",
"are",
"an",
"anion",
"and",
"a",
"cation",
".",
":",
"param",
"valences",
":",
"list",
"of",
"site",
"valences",
":",
"param",
"ii",
":",
"index",
"of",
"a",
"site",
":",
"param",
"jj",
":",
"index",
"of",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L524-L536 | [
"def",
"is_anion_cation_bond",
"(",
"valences",
",",
"ii",
",",
"jj",
")",
":",
"if",
"valences",
"==",
"'undefined'",
":",
"return",
"True",
"if",
"valences",
"[",
"ii",
"]",
"==",
"0",
"or",
"valences",
"[",
"jj",
"]",
"==",
"0",
":",
"return",
"Tr... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Plane.is_in_plane | Determines if point pp is in the plane within the tolerance dist_tolerance
:param pp: point to be tested
:param dist_tolerance: tolerance on the distance to the plane within which point pp is considered in the plane
:return: True if pp is in the plane, False otherwise | pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py | def is_in_plane(self, pp, dist_tolerance):
"""
Determines if point pp is in the plane within the tolerance dist_tolerance
:param pp: point to be tested
:param dist_tolerance: tolerance on the distance to the plane within which point pp is considered in the plane
:return: True if ... | def is_in_plane(self, pp, dist_tolerance):
"""
Determines if point pp is in the plane within the tolerance dist_tolerance
:param pp: point to be tested
:param dist_tolerance: tolerance on the distance to the plane within which point pp is considered in the plane
:return: True if ... | [
"Determines",
"if",
"point",
"pp",
"is",
"in",
"the",
"plane",
"within",
"the",
"tolerance",
"dist_tolerance",
":",
"param",
"pp",
":",
"point",
"to",
"be",
"tested",
":",
"param",
"dist_tolerance",
":",
"tolerance",
"on",
"the",
"distance",
"to",
"the",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py#L634-L641 | [
"def",
"is_in_plane",
"(",
"self",
",",
"pp",
",",
"dist_tolerance",
")",
":",
"return",
"np",
".",
"abs",
"(",
"np",
".",
"dot",
"(",
"self",
".",
"normal_vector",
",",
"pp",
")",
"+",
"self",
".",
"_coefficients",
"[",
"3",
"]",
")",
"<=",
"dist_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.