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 | Kpoint.as_dict | Json-serializable dict representation of a kpoint | pymatgen/electronic_structure/bandstructure.py | def as_dict(self):
"""
Json-serializable dict representation of a kpoint
"""
return {"lattice": self.lattice.as_dict(),
"fcoords": list(self.frac_coords),
"ccoords": list(self.cart_coords), "label": self.label,
"@module": self.__class__.__m... | def as_dict(self):
"""
Json-serializable dict representation of a kpoint
"""
return {"lattice": self.lattice.as_dict(),
"fcoords": list(self.frac_coords),
"ccoords": list(self.cart_coords), "label": self.label,
"@module": self.__class__.__m... | [
"Json",
"-",
"serializable",
"dict",
"representation",
"of",
"a",
"kpoint"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L122-L130 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"lattice\"",
":",
"self",
".",
"lattice",
".",
"as_dict",
"(",
")",
",",
"\"fcoords\"",
":",
"list",
"(",
"self",
".",
"frac_coords",
")",
",",
"\"ccoords\"",
":",
"list",
"(",
"self",
".",
"c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_projection_on_elements | Method returning a dictionary of projections on elements.
Returns:
a dictionary in the {Spin.up:[][{Element:values}],
Spin.down:[][{Element:values}]} format
if there is no projections in the band structure
returns an empty dict | pymatgen/electronic_structure/bandstructure.py | def get_projection_on_elements(self):
"""
Method returning a dictionary of projections on elements.
Returns:
a dictionary in the {Spin.up:[][{Element:values}],
Spin.down:[][{Element:values}]} format
if there is no projections in the band structure
... | def get_projection_on_elements(self):
"""
Method returning a dictionary of projections on elements.
Returns:
a dictionary in the {Spin.up:[][{Element:values}],
Spin.down:[][{Element:values}]} format
if there is no projections in the band structure
... | [
"Method",
"returning",
"a",
"dictionary",
"of",
"projections",
"on",
"elements",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L233-L254 | [
"def",
"get_projection_on_elements",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"structure",
"=",
"self",
".",
"structure",
"for",
"spin",
",",
"v",
"in",
"self",
".",
"projections",
".",
"items",
"(",
")",
":",
"result",
"[",
"spin",
"]",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_projections_on_elements_and_orbitals | Method returning a dictionary of projections on elements and specific
orbitals
Args:
el_orb_spec: A dictionary of Elements and Orbitals for which we want
to have projections on. It is given as: {Element:[orbitals]},
e.g., {'Cu':['d','s']}
Returns:
... | pymatgen/electronic_structure/bandstructure.py | def get_projections_on_elements_and_orbitals(self, el_orb_spec):
"""
Method returning a dictionary of projections on elements and specific
orbitals
Args:
el_orb_spec: A dictionary of Elements and Orbitals for which we want
to have projections on. It is given ... | def get_projections_on_elements_and_orbitals(self, el_orb_spec):
"""
Method returning a dictionary of projections on elements and specific
orbitals
Args:
el_orb_spec: A dictionary of Elements and Orbitals for which we want
to have projections on. It is given ... | [
"Method",
"returning",
"a",
"dictionary",
"of",
"projections",
"on",
"elements",
"and",
"specific",
"orbitals"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L256-L292 | [
"def",
"get_projections_on_elements_and_orbitals",
"(",
"self",
",",
"el_orb_spec",
")",
":",
"result",
"=",
"{",
"}",
"structure",
"=",
"self",
".",
"structure",
"el_orb_spec",
"=",
"{",
"get_el_sp",
"(",
"el",
")",
":",
"orbs",
"for",
"el",
",",
"orbs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.is_metal | Check if the band structure indicates a metal by looking if the fermi
level crosses a band.
Returns:
True if a metal, False if not | pymatgen/electronic_structure/bandstructure.py | def is_metal(self, efermi_tol=1e-4):
"""
Check if the band structure indicates a metal by looking if the fermi
level crosses a band.
Returns:
True if a metal, False if not
"""
for spin, values in self.bands.items():
for i in range(self.nb_bands):
... | def is_metal(self, efermi_tol=1e-4):
"""
Check if the band structure indicates a metal by looking if the fermi
level crosses a band.
Returns:
True if a metal, False if not
"""
for spin, values in self.bands.items():
for i in range(self.nb_bands):
... | [
"Check",
"if",
"the",
"band",
"structure",
"indicates",
"a",
"metal",
"by",
"looking",
"if",
"the",
"fermi",
"level",
"crosses",
"a",
"band",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L294-L307 | [
"def",
"is_metal",
"(",
"self",
",",
"efermi_tol",
"=",
"1e-4",
")",
":",
"for",
"spin",
",",
"values",
"in",
"self",
".",
"bands",
".",
"items",
"(",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nb_bands",
")",
":",
"if",
"np",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_vbm | Returns data about the VBM.
Returns:
dict as {"band_index","kpoint_index","kpoint","energy"}
- "band_index": A dict with spin keys pointing to a list of the
indices of the band containing the VBM (please note that you
can have several bands sharing the VBM) {Spin... | pymatgen/electronic_structure/bandstructure.py | def get_vbm(self):
"""
Returns data about the VBM.
Returns:
dict as {"band_index","kpoint_index","kpoint","energy"}
- "band_index": A dict with spin keys pointing to a list of the
indices of the band containing the VBM (please note that you
can ha... | def get_vbm(self):
"""
Returns data about the VBM.
Returns:
dict as {"band_index","kpoint_index","kpoint","energy"}
- "band_index": A dict with spin keys pointing to a list of the
indices of the band containing the VBM (please note that you
can ha... | [
"Returns",
"data",
"about",
"the",
"VBM",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L309-L365 | [
"def",
"get_vbm",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_metal",
"(",
")",
":",
"return",
"{",
"\"band_index\"",
":",
"[",
"]",
",",
"\"kpoint_index\"",
":",
"[",
"]",
",",
"\"kpoint\"",
":",
"[",
"]",
",",
"\"energy\"",
":",
"None",
",",
"\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_cbm | Returns data about the CBM.
Returns:
{"band_index","kpoint_index","kpoint","energy"}
- "band_index": A dict with spin keys pointing to a list of the
indices of the band containing the VBM (please note that you
can have several bands sharing the VBM) {Spin.up:[],
... | pymatgen/electronic_structure/bandstructure.py | def get_cbm(self):
"""
Returns data about the CBM.
Returns:
{"band_index","kpoint_index","kpoint","energy"}
- "band_index": A dict with spin keys pointing to a list of the
indices of the band containing the VBM (please note that you
can have sever... | def get_cbm(self):
"""
Returns data about the CBM.
Returns:
{"band_index","kpoint_index","kpoint","energy"}
- "band_index": A dict with spin keys pointing to a list of the
indices of the band containing the VBM (please note that you
can have sever... | [
"Returns",
"data",
"about",
"the",
"CBM",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L367-L426 | [
"def",
"get_cbm",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_metal",
"(",
")",
":",
"return",
"{",
"\"band_index\"",
":",
"[",
"]",
",",
"\"kpoint_index\"",
":",
"[",
"]",
",",
"\"kpoint\"",
":",
"[",
"]",
",",
"\"energy\"",
":",
"None",
",",
"\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_band_gap | Returns band gap data.
Returns:
A dict {"energy","direct","transition"}:
"energy": band gap energy
"direct": A boolean telling if the gap is direct or not
"transition": kpoint labels of the transition (e.g., "\\Gamma-X") | pymatgen/electronic_structure/bandstructure.py | def get_band_gap(self):
"""
Returns band gap data.
Returns:
A dict {"energy","direct","transition"}:
"energy": band gap energy
"direct": A boolean telling if the gap is direct or not
"transition": kpoint labels of the transition (e.g., "\\Gamma-X"... | def get_band_gap(self):
"""
Returns band gap data.
Returns:
A dict {"energy","direct","transition"}:
"energy": band gap energy
"direct": A boolean telling if the gap is direct or not
"transition": kpoint labels of the transition (e.g., "\\Gamma-X"... | [
"Returns",
"band",
"gap",
"data",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L428-L458 | [
"def",
"get_band_gap",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_metal",
"(",
")",
":",
"return",
"{",
"\"energy\"",
":",
"0.0",
",",
"\"direct\"",
":",
"False",
",",
"\"transition\"",
":",
"None",
"}",
"cbm",
"=",
"self",
".",
"get_cbm",
"(",
")... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_direct_band_gap_dict | Returns a dictionary of information about the direct
band gap
Returns:
a dictionary of the band gaps indexed by spin
along with their band indices and k-point index | pymatgen/electronic_structure/bandstructure.py | def get_direct_band_gap_dict(self):
"""
Returns a dictionary of information about the direct
band gap
Returns:
a dictionary of the band gaps indexed by spin
along with their band indices and k-point index
"""
if self.is_metal():
raise ... | def get_direct_band_gap_dict(self):
"""
Returns a dictionary of information about the direct
band gap
Returns:
a dictionary of the band gaps indexed by spin
along with their band indices and k-point index
"""
if self.is_metal():
raise ... | [
"Returns",
"a",
"dictionary",
"of",
"information",
"about",
"the",
"direct",
"band",
"gap"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L460-L485 | [
"def",
"get_direct_band_gap_dict",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_metal",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"get_direct_band_gap_dict should\"",
"\"only be used with non-metals\"",
")",
"direct_gap_dict",
"=",
"{",
"}",
"for",
"spin",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_direct_band_gap | Returns the direct band gap.
Returns:
the value of the direct band gap | pymatgen/electronic_structure/bandstructure.py | def get_direct_band_gap(self):
"""
Returns the direct band gap.
Returns:
the value of the direct band gap
"""
if self.is_metal():
return 0.0
dg = self.get_direct_band_gap_dict()
return min(v['value'] for v in dg.values()) | def get_direct_band_gap(self):
"""
Returns the direct band gap.
Returns:
the value of the direct band gap
"""
if self.is_metal():
return 0.0
dg = self.get_direct_band_gap_dict()
return min(v['value'] for v in dg.values()) | [
"Returns",
"the",
"direct",
"band",
"gap",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L487-L497 | [
"def",
"get_direct_band_gap",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_metal",
"(",
")",
":",
"return",
"0.0",
"dg",
"=",
"self",
".",
"get_direct_band_gap_dict",
"(",
")",
"return",
"min",
"(",
"v",
"[",
"'value'",
"]",
"for",
"v",
"in",
"dg",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_sym_eq_kpoints | Returns a list of unique symmetrically equivalent k-points.
Args:
kpoint (1x3 array): coordinate of the k-point
cartesian (bool): kpoint is in cartesian or fractional coordinates
tol (float): tolerance below which coordinates are considered equal
Returns:
... | pymatgen/electronic_structure/bandstructure.py | def get_sym_eq_kpoints(self, kpoint, cartesian=False, tol=1e-2):
"""
Returns a list of unique symmetrically equivalent k-points.
Args:
kpoint (1x3 array): coordinate of the k-point
cartesian (bool): kpoint is in cartesian or fractional coordinates
tol (float)... | def get_sym_eq_kpoints(self, kpoint, cartesian=False, tol=1e-2):
"""
Returns a list of unique symmetrically equivalent k-points.
Args:
kpoint (1x3 array): coordinate of the k-point
cartesian (bool): kpoint is in cartesian or fractional coordinates
tol (float)... | [
"Returns",
"a",
"list",
"of",
"unique",
"symmetrically",
"equivalent",
"k",
"-",
"points",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L499-L523 | [
"def",
"get_sym_eq_kpoints",
"(",
"self",
",",
"kpoint",
",",
"cartesian",
"=",
"False",
",",
"tol",
"=",
"1e-2",
")",
":",
"if",
"not",
"self",
".",
"structure",
":",
"return",
"None",
"sg",
"=",
"SpacegroupAnalyzer",
"(",
"self",
".",
"structure",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.get_kpoint_degeneracy | Returns degeneracy of a given k-point based on structure symmetry
Args:
kpoint (1x3 array): coordinate of the k-point
cartesian (bool): kpoint is in cartesian or fractional coordinates
tol (float): tolerance below which coordinates are considered equal
Returns:
... | pymatgen/electronic_structure/bandstructure.py | def get_kpoint_degeneracy(self, kpoint, cartesian=False, tol=1e-2):
"""
Returns degeneracy of a given k-point based on structure symmetry
Args:
kpoint (1x3 array): coordinate of the k-point
cartesian (bool): kpoint is in cartesian or fractional coordinates
tol... | def get_kpoint_degeneracy(self, kpoint, cartesian=False, tol=1e-2):
"""
Returns degeneracy of a given k-point based on structure symmetry
Args:
kpoint (1x3 array): coordinate of the k-point
cartesian (bool): kpoint is in cartesian or fractional coordinates
tol... | [
"Returns",
"degeneracy",
"of",
"a",
"given",
"k",
"-",
"point",
"based",
"on",
"structure",
"symmetry",
"Args",
":",
"kpoint",
"(",
"1x3",
"array",
")",
":",
"coordinate",
"of",
"the",
"k",
"-",
"point",
"cartesian",
"(",
"bool",
")",
":",
"kpoint",
"i... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L525-L538 | [
"def",
"get_kpoint_degeneracy",
"(",
"self",
",",
"kpoint",
",",
"cartesian",
"=",
"False",
",",
"tol",
"=",
"1e-2",
")",
":",
"all_kpts",
"=",
"self",
".",
"get_sym_eq_kpoints",
"(",
"kpoint",
",",
"cartesian",
",",
"tol",
"=",
"tol",
")",
"if",
"all_kp... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructure.from_dict | Create from dict.
Args:
A dict with all data for a band structure object.
Returns:
A BandStructure object | pymatgen/electronic_structure/bandstructure.py | def from_dict(cls, d):
"""
Create from dict.
Args:
A dict with all data for a band structure object.
Returns:
A BandStructure object
"""
labels_dict = d['labels_dict']
projections = {}
structure = None
if isinstance(list(d... | def from_dict(cls, d):
"""
Create from dict.
Args:
A dict with all data for a band structure object.
Returns:
A BandStructure object
"""
labels_dict = d['labels_dict']
projections = {}
structure = None
if isinstance(list(d... | [
"Create",
"from",
"dict",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L582-L609 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"labels_dict",
"=",
"d",
"[",
"'labels_dict'",
"]",
"projections",
"=",
"{",
"}",
"structure",
"=",
"None",
"if",
"isinstance",
"(",
"list",
"(",
"d",
"[",
"'bands'",
"]",
".",
"values",
"(",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureSymmLine.get_equivalent_kpoints | Returns the list of kpoint indices equivalent (meaning they are the
same frac coords) to the given one.
Args:
index: the kpoint index
Returns:
a list of equivalent indices
TODO: now it uses the label we might want to use coordinates instead
(in case the... | pymatgen/electronic_structure/bandstructure.py | def get_equivalent_kpoints(self, index):
"""
Returns the list of kpoint indices equivalent (meaning they are the
same frac coords) to the given one.
Args:
index: the kpoint index
Returns:
a list of equivalent indices
TODO: now it uses the label ... | def get_equivalent_kpoints(self, index):
"""
Returns the list of kpoint indices equivalent (meaning they are the
same frac coords) to the given one.
Args:
index: the kpoint index
Returns:
a list of equivalent indices
TODO: now it uses the label ... | [
"Returns",
"the",
"list",
"of",
"kpoint",
"indices",
"equivalent",
"(",
"meaning",
"they",
"are",
"the",
"same",
"frac",
"coords",
")",
"to",
"the",
"given",
"one",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L728-L753 | [
"def",
"get_equivalent_kpoints",
"(",
"self",
",",
"index",
")",
":",
"# if the kpoint has no label it can\"t have a repetition along the band",
"# structure line object",
"if",
"self",
".",
"kpoints",
"[",
"index",
"]",
".",
"label",
"is",
"None",
":",
"return",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureSymmLine.as_dict | Json-serializable dict representation of BandStructureSymmLine. | pymatgen/electronic_structure/bandstructure.py | def as_dict(self):
"""
Json-serializable dict representation of BandStructureSymmLine.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"lattice_rec": self.lattice_rec.as_dict(), "efermi": self.efermi,
"kpoints": []... | def as_dict(self):
"""
Json-serializable dict representation of BandStructureSymmLine.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"lattice_rec": self.lattice_rec.as_dict(), "efermi": self.efermi,
"kpoints": []... | [
"Json",
"-",
"serializable",
"dict",
"representation",
"of",
"BandStructureSymmLine",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L842-L885 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"lattice_rec\"",
":",
"self",
".",
"lattice_rec",
".",
"as_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureSymmLine.from_dict | Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object | pymatgen/electronic_structure/bandstructure.py | def from_dict(cls, d):
"""
Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object
"""
try:
# Strip the label to recover initial string (see trick used in as_dict to h... | def from_dict(cls, d):
"""
Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object
"""
try:
# Strip the label to recover initial string (see trick used in as_dict to h... | [
"Args",
":",
"d",
"(",
"dict",
")",
":",
"A",
"dict",
"with",
"all",
"data",
"for",
"a",
"band",
"structure",
"symm",
"line",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L888-L919 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"try",
":",
"# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)",
"labels_dict",
"=",
"{",
"k",
".",
"strip",
"(",
")",
":",
"v",
"for",
"k",
",",
"v",
"in",
"d",
"[",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureSymmLine.from_old_dict | Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object | pymatgen/electronic_structure/bandstructure.py | def from_old_dict(cls, d):
"""
Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object
"""
# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)... | def from_old_dict(cls, d):
"""
Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object
"""
# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)... | [
"Args",
":",
"d",
"(",
"dict",
")",
":",
"A",
"dict",
"with",
"all",
"data",
"for",
"a",
"band",
"structure",
"symm",
"line",
"object",
".",
"Returns",
":",
"A",
"BandStructureSymmLine",
"object"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L922-L959 | [
"def",
"from_old_dict",
"(",
"cls",
",",
"d",
")",
":",
"# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)",
"labels_dict",
"=",
"{",
"k",
".",
"strip",
"(",
")",
":",
"v",
"for",
"k",
",",
"v",
"in",
"d",
"[",
"'labels_dict... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LobsterBandStructureSymmLine.apply_scissor | Apply a scissor operator (shift of the CBM) to fit the given band gap.
If it's a metal. We look for the band crossing the fermi level
and shift this one up. This will not work all the time for metals!
Args:
new_band_gap: the band gap the scissor band structure need to have.
... | pymatgen/electronic_structure/bandstructure.py | def apply_scissor(self, new_band_gap):
"""
Apply a scissor operator (shift of the CBM) to fit the given band gap.
If it's a metal. We look for the band crossing the fermi level
and shift this one up. This will not work all the time for metals!
Args:
new_band_gap: the... | def apply_scissor(self, new_band_gap):
"""
Apply a scissor operator (shift of the CBM) to fit the given band gap.
If it's a metal. We look for the band crossing the fermi level
and shift this one up. This will not work all the time for metals!
Args:
new_band_gap: the... | [
"Apply",
"a",
"scissor",
"operator",
"(",
"shift",
"of",
"the",
"CBM",
")",
"to",
"fit",
"the",
"given",
"band",
"gap",
".",
"If",
"it",
"s",
"a",
"metal",
".",
"We",
"look",
"for",
"the",
"band",
"crossing",
"the",
"fermi",
"level",
"and",
"shift",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L1024-L1086 | [
"def",
"apply_scissor",
"(",
"self",
",",
"new_band_gap",
")",
":",
"if",
"self",
".",
"is_metal",
"(",
")",
":",
"# moves then the highest index band crossing the fermi level",
"# find this band...",
"max_index",
"=",
"-",
"1000",
"# spin_index = None",
"for",
"i",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LobsterBandStructureSymmLine.from_old_dict | Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object | pymatgen/electronic_structure/bandstructure.py | def from_old_dict(cls, d):
"""
Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object
"""
# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)... | def from_old_dict(cls, d):
"""
Args:
d (dict): A dict with all data for a band structure symm line
object.
Returns:
A BandStructureSymmLine object
"""
# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)... | [
"Args",
":",
"d",
"(",
"dict",
")",
":",
"A",
"dict",
"with",
"all",
"data",
"for",
"a",
"band",
"structure",
"symm",
"line",
"object",
".",
"Returns",
":",
"A",
"BandStructureSymmLine",
"object"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L1169-L1198 | [
"def",
"from_old_dict",
"(",
"cls",
",",
"d",
")",
":",
"# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)",
"labels_dict",
"=",
"{",
"k",
".",
"strip",
"(",
")",
":",
"v",
"for",
"k",
",",
"v",
"in",
"d",
"[",
"'labels_dict... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LobsterBandStructureSymmLine.get_projections_on_elements_and_orbitals | Method returning a dictionary of projections on elements and specific
orbitals
Args:
el_orb_spec: A dictionary of Elements and Orbitals for which we want
to have projections on. It is given as: {Element:[orbitals]},
e.g., {'Si':['3s','3p']} or {'Si':['3s','3p... | pymatgen/electronic_structure/bandstructure.py | def get_projections_on_elements_and_orbitals(self, el_orb_spec):
"""
Method returning a dictionary of projections on elements and specific
orbitals
Args:
el_orb_spec: A dictionary of Elements and Orbitals for which we want
to have projections on. It is given ... | def get_projections_on_elements_and_orbitals(self, el_orb_spec):
"""
Method returning a dictionary of projections on elements and specific
orbitals
Args:
el_orb_spec: A dictionary of Elements and Orbitals for which we want
to have projections on. It is given ... | [
"Method",
"returning",
"a",
"dictionary",
"of",
"projections",
"on",
"elements",
"and",
"specific",
"orbitals"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/bandstructure.py#L1225-L1259 | [
"def",
"get_projections_on_elements_and_orbitals",
"(",
"self",
",",
"el_orb_spec",
")",
":",
"result",
"=",
"{",
"}",
"structure",
"=",
"self",
".",
"structure",
"el_orb_spec",
"=",
"{",
"get_el_sp",
"(",
"el",
")",
":",
"orbs",
"for",
"el",
",",
"orbs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOSBase._initial_guess | Quadratic fit to get an initial guess for the parameters.
Returns:
tuple: (e0, b0, b1, v0) | pymatgen/analysis/eos.py | def _initial_guess(self):
"""
Quadratic fit to get an initial guess for the parameters.
Returns:
tuple: (e0, b0, b1, v0)
"""
a, b, c = np.polyfit(self.volumes, self.energies, 2)
self.eos_params = [a, b, c]
v0 = -b/(2*a)
e0 = a*(v0**2) + b*v0 ... | def _initial_guess(self):
"""
Quadratic fit to get an initial guess for the parameters.
Returns:
tuple: (e0, b0, b1, v0)
"""
a, b, c = np.polyfit(self.volumes, self.energies, 2)
self.eos_params = [a, b, c]
v0 = -b/(2*a)
e0 = a*(v0**2) + b*v0 ... | [
"Quadratic",
"fit",
"to",
"get",
"an",
"initial",
"guess",
"for",
"the",
"parameters",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L52-L73 | [
"def",
"_initial_guess",
"(",
"self",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"np",
".",
"polyfit",
"(",
"self",
".",
"volumes",
",",
"self",
".",
"energies",
",",
"2",
")",
"self",
".",
"eos_params",
"=",
"[",
"a",
",",
"b",
",",
"c",
"]",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOSBase.fit | Do the fitting. Does least square fitting. If you want to use custom
fitting, must override this. | pymatgen/analysis/eos.py | def fit(self):
"""
Do the fitting. Does least square fitting. If you want to use custom
fitting, must override this.
"""
# the objective function that will be minimized in the least square
# fitting
objective_func = lambda pars, x, y: y - self._func(x, pars)
... | def fit(self):
"""
Do the fitting. Does least square fitting. If you want to use custom
fitting, must override this.
"""
# the objective function that will be minimized in the least square
# fitting
objective_func = lambda pars, x, y: y - self._func(x, pars)
... | [
"Do",
"the",
"fitting",
".",
"Does",
"least",
"square",
"fitting",
".",
"If",
"you",
"want",
"to",
"use",
"custom",
"fitting",
"must",
"override",
"this",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L75-L89 | [
"def",
"fit",
"(",
"self",
")",
":",
"# the objective function that will be minimized in the least square",
"# fitting",
"objective_func",
"=",
"lambda",
"pars",
",",
"x",
",",
"y",
":",
"y",
"-",
"self",
".",
"_func",
"(",
"x",
",",
"pars",
")",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOSBase.func | The equation of state function with the paramters other than volume set
to the ones obtained from fitting.
Args:
volume (list/numpy.array)
Returns:
numpy.array | pymatgen/analysis/eos.py | def func(self, volume):
"""
The equation of state function with the paramters other than volume set
to the ones obtained from fitting.
Args:
volume (list/numpy.array)
Returns:
numpy.array
"""
return self._func(np.array(volume), self.eos_... | def func(self, volume):
"""
The equation of state function with the paramters other than volume set
to the ones obtained from fitting.
Args:
volume (list/numpy.array)
Returns:
numpy.array
"""
return self._func(np.array(volume), self.eos_... | [
"The",
"equation",
"of",
"state",
"function",
"with",
"the",
"paramters",
"other",
"than",
"volume",
"set",
"to",
"the",
"ones",
"obtained",
"from",
"fitting",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L104-L115 | [
"def",
"func",
"(",
"self",
",",
"volume",
")",
":",
"return",
"self",
".",
"_func",
"(",
"np",
".",
"array",
"(",
"volume",
")",
",",
"self",
".",
"eos_params",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOSBase.results | Returns a summary dict.
Returns:
dict | pymatgen/analysis/eos.py | def results(self):
"""
Returns a summary dict.
Returns:
dict
"""
return dict(e0=self.e0, b0=self.b0, b1=self.b1, v0=self.v0) | def results(self):
"""
Returns a summary dict.
Returns:
dict
"""
return dict(e0=self.e0, b0=self.b0, b1=self.b1, v0=self.v0) | [
"Returns",
"a",
"summary",
"dict",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L159-L166 | [
"def",
"results",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"e0",
"=",
"self",
".",
"e0",
",",
"b0",
"=",
"self",
".",
"b0",
",",
"b1",
"=",
"self",
".",
"b1",
",",
"v0",
"=",
"self",
".",
"v0",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOSBase.plot | Plot the equation of state.
Args:
width (float): Width of plot in inches. Defaults to 8in.
height (float): Height of plot in inches. Defaults to width *
golden ratio.
plt (matplotlib.pyplot): If plt is supplied, changes will be made
to an exis... | pymatgen/analysis/eos.py | def plot(self, width=8, height=None, plt=None, dpi=None, **kwargs):
"""
Plot the equation of state.
Args:
width (float): Width of plot in inches. Defaults to 8in.
height (float): Height of plot in inches. Defaults to width *
golden ratio.
plt ... | def plot(self, width=8, height=None, plt=None, dpi=None, **kwargs):
"""
Plot the equation of state.
Args:
width (float): Width of plot in inches. Defaults to 8in.
height (float): Height of plot in inches. Defaults to width *
golden ratio.
plt ... | [
"Plot",
"the",
"equation",
"of",
"state",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L168-L217 | [
"def",
"plot",
"(",
"self",
",",
"width",
"=",
"8",
",",
"height",
"=",
"None",
",",
"plt",
"=",
"None",
",",
"dpi",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
"=",
"pretty_plot",
"(",
"width",
"=",
"width",
",",
"height",
"=",
"hei... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOSBase.plot_ax | Plot the equation of state on axis `ax`
Args:
ax: matplotlib :class:`Axes` or None if a new figure should be created.
fontsize: Legend fontsize.
color (str): plot color.
label (str): Plot label
text (str): Legend text (options)
Returns:
... | pymatgen/analysis/eos.py | def plot_ax(self, ax=None, fontsize=12, **kwargs):
"""
Plot the equation of state on axis `ax`
Args:
ax: matplotlib :class:`Axes` or None if a new figure should be created.
fontsize: Legend fontsize.
color (str): plot color.
label (str): Plot labe... | def plot_ax(self, ax=None, fontsize=12, **kwargs):
"""
Plot the equation of state on axis `ax`
Args:
ax: matplotlib :class:`Axes` or None if a new figure should be created.
fontsize: Legend fontsize.
color (str): plot color.
label (str): Plot labe... | [
"Plot",
"the",
"equation",
"of",
"state",
"on",
"axis",
"ax"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L220-L265 | [
"def",
"plot_ax",
"(",
"self",
",",
"ax",
"=",
"None",
",",
"fontsize",
"=",
"12",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
",",
"fig",
",",
"plt",
"=",
"get_ax_fig_plt",
"(",
"ax",
"=",
"ax",
")",
"color",
"=",
"kwargs",
".",
"get",
"(",
"\"co... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Birch._func | From Intermetallic compounds: Principles and Practice, Vol. I:
Principles Chapter 9 pages 195-210 by M. Mehl. B. Klein,
D. Papaconstantopoulos.
case where n=0 | pymatgen/analysis/eos.py | def _func(self, volume, params):
"""
From Intermetallic compounds: Principles and Practice, Vol. I:
Principles Chapter 9 pages 195-210 by M. Mehl. B. Klein,
D. Papaconstantopoulos.
case where n=0
"""
e0, b0, b1, v0 = tuple(params)
return (e0
... | def _func(self, volume, params):
"""
From Intermetallic compounds: Principles and Practice, Vol. I:
Principles Chapter 9 pages 195-210 by M. Mehl. B. Klein,
D. Papaconstantopoulos.
case where n=0
"""
e0, b0, b1, v0 = tuple(params)
return (e0
... | [
"From",
"Intermetallic",
"compounds",
":",
"Principles",
"and",
"Practice",
"Vol",
".",
"I",
":",
"Principles",
"Chapter",
"9",
"pages",
"195",
"-",
"210",
"by",
"M",
".",
"Mehl",
".",
"B",
".",
"Klein",
"D",
".",
"Papaconstantopoulos",
".",
"case",
"whe... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L282-L293 | [
"def",
"_func",
"(",
"self",
",",
"volume",
",",
"params",
")",
":",
"e0",
",",
"b0",
",",
"b1",
",",
"v0",
"=",
"tuple",
"(",
"params",
")",
"return",
"(",
"e0",
"+",
"9.0",
"/",
"8.0",
"*",
"b0",
"*",
"v0",
"*",
"(",
"(",
"v0",
"/",
"volu... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BirchMurnaghan._func | BirchMurnaghan equation from PRB 70, 224107 | pymatgen/analysis/eos.py | def _func(self, volume, params):
"""
BirchMurnaghan equation from PRB 70, 224107
"""
e0, b0, b1, v0 = tuple(params)
eta = (v0 / volume) ** (1. / 3.)
return (e0 +
9. * b0 * v0 / 16. * (eta ** 2 - 1)**2 *
(6 + b1 * (eta ** 2 - 1.) - 4. * eta ... | def _func(self, volume, params):
"""
BirchMurnaghan equation from PRB 70, 224107
"""
e0, b0, b1, v0 = tuple(params)
eta = (v0 / volume) ** (1. / 3.)
return (e0 +
9. * b0 * v0 / 16. * (eta ** 2 - 1)**2 *
(6 + b1 * (eta ** 2 - 1.) - 4. * eta ... | [
"BirchMurnaghan",
"equation",
"from",
"PRB",
"70",
"224107"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L298-L306 | [
"def",
"_func",
"(",
"self",
",",
"volume",
",",
"params",
")",
":",
"e0",
",",
"b0",
",",
"b1",
",",
"v0",
"=",
"tuple",
"(",
"params",
")",
"eta",
"=",
"(",
"v0",
"/",
"volume",
")",
"**",
"(",
"1.",
"/",
"3.",
")",
"return",
"(",
"e0",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PourierTarantola._func | Pourier-Tarantola equation from PRB 70, 224107 | pymatgen/analysis/eos.py | def _func(self, volume, params):
"""
Pourier-Tarantola equation from PRB 70, 224107
"""
e0, b0, b1, v0 = tuple(params)
eta = (volume / v0) ** (1. / 3.)
squiggle = -3.*np.log(eta)
return e0 + b0 * v0 * squiggle ** 2 / 6. * (3. + squiggle * (b1 - 2)) | def _func(self, volume, params):
"""
Pourier-Tarantola equation from PRB 70, 224107
"""
e0, b0, b1, v0 = tuple(params)
eta = (volume / v0) ** (1. / 3.)
squiggle = -3.*np.log(eta)
return e0 + b0 * v0 * squiggle ** 2 / 6. * (3. + squiggle * (b1 - 2)) | [
"Pourier",
"-",
"Tarantola",
"equation",
"from",
"PRB",
"70",
"224107"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L311-L318 | [
"def",
"_func",
"(",
"self",
",",
"volume",
",",
"params",
")",
":",
"e0",
",",
"b0",
",",
"b1",
",",
"v0",
"=",
"tuple",
"(",
"params",
")",
"eta",
"=",
"(",
"volume",
"/",
"v0",
")",
"**",
"(",
"1.",
"/",
"3.",
")",
"squiggle",
"=",
"-",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PolynomialEOS._set_params | Use the fit polynomial to compute the parameter e0, b0, b1 and v0
and set to the _params attribute. | pymatgen/analysis/eos.py | def _set_params(self):
"""
Use the fit polynomial to compute the parameter e0, b0, b1 and v0
and set to the _params attribute.
"""
fit_poly = np.poly1d(self.eos_params)
# the volume at min energy, used as the intial guess for the
# optimization wrt volume.
... | def _set_params(self):
"""
Use the fit polynomial to compute the parameter e0, b0, b1 and v0
and set to the _params attribute.
"""
fit_poly = np.poly1d(self.eos_params)
# the volume at min energy, used as the intial guess for the
# optimization wrt volume.
... | [
"Use",
"the",
"fit",
"polynomial",
"to",
"compute",
"the",
"parameter",
"e0",
"b0",
"b1",
"and",
"v0",
"and",
"set",
"to",
"the",
"_params",
"attribute",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L353-L371 | [
"def",
"_set_params",
"(",
"self",
")",
":",
"fit_poly",
"=",
"np",
".",
"poly1d",
"(",
"self",
".",
"eos_params",
")",
"# the volume at min energy, used as the intial guess for the",
"# optimization wrt volume.",
"v_e_min",
"=",
"self",
".",
"volumes",
"[",
"np",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DeltaFactor.fit | Overriden since this eos works with volume**(2/3) instead of volume. | pymatgen/analysis/eos.py | def fit(self, order=3):
"""
Overriden since this eos works with volume**(2/3) instead of volume.
"""
x = self.volumes**(-2./3.)
self.eos_params = np.polyfit(x, self.energies, order)
self._set_params() | def fit(self, order=3):
"""
Overriden since this eos works with volume**(2/3) instead of volume.
"""
x = self.volumes**(-2./3.)
self.eos_params = np.polyfit(x, self.energies, order)
self._set_params() | [
"Overriden",
"since",
"this",
"eos",
"works",
"with",
"volume",
"**",
"(",
"2",
"/",
"3",
")",
"instead",
"of",
"volume",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L380-L386 | [
"def",
"fit",
"(",
"self",
",",
"order",
"=",
"3",
")",
":",
"x",
"=",
"self",
".",
"volumes",
"**",
"(",
"-",
"2.",
"/",
"3.",
")",
"self",
".",
"eos_params",
"=",
"np",
".",
"polyfit",
"(",
"x",
",",
"self",
".",
"energies",
",",
"order",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DeltaFactor._set_params | Overriden to account for the fact the fit with volume**(2/3) instead
of volume. | pymatgen/analysis/eos.py | def _set_params(self):
"""
Overriden to account for the fact the fit with volume**(2/3) instead
of volume.
"""
deriv0 = np.poly1d(self.eos_params)
deriv1 = np.polyder(deriv0, 1)
deriv2 = np.polyder(deriv1, 1)
deriv3 = np.polyder(deriv2, 1)
for x i... | def _set_params(self):
"""
Overriden to account for the fact the fit with volume**(2/3) instead
of volume.
"""
deriv0 = np.poly1d(self.eos_params)
deriv1 = np.polyder(deriv0, 1)
deriv2 = np.polyder(deriv1, 1)
deriv3 = np.polyder(deriv2, 1)
for x i... | [
"Overriden",
"to",
"account",
"for",
"the",
"fact",
"the",
"fit",
"with",
"volume",
"**",
"(",
"2",
"/",
"3",
")",
"instead",
"of",
"volume",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L388-L412 | [
"def",
"_set_params",
"(",
"self",
")",
":",
"deriv0",
"=",
"np",
".",
"poly1d",
"(",
"self",
".",
"eos_params",
")",
"deriv1",
"=",
"np",
".",
"polyder",
"(",
"deriv0",
",",
"1",
")",
"deriv2",
"=",
"np",
".",
"polyder",
"(",
"deriv1",
",",
"1",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NumericalEOS.fit | Fit the input data to the 'numerical eos', the equation of state employed
in the quasiharmonic Debye model described in the paper:
10.1103/PhysRevB.90.174107.
credits: Cormac Toher
Args:
min_ndata_factor (int): parameter that controls the minimum number
of d... | pymatgen/analysis/eos.py | def fit(self, min_ndata_factor=3, max_poly_order_factor=5, min_poly_order=2):
"""
Fit the input data to the 'numerical eos', the equation of state employed
in the quasiharmonic Debye model described in the paper:
10.1103/PhysRevB.90.174107.
credits: Cormac Toher
Args:
... | def fit(self, min_ndata_factor=3, max_poly_order_factor=5, min_poly_order=2):
"""
Fit the input data to the 'numerical eos', the equation of state employed
in the quasiharmonic Debye model described in the paper:
10.1103/PhysRevB.90.174107.
credits: Cormac Toher
Args:
... | [
"Fit",
"the",
"input",
"data",
"to",
"the",
"numerical",
"eos",
"the",
"equation",
"of",
"state",
"employed",
"in",
"the",
"quasiharmonic",
"Debye",
"model",
"described",
"in",
"the",
"paper",
":",
"10",
".",
"1103",
"/",
"PhysRevB",
".",
"90",
".",
"174... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L417-L518 | [
"def",
"fit",
"(",
"self",
",",
"min_ndata_factor",
"=",
"3",
",",
"max_poly_order_factor",
"=",
"5",
",",
"min_poly_order",
"=",
"2",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"'ignore'",
",",
"np",
".",
"RankWarning",
")",
"get_rms",
"=",
"lambda",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | EOS.fit | Fit energies as function of volumes.
Args:
volumes (list/np.array)
energies (list/np.array)
Returns:
EOSBase: EOSBase object | pymatgen/analysis/eos.py | def fit(self, volumes, energies):
"""
Fit energies as function of volumes.
Args:
volumes (list/np.array)
energies (list/np.array)
Returns:
EOSBase: EOSBase object
"""
eos_fit = self.model(np.array(volumes), np.array(energies))
... | def fit(self, volumes, energies):
"""
Fit energies as function of volumes.
Args:
volumes (list/np.array)
energies (list/np.array)
Returns:
EOSBase: EOSBase object
"""
eos_fit = self.model(np.array(volumes), np.array(energies))
... | [
"Fit",
"energies",
"as",
"function",
"of",
"volumes",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/eos.py#L570-L583 | [
"def",
"fit",
"(",
"self",
",",
"volumes",
",",
"energies",
")",
":",
"eos_fit",
"=",
"self",
".",
"model",
"(",
"np",
".",
"array",
"(",
"volumes",
")",
",",
"np",
".",
"array",
"(",
"energies",
")",
")",
"eos_fit",
".",
"fit",
"(",
")",
"return... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | dilute_solution_model | Compute the defect densities using dilute solution model.
Args:
structure: pymatgen.core.structure.Structure object representing the
primitive or unitcell of the crystal.
e0: The total energy of the undefected system.
This is E0 from VASP calculation.
vac_defs: List ... | pymatgen/analysis/defects/dilute_solution_model.py | def dilute_solution_model(structure, e0, vac_defs, antisite_defs, T, trial_chem_pot=None, generate='plot'):
"""
Compute the defect densities using dilute solution model.
Args:
structure: pymatgen.core.structure.Structure object representing the
primitive or unitcell of the crystal.
... | def dilute_solution_model(structure, e0, vac_defs, antisite_defs, T, trial_chem_pot=None, generate='plot'):
"""
Compute the defect densities using dilute solution model.
Args:
structure: pymatgen.core.structure.Structure object representing the
primitive or unitcell of the crystal.
... | [
"Compute",
"the",
"defect",
"densities",
"using",
"dilute",
"solution",
"model",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/dilute_solution_model.py#L45-L664 | [
"def",
"dilute_solution_model",
"(",
"structure",
",",
"e0",
",",
"vac_defs",
",",
"antisite_defs",
",",
"T",
",",
"trial_chem_pot",
"=",
"None",
",",
"generate",
"=",
"'plot'",
")",
":",
"if",
"not",
"check_input",
"(",
"vac_defs",
")",
":",
"raise",
"Val... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | compute_defect_density | Wrapper for the dilute_solution_model.
The computed plot data is prepared based on plot_style.
Args:
structure: pymatgen.core.structure.Structure object representing the
primitive or unitcell of the crystal.
e0: The total energy of the undefected system.
This is E0 from ... | pymatgen/analysis/defects/dilute_solution_model.py | def compute_defect_density(structure, e0, vac_defs, antisite_defs, T=800, trial_chem_pot=None, plot_style="highcharts"):
"""
Wrapper for the dilute_solution_model.
The computed plot data is prepared based on plot_style.
Args:
structure: pymatgen.core.structure.Structure object representing the
... | def compute_defect_density(structure, e0, vac_defs, antisite_defs, T=800, trial_chem_pot=None, plot_style="highcharts"):
"""
Wrapper for the dilute_solution_model.
The computed plot data is prepared based on plot_style.
Args:
structure: pymatgen.core.structure.Structure object representing the
... | [
"Wrapper",
"for",
"the",
"dilute_solution_model",
".",
"The",
"computed",
"plot",
"data",
"is",
"prepared",
"based",
"on",
"plot_style",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/dilute_solution_model.py#L667-L744 | [
"def",
"compute_defect_density",
"(",
"structure",
",",
"e0",
",",
"vac_defs",
",",
"antisite_defs",
",",
"T",
"=",
"800",
",",
"trial_chem_pot",
"=",
"None",
",",
"plot_style",
"=",
"\"highcharts\"",
")",
":",
"conc_data",
",",
"en_data",
",",
"mu_data",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | solute_site_preference_finder | Compute the solute defect densities using dilute solution model.
Args:
structure: pymatgen.core.structure.Structure object representing the
primitive or unitcell of the crystal.
e0: The total energy of the undefected system.
This is E0 from VASP calculation.
T: Temper... | pymatgen/analysis/defects/dilute_solution_model.py | def solute_site_preference_finder(structure,
e0,
T,
vac_defs,
antisite_defs,
solute_defs,
solute_concen=0.01,
... | def solute_site_preference_finder(structure,
e0,
T,
vac_defs,
antisite_defs,
solute_defs,
solute_concen=0.01,
... | [
"Compute",
"the",
"solute",
"defect",
"densities",
"using",
"dilute",
"solution",
"model",
".",
"Args",
":",
"structure",
":",
"pymatgen",
".",
"core",
".",
"structure",
".",
"Structure",
"object",
"representing",
"the",
"primitive",
"or",
"unitcell",
"of",
"t... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/dilute_solution_model.py#L750-L1268 | [
"def",
"solute_site_preference_finder",
"(",
"structure",
",",
"e0",
",",
"T",
",",
"vac_defs",
",",
"antisite_defs",
",",
"solute_defs",
",",
"solute_concen",
"=",
"0.01",
",",
"trial_chem_pot",
"=",
"None",
")",
":",
"if",
"not",
"check_input",
"(",
"vac_def... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | solute_defect_density | Wrapper for the solute_site_preference_finder.
The computed plot data is prepared based on plot_style.
Args:
structure: pymatgen.core.structure.Structure object representing the
primitive or unitcell of the crystal.
e0: The total energy of the undefected system.
This is ... | pymatgen/analysis/defects/dilute_solution_model.py | def solute_defect_density(structure,
e0,
vac_defs,
antisite_defs,
solute_defs,
solute_concen=0.01,
T=800,
trial_chem_pot=None,
... | def solute_defect_density(structure,
e0,
vac_defs,
antisite_defs,
solute_defs,
solute_concen=0.01,
T=800,
trial_chem_pot=None,
... | [
"Wrapper",
"for",
"the",
"solute_site_preference_finder",
".",
"The",
"computed",
"plot",
"data",
"is",
"prepared",
"based",
"on",
"plot_style",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/dilute_solution_model.py#L1271-L1370 | [
"def",
"solute_defect_density",
"(",
"structure",
",",
"e0",
",",
"vac_defs",
",",
"antisite_defs",
",",
"solute_defs",
",",
"solute_concen",
"=",
"0.01",
",",
"T",
"=",
"800",
",",
"trial_chem_pot",
"=",
"None",
",",
"plot_style",
"=",
"\"highchargs\"",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.optimize_gibbs_free_energy | Evaluate the gibbs free energy as a function of V, T and P i.e
G(V, T, P), minimize G(V, T, P) wrt V for each T and store the
optimum values.
Note: The data points for which the equation of state fitting fails
are skipped. | pymatgen/analysis/quasiharmonic.py | def optimize_gibbs_free_energy(self):
"""
Evaluate the gibbs free energy as a function of V, T and P i.e
G(V, T, P), minimize G(V, T, P) wrt V for each T and store the
optimum values.
Note: The data points for which the equation of state fitting fails
are skipped.
... | def optimize_gibbs_free_energy(self):
"""
Evaluate the gibbs free energy as a function of V, T and P i.e
G(V, T, P), minimize G(V, T, P) wrt V for each T and store the
optimum values.
Note: The data points for which the equation of state fitting fails
are skipped.
... | [
"Evaluate",
"the",
"gibbs",
"free",
"energy",
"as",
"a",
"function",
"of",
"V",
"T",
"and",
"P",
"i",
".",
"e",
"G",
"(",
"V",
"T",
"P",
")",
"minimize",
"G",
"(",
"V",
"T",
"P",
")",
"wrt",
"V",
"for",
"each",
"T",
"and",
"store",
"the",
"op... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L90-L116 | [
"def",
"optimize_gibbs_free_energy",
"(",
"self",
")",
":",
"temperatures",
"=",
"np",
".",
"linspace",
"(",
"self",
".",
"temperature_min",
",",
"self",
".",
"temperature_max",
",",
"int",
"(",
"np",
".",
"ceil",
"(",
"(",
"self",
".",
"temperature_max",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.optimizer | Evaluate G(V, T, P) at the given temperature(and pressure) and
minimize it wrt V.
1. Compute the vibrational helmholtz free energy, A_vib.
2. Compute the gibbs free energy as a function of volume, temperature
and pressure, G(V,T,P).
3. Preform an equation of state fit to ge... | pymatgen/analysis/quasiharmonic.py | def optimizer(self, temperature):
"""
Evaluate G(V, T, P) at the given temperature(and pressure) and
minimize it wrt V.
1. Compute the vibrational helmholtz free energy, A_vib.
2. Compute the gibbs free energy as a function of volume, temperature
and pressure, G(V,T... | def optimizer(self, temperature):
"""
Evaluate G(V, T, P) at the given temperature(and pressure) and
minimize it wrt V.
1. Compute the vibrational helmholtz free energy, A_vib.
2. Compute the gibbs free energy as a function of volume, temperature
and pressure, G(V,T... | [
"Evaluate",
"G",
"(",
"V",
"T",
"P",
")",
"at",
"the",
"given",
"temperature",
"(",
"and",
"pressure",
")",
"and",
"minimize",
"it",
"wrt",
"V",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L118-L151 | [
"def",
"optimizer",
"(",
"self",
",",
"temperature",
")",
":",
"G_V",
"=",
"[",
"]",
"# G for each volume",
"# G = E(V) + PV + A_vib(V, T)",
"for",
"i",
",",
"v",
"in",
"enumerate",
"(",
"self",
".",
"volumes",
")",
":",
"G_V",
".",
"append",
"(",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.vibrational_free_energy | Vibrational Helmholtz free energy, A_vib(V, T).
Eq(4) in doi.org/10.1016/j.comphy.2003.12.001
Args:
temperature (float): temperature in K
volume (float)
Returns:
float: vibrational free energy in eV | pymatgen/analysis/quasiharmonic.py | def vibrational_free_energy(self, temperature, volume):
"""
Vibrational Helmholtz free energy, A_vib(V, T).
Eq(4) in doi.org/10.1016/j.comphy.2003.12.001
Args:
temperature (float): temperature in K
volume (float)
Returns:
float: vibrational f... | def vibrational_free_energy(self, temperature, volume):
"""
Vibrational Helmholtz free energy, A_vib(V, T).
Eq(4) in doi.org/10.1016/j.comphy.2003.12.001
Args:
temperature (float): temperature in K
volume (float)
Returns:
float: vibrational f... | [
"Vibrational",
"Helmholtz",
"free",
"energy",
"A_vib",
"(",
"V",
"T",
")",
".",
"Eq",
"(",
"4",
")",
"in",
"doi",
".",
"org",
"/",
"10",
".",
"1016",
"/",
"j",
".",
"comphy",
".",
"2003",
".",
"12",
".",
"001"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L153-L167 | [
"def",
"vibrational_free_energy",
"(",
"self",
",",
"temperature",
",",
"volume",
")",
":",
"y",
"=",
"self",
".",
"debye_temperature",
"(",
"volume",
")",
"/",
"temperature",
"return",
"self",
".",
"kb",
"*",
"self",
".",
"natoms",
"*",
"temperature",
"*"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.vibrational_internal_energy | Vibrational internal energy, U_vib(V, T).
Eq(4) in doi.org/10.1016/j.comphy.2003.12.001
Args:
temperature (float): temperature in K
volume (float): in Ang^3
Returns:
float: vibrational internal energy in eV | pymatgen/analysis/quasiharmonic.py | def vibrational_internal_energy(self, temperature, volume):
"""
Vibrational internal energy, U_vib(V, T).
Eq(4) in doi.org/10.1016/j.comphy.2003.12.001
Args:
temperature (float): temperature in K
volume (float): in Ang^3
Returns:
float: vibra... | def vibrational_internal_energy(self, temperature, volume):
"""
Vibrational internal energy, U_vib(V, T).
Eq(4) in doi.org/10.1016/j.comphy.2003.12.001
Args:
temperature (float): temperature in K
volume (float): in Ang^3
Returns:
float: vibra... | [
"Vibrational",
"internal",
"energy",
"U_vib",
"(",
"V",
"T",
")",
".",
"Eq",
"(",
"4",
")",
"in",
"doi",
".",
"org",
"/",
"10",
".",
"1016",
"/",
"j",
".",
"comphy",
".",
"2003",
".",
"12",
".",
"001"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L169-L183 | [
"def",
"vibrational_internal_energy",
"(",
"self",
",",
"temperature",
",",
"volume",
")",
":",
"y",
"=",
"self",
".",
"debye_temperature",
"(",
"volume",
")",
"/",
"temperature",
"return",
"self",
".",
"kb",
"*",
"self",
".",
"natoms",
"*",
"temperature",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.debye_temperature | Calculates the debye temperature.
Eq(6) in doi.org/10.1016/j.comphy.2003.12.001. Thanks to Joey.
Eq(6) above is equivalent to Eq(3) in doi.org/10.1103/PhysRevB.37.790
which does not consider anharmonic effects. Eq(20) in the same paper
and Eq(18) in doi.org/10.1016/j.commatsci.2009.12.0... | pymatgen/analysis/quasiharmonic.py | def debye_temperature(self, volume):
"""
Calculates the debye temperature.
Eq(6) in doi.org/10.1016/j.comphy.2003.12.001. Thanks to Joey.
Eq(6) above is equivalent to Eq(3) in doi.org/10.1103/PhysRevB.37.790
which does not consider anharmonic effects. Eq(20) in the same paper
... | def debye_temperature(self, volume):
"""
Calculates the debye temperature.
Eq(6) in doi.org/10.1016/j.comphy.2003.12.001. Thanks to Joey.
Eq(6) above is equivalent to Eq(3) in doi.org/10.1103/PhysRevB.37.790
which does not consider anharmonic effects. Eq(20) in the same paper
... | [
"Calculates",
"the",
"debye",
"temperature",
".",
"Eq",
"(",
"6",
")",
"in",
"doi",
".",
"org",
"/",
"10",
".",
"1016",
"/",
"j",
".",
"comphy",
".",
"2003",
".",
"12",
".",
"001",
".",
"Thanks",
"to",
"Joey",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L185-L214 | [
"def",
"debye_temperature",
"(",
"self",
",",
"volume",
")",
":",
"term1",
"=",
"(",
"2.",
"/",
"3.",
"*",
"(",
"1.",
"+",
"self",
".",
"poisson",
")",
"/",
"(",
"1.",
"-",
"2.",
"*",
"self",
".",
"poisson",
")",
")",
"**",
"1.5",
"term2",
"=",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.debye_integral | Debye integral. Eq(5) in doi.org/10.1016/j.comphy.2003.12.001
Args:
y (float): debye temperature/T, upper limit
Returns:
float: unitless | pymatgen/analysis/quasiharmonic.py | def debye_integral(y):
"""
Debye integral. Eq(5) in doi.org/10.1016/j.comphy.2003.12.001
Args:
y (float): debye temperature/T, upper limit
Returns:
float: unitless
"""
# floating point limit is reached around y=155, so values beyond that
... | def debye_integral(y):
"""
Debye integral. Eq(5) in doi.org/10.1016/j.comphy.2003.12.001
Args:
y (float): debye temperature/T, upper limit
Returns:
float: unitless
"""
# floating point limit is reached around y=155, so values beyond that
... | [
"Debye",
"integral",
".",
"Eq",
"(",
"5",
")",
"in",
"doi",
".",
"org",
"/",
"10",
".",
"1016",
"/",
"j",
".",
"comphy",
".",
"2003",
".",
"12",
".",
"001"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L218-L236 | [
"def",
"debye_integral",
"(",
"y",
")",
":",
"# floating point limit is reached around y=155, so values beyond that",
"# are set to the limiting value(T-->0, y --> \\infty) of",
"# 6.4939394 (from wolfram alpha).",
"factor",
"=",
"3.",
"/",
"y",
"**",
"3",
"if",
"y",
"<",
"155"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.gruneisen_parameter | Slater-gamma formulation(the default):
gruneisen paramter = - d log(theta)/ d log(V)
= - ( 1/6 + 0.5 d log(B)/ d log(V) )
= - (1/6 + 0.5 V/B dB/dV),
where dB/dV = d^2E/dV^2 + V * d^3E/dV^3
Mie-gruneise... | pymatgen/analysis/quasiharmonic.py | def gruneisen_parameter(self, temperature, volume):
"""
Slater-gamma formulation(the default):
gruneisen paramter = - d log(theta)/ d log(V)
= - ( 1/6 + 0.5 d log(B)/ d log(V) )
= - (1/6 + 0.5 V/B dB/dV),
... | def gruneisen_parameter(self, temperature, volume):
"""
Slater-gamma formulation(the default):
gruneisen paramter = - d log(theta)/ d log(V)
= - ( 1/6 + 0.5 d log(B)/ d log(V) )
= - (1/6 + 0.5 V/B dB/dV),
... | [
"Slater",
"-",
"gamma",
"formulation",
"(",
"the",
"default",
")",
":",
"gruneisen",
"paramter",
"=",
"-",
"d",
"log",
"(",
"theta",
")",
"/",
"d",
"log",
"(",
"V",
")",
"=",
"-",
"(",
"1",
"/",
"6",
"+",
"0",
".",
"5",
"d",
"log",
"(",
"B",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L238-L289 | [
"def",
"gruneisen_parameter",
"(",
"self",
",",
"temperature",
",",
"volume",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"eos",
",",
"PolynomialEOS",
")",
":",
"p",
"=",
"np",
".",
"poly1d",
"(",
"self",
".",
"eos",
".",
"eos_params",
")",
"# firs... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.thermal_conductivity | Eq(17) in 10.1103/PhysRevB.90.174107
Args:
temperature (float): temperature in K
volume (float): in Ang^3
Returns:
float: thermal conductivity in W/K/m | pymatgen/analysis/quasiharmonic.py | def thermal_conductivity(self, temperature, volume):
"""
Eq(17) in 10.1103/PhysRevB.90.174107
Args:
temperature (float): temperature in K
volume (float): in Ang^3
Returns:
float: thermal conductivity in W/K/m
"""
gamma = self.gruneise... | def thermal_conductivity(self, temperature, volume):
"""
Eq(17) in 10.1103/PhysRevB.90.174107
Args:
temperature (float): temperature in K
volume (float): in Ang^3
Returns:
float: thermal conductivity in W/K/m
"""
gamma = self.gruneise... | [
"Eq",
"(",
"17",
")",
"in",
"10",
".",
"1103",
"/",
"PhysRevB",
".",
"90",
".",
"174107"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L291-L312 | [
"def",
"thermal_conductivity",
"(",
"self",
",",
"temperature",
",",
"volume",
")",
":",
"gamma",
"=",
"self",
".",
"gruneisen_parameter",
"(",
"temperature",
",",
"volume",
")",
"theta_d",
"=",
"self",
".",
"debye_temperature",
"(",
"volume",
")",
"# K",
"t... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QuasiharmonicDebyeApprox.get_summary_dict | Returns a dict with a summary of the computed properties. | pymatgen/analysis/quasiharmonic.py | def get_summary_dict(self):
"""
Returns a dict with a summary of the computed properties.
"""
d = defaultdict(list)
d["pressure"] = self.pressure
d["poisson"] = self.poisson
d["mass"] = self.mass
d["natoms"] = int(self.natoms)
d["bulk_modulus"] = s... | def get_summary_dict(self):
"""
Returns a dict with a summary of the computed properties.
"""
d = defaultdict(list)
d["pressure"] = self.pressure
d["poisson"] = self.poisson
d["mass"] = self.mass
d["natoms"] = int(self.natoms)
d["bulk_modulus"] = s... | [
"Returns",
"a",
"dict",
"with",
"a",
"summary",
"of",
"the",
"computed",
"properties",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/quasiharmonic.py#L314-L331 | [
"def",
"get_summary_dict",
"(",
"self",
")",
":",
"d",
"=",
"defaultdict",
"(",
"list",
")",
"d",
"[",
"\"pressure\"",
"]",
"=",
"self",
".",
"pressure",
"d",
"[",
"\"poisson\"",
"]",
"=",
"self",
".",
"poisson",
"d",
"[",
"\"mass\"",
"]",
"=",
"self... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | fix_pbc | Set all frac_coords of the input structure within [0,1].
Args:
structure (pymatgen structure object):
input structure
matrix (lattice matrix, 3 by 3 array/matrix)
new structure's lattice matrix, if none, use
input structure's matrix
Return:
new struc... | pymatgen/analysis/gb/grain.py | def fix_pbc(structure, matrix=None):
"""
Set all frac_coords of the input structure within [0,1].
Args:
structure (pymatgen structure object):
input structure
matrix (lattice matrix, 3 by 3 array/matrix)
new structure's lattice matrix, if none, use
input ... | def fix_pbc(structure, matrix=None):
"""
Set all frac_coords of the input structure within [0,1].
Args:
structure (pymatgen structure object):
input structure
matrix (lattice matrix, 3 by 3 array/matrix)
new structure's lattice matrix, if none, use
input ... | [
"Set",
"all",
"frac_coords",
"of",
"the",
"input",
"structure",
"within",
"[",
"0",
"1",
"]",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L2257-L2292 | [
"def",
"fix_pbc",
"(",
"structure",
",",
"matrix",
"=",
"None",
")",
":",
"spec",
"=",
"[",
"]",
"coords",
"=",
"[",
"]",
"if",
"matrix",
"is",
"None",
":",
"latte",
"=",
"Lattice",
"(",
"structure",
".",
"lattice",
".",
"matrix",
")",
"else",
":",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | symm_group_cubic | obtain cubic symmetric eqivalents of the list of vectors.
Args:
matrix (lattice matrix, n by 3 array/matrix)
Return:
cubic symmetric eqivalents of the list of vectors. | pymatgen/analysis/gb/grain.py | def symm_group_cubic(mat):
"""
obtain cubic symmetric eqivalents of the list of vectors.
Args:
matrix (lattice matrix, n by 3 array/matrix)
Return:
cubic symmetric eqivalents of the list of vectors.
"""
sym_group = np.zeros([24, 3, 3])
sym_group[0, :] = [[1, 0, 0], [0, 1, ... | def symm_group_cubic(mat):
"""
obtain cubic symmetric eqivalents of the list of vectors.
Args:
matrix (lattice matrix, n by 3 array/matrix)
Return:
cubic symmetric eqivalents of the list of vectors.
"""
sym_group = np.zeros([24, 3, 3])
sym_group[0, :] = [[1, 0, 0], [0, 1, ... | [
"obtain",
"cubic",
"symmetric",
"eqivalents",
"of",
"the",
"list",
"of",
"vectors",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L2295-L2336 | [
"def",
"symm_group_cubic",
"(",
"mat",
")",
":",
"sym_group",
"=",
"np",
".",
"zeros",
"(",
"[",
"24",
",",
"3",
",",
"3",
"]",
")",
"sym_group",
"[",
"0",
",",
":",
"]",
"=",
"[",
"[",
"1",
",",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"1... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.copy | Convenience method to get a copy of the structure, with options to add
site properties.
Returns:
A copy of the Structure, with optionally new site_properties and
optionally sanitized. | pymatgen/analysis/gb/grain.py | def copy(self):
"""
Convenience method to get a copy of the structure, with options to add
site properties.
Returns:
A copy of the Structure, with optionally new site_properties and
optionally sanitized.
"""
return GrainBoundary(self.lattice, self... | def copy(self):
"""
Convenience method to get a copy of the structure, with options to add
site properties.
Returns:
A copy of the Structure, with optionally new site_properties and
optionally sanitized.
"""
return GrainBoundary(self.lattice, self... | [
"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/analysis/gb/grain.py#L110-L122 | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"GrainBoundary",
"(",
"self",
".",
"lattice",
",",
"self",
".",
"species_and_occu",
",",
"self",
".",
"frac_coords",
",",
"self",
".",
"rotation_axis",
",",
"self",
".",
"rotation_angle",
",",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.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 a... | pymatgen/analysis/gb/grain.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/analysis/gb/grain.py#L124-L142 | [
"def",
"get_sorted_structure",
"(",
"self",
",",
"key",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"sites",
"=",
"sorted",
"(",
"self",
",",
"key",
"=",
"key",
",",
"reverse",
"=",
"reverse",
")",
"s",
"=",
"Structure",
".",
"from_sites",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.sigma | This method returns the sigma value of the gb.
If using 'quick_gen' to generate GB, this value is not valid. | pymatgen/analysis/gb/grain.py | def sigma(self):
"""
This method returns the sigma value of the gb.
If using 'quick_gen' to generate GB, this value is not valid.
"""
return int(round(self.oriented_unit_cell.volume / self.init_cell.volume)) | def sigma(self):
"""
This method returns the sigma value of the gb.
If using 'quick_gen' to generate GB, this value is not valid.
"""
return int(round(self.oriented_unit_cell.volume / self.init_cell.volume)) | [
"This",
"method",
"returns",
"the",
"sigma",
"value",
"of",
"the",
"gb",
".",
"If",
"using",
"quick_gen",
"to",
"generate",
"GB",
"this",
"value",
"is",
"not",
"valid",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L145-L150 | [
"def",
"sigma",
"(",
"self",
")",
":",
"return",
"int",
"(",
"round",
"(",
"self",
".",
"oriented_unit_cell",
".",
"volume",
"/",
"self",
".",
"init_cell",
".",
"volume",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.sigma_from_site_prop | This method returns the sigma value of the gb from site properties.
If the GB structure merge some atoms due to the atoms too closer with
each other, this property will not work. | pymatgen/analysis/gb/grain.py | def sigma_from_site_prop(self):
"""
This method returns the sigma value of the gb from site properties.
If the GB structure merge some atoms due to the atoms too closer with
each other, this property will not work.
"""
num_coi = 0
if None in self.site_properties['... | def sigma_from_site_prop(self):
"""
This method returns the sigma value of the gb from site properties.
If the GB structure merge some atoms due to the atoms too closer with
each other, this property will not work.
"""
num_coi = 0
if None in self.site_properties['... | [
"This",
"method",
"returns",
"the",
"sigma",
"value",
"of",
"the",
"gb",
"from",
"site",
"properties",
".",
"If",
"the",
"GB",
"structure",
"merge",
"some",
"atoms",
"due",
"to",
"the",
"atoms",
"too",
"closer",
"with",
"each",
"other",
"this",
"property",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L153-L165 | [
"def",
"sigma_from_site_prop",
"(",
"self",
")",
":",
"num_coi",
"=",
"0",
"if",
"None",
"in",
"self",
".",
"site_properties",
"[",
"'grain_label'",
"]",
":",
"raise",
"RuntimeError",
"(",
"'Site were merged, this property do not work'",
")",
"for",
"tag",
"in",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.top_grain | return the top grain (Structure) of the GB. | pymatgen/analysis/gb/grain.py | def top_grain(self):
"""
return the top grain (Structure) of the GB.
"""
top_sites = []
for i, tag in enumerate(self.site_properties['grain_label']):
if 'top' in tag:
top_sites.append(self.sites[i])
return Structure.from_sites(top_sites) | def top_grain(self):
"""
return the top grain (Structure) of the GB.
"""
top_sites = []
for i, tag in enumerate(self.site_properties['grain_label']):
if 'top' in tag:
top_sites.append(self.sites[i])
return Structure.from_sites(top_sites) | [
"return",
"the",
"top",
"grain",
"(",
"Structure",
")",
"of",
"the",
"GB",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L168-L176 | [
"def",
"top_grain",
"(",
"self",
")",
":",
"top_sites",
"=",
"[",
"]",
"for",
"i",
",",
"tag",
"in",
"enumerate",
"(",
"self",
".",
"site_properties",
"[",
"'grain_label'",
"]",
")",
":",
"if",
"'top'",
"in",
"tag",
":",
"top_sites",
".",
"append",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.bottom_grain | return the bottom grain (Structure) of the GB. | pymatgen/analysis/gb/grain.py | def bottom_grain(self):
"""
return the bottom grain (Structure) of the GB.
"""
bottom_sites = []
for i, tag in enumerate(self.site_properties['grain_label']):
if 'bottom' in tag:
bottom_sites.append(self.sites[i])
return Structure.from_sites(bo... | def bottom_grain(self):
"""
return the bottom grain (Structure) of the GB.
"""
bottom_sites = []
for i, tag in enumerate(self.site_properties['grain_label']):
if 'bottom' in tag:
bottom_sites.append(self.sites[i])
return Structure.from_sites(bo... | [
"return",
"the",
"bottom",
"grain",
"(",
"Structure",
")",
"of",
"the",
"GB",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L179-L187 | [
"def",
"bottom_grain",
"(",
"self",
")",
":",
"bottom_sites",
"=",
"[",
"]",
"for",
"i",
",",
"tag",
"in",
"enumerate",
"(",
"self",
".",
"site_properties",
"[",
"'grain_label'",
"]",
")",
":",
"if",
"'bottom'",
"in",
"tag",
":",
"bottom_sites",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundary.coincidents | return the a list of coincident sites. | pymatgen/analysis/gb/grain.py | def coincidents(self):
"""
return the a list of coincident sites.
"""
coincident_sites = []
for i, tag in enumerate(self.site_properties['grain_label']):
if 'incident' in tag:
coincident_sites.append(self.sites[i])
return coincident_sites | def coincidents(self):
"""
return the a list of coincident sites.
"""
coincident_sites = []
for i, tag in enumerate(self.site_properties['grain_label']):
if 'incident' in tag:
coincident_sites.append(self.sites[i])
return coincident_sites | [
"return",
"the",
"a",
"list",
"of",
"coincident",
"sites",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L190-L198 | [
"def",
"coincidents",
"(",
"self",
")",
":",
"coincident_sites",
"=",
"[",
"]",
"for",
"i",
",",
"tag",
"in",
"enumerate",
"(",
"self",
".",
"site_properties",
"[",
"'grain_label'",
"]",
")",
":",
"if",
"'incident'",
"in",
"tag",
":",
"coincident_sites",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.gb_from_parameters | Args:
rotation_axis (list): Rotation axis of GB in the form of a list of integer
e.g.: [1, 1, 0]
rotation_angle (float, in unit of degree): rotation angle used to generate GB.
Make sure the angle is accurate enough. You can use the enum* functions
in... | pymatgen/analysis/gb/grain.py | def gb_from_parameters(self, rotation_axis, rotation_angle, expand_times=4, vacuum_thickness=0.0,
ab_shift=[0, 0], normal=False, ratio=None, plane=None, max_search=20,
tol_coi=1.e-8, rm_ratio=0.7, quick_gen=False):
"""
Args:
rotation_axis... | def gb_from_parameters(self, rotation_axis, rotation_angle, expand_times=4, vacuum_thickness=0.0,
ab_shift=[0, 0], normal=False, ratio=None, plane=None, max_search=20,
tol_coi=1.e-8, rm_ratio=0.7, quick_gen=False):
"""
Args:
rotation_axis... | [
"Args",
":",
"rotation_axis",
"(",
"list",
")",
":",
"Rotation",
"axis",
"of",
"GB",
"in",
"the",
"form",
"of",
"a",
"list",
"of",
"integer",
"e",
".",
"g",
".",
":",
"[",
"1",
"1",
"0",
"]",
"rotation_angle",
"(",
"float",
"in",
"unit",
"of",
"d... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L326-L668 | [
"def",
"gb_from_parameters",
"(",
"self",
",",
"rotation_axis",
",",
"rotation_angle",
",",
"expand_times",
"=",
"4",
",",
"vacuum_thickness",
"=",
"0.0",
",",
"ab_shift",
"=",
"[",
"0",
",",
"0",
"]",
",",
"normal",
"=",
"False",
",",
"ratio",
"=",
"Non... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.get_ratio | find the axial ratio needed for GB generator input.
Args:
max_denominator (int): the maximum denominator for
the computed ratio, default to be 5.
index_none (int): specify the irrational axis.
0-a, 1-b, 2-c. Only may be needed for orthorombic system.
... | pymatgen/analysis/gb/grain.py | def get_ratio(self, max_denominator=5, index_none=None):
"""
find the axial ratio needed for GB generator input.
Args:
max_denominator (int): the maximum denominator for
the computed ratio, default to be 5.
index_none (int): specify the irrational axis.
... | def get_ratio(self, max_denominator=5, index_none=None):
"""
find the axial ratio needed for GB generator input.
Args:
max_denominator (int): the maximum denominator for
the computed ratio, default to be 5.
index_none (int): specify the irrational axis.
... | [
"find",
"the",
"axial",
"ratio",
"needed",
"for",
"GB",
"generator",
"input",
".",
"Args",
":",
"max_denominator",
"(",
"int",
")",
":",
"the",
"maximum",
"denominator",
"for",
"the",
"computed",
"ratio",
"default",
"to",
"be",
"5",
".",
"index_none",
"(",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L670-L726 | [
"def",
"get_ratio",
"(",
"self",
",",
"max_denominator",
"=",
"5",
",",
"index_none",
"=",
"None",
")",
":",
"structure",
"=",
"self",
".",
"initial_structure",
"lat_type",
"=",
"self",
".",
"lat_type",
"if",
"lat_type",
"==",
"'t'",
"or",
"lat_type",
"=="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.get_trans_mat | Find the two transformation matrix for each grain from given rotation axis,
GB plane, rotation angle and corresponding ratio (see explanation for ratio
below).
The structure of each grain can be obtained by applying the corresponding
transformation matrix to the conventional cell.
... | pymatgen/analysis/gb/grain.py | def get_trans_mat(r_axis, angle, normal=False, trans_cry=np.eye(3), lat_type='c',
ratio=None, surface=None, max_search=20, quick_gen=False):
"""
Find the two transformation matrix for each grain from given rotation axis,
GB plane, rotation angle and corresponding ratio (see... | def get_trans_mat(r_axis, angle, normal=False, trans_cry=np.eye(3), lat_type='c',
ratio=None, surface=None, max_search=20, quick_gen=False):
"""
Find the two transformation matrix for each grain from given rotation axis,
GB plane, rotation angle and corresponding ratio (see... | [
"Find",
"the",
"two",
"transformation",
"matrix",
"for",
"each",
"grain",
"from",
"given",
"rotation",
"axis",
"GB",
"plane",
"rotation",
"angle",
"and",
"corresponding",
"ratio",
"(",
"see",
"explanation",
"for",
"ratio",
"below",
")",
".",
"The",
"structure"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L729-L1169 | [
"def",
"get_trans_mat",
"(",
"r_axis",
",",
"angle",
",",
"normal",
"=",
"False",
",",
"trans_cry",
"=",
"np",
".",
"eye",
"(",
"3",
")",
",",
"lat_type",
"=",
"'c'",
",",
"ratio",
"=",
"None",
",",
"surface",
"=",
"None",
",",
"max_search",
"=",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.enum_sigma_cubic | Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in cubic system.
The algorithm for this code is from reference, Acta Cryst, A40,108(1984)
Args:
cutoff (integer): the cutoff of sigma values.
r_axis (list... | pymatgen/analysis/gb/grain.py | def enum_sigma_cubic(cutoff, r_axis):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in cubic system.
The algorithm for this code is from reference, Acta Cryst, A40,108(1984)
Args:
cutoff (inte... | def enum_sigma_cubic(cutoff, r_axis):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in cubic system.
The algorithm for this code is from reference, Acta Cryst, A40,108(1984)
Args:
cutoff (inte... | [
"Find",
"all",
"possible",
"sigma",
"values",
"and",
"corresponding",
"rotation",
"angles",
"within",
"a",
"sigma",
"value",
"cutoff",
"with",
"known",
"rotation",
"axis",
"in",
"cubic",
"system",
".",
"The",
"algorithm",
"for",
"this",
"code",
"is",
"from",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1172-L1247 | [
"def",
"enum_sigma_cubic",
"(",
"cutoff",
",",
"r_axis",
")",
":",
"sigmas",
"=",
"{",
"}",
"# make sure gcd(r_axis)==1",
"if",
"reduce",
"(",
"gcd",
",",
"r_axis",
")",
"!=",
"1",
":",
"r_axis",
"=",
"[",
"int",
"(",
"round",
"(",
"x",
"/",
"reduce",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.enum_sigma_rho | Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in rhombohedral system.
The algorithm for this code is from reference, Acta Cryst, A45,505(1989).
Args:
cutoff (integer): the cutoff of sigma values.
r_a... | pymatgen/analysis/gb/grain.py | def enum_sigma_rho(cutoff, r_axis, ratio_alpha):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in rhombohedral system.
The algorithm for this code is from reference, Acta Cryst, A45,505(1989).
Args:
... | def enum_sigma_rho(cutoff, r_axis, ratio_alpha):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in rhombohedral system.
The algorithm for this code is from reference, Acta Cryst, A45,505(1989).
Args:
... | [
"Find",
"all",
"possible",
"sigma",
"values",
"and",
"corresponding",
"rotation",
"angles",
"within",
"a",
"sigma",
"value",
"cutoff",
"with",
"known",
"rotation",
"axis",
"in",
"rhombohedral",
"system",
".",
"The",
"algorithm",
"for",
"this",
"code",
"is",
"f... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1376-L1517 | [
"def",
"enum_sigma_rho",
"(",
"cutoff",
",",
"r_axis",
",",
"ratio_alpha",
")",
":",
"sigmas",
"=",
"{",
"}",
"# transform four index notation to three index notation",
"if",
"len",
"(",
"r_axis",
")",
"==",
"4",
":",
"u1",
"=",
"r_axis",
"[",
"0",
"]",
"v1"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.enum_sigma_tet | Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in tetragonal system.
The algorithm for this code is from reference, Acta Cryst, B46,117(1990)
Args:
cutoff (integer): the cutoff of sigma values.
r_axis... | pymatgen/analysis/gb/grain.py | def enum_sigma_tet(cutoff, r_axis, c2_a2_ratio):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in tetragonal system.
The algorithm for this code is from reference, Acta Cryst, B46,117(1990)
Args:
... | def enum_sigma_tet(cutoff, r_axis, c2_a2_ratio):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in tetragonal system.
The algorithm for this code is from reference, Acta Cryst, B46,117(1990)
Args:
... | [
"Find",
"all",
"possible",
"sigma",
"values",
"and",
"corresponding",
"rotation",
"angles",
"within",
"a",
"sigma",
"value",
"cutoff",
"with",
"known",
"rotation",
"axis",
"in",
"tetragonal",
"system",
".",
"The",
"algorithm",
"for",
"this",
"code",
"is",
"fro... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1520-L1635 | [
"def",
"enum_sigma_tet",
"(",
"cutoff",
",",
"r_axis",
",",
"c2_a2_ratio",
")",
":",
"sigmas",
"=",
"{",
"}",
"# make sure gcd(r_axis)==1",
"if",
"reduce",
"(",
"gcd",
",",
"r_axis",
")",
"!=",
"1",
":",
"r_axis",
"=",
"[",
"int",
"(",
"round",
"(",
"x... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.enum_sigma_ort | Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in orthorhombic system.
The algorithm for this code is from reference, Scipta Metallurgica 27, 291(1992)
Args:
cutoff (integer): the cutoff of sigma values.
... | pymatgen/analysis/gb/grain.py | def enum_sigma_ort(cutoff, r_axis, c2_b2_a2_ratio):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in orthorhombic system.
The algorithm for this code is from reference, Scipta Metallurgica 27, 291(1992)
... | def enum_sigma_ort(cutoff, r_axis, c2_b2_a2_ratio):
"""
Find all possible sigma values and corresponding rotation angles
within a sigma value cutoff with known rotation axis in orthorhombic system.
The algorithm for this code is from reference, Scipta Metallurgica 27, 291(1992)
... | [
"Find",
"all",
"possible",
"sigma",
"values",
"and",
"corresponding",
"rotation",
"angles",
"within",
"a",
"sigma",
"value",
"cutoff",
"with",
"known",
"rotation",
"axis",
"in",
"orthorhombic",
"system",
".",
"The",
"algorithm",
"for",
"this",
"code",
"is",
"f... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1638-L1790 | [
"def",
"enum_sigma_ort",
"(",
"cutoff",
",",
"r_axis",
",",
"c2_b2_a2_ratio",
")",
":",
"sigmas",
"=",
"{",
"}",
"# make sure gcd(r_axis)==1",
"if",
"reduce",
"(",
"gcd",
",",
"r_axis",
")",
"!=",
"1",
":",
"r_axis",
"=",
"[",
"int",
"(",
"round",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.enum_possible_plane_cubic | Find all possible plane combinations for GBs given a rotaion axis and angle for
cubic system, and classify them to different categories, including 'Twist',
'Symmetric tilt', 'Normal tilt', 'Mixed' GBs.
Args:
plane_cutoff (integer): the cutoff of plane miller index.
r_axi... | pymatgen/analysis/gb/grain.py | def enum_possible_plane_cubic(plane_cutoff, r_axis, r_angle):
"""
Find all possible plane combinations for GBs given a rotaion axis and angle for
cubic system, and classify them to different categories, including 'Twist',
'Symmetric tilt', 'Normal tilt', 'Mixed' GBs.
Args:
... | def enum_possible_plane_cubic(plane_cutoff, r_axis, r_angle):
"""
Find all possible plane combinations for GBs given a rotaion axis and angle for
cubic system, and classify them to different categories, including 'Twist',
'Symmetric tilt', 'Normal tilt', 'Mixed' GBs.
Args:
... | [
"Find",
"all",
"possible",
"plane",
"combinations",
"for",
"GBs",
"given",
"a",
"rotaion",
"axis",
"and",
"angle",
"for",
"cubic",
"system",
"and",
"classify",
"them",
"to",
"different",
"categories",
"including",
"Twist",
"Symmetric",
"tilt",
"Normal",
"tilt",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1793-L1857 | [
"def",
"enum_possible_plane_cubic",
"(",
"plane_cutoff",
",",
"r_axis",
",",
"r_angle",
")",
":",
"all_combinations",
"=",
"{",
"}",
"all_combinations",
"[",
"'Symmetric tilt'",
"]",
"=",
"[",
"]",
"all_combinations",
"[",
"'Twist'",
"]",
"=",
"[",
"]",
"all_c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.get_rotation_angle_from_sigma | Find all possible rotation angle for the given sigma value.
Args:
sigma (integer):
sigma value provided
r_axis (list of three integers, e.g. u, v, w
or four integers, e.g. u, v, t, w for hex/rho system only):
the rotation axis ... | pymatgen/analysis/gb/grain.py | def get_rotation_angle_from_sigma(sigma, r_axis, lat_type='C', ratio=None):
"""
Find all possible rotation angle for the given sigma value.
Args:
sigma (integer):
sigma value provided
r_axis (list of three integers, e.g. u, v, w
or... | def get_rotation_angle_from_sigma(sigma, r_axis, lat_type='C', ratio=None):
"""
Find all possible rotation angle for the given sigma value.
Args:
sigma (integer):
sigma value provided
r_axis (list of three integers, e.g. u, v, w
or... | [
"Find",
"all",
"possible",
"rotation",
"angle",
"for",
"the",
"given",
"sigma",
"value",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1860-L1940 | [
"def",
"get_rotation_angle_from_sigma",
"(",
"sigma",
",",
"r_axis",
",",
"lat_type",
"=",
"'C'",
",",
"ratio",
"=",
"None",
")",
":",
"if",
"lat_type",
".",
"lower",
"(",
")",
"==",
"'c'",
":",
"logger",
".",
"info",
"(",
"'Make sure this is for cubic syste... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.slab_from_csl | By linear operation of csl lattice vectors to get the best corresponding
slab lattice. That is the area of a,b vectors (within the surface plane)
is the smallest, the c vector first, has shortest length perpendicular
to surface [h,k,l], second, has shortest length itself.
Args:
... | pymatgen/analysis/gb/grain.py | def slab_from_csl(csl, surface, normal, trans_cry, max_search=20, quick_gen=False):
"""
By linear operation of csl lattice vectors to get the best corresponding
slab lattice. That is the area of a,b vectors (within the surface plane)
is the smallest, the c vector first, has shortest leng... | def slab_from_csl(csl, surface, normal, trans_cry, max_search=20, quick_gen=False):
"""
By linear operation of csl lattice vectors to get the best corresponding
slab lattice. That is the area of a,b vectors (within the surface plane)
is the smallest, the c vector first, has shortest leng... | [
"By",
"linear",
"operation",
"of",
"csl",
"lattice",
"vectors",
"to",
"get",
"the",
"best",
"corresponding",
"slab",
"lattice",
".",
"That",
"is",
"the",
"area",
"of",
"a",
"b",
"vectors",
"(",
"within",
"the",
"surface",
"plane",
")",
"is",
"the",
"smal... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L1943-L2168 | [
"def",
"slab_from_csl",
"(",
"csl",
",",
"surface",
",",
"normal",
",",
"trans_cry",
",",
"max_search",
"=",
"20",
",",
"quick_gen",
"=",
"False",
")",
":",
"# set the transform matrix in real space",
"trans",
"=",
"trans_cry",
"# transform matrix in reciprocal space"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.reduce_mat | Reduce integer array mat's determinant mag times by linear combination
of its row vectors, so that the new array after rotation (r_matrix) is
still an integer array
Args:
mat (3 by 3 array): input matrix
mag (integer): reduce times for the determinant
r_matri... | pymatgen/analysis/gb/grain.py | def reduce_mat(mat, mag, r_matrix):
"""
Reduce integer array mat's determinant mag times by linear combination
of its row vectors, so that the new array after rotation (r_matrix) is
still an integer array
Args:
mat (3 by 3 array): input matrix
mag (intege... | def reduce_mat(mat, mag, r_matrix):
"""
Reduce integer array mat's determinant mag times by linear combination
of its row vectors, so that the new array after rotation (r_matrix) is
still an integer array
Args:
mat (3 by 3 array): input matrix
mag (intege... | [
"Reduce",
"integer",
"array",
"mat",
"s",
"determinant",
"mag",
"times",
"by",
"linear",
"combination",
"of",
"its",
"row",
"vectors",
"so",
"that",
"the",
"new",
"array",
"after",
"rotation",
"(",
"r_matrix",
")",
"is",
"still",
"an",
"integer",
"array"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L2171-L2205 | [
"def",
"reduce_mat",
"(",
"mat",
",",
"mag",
",",
"r_matrix",
")",
":",
"max_j",
"=",
"abs",
"(",
"int",
"(",
"round",
"(",
"np",
".",
"linalg",
".",
"det",
"(",
"mat",
")",
"/",
"mag",
")",
")",
")",
"reduced",
"=",
"False",
"for",
"h",
"in",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GrainBoundaryGenerator.vec_to_surface | Transform a float vector to a surface miller index with integers.
Args:
vec (1 by 3 array float vector): input float vector
Return:
the surface miller index of the input vector. | pymatgen/analysis/gb/grain.py | def vec_to_surface(vec):
"""
Transform a float vector to a surface miller index with integers.
Args:
vec (1 by 3 array float vector): input float vector
Return:
the surface miller index of the input vector.
"""
miller = [None] * 3
index = ... | def vec_to_surface(vec):
"""
Transform a float vector to a surface miller index with integers.
Args:
vec (1 by 3 array float vector): input float vector
Return:
the surface miller index of the input vector.
"""
miller = [None] * 3
index = ... | [
"Transform",
"a",
"float",
"vector",
"to",
"a",
"surface",
"miller",
"index",
"with",
"integers",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/gb/grain.py#L2208-L2241 | [
"def",
"vec_to_surface",
"(",
"vec",
")",
":",
"miller",
"=",
"[",
"None",
"]",
"*",
"3",
"index",
"=",
"[",
"]",
"for",
"i",
",",
"value",
"in",
"enumerate",
"(",
"vec",
")",
":",
"if",
"abs",
"(",
"value",
")",
"<",
"1.e-8",
":",
"miller",
"[... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpectrumPlotter.add_spectrum | Adds a Spectrum for plotting.
Args:
label (str): Label for the Spectrum. Must be unique.
spectrum: Spectrum object
color (str): This is passed on to matplotlib. E.g., "k--" indicates
a dashed black line. If None, a color will be chosen based on
... | pymatgen/vis/plotters.py | def add_spectrum(self, label, spectrum, color=None):
"""
Adds a Spectrum for plotting.
Args:
label (str): Label for the Spectrum. Must be unique.
spectrum: Spectrum object
color (str): This is passed on to matplotlib. E.g., "k--" indicates
a d... | def add_spectrum(self, label, spectrum, color=None):
"""
Adds a Spectrum for plotting.
Args:
label (str): Label for the Spectrum. Must be unique.
spectrum: Spectrum object
color (str): This is passed on to matplotlib. E.g., "k--" indicates
a d... | [
"Adds",
"a",
"Spectrum",
"for",
"plotting",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/plotters.py#L65-L79 | [
"def",
"add_spectrum",
"(",
"self",
",",
"label",
",",
"spectrum",
",",
"color",
"=",
"None",
")",
":",
"self",
".",
"_spectra",
"[",
"label",
"]",
"=",
"spectrum",
"self",
".",
"colors",
".",
"append",
"(",
"color",
"or",
"self",
".",
"colors_cycle",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpectrumPlotter.add_spectra | Add a dictionary of doses, with an optional sorting function for the
keys.
Args:
dos_dict: dict of {label: Dos}
key_sort_func: function used to sort the dos_dict keys. | pymatgen/vis/plotters.py | def add_spectra(self, spectra_dict, key_sort_func=None):
"""
Add a dictionary of doses, with an optional sorting function for the
keys.
Args:
dos_dict: dict of {label: Dos}
key_sort_func: function used to sort the dos_dict keys.
"""
if key_sort_fu... | def add_spectra(self, spectra_dict, key_sort_func=None):
"""
Add a dictionary of doses, with an optional sorting function for the
keys.
Args:
dos_dict: dict of {label: Dos}
key_sort_func: function used to sort the dos_dict keys.
"""
if key_sort_fu... | [
"Add",
"a",
"dictionary",
"of",
"doses",
"with",
"an",
"optional",
"sorting",
"function",
"for",
"the",
"keys",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/plotters.py#L81-L95 | [
"def",
"add_spectra",
"(",
"self",
",",
"spectra_dict",
",",
"key_sort_func",
"=",
"None",
")",
":",
"if",
"key_sort_func",
":",
"keys",
"=",
"sorted",
"(",
"spectra_dict",
".",
"keys",
"(",
")",
",",
"key",
"=",
"key_sort_func",
")",
"else",
":",
"keys"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpectrumPlotter.get_plot | Get a matplotlib plot showing the DOS.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits. | pymatgen/vis/plotters.py | def get_plot(self, xlim=None, ylim=None):
"""
Get a matplotlib plot showing the DOS.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
"""
plt = pretty_plot(12, 8)
... | def get_plot(self, xlim=None, ylim=None):
"""
Get a matplotlib plot showing the DOS.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
"""
plt = pretty_plot(12, 8)
... | [
"Get",
"a",
"matplotlib",
"plot",
"showing",
"the",
"DOS",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/plotters.py#L97-L133 | [
"def",
"get_plot",
"(",
"self",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
")",
":",
"plt",
"=",
"pretty_plot",
"(",
"12",
",",
"8",
")",
"base",
"=",
"0.0",
"i",
"=",
"0",
"for",
"key",
",",
"sp",
"in",
"self",
".",
"_spectra",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpectrumPlotter.save_plot | Save matplotlib plot to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS. | pymatgen/vis/plotters.py | def save_plot(self, filename, img_format="eps", **kwargs):
"""
Save matplotlib plot to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
"""
plt = self.get_plot(**kwargs)
plt.savefig(filename, format=i... | def save_plot(self, filename, img_format="eps", **kwargs):
"""
Save matplotlib plot to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
"""
plt = self.get_plot(**kwargs)
plt.savefig(filename, format=i... | [
"Save",
"matplotlib",
"plot",
"to",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/plotters.py#L135-L144 | [
"def",
"save_plot",
"(",
"self",
",",
"filename",
",",
"img_format",
"=",
"\"eps\"",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
"=",
"self",
".",
"get_plot",
"(",
"*",
"*",
"kwargs",
")",
"plt",
".",
"savefig",
"(",
"filename",
",",
"format",
"=",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PartialRemoveSpecieTransformation.apply_transformation | Apply the transformation.
Args:
structure: input structure
return_ranked_list (bool/int): Boolean stating whether or not
multiple structures are returned. If return_ranked_list is
an int, that number of structures is returned.
Returns:
... | pymatgen/transformations/standard_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply the transformation.
Args:
structure: input structure
return_ranked_list (bool/int): Boolean stating whether or not
multiple structures are returned. If return_ranked_list is
... | def apply_transformation(self, structure, return_ranked_list=False):
"""
Apply the transformation.
Args:
structure: input structure
return_ranked_list (bool/int): Boolean stating whether or not
multiple structures are returned. If return_ranked_list is
... | [
"Apply",
"the",
"transformation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/standard_transformations.py#L343-L371 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"sp",
"=",
"get_el_sp",
"(",
"self",
".",
"specie_to_remove",
")",
"specie_indices",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"len",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | OrderDisorderedStructureTransformation.apply_transformation | For this transformation, the apply_transformation method will return
only the ordered structure with the lowest Ewald energy, to be
consistent with the method signature of the other transformations.
However, all structures are stored in the all_structures attribute in
the transformation... | pymatgen/transformations/standard_transformations.py | def apply_transformation(self, structure, return_ranked_list=False):
"""
For this transformation, the apply_transformation method will return
only the ordered structure with the lowest Ewald energy, to be
consistent with the method signature of the other transformations.
However,... | def apply_transformation(self, structure, return_ranked_list=False):
"""
For this transformation, the apply_transformation method will return
only the ordered structure with the lowest Ewald energy, to be
consistent with the method signature of the other transformations.
However,... | [
"For",
"this",
"transformation",
"the",
"apply_transformation",
"method",
"will",
"return",
"only",
"the",
"ordered",
"structure",
"with",
"the",
"lowest",
"Ewald",
"energy",
"to",
"be",
"consistent",
"with",
"the",
"method",
"signature",
"of",
"the",
"other",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/standard_transformations.py#L439-L565 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
",",
"return_ranked_list",
"=",
"False",
")",
":",
"try",
":",
"num_to_return",
"=",
"int",
"(",
"return_ranked_list",
")",
"except",
"ValueError",
":",
"num_to_return",
"=",
"1",
"num_to_return",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ConventionalCellTransformation.apply_transformation | Returns most primitive cell for structure.
Args:
structure: A structure
Returns:
The same structure in a conventional standard setting | pymatgen/transformations/standard_transformations.py | def apply_transformation(self, structure):
"""
Returns most primitive cell for structure.
Args:
structure: A structure
Returns:
The same structure in a conventional standard setting
"""
sga = SpacegroupAnalyzer(structure, symprec=self.symprec,
... | def apply_transformation(self, structure):
"""
Returns most primitive cell for structure.
Args:
structure: A structure
Returns:
The same structure in a conventional standard setting
"""
sga = SpacegroupAnalyzer(structure, symprec=self.symprec,
... | [
"Returns",
"most",
"primitive",
"cell",
"for",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/standard_transformations.py#L646-L658 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
")",
":",
"sga",
"=",
"SpacegroupAnalyzer",
"(",
"structure",
",",
"symprec",
"=",
"self",
".",
"symprec",
",",
"angle_tolerance",
"=",
"self",
".",
"angle_tolerance",
")",
"return",
"sga",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DiscretizeOccupanciesTransformation.apply_transformation | Discretizes the site occupancies in the structure.
Args:
structure: disordered Structure to discretize occupancies
Returns:
A new disordered Structure with occupancies discretized | pymatgen/transformations/standard_transformations.py | def apply_transformation(self, structure):
"""
Discretizes the site occupancies in the structure.
Args:
structure: disordered Structure to discretize occupancies
Returns:
A new disordered Structure with occupancies discretized
"""
if structure.is... | def apply_transformation(self, structure):
"""
Discretizes the site occupancies in the structure.
Args:
structure: disordered Structure to discretize occupancies
Returns:
A new disordered Structure with occupancies discretized
"""
if structure.is... | [
"Discretizes",
"the",
"site",
"occupancies",
"in",
"the",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/standard_transformations.py#L768-L796 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
")",
":",
"if",
"structure",
".",
"is_ordered",
":",
"return",
"structure",
"species",
"=",
"[",
"dict",
"(",
"sp",
")",
"for",
"sp",
"in",
"structure",
".",
"species_and_occu",
"]",
"for",
"sp"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ScaleToRelaxedTransformation.apply_transformation | Returns a copy of structure with lattice parameters
and sites scaled to the same degree as the relaxed_structure.
Arg:
structure (Structure): A structurally similar structure in
regards to crystal and site positions. | pymatgen/transformations/standard_transformations.py | def apply_transformation(self, structure):
"""
Returns a copy of structure with lattice parameters
and sites scaled to the same degree as the relaxed_structure.
Arg:
structure (Structure): A structurally similar structure in
regards to crystal and site positi... | def apply_transformation(self, structure):
"""
Returns a copy of structure with lattice parameters
and sites scaled to the same degree as the relaxed_structure.
Arg:
structure (Structure): A structurally similar structure in
regards to crystal and site positi... | [
"Returns",
"a",
"copy",
"of",
"structure",
"with",
"lattice",
"parameters",
"and",
"sites",
"scaled",
"to",
"the",
"same",
"degree",
"as",
"the",
"relaxed_structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/standard_transformations.py#L885-L912 | [
"def",
"apply_transformation",
"(",
"self",
",",
"structure",
")",
":",
"if",
"self",
".",
"species_map",
"==",
"None",
":",
"match",
"=",
"StructureMatcher",
"(",
")",
"s_map",
"=",
"match",
".",
"get_best_electronegativity_anonymous_mapping",
"(",
"self",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LibxcFunc.as_dict | Makes LibxcFunc obey the general json interface used in pymatgen for
easier serialization. | pymatgen/core/libxcfunc.py | def as_dict(self):
"""
Makes LibxcFunc obey the general json interface used in pymatgen for
easier serialization.
"""
return {"name": self.name,
"@module": self.__class__.__module__,
"@class": self.__class__.__name__} | def as_dict(self):
"""
Makes LibxcFunc obey the general json interface used in pymatgen for
easier serialization.
"""
return {"name": self.name,
"@module": self.__class__.__module__,
"@class": self.__class__.__name__} | [
"Makes",
"LibxcFunc",
"obey",
"the",
"general",
"json",
"interface",
"used",
"in",
"pymatgen",
"for",
"easier",
"serialization",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/libxcfunc.py#L486-L493 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
"}"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | lattice_2_lmpbox | Converts a lattice object to LammpsBox, and calculates the symmetry
operation used.
Args:
lattice (Lattice): Input lattice.
origin: A (3,) array/list of floats setting lower bounds of
simulation box. Default to (0, 0, 0).
Returns:
LammpsBox, SymmOp | pymatgen/io/lammps/data.py | def lattice_2_lmpbox(lattice, origin=(0, 0, 0)):
"""
Converts a lattice object to LammpsBox, and calculates the symmetry
operation used.
Args:
lattice (Lattice): Input lattice.
origin: A (3,) array/list of floats setting lower bounds of
simulation box. Default to (0, 0, 0).
... | def lattice_2_lmpbox(lattice, origin=(0, 0, 0)):
"""
Converts a lattice object to LammpsBox, and calculates the symmetry
operation used.
Args:
lattice (Lattice): Input lattice.
origin: A (3,) array/list of floats setting lower bounds of
simulation box. Default to (0, 0, 0).
... | [
"Converts",
"a",
"lattice",
"object",
"to",
"LammpsBox",
"and",
"calculates",
"the",
"symmetry",
"operation",
"used",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L179-L208 | [
"def",
"lattice_2_lmpbox",
"(",
"lattice",
",",
"origin",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"lattice",
".",
"abc",
"xlo",
",",
"ylo",
",",
"zlo",
"=",
"origin",
"xhi",
"=",
"a",
"+",
"xlo",
"m",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | structure_2_lmpdata | Converts a structure to a LammpsData object with no force field
parameters and topologies.
Args:
structure (Structure): Input structure.
ff_elements ([str]): List of strings of elements that must be
present due to force field settings but not necessarily in
the structure... | pymatgen/io/lammps/data.py | def structure_2_lmpdata(structure, ff_elements=None, atom_style="charge"):
"""
Converts a structure to a LammpsData object with no force field
parameters and topologies.
Args:
structure (Structure): Input structure.
ff_elements ([str]): List of strings of elements that must be
... | def structure_2_lmpdata(structure, ff_elements=None, atom_style="charge"):
"""
Converts a structure to a LammpsData object with no force field
parameters and topologies.
Args:
structure (Structure): Input structure.
ff_elements ([str]): List of strings of elements that must be
... | [
"Converts",
"a",
"structure",
"to",
"a",
"LammpsData",
"object",
"with",
"no",
"force",
"field",
"parameters",
"and",
"topologies",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L1159-L1201 | [
"def",
"structure_2_lmpdata",
"(",
"structure",
",",
"ff_elements",
"=",
"None",
",",
"atom_style",
"=",
"\"charge\"",
")",
":",
"s",
"=",
"structure",
".",
"get_sorted_structure",
"(",
")",
"a",
",",
"b",
",",
"c",
"=",
"s",
".",
"lattice",
".",
"abc",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsBox.volume | Volume of simulation box. | pymatgen/io/lammps/data.py | def volume(self):
"""
Volume of simulation box.
"""
m = self._matrix
return np.dot(np.cross(m[0], m[1]), m[2]) | def volume(self):
"""
Volume of simulation box.
"""
m = self._matrix
return np.dot(np.cross(m[0], m[1]), m[2]) | [
"Volume",
"of",
"simulation",
"box",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L120-L126 | [
"def",
"volume",
"(",
"self",
")",
":",
"m",
"=",
"self",
".",
"_matrix",
"return",
"np",
".",
"dot",
"(",
"np",
".",
"cross",
"(",
"m",
"[",
"0",
"]",
",",
"m",
"[",
"1",
"]",
")",
",",
"m",
"[",
"2",
"]",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsBox.get_string | Returns the string representation of simulation box in LAMMPS
data file format.
Args:
significant_figures (int): No. of significant figures to
output for box settings. Default to 6.
Returns:
String representation | pymatgen/io/lammps/data.py | def get_string(self, significant_figures=6):
"""
Returns the string representation of simulation box in LAMMPS
data file format.
Args:
significant_figures (int): No. of significant figures to
output for box settings. Default to 6.
Returns:
... | def get_string(self, significant_figures=6):
"""
Returns the string representation of simulation box in LAMMPS
data file format.
Args:
significant_figures (int): No. of significant figures to
output for box settings. Default to 6.
Returns:
... | [
"Returns",
"the",
"string",
"representation",
"of",
"simulation",
"box",
"in",
"LAMMPS",
"data",
"file",
"format",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L128-L150 | [
"def",
"get_string",
"(",
"self",
",",
"significant_figures",
"=",
"6",
")",
":",
"ph",
"=",
"\"{:.%df}\"",
"%",
"significant_figures",
"lines",
"=",
"[",
"]",
"for",
"bound",
",",
"d",
"in",
"zip",
"(",
"self",
".",
"bounds",
",",
"\"xyz\"",
")",
":",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.structure | Exports a periodic structure object representing the simulation
box.
Return:
Structure | pymatgen/io/lammps/data.py | def structure(self):
"""
Exports a periodic structure object representing the simulation
box.
Return:
Structure
"""
masses = self.masses
atoms = self.atoms.copy()
if "nx" in atoms.columns:
atoms.drop(["nx", "ny", "nz"], axis=1, in... | def structure(self):
"""
Exports a periodic structure object representing the simulation
box.
Return:
Structure
"""
masses = self.masses
atoms = self.atoms.copy()
if "nx" in atoms.columns:
atoms.drop(["nx", "ny", "nz"], axis=1, in... | [
"Exports",
"a",
"periodic",
"structure",
"object",
"representing",
"the",
"simulation",
"box",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L273-L299 | [
"def",
"structure",
"(",
"self",
")",
":",
"masses",
"=",
"self",
".",
"masses",
"atoms",
"=",
"self",
".",
"atoms",
".",
"copy",
"(",
")",
"if",
"\"nx\"",
"in",
"atoms",
".",
"columns",
":",
"atoms",
".",
"drop",
"(",
"[",
"\"nx\"",
",",
"\"ny\"",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.get_string | Returns the string representation of LammpsData, essentially
the string to be written to a file.
Args:
distance (int): No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
Default to 6.
velocity (int): No... | pymatgen/io/lammps/data.py | def get_string(self, distance=6, velocity=8, charge=3):
"""
Returns the string representation of LammpsData, essentially
the string to be written to a file.
Args:
distance (int): No. of significant figures to output for
box settings (bounds and tilt) and atom... | def get_string(self, distance=6, velocity=8, charge=3):
"""
Returns the string representation of LammpsData, essentially
the string to be written to a file.
Args:
distance (int): No. of significant figures to output for
box settings (bounds and tilt) and atom... | [
"Returns",
"the",
"string",
"representation",
"of",
"LammpsData",
"essentially",
"the",
"string",
"to",
"be",
"written",
"to",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L301-L374 | [
"def",
"get_string",
"(",
"self",
",",
"distance",
"=",
"6",
",",
"velocity",
"=",
"8",
",",
"charge",
"=",
"3",
")",
":",
"file_template",
"=",
"\"\"\"Generated by pymatgen.io.lammps.data.LammpsData\n\n{stats}\n\n{box}\n\n{body}\n\"\"\"",
"box",
"=",
"self",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.write_file | Writes LammpsData to file.
Args:
filename (str): Filename.
distance (int): No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
Default to 6.
velocity (int): No. of significant figures to output for
... | pymatgen/io/lammps/data.py | def write_file(self, filename, distance=6, velocity=8, charge=3):
"""
Writes LammpsData to file.
Args:
filename (str): Filename.
distance (int): No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
... | def write_file(self, filename, distance=6, velocity=8, charge=3):
"""
Writes LammpsData to file.
Args:
filename (str): Filename.
distance (int): No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
... | [
"Writes",
"LammpsData",
"to",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L376-L393 | [
"def",
"write_file",
"(",
"self",
",",
"filename",
",",
"distance",
"=",
"6",
",",
"velocity",
"=",
"8",
",",
"charge",
"=",
"3",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.disassemble | Breaks down LammpsData to building blocks
(LammpsBox, ForceField and a series of Topology).
RESTRICTIONS APPLIED:
1. No complex force field defined not just on atom
types, where the same type or equivalent types of topology
may have more than one set of coefficients.
... | pymatgen/io/lammps/data.py | def disassemble(self, atom_labels=None, guess_element=True,
ff_label="ff_map"):
"""
Breaks down LammpsData to building blocks
(LammpsBox, ForceField and a series of Topology).
RESTRICTIONS APPLIED:
1. No complex force field defined not just on atom
... | def disassemble(self, atom_labels=None, guess_element=True,
ff_label="ff_map"):
"""
Breaks down LammpsData to building blocks
(LammpsBox, ForceField and a series of Topology).
RESTRICTIONS APPLIED:
1. No complex force field defined not just on atom
... | [
"Breaks",
"down",
"LammpsData",
"to",
"building",
"blocks",
"(",
"LammpsBox",
"ForceField",
"and",
"a",
"series",
"of",
"Topology",
")",
".",
"RESTRICTIONS",
"APPLIED",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L395-L541 | [
"def",
"disassemble",
"(",
"self",
",",
"atom_labels",
"=",
"None",
",",
"guess_element",
"=",
"True",
",",
"ff_label",
"=",
"\"ff_map\"",
")",
":",
"atoms_df",
"=",
"self",
".",
"atoms",
".",
"copy",
"(",
")",
"if",
"\"nx\"",
"in",
"atoms_df",
".",
"c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.from_file | Constructor that parses a file.
Args:
filename (str): Filename to read.
atom_style (str): Associated atom_style. Default to "full".
sort_id (bool): Whether sort each section by id. Default to
True. | pymatgen/io/lammps/data.py | def from_file(cls, filename, atom_style="full", sort_id=False):
"""
Constructor that parses a file.
Args:
filename (str): Filename to read.
atom_style (str): Associated atom_style. Default to "full".
sort_id (bool): Whether sort each section by id. Default to... | def from_file(cls, filename, atom_style="full", sort_id=False):
"""
Constructor that parses a file.
Args:
filename (str): Filename to read.
atom_style (str): Associated atom_style. Default to "full".
sort_id (bool): Whether sort each section by id. Default to... | [
"Constructor",
"that",
"parses",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L544-L664 | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
",",
"atom_style",
"=",
"\"full\"",
",",
"sort_id",
"=",
"False",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"kw_pattern",
"=",
"r\"|... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.from_ff_and_topologies | Constructor building LammpsData from a ForceField object and a
list of Topology objects. Do not support intermolecular
topologies since a Topology object includes data for ONE
molecule or structure only.
Args:
box (LammpsBox): Simulation box.
ff (ForceField): For... | pymatgen/io/lammps/data.py | def from_ff_and_topologies(cls, box, ff, topologies, atom_style="full"):
"""
Constructor building LammpsData from a ForceField object and a
list of Topology objects. Do not support intermolecular
topologies since a Topology object includes data for ONE
molecule or structure only.... | def from_ff_and_topologies(cls, box, ff, topologies, atom_style="full"):
"""
Constructor building LammpsData from a ForceField object and a
list of Topology objects. Do not support intermolecular
topologies since a Topology object includes data for ONE
molecule or structure only.... | [
"Constructor",
"building",
"LammpsData",
"from",
"a",
"ForceField",
"object",
"and",
"a",
"list",
"of",
"Topology",
"objects",
".",
"Do",
"not",
"support",
"intermolecular",
"topologies",
"since",
"a",
"Topology",
"object",
"includes",
"data",
"for",
"ONE",
"mol... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L667-L739 | [
"def",
"from_ff_and_topologies",
"(",
"cls",
",",
"box",
",",
"ff",
",",
"topologies",
",",
"atom_style",
"=",
"\"full\"",
")",
":",
"atom_types",
"=",
"set",
".",
"union",
"(",
"*",
"[",
"t",
".",
"species",
"for",
"t",
"in",
"topologies",
"]",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsData.from_structure | Simple constructor building LammpsData from a structure without
force field parameters and topologies.
Args:
structure (Structure): Input structure.
ff_elements ([str]): List of strings of elements that must
be present due to force field settings but not
... | pymatgen/io/lammps/data.py | def from_structure(cls, structure, ff_elements=None, atom_style="charge"):
"""
Simple constructor building LammpsData from a structure without
force field parameters and topologies.
Args:
structure (Structure): Input structure.
ff_elements ([str]): List of string... | def from_structure(cls, structure, ff_elements=None, atom_style="charge"):
"""
Simple constructor building LammpsData from a structure without
force field parameters and topologies.
Args:
structure (Structure): Input structure.
ff_elements ([str]): List of string... | [
"Simple",
"constructor",
"building",
"LammpsData",
"from",
"a",
"structure",
"without",
"force",
"field",
"parameters",
"and",
"topologies",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L742-L777 | [
"def",
"from_structure",
"(",
"cls",
",",
"structure",
",",
"ff_elements",
"=",
"None",
",",
"atom_style",
"=",
"\"charge\"",
")",
":",
"s",
"=",
"structure",
".",
"get_sorted_structure",
"(",
")",
"box",
",",
"symmop",
"=",
"lattice_2_lmpbox",
"(",
"s",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Topology.from_bonding | Another constructor that creates an instance from a molecule.
Covalent bonds and other bond-based topologies (angles and
dihedrals) can be automatically determined. Cannot be used for
non bond-based topologies, e.g., improper dihedrals.
Args:
molecule (Molecule): Input molec... | pymatgen/io/lammps/data.py | def from_bonding(cls, molecule, bond=True, angle=True, dihedral=True,
tol=0.1, **kwargs):
"""
Another constructor that creates an instance from a molecule.
Covalent bonds and other bond-based topologies (angles and
dihedrals) can be automatically determined. Cannot b... | def from_bonding(cls, molecule, bond=True, angle=True, dihedral=True,
tol=0.1, **kwargs):
"""
Another constructor that creates an instance from a molecule.
Covalent bonds and other bond-based topologies (angles and
dihedrals) can be automatically determined. Cannot b... | [
"Another",
"constructor",
"that",
"creates",
"an",
"instance",
"from",
"a",
"molecule",
".",
"Covalent",
"bonds",
"and",
"other",
"bond",
"-",
"based",
"topologies",
"(",
"angles",
"and",
"dihedrals",
")",
"can",
"be",
"automatically",
"determined",
".",
"Cann... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L895-L955 | [
"def",
"from_bonding",
"(",
"cls",
",",
"molecule",
",",
"bond",
"=",
"True",
",",
"angle",
"=",
"True",
",",
"dihedral",
"=",
"True",
",",
"tol",
"=",
"0.1",
",",
"*",
"*",
"kwargs",
")",
":",
"real_bonds",
"=",
"molecule",
".",
"get_covalent_bonds",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ForceField.to_file | Saves object to a file in YAML format.
Args:
filename (str): Filename. | pymatgen/io/lammps/data.py | def to_file(self, filename):
"""
Saves object to a file in YAML format.
Args:
filename (str): Filename.
"""
d = {"mass_info": self.mass_info,
"nonbond_coeffs": self.nonbond_coeffs,
"topo_coeffs": self.topo_coeffs}
yaml = YAML(typ="s... | def to_file(self, filename):
"""
Saves object to a file in YAML format.
Args:
filename (str): Filename.
"""
d = {"mass_info": self.mass_info,
"nonbond_coeffs": self.nonbond_coeffs,
"topo_coeffs": self.topo_coeffs}
yaml = YAML(typ="s... | [
"Saves",
"object",
"to",
"a",
"file",
"in",
"YAML",
"format",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L1117-L1130 | [
"def",
"to_file",
"(",
"self",
",",
"filename",
")",
":",
"d",
"=",
"{",
"\"mass_info\"",
":",
"self",
".",
"mass_info",
",",
"\"nonbond_coeffs\"",
":",
"self",
".",
"nonbond_coeffs",
",",
"\"topo_coeffs\"",
":",
"self",
".",
"topo_coeffs",
"}",
"yaml",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ForceField.from_file | Constructor that reads in a file in YAML format.
Args:
filename (str): Filename. | pymatgen/io/lammps/data.py | def from_file(cls, filename):
"""
Constructor that reads in a file in YAML format.
Args:
filename (str): Filename.
"""
yaml = YAML(typ="safe")
with open(filename, "r") as f:
d = yaml.load(f)
return cls.from_dict(d) | def from_file(cls, filename):
"""
Constructor that reads in a file in YAML format.
Args:
filename (str): Filename.
"""
yaml = YAML(typ="safe")
with open(filename, "r") as f:
d = yaml.load(f)
return cls.from_dict(d) | [
"Constructor",
"that",
"reads",
"in",
"a",
"file",
"in",
"YAML",
"format",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L1133-L1144 | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
")",
":",
"yaml",
"=",
"YAML",
"(",
"typ",
"=",
"\"safe\"",
")",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"d",
"=",
"yaml",
".",
"load",
"(",
"f",
")",
"return",
"cls",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _read_nlines | Read at most nlines lines from file filename.
If nlines is < 0, the entire file is read. | pymatgen/io/abinit/pseudos.py | def _read_nlines(filename, nlines):
"""
Read at most nlines lines from file filename.
If nlines is < 0, the entire file is read.
"""
if nlines < 0:
with open(filename, 'r') as fh:
return fh.readlines()
lines = []
with open(filename, 'r') as fh:
for lineno, line i... | def _read_nlines(filename, nlines):
"""
Read at most nlines lines from file filename.
If nlines is < 0, the entire file is read.
"""
if nlines < 0:
with open(filename, 'r') as fh:
return fh.readlines()
lines = []
with open(filename, 'r') as fh:
for lineno, line i... | [
"Read",
"at",
"most",
"nlines",
"lines",
"from",
"file",
"filename",
".",
"If",
"nlines",
"is",
"<",
"0",
"the",
"entire",
"file",
"is",
"read",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L50-L64 | [
"def",
"_read_nlines",
"(",
"filename",
",",
"nlines",
")",
":",
"if",
"nlines",
"<",
"0",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"fh",
":",
"return",
"fh",
".",
"readlines",
"(",
")",
"lines",
"=",
"[",
"]",
"with",
"open",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _dict_from_lines | Helper function to parse formatted text structured like:
value1 value2 ... sep key1, key2 ...
key_nums is a list giving the number of keys for each line. 0 if line should be skipped.
sep is a string denoting the character that separates the keys from the value (None if
no separator is present).
R... | pymatgen/io/abinit/pseudos.py | def _dict_from_lines(lines, key_nums, sep=None):
"""
Helper function to parse formatted text structured like:
value1 value2 ... sep key1, key2 ...
key_nums is a list giving the number of keys for each line. 0 if line should be skipped.
sep is a string denoting the character that separates the keys... | def _dict_from_lines(lines, key_nums, sep=None):
"""
Helper function to parse formatted text structured like:
value1 value2 ... sep key1, key2 ...
key_nums is a list giving the number of keys for each line. 0 if line should be skipped.
sep is a string denoting the character that separates the keys... | [
"Helper",
"function",
"to",
"parse",
"formatted",
"text",
"structured",
"like",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L565-L615 | [
"def",
"_dict_from_lines",
"(",
"lines",
",",
"key_nums",
",",
"sep",
"=",
"None",
")",
":",
"if",
"is_string",
"(",
"lines",
")",
":",
"lines",
"=",
"[",
"lines",
"]",
"if",
"not",
"isinstance",
"(",
"key_nums",
",",
"collections",
".",
"abc",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _int_from_str | Convert string into integer
Raise:
TypeError if string is not a valid integer | pymatgen/io/abinit/pseudos.py | def _int_from_str(string):
"""
Convert string into integer
Raise:
TypeError if string is not a valid integer
"""
float_num = float(string)
int_num = int(float_num)
if float_num == int_num:
return int_num
else:
# Needed to handle pseudos with fractional charge
... | def _int_from_str(string):
"""
Convert string into integer
Raise:
TypeError if string is not a valid integer
"""
float_num = float(string)
int_num = int(float_num)
if float_num == int_num:
return int_num
else:
# Needed to handle pseudos with fractional charge
... | [
"Convert",
"string",
"into",
"integer"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L632-L647 | [
"def",
"_int_from_str",
"(",
"string",
")",
":",
"float_num",
"=",
"float",
"(",
"string",
")",
"int_num",
"=",
"int",
"(",
"float_num",
")",
"if",
"float_num",
"==",
"int_num",
":",
"return",
"int_num",
"else",
":",
"# Needed to handle pseudos with fractional c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Pseudo.as_pseudo | Convert obj into a pseudo. Accepts:
* Pseudo object.
* string defining a valid path. | pymatgen/io/abinit/pseudos.py | def as_pseudo(cls, obj):
"""
Convert obj into a pseudo. Accepts:
* Pseudo object.
* string defining a valid path.
"""
return obj if isinstance(obj, cls) else cls.from_file(obj) | def as_pseudo(cls, obj):
"""
Convert obj into a pseudo. Accepts:
* Pseudo object.
* string defining a valid path.
"""
return obj if isinstance(obj, cls) else cls.from_file(obj) | [
"Convert",
"obj",
"into",
"a",
"pseudo",
".",
"Accepts",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L99-L106 | [
"def",
"as_pseudo",
"(",
"cls",
",",
"obj",
")",
":",
"return",
"obj",
"if",
"isinstance",
"(",
"obj",
",",
"cls",
")",
"else",
"cls",
".",
"from_file",
"(",
"obj",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Pseudo.to_string | String representation. | pymatgen/io/abinit/pseudos.py | def to_string(self, verbose=0):
"""String representation."""
lines = []
app = lines.append
app("<%s: %s>" % (self.__class__.__name__, self.basename))
app(" summary: " + self.summary.strip())
app(" number of valence electrons: %s" % self.Z_val)
app(" maximum ang... | def to_string(self, verbose=0):
"""String representation."""
lines = []
app = lines.append
app("<%s: %s>" % (self.__class__.__name__, self.basename))
app(" summary: " + self.summary.strip())
app(" number of valence electrons: %s" % self.Z_val)
app(" maximum ang... | [
"String",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L138-L158 | [
"def",
"to_string",
"(",
"self",
",",
"verbose",
"=",
"0",
")",
":",
"lines",
"=",
"[",
"]",
"app",
"=",
"lines",
".",
"append",
"app",
"(",
"\"<%s: %s>\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"basename",
")",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Pseudo.element | Pymatgen :class:`Element`. | pymatgen/io/abinit/pseudos.py | def element(self):
"""Pymatgen :class:`Element`."""
try:
return Element.from_Z(self.Z)
except (KeyError, IndexError):
return Element.from_Z(int(self.Z)) | def element(self):
"""Pymatgen :class:`Element`."""
try:
return Element.from_Z(self.Z)
except (KeyError, IndexError):
return Element.from_Z(int(self.Z)) | [
"Pymatgen",
":",
"class",
":",
"Element",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L189-L194 | [
"def",
"element",
"(",
"self",
")",
":",
"try",
":",
"return",
"Element",
".",
"from_Z",
"(",
"self",
".",
"Z",
")",
"except",
"(",
"KeyError",
",",
"IndexError",
")",
":",
"return",
"Element",
".",
"from_Z",
"(",
"int",
"(",
"self",
".",
"Z",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Pseudo.compute_md5 | Compute and erturn MD5 hash value. | pymatgen/io/abinit/pseudos.py | def compute_md5(self):
"""Compute and erturn MD5 hash value."""
import hashlib
with open(self.path, "rt") as fh:
text = fh.read()
m = hashlib.md5(text.encode("utf-8"))
return m.hexdigest() | def compute_md5(self):
"""Compute and erturn MD5 hash value."""
import hashlib
with open(self.path, "rt") as fh:
text = fh.read()
m = hashlib.md5(text.encode("utf-8"))
return m.hexdigest() | [
"Compute",
"and",
"erturn",
"MD5",
"hash",
"value",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L227-L233 | [
"def",
"compute_md5",
"(",
"self",
")",
":",
"import",
"hashlib",
"with",
"open",
"(",
"self",
".",
"path",
",",
"\"rt\"",
")",
"as",
"fh",
":",
"text",
"=",
"fh",
".",
"read",
"(",
")",
"m",
"=",
"hashlib",
".",
"md5",
"(",
"text",
".",
"encode"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Pseudo.as_tmpfile | Copy the pseudopotential to a temporary a file and returns a new pseudopotential object.
Useful for unit tests in which we have to change the content of the file.
Args:
tmpdir: If None, a new temporary directory is created and files are copied here
else tmpdir is used. | pymatgen/io/abinit/pseudos.py | def as_tmpfile(self, tmpdir=None):
"""
Copy the pseudopotential to a temporary a file and returns a new pseudopotential object.
Useful for unit tests in which we have to change the content of the file.
Args:
tmpdir: If None, a new temporary directory is created and files are... | def as_tmpfile(self, tmpdir=None):
"""
Copy the pseudopotential to a temporary a file and returns a new pseudopotential object.
Useful for unit tests in which we have to change the content of the file.
Args:
tmpdir: If None, a new temporary directory is created and files are... | [
"Copy",
"the",
"pseudopotential",
"to",
"a",
"temporary",
"a",
"file",
"and",
"returns",
"a",
"new",
"pseudopotential",
"object",
".",
"Useful",
"for",
"unit",
"tests",
"in",
"which",
"we",
"have",
"to",
"change",
"the",
"content",
"of",
"the",
"file",
"."... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L268-L292 | [
"def",
"as_tmpfile",
"(",
"self",
",",
"tmpdir",
"=",
"None",
")",
":",
"import",
"tempfile",
",",
"shutil",
"tmpdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"if",
"tmpdir",
"is",
"None",
"else",
"tmpdir",
"new_path",
"=",
"os",
".",
"path",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Pseudo.djrepo_path | The path of the djrepo file. None if file does not exist. | pymatgen/io/abinit/pseudos.py | def djrepo_path(self):
"""The path of the djrepo file. None if file does not exist."""
root, ext = os.path.splitext(self.filepath)
path = root + ".djrepo"
return path | def djrepo_path(self):
"""The path of the djrepo file. None if file does not exist."""
root, ext = os.path.splitext(self.filepath)
path = root + ".djrepo"
return path | [
"The",
"path",
"of",
"the",
"djrepo",
"file",
".",
"None",
"if",
"file",
"does",
"not",
"exist",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L300-L304 | [
"def",
"djrepo_path",
"(",
"self",
")",
":",
"root",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"self",
".",
"filepath",
")",
"path",
"=",
"root",
"+",
"\".djrepo\"",
"return",
"path"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.