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 | Outcar.read_pseudo_zval | Create pseudopotential ZVAL dictionary. | pymatgen/io/vasp/outputs.py | def read_pseudo_zval(self):
"""
Create pseudopotential ZVAL dictionary.
"""
try:
def poscar_line(results, match):
poscar_line = match.group(1)
results.poscar_line = re.findall(r'[A-Z][a-z]?', poscar_line)
def zvals(results, match):... | def read_pseudo_zval(self):
"""
Create pseudopotential ZVAL dictionary.
"""
try:
def poscar_line(results, match):
poscar_line = match.group(1)
results.poscar_line = re.findall(r'[A-Z][a-z]?', poscar_line)
def zvals(results, match):... | [
"Create",
"pseudopotential",
"ZVAL",
"dictionary",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2517-L2545 | [
"def",
"read_pseudo_zval",
"(",
"self",
")",
":",
"try",
":",
"def",
"poscar_line",
"(",
"results",
",",
"match",
")",
":",
"poscar_line",
"=",
"match",
".",
"group",
"(",
"1",
")",
"results",
".",
"poscar_line",
"=",
"re",
".",
"findall",
"(",
"r'[A-Z... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Outcar.read_core_state_eigen | Read the core state eigenenergies at each ionic step.
Returns:
A list of dict over the atom such as [{"AO":[core state eig]}].
The core state eigenenergie list for each AO is over all ionic
step.
Example:
The core state eigenenergie of the 2s AO of the 6... | pymatgen/io/vasp/outputs.py | def read_core_state_eigen(self):
"""
Read the core state eigenenergies at each ionic step.
Returns:
A list of dict over the atom such as [{"AO":[core state eig]}].
The core state eigenenergie list for each AO is over all ionic
step.
Example:
... | def read_core_state_eigen(self):
"""
Read the core state eigenenergies at each ionic step.
Returns:
A list of dict over the atom such as [{"AO":[core state eig]}].
The core state eigenenergie list for each AO is over all ionic
step.
Example:
... | [
"Read",
"the",
"core",
"state",
"eigenenergies",
"at",
"each",
"ionic",
"step",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2547-L2586 | [
"def",
"read_core_state_eigen",
"(",
"self",
")",
":",
"with",
"zopen",
"(",
"self",
".",
"filename",
",",
"\"rt\"",
")",
"as",
"foutcar",
":",
"line",
"=",
"foutcar",
".",
"readline",
"(",
")",
"while",
"line",
"!=",
"\"\"",
":",
"line",
"=",
"foutcar... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Outcar.read_avg_core_poten | Read the core potential at each ionic step.
Returns:
A list for each ionic step containing a list of the average core
potentials for each atom: [[avg core pot]].
Example:
The average core potential of the 2nd atom of the structure at the
last ionic step ... | pymatgen/io/vasp/outputs.py | def read_avg_core_poten(self):
"""
Read the core potential at each ionic step.
Returns:
A list for each ionic step containing a list of the average core
potentials for each atom: [[avg core pot]].
Example:
The average core potential of the 2nd atom o... | def read_avg_core_poten(self):
"""
Read the core potential at each ionic step.
Returns:
A list for each ionic step containing a list of the average core
potentials for each atom: [[avg core pot]].
Example:
The average core potential of the 2nd atom o... | [
"Read",
"the",
"core",
"potential",
"at",
"each",
"ionic",
"step",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2588-L2626 | [
"def",
"read_avg_core_poten",
"(",
"self",
")",
":",
"def",
"pairwise",
"(",
"iterable",
")",
":",
"\"s -> (s0,s1), (s1,s2), (s2, s3), ...\"",
"a",
"=",
"iter",
"(",
"iterable",
")",
"return",
"zip",
"(",
"a",
",",
"a",
")",
"with",
"zopen",
"(",
"self",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Outcar.read_fermi_contact_shift | output example:
Fermi contact (isotropic) hyperfine coupling parameter (MHz)
-------------------------------------------------------------
ion A_pw A_1PS A_1AE A_1c A_tot
-------------------------------------------------------------
1 -0.002 -0.002... | pymatgen/io/vasp/outputs.py | def read_fermi_contact_shift(self):
'''
output example:
Fermi contact (isotropic) hyperfine coupling parameter (MHz)
-------------------------------------------------------------
ion A_pw A_1PS A_1AE A_1c A_tot
--------------------------------------... | def read_fermi_contact_shift(self):
'''
output example:
Fermi contact (isotropic) hyperfine coupling parameter (MHz)
-------------------------------------------------------------
ion A_pw A_1PS A_1AE A_1c A_tot
--------------------------------------... | [
"output",
"example",
":",
"Fermi",
"contact",
"(",
"isotropic",
")",
"hyperfine",
"coupling",
"parameter",
"(",
"MHz",
")",
"-------------------------------------------------------------",
"ion",
"A_pw",
"A_1PS",
"A_1AE",
"A_1c",
"A_tot",
"----------------------------------... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2671-L2722 | [
"def",
"read_fermi_contact_shift",
"(",
"self",
")",
":",
"# Fermi contact (isotropic) hyperfine coupling parameter (MHz)",
"header_pattern1",
"=",
"r\"\\s*Fermi contact \\(isotropic\\) hyperfine coupling parameter \\(MHz\\)\\s+\"",
"r\"\\s*\\-+\"",
"r\"\\s*ion\\s+A_pw\\s+A_1PS\\s+A_1AE\\s+A_1... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.spin_data | The data decomposed into actual spin data as {spin: data}.
Essentially, this provides the actual Spin.up and Spin.down data
instead of the total and diff. Note that by definition, a
non-spin-polarized run would have Spin.up data == Spin.down data. | pymatgen/io/vasp/outputs.py | def spin_data(self):
"""
The data decomposed into actual spin data as {spin: data}.
Essentially, this provides the actual Spin.up and Spin.down data
instead of the total and diff. Note that by definition, a
non-spin-polarized run would have Spin.up data == Spin.down data.
... | def spin_data(self):
"""
The data decomposed into actual spin data as {spin: data}.
Essentially, this provides the actual Spin.up and Spin.down data
instead of the total and diff. Note that by definition, a
non-spin-polarized run would have Spin.up data == Spin.down data.
... | [
"The",
"data",
"decomposed",
"into",
"actual",
"spin",
"data",
"as",
"{",
"spin",
":",
"data",
"}",
".",
"Essentially",
"this",
"provides",
"the",
"actual",
"Spin",
".",
"up",
"and",
"Spin",
".",
"down",
"data",
"instead",
"of",
"the",
"total",
"and",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2780-L2794 | [
"def",
"spin_data",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_spin_data",
":",
"spin_data",
"=",
"dict",
"(",
")",
"spin_data",
"[",
"Spin",
".",
"up",
"]",
"=",
"0.5",
"*",
"(",
"self",
".",
"data",
"[",
"\"total\"",
"]",
"+",
"self",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.get_axis_grid | Returns the grid for a particular axis.
Args:
ind (int): Axis index. | pymatgen/io/vasp/outputs.py | def get_axis_grid(self, ind):
"""
Returns the grid for a particular axis.
Args:
ind (int): Axis index.
"""
ng = self.dim
num_pts = ng[ind]
lengths = self.structure.lattice.abc
return [i / num_pts * lengths[ind] for i in range(num_pts)] | def get_axis_grid(self, ind):
"""
Returns the grid for a particular axis.
Args:
ind (int): Axis index.
"""
ng = self.dim
num_pts = ng[ind]
lengths = self.structure.lattice.abc
return [i / num_pts * lengths[ind] for i in range(num_pts)] | [
"Returns",
"the",
"grid",
"for",
"a",
"particular",
"axis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2796-L2806 | [
"def",
"get_axis_grid",
"(",
"self",
",",
"ind",
")",
":",
"ng",
"=",
"self",
".",
"dim",
"num_pts",
"=",
"ng",
"[",
"ind",
"]",
"lengths",
"=",
"self",
".",
"structure",
".",
"lattice",
".",
"abc",
"return",
"[",
"i",
"/",
"num_pts",
"*",
"lengths... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.linear_add | Method to do a linear sum of volumetric objects. Used by + and -
operators as well. Returns a VolumetricData object containing the
linear sum.
Args:
other (VolumetricData): Another VolumetricData object
scale_factor (float): Factor to scale the other data by.
Re... | pymatgen/io/vasp/outputs.py | def linear_add(self, other, scale_factor=1.0):
"""
Method to do a linear sum of volumetric objects. Used by + and -
operators as well. Returns a VolumetricData object containing the
linear sum.
Args:
other (VolumetricData): Another VolumetricData object
s... | def linear_add(self, other, scale_factor=1.0):
"""
Method to do a linear sum of volumetric objects. Used by + and -
operators as well. Returns a VolumetricData object containing the
linear sum.
Args:
other (VolumetricData): Another VolumetricData object
s... | [
"Method",
"to",
"do",
"a",
"linear",
"sum",
"of",
"volumetric",
"objects",
".",
"Used",
"by",
"+",
"and",
"-",
"operators",
"as",
"well",
".",
"Returns",
"a",
"VolumetricData",
"object",
"containing",
"the",
"linear",
"sum",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2814-L2835 | [
"def",
"linear_add",
"(",
"self",
",",
"other",
",",
"scale_factor",
"=",
"1.0",
")",
":",
"if",
"self",
".",
"structure",
"!=",
"other",
".",
"structure",
":",
"raise",
"ValueError",
"(",
"\"Adding or subtraction operations can only be \"",
"\"performed for volumet... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.parse_file | Convenience method to parse a generic volumetric data file in the vasp
like format. Used by subclasses for parsing file.
Args:
filename (str): Path of file to parse
Returns:
(poscar, data) | pymatgen/io/vasp/outputs.py | def parse_file(filename):
"""
Convenience method to parse a generic volumetric data file in the vasp
like format. Used by subclasses for parsing file.
Args:
filename (str): Path of file to parse
Returns:
(poscar, data)
"""
poscar_read = F... | def parse_file(filename):
"""
Convenience method to parse a generic volumetric data file in the vasp
like format. Used by subclasses for parsing file.
Args:
filename (str): Path of file to parse
Returns:
(poscar, data)
"""
poscar_read = F... | [
"Convenience",
"method",
"to",
"parse",
"a",
"generic",
"volumetric",
"data",
"file",
"in",
"the",
"vasp",
"like",
"format",
".",
"Used",
"by",
"subclasses",
"for",
"parsing",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2838-L2938 | [
"def",
"parse_file",
"(",
"filename",
")",
":",
"poscar_read",
"=",
"False",
"poscar_string",
"=",
"[",
"]",
"dataset",
"=",
"[",
"]",
"all_dataset",
"=",
"[",
"]",
"# for holding any strings in input that are not Poscar",
"# or VolumetricData (typically augmentation char... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.write_file | Write the VolumetricData object to a vasp compatible file.
Args:
file_name (str): Path to a file
vasp4_compatible (bool): True if the format is vasp4 compatible | pymatgen/io/vasp/outputs.py | def write_file(self, file_name, vasp4_compatible=False):
"""
Write the VolumetricData object to a vasp compatible file.
Args:
file_name (str): Path to a file
vasp4_compatible (bool): True if the format is vasp4 compatible
"""
def _print_fortran_float(f):... | def write_file(self, file_name, vasp4_compatible=False):
"""
Write the VolumetricData object to a vasp compatible file.
Args:
file_name (str): Path to a file
vasp4_compatible (bool): True if the format is vasp4 compatible
"""
def _print_fortran_float(f):... | [
"Write",
"the",
"VolumetricData",
"object",
"to",
"a",
"vasp",
"compatible",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2940-L3009 | [
"def",
"write_file",
"(",
"self",
",",
"file_name",
",",
"vasp4_compatible",
"=",
"False",
")",
":",
"def",
"_print_fortran_float",
"(",
"f",
")",
":",
"\"\"\"\n Fortran codes print floats with a leading zero in scientific\n notation. When writing CHGCAR fil... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.get_integrated_diff | Get integrated difference of atom index ind up to radius. This can be
an extremely computationally intensive process, depending on how many
grid points are in the VolumetricData.
Args:
ind (int): Index of atom.
radius (float): Radius of integration.
nbins (in... | pymatgen/io/vasp/outputs.py | def get_integrated_diff(self, ind, radius, nbins=1):
"""
Get integrated difference of atom index ind up to radius. This can be
an extremely computationally intensive process, depending on how many
grid points are in the VolumetricData.
Args:
ind (int): Index of atom.... | def get_integrated_diff(self, ind, radius, nbins=1):
"""
Get integrated difference of atom index ind up to radius. This can be
an extremely computationally intensive process, depending on how many
grid points are in the VolumetricData.
Args:
ind (int): Index of atom.... | [
"Get",
"integrated",
"difference",
"of",
"atom",
"index",
"ind",
"up",
"to",
"radius",
".",
"This",
"can",
"be",
"an",
"extremely",
"computationally",
"intensive",
"process",
"depending",
"on",
"how",
"many",
"grid",
"points",
"are",
"in",
"the",
"VolumetricDa... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3011-L3065 | [
"def",
"get_integrated_diff",
"(",
"self",
",",
"ind",
",",
"radius",
",",
"nbins",
"=",
"1",
")",
":",
"# For non-spin-polarized runs, this is zero by definition.",
"if",
"not",
"self",
".",
"is_spin_polarized",
":",
"radii",
"=",
"[",
"radius",
"/",
"nbins",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.get_average_along_axis | Get the averaged total of the volumetric data a certain axis direction.
For example, useful for visualizing Hartree Potentials from a LOCPOT
file.
Args:
ind (int): Index of axis.
Returns:
Average total along axis | pymatgen/io/vasp/outputs.py | def get_average_along_axis(self, ind):
"""
Get the averaged total of the volumetric data a certain axis direction.
For example, useful for visualizing Hartree Potentials from a LOCPOT
file.
Args:
ind (int): Index of axis.
Returns:
Average total a... | def get_average_along_axis(self, ind):
"""
Get the averaged total of the volumetric data a certain axis direction.
For example, useful for visualizing Hartree Potentials from a LOCPOT
file.
Args:
ind (int): Index of axis.
Returns:
Average total a... | [
"Get",
"the",
"averaged",
"total",
"of",
"the",
"volumetric",
"data",
"a",
"certain",
"axis",
"direction",
".",
"For",
"example",
"useful",
"for",
"visualizing",
"Hartree",
"Potentials",
"from",
"a",
"LOCPOT",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3067-L3087 | [
"def",
"get_average_along_axis",
"(",
"self",
",",
"ind",
")",
":",
"m",
"=",
"self",
".",
"data",
"[",
"\"total\"",
"]",
"ng",
"=",
"self",
".",
"dim",
"if",
"ind",
"==",
"0",
":",
"total",
"=",
"np",
".",
"sum",
"(",
"np",
".",
"sum",
"(",
"m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | VolumetricData.to_hdf5 | Writes the VolumetricData to a HDF5 format, which is a highly optimized
format for reading storing large data. The mapping of the VolumetricData
to this file format is as follows:
VolumetricData.data -> f["vdata"]
VolumetricData.structure ->
f["Z"]: Sequence of atomic number... | pymatgen/io/vasp/outputs.py | def to_hdf5(self, filename):
"""
Writes the VolumetricData to a HDF5 format, which is a highly optimized
format for reading storing large data. The mapping of the VolumetricData
to this file format is as follows:
VolumetricData.data -> f["vdata"]
VolumetricData.structure... | def to_hdf5(self, filename):
"""
Writes the VolumetricData to a HDF5 format, which is a highly optimized
format for reading storing large data. The mapping of the VolumetricData
to this file format is as follows:
VolumetricData.data -> f["vdata"]
VolumetricData.structure... | [
"Writes",
"the",
"VolumetricData",
"to",
"a",
"HDF5",
"format",
"which",
"is",
"a",
"highly",
"optimized",
"format",
"for",
"reading",
"storing",
"large",
"data",
".",
"The",
"mapping",
"of",
"the",
"VolumetricData",
"to",
"this",
"file",
"format",
"is",
"as... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3089-L3125 | [
"def",
"to_hdf5",
"(",
"self",
",",
"filename",
")",
":",
"import",
"h5py",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"ds",
"=",
"f",
".",
"create_dataset",
"(",
"\"lattice\"",
",",
"(",
"3",
",",
"3",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Procar.get_projection_on_elements | Method returning a dictionary of projections on elements.
Args:
structure (Structure): Input structure.
Returns:
a dictionary in the {Spin.up:[k index][b index][{Element:values}]] | pymatgen/io/vasp/outputs.py | def get_projection_on_elements(self, structure):
"""
Method returning a dictionary of projections on elements.
Args:
structure (Structure): Input structure.
Returns:
a dictionary in the {Spin.up:[k index][b index][{Element:values}]]
"""
dico = {}... | def get_projection_on_elements(self, structure):
"""
Method returning a dictionary of projections on elements.
Args:
structure (Structure): Input structure.
Returns:
a dictionary in the {Spin.up:[k index][b index][{Element:values}]]
"""
dico = {}... | [
"Method",
"returning",
"a",
"dictionary",
"of",
"projections",
"on",
"elements",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3312-L3335 | [
"def",
"get_projection_on_elements",
"(",
"self",
",",
"structure",
")",
":",
"dico",
"=",
"{",
"}",
"for",
"spin",
"in",
"self",
".",
"data",
".",
"keys",
"(",
")",
":",
"dico",
"[",
"spin",
"]",
"=",
"[",
"[",
"defaultdict",
"(",
"float",
")",
"f... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Procar.get_occupation | Returns the occupation for a particular orbital of a particular atom.
Args:
atom_num (int): Index of atom in the PROCAR. It should be noted
that VASP uses 1-based indexing for atoms, but this is
converted to 0-based indexing in this parser to be
consi... | pymatgen/io/vasp/outputs.py | def get_occupation(self, atom_index, orbital):
"""
Returns the occupation for a particular orbital of a particular atom.
Args:
atom_num (int): Index of atom in the PROCAR. It should be noted
that VASP uses 1-based indexing for atoms, but this is
conve... | def get_occupation(self, atom_index, orbital):
"""
Returns the occupation for a particular orbital of a particular atom.
Args:
atom_num (int): Index of atom in the PROCAR. It should be noted
that VASP uses 1-based indexing for atoms, but this is
conve... | [
"Returns",
"the",
"occupation",
"for",
"a",
"particular",
"orbital",
"of",
"a",
"particular",
"atom",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3337-L3358 | [
"def",
"get_occupation",
"(",
"self",
",",
"atom_index",
",",
"orbital",
")",
":",
"orbital_index",
"=",
"self",
".",
"orbitals",
".",
"index",
"(",
"orbital",
")",
"return",
"{",
"spin",
":",
"np",
".",
"sum",
"(",
"d",
"[",
":",
",",
":",
",",
"a... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Oszicar.all_energies | Compilation of all energies from all electronic steps and ionic steps
as a tuple of list of energies, e.g.,
((4507.24605593, 143.824705755, -512.073149912, ...), ...) | pymatgen/io/vasp/outputs.py | def all_energies(self):
"""
Compilation of all energies from all electronic steps and ionic steps
as a tuple of list of energies, e.g.,
((4507.24605593, 143.824705755, -512.073149912, ...), ...)
"""
all_energies = []
for i in range(len(self.electronic_steps)):
... | def all_energies(self):
"""
Compilation of all energies from all electronic steps and ionic steps
as a tuple of list of energies, e.g.,
((4507.24605593, 143.824705755, -512.073149912, ...), ...)
"""
all_energies = []
for i in range(len(self.electronic_steps)):
... | [
"Compilation",
"of",
"all",
"energies",
"from",
"all",
"electronic",
"steps",
"and",
"ionic",
"steps",
"as",
"a",
"tuple",
"of",
"list",
"of",
"energies",
"e",
".",
"g",
".",
"((",
"4507",
".",
"24605593",
"143",
".",
"824705755",
"-",
"512",
".",
"073... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3458-L3469 | [
"def",
"all_energies",
"(",
"self",
")",
":",
"all_energies",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"electronic_steps",
")",
")",
":",
"energies",
"=",
"[",
"step",
"[",
"\"E\"",
"]",
"for",
"step",
"in",
"self",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Xdatcar.site_symbols | Sequence of symbols associated with the Xdatcar. Similar to 6th line in
vasp 5+ Xdatcar. | pymatgen/io/vasp/outputs.py | def site_symbols(self):
"""
Sequence of symbols associated with the Xdatcar. Similar to 6th line in
vasp 5+ Xdatcar.
"""
syms = [site.specie.symbol for site in self.structures[0]]
return [a[0] for a in itertools.groupby(syms)] | def site_symbols(self):
"""
Sequence of symbols associated with the Xdatcar. Similar to 6th line in
vasp 5+ Xdatcar.
"""
syms = [site.specie.symbol for site in self.structures[0]]
return [a[0] for a in itertools.groupby(syms)] | [
"Sequence",
"of",
"symbols",
"associated",
"with",
"the",
"Xdatcar",
".",
"Similar",
"to",
"6th",
"line",
"in",
"vasp",
"5",
"+",
"Xdatcar",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3621-L3627 | [
"def",
"site_symbols",
"(",
"self",
")",
":",
"syms",
"=",
"[",
"site",
".",
"specie",
".",
"symbol",
"for",
"site",
"in",
"self",
".",
"structures",
"[",
"0",
"]",
"]",
"return",
"[",
"a",
"[",
"0",
"]",
"for",
"a",
"in",
"itertools",
".",
"grou... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Xdatcar.natoms | Sequence of number of sites of each type associated with the Poscar.
Similar to 7th line in vasp 5+ Xdatcar. | pymatgen/io/vasp/outputs.py | def natoms(self):
"""
Sequence of number of sites of each type associated with the Poscar.
Similar to 7th line in vasp 5+ Xdatcar.
"""
syms = [site.specie.symbol for site in self.structures[0]]
return [len(tuple(a[1])) for a in itertools.groupby(syms)] | def natoms(self):
"""
Sequence of number of sites of each type associated with the Poscar.
Similar to 7th line in vasp 5+ Xdatcar.
"""
syms = [site.specie.symbol for site in self.structures[0]]
return [len(tuple(a[1])) for a in itertools.groupby(syms)] | [
"Sequence",
"of",
"number",
"of",
"sites",
"of",
"each",
"type",
"associated",
"with",
"the",
"Poscar",
".",
"Similar",
"to",
"7th",
"line",
"in",
"vasp",
"5",
"+",
"Xdatcar",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3630-L3636 | [
"def",
"natoms",
"(",
"self",
")",
":",
"syms",
"=",
"[",
"site",
".",
"specie",
".",
"symbol",
"for",
"site",
"in",
"self",
".",
"structures",
"[",
"0",
"]",
"]",
"return",
"[",
"len",
"(",
"tuple",
"(",
"a",
"[",
"1",
"]",
")",
")",
"for",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Xdatcar.get_string | Write Xdatcar class into a file
Args:
filename (str): Filename of output XDATCAR file.
ionicstep_start (int): Starting number of ionic step.
ionicstep_end (int): Ending number of ionic step. | pymatgen/io/vasp/outputs.py | def get_string(self, ionicstep_start=1,
ionicstep_end=None,
significant_figures=8):
"""
Write Xdatcar class into a file
Args:
filename (str): Filename of output XDATCAR file.
ionicstep_start (int): Starting number of ionic step.
... | def get_string(self, ionicstep_start=1,
ionicstep_end=None,
significant_figures=8):
"""
Write Xdatcar class into a file
Args:
filename (str): Filename of output XDATCAR file.
ionicstep_start (int): Starting number of ionic step.
... | [
"Write",
"Xdatcar",
"class",
"into",
"a",
"file",
"Args",
":",
"filename",
"(",
"str",
")",
":",
"Filename",
"of",
"output",
"XDATCAR",
"file",
".",
"ionicstep_start",
"(",
"int",
")",
":",
"Starting",
"number",
"of",
"ionic",
"step",
".",
"ionicstep_end",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3701-L3746 | [
"def",
"get_string",
"(",
"self",
",",
"ionicstep_start",
"=",
"1",
",",
"ionicstep_end",
"=",
"None",
",",
"significant_figures",
"=",
"8",
")",
":",
"from",
"pymatgen",
".",
"io",
".",
"vasp",
"import",
"Poscar",
"if",
"(",
"ionicstep_start",
"<",
"1",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Dynmat.get_phonon_frequencies | calculate phonon frequencies | pymatgen/io/vasp/outputs.py | def get_phonon_frequencies(self):
"""calculate phonon frequencies"""
# TODO: the following is most likely not correct or suboptimal
# hence for demonstration purposes only
frequencies = []
for k, v0 in self.data.iteritems():
for v1 in v0.itervalues():
... | def get_phonon_frequencies(self):
"""calculate phonon frequencies"""
# TODO: the following is most likely not correct or suboptimal
# hence for demonstration purposes only
frequencies = []
for k, v0 in self.data.iteritems():
for v1 in v0.itervalues():
... | [
"calculate",
"phonon",
"frequencies"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L3803-L3814 | [
"def",
"get_phonon_frequencies",
"(",
"self",
")",
":",
"# TODO: the following is most likely not correct or suboptimal",
"# hence for demonstration purposes only",
"frequencies",
"=",
"[",
"]",
"for",
"k",
",",
"v0",
"in",
"self",
".",
"data",
".",
"iteritems",
"(",
")... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Wavecar._generate_nbmax | Helper function that determines maximum number of b vectors for
each direction.
This algorithm is adapted from WaveTrans (see Class docstring). There
should be no reason for this function to be called outside of
initialization. | pymatgen/io/vasp/outputs.py | def _generate_nbmax(self):
"""
Helper function that determines maximum number of b vectors for
each direction.
This algorithm is adapted from WaveTrans (see Class docstring). There
should be no reason for this function to be called outside of
initialization.
"""
... | def _generate_nbmax(self):
"""
Helper function that determines maximum number of b vectors for
each direction.
This algorithm is adapted from WaveTrans (see Class docstring). There
should be no reason for this function to be called outside of
initialization.
"""
... | [
"Helper",
"function",
"that",
"determines",
"maximum",
"number",
"of",
"b",
"vectors",
"for",
"each",
"direction",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4095-L4136 | [
"def",
"_generate_nbmax",
"(",
"self",
")",
":",
"bmag",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"self",
".",
"b",
",",
"axis",
"=",
"1",
")",
"b",
"=",
"self",
".",
"b",
"# calculate maximum integers in each direction for G",
"phi12",
"=",
"np",
"."... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Wavecar._generate_G_points | Helper function to generate G-points based on nbmax.
This function iterates over possible G-point values and determines
if the energy is less than G_{cut}. Valid values are appended to
the output array. This function should not be called outside of
initialization.
Args:
... | pymatgen/io/vasp/outputs.py | def _generate_G_points(self, kpoint):
"""
Helper function to generate G-points based on nbmax.
This function iterates over possible G-point values and determines
if the energy is less than G_{cut}. Valid values are appended to
the output array. This function should not be called... | def _generate_G_points(self, kpoint):
"""
Helper function to generate G-points based on nbmax.
This function iterates over possible G-point values and determines
if the energy is less than G_{cut}. Valid values are appended to
the output array. This function should not be called... | [
"Helper",
"function",
"to",
"generate",
"G",
"-",
"points",
"based",
"on",
"nbmax",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4138-L4166 | [
"def",
"_generate_G_points",
"(",
"self",
",",
"kpoint",
")",
":",
"gpoints",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"2",
"*",
"self",
".",
"_nbmax",
"[",
"2",
"]",
"+",
"1",
")",
":",
"i3",
"=",
"i",
"-",
"2",
"*",
"self",
".",
"_nbm... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Wavecar.evaluate_wavefunc | r"""
Evaluates the wavefunction for a given position, r.
The wavefunction is given by the k-point and band. It is evaluated
at the given position by summing over the components. Formally,
\psi_n^k (r) = \sum_{i=1}^N c_i^{n,k} \exp (i (k + G_i^{n,k}) \cdot r)
where \psi_n^k is ... | pymatgen/io/vasp/outputs.py | def evaluate_wavefunc(self, kpoint, band, r, spin=0):
r"""
Evaluates the wavefunction for a given position, r.
The wavefunction is given by the k-point and band. It is evaluated
at the given position by summing over the components. Formally,
\psi_n^k (r) = \sum_{i=1}^N c_i^{n,k... | def evaluate_wavefunc(self, kpoint, band, r, spin=0):
r"""
Evaluates the wavefunction for a given position, r.
The wavefunction is given by the k-point and band. It is evaluated
at the given position by summing over the components. Formally,
\psi_n^k (r) = \sum_{i=1}^N c_i^{n,k... | [
"r",
"Evaluates",
"the",
"wavefunction",
"for",
"a",
"given",
"position",
"r",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4168-L4201 | [
"def",
"evaluate_wavefunc",
"(",
"self",
",",
"kpoint",
",",
"band",
",",
"r",
",",
"spin",
"=",
"0",
")",
":",
"v",
"=",
"self",
".",
"Gpoints",
"[",
"kpoint",
"]",
"+",
"self",
".",
"kpoints",
"[",
"kpoint",
"]",
"u",
"=",
"np",
".",
"dot",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Wavecar.fft_mesh | Places the coefficients of a wavefunction onto an fft mesh.
Once the mesh has been obtained, a discrete fourier transform can be
used to obtain real-space evaluation of the wavefunction. The output
of this function can be passed directly to numpy's fft function. For
example:
... | pymatgen/io/vasp/outputs.py | def fft_mesh(self, kpoint, band, spin=0, shift=True):
"""
Places the coefficients of a wavefunction onto an fft mesh.
Once the mesh has been obtained, a discrete fourier transform can be
used to obtain real-space evaluation of the wavefunction. The output
of this function can be... | def fft_mesh(self, kpoint, band, spin=0, shift=True):
"""
Places the coefficients of a wavefunction onto an fft mesh.
Once the mesh has been obtained, a discrete fourier transform can be
used to obtain real-space evaluation of the wavefunction. The output
of this function can be... | [
"Places",
"the",
"coefficients",
"of",
"a",
"wavefunction",
"onto",
"an",
"fft",
"mesh",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4203-L4236 | [
"def",
"fft_mesh",
"(",
"self",
",",
"kpoint",
",",
"band",
",",
"spin",
"=",
"0",
",",
"shift",
"=",
"True",
")",
":",
"mesh",
"=",
"np",
".",
"zeros",
"(",
"tuple",
"(",
"self",
".",
"ng",
")",
",",
"dtype",
"=",
"np",
".",
"complex",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Wavecar.get_parchg | Generates a Chgcar object, which is the charge density of the specified
wavefunction.
This function generates a Chgcar object with the charge density of the
wavefunction specified by band and kpoint (and spin, if the WAVECAR
corresponds to a spin-polarized calculation). The phase tag is... | pymatgen/io/vasp/outputs.py | def get_parchg(self, poscar, kpoint, band, spin=None, phase=False,
scale=2):
"""
Generates a Chgcar object, which is the charge density of the specified
wavefunction.
This function generates a Chgcar object with the charge density of the
wavefunction specified... | def get_parchg(self, poscar, kpoint, band, spin=None, phase=False,
scale=2):
"""
Generates a Chgcar object, which is the charge density of the specified
wavefunction.
This function generates a Chgcar object with the charge density of the
wavefunction specified... | [
"Generates",
"a",
"Chgcar",
"object",
"which",
"is",
"the",
"charge",
"density",
"of",
"the",
"specified",
"wavefunction",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4238-L4307 | [
"def",
"get_parchg",
"(",
"self",
",",
"poscar",
",",
"kpoint",
",",
"band",
",",
"spin",
"=",
"None",
",",
"phase",
"=",
"False",
",",
"scale",
"=",
"2",
")",
":",
"if",
"phase",
"and",
"not",
"np",
".",
"all",
"(",
"self",
".",
"kpoints",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Wavederf.get_elements_between_bands | Method returning a numpy array with elements
[cdum_x_real, cdum_x_imag, cdum_y_real, cdum_y_imag, cdum_z_real, cdum_z_imag]
between bands band_i and band_j (vasp 1-based indexing) for all kpoints.
Args:
band_i (Integer): Index of band i
band_j (Integer): Index of band ... | pymatgen/io/vasp/outputs.py | def get_elements_between_bands(self, band_i, band_j):
"""
Method returning a numpy array with elements
[cdum_x_real, cdum_x_imag, cdum_y_real, cdum_y_imag, cdum_z_real, cdum_z_imag]
between bands band_i and band_j (vasp 1-based indexing) for all kpoints.
Args:
band... | def get_elements_between_bands(self, band_i, band_j):
"""
Method returning a numpy array with elements
[cdum_x_real, cdum_x_imag, cdum_y_real, cdum_y_imag, cdum_z_real, cdum_z_imag]
between bands band_i and band_j (vasp 1-based indexing) for all kpoints.
Args:
band... | [
"Method",
"returning",
"a",
"numpy",
"array",
"with",
"elements"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4383-L4401 | [
"def",
"get_elements_between_bands",
"(",
"self",
",",
"band_i",
",",
"band_j",
")",
":",
"if",
"band_i",
"<",
"1",
"or",
"band_i",
">",
"self",
".",
"nb_bands",
"or",
"band_j",
"<",
"1",
"or",
"band_j",
">",
"self",
".",
"nb_bands",
":",
"raise",
"Val... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Waveder.get_orbital_derivative_between_states | Method returning a value
between bands band_i and band_j for k-point index, spin-channel and cartesian direction.
Args:
band_i (Integer): Index of band i
band_j (Integer): Index of band j
kpoint (Integer): Index of k-point
spin (Integer): Index of spin-c... | pymatgen/io/vasp/outputs.py | def get_orbital_derivative_between_states(self, band_i, band_j, kpoint, spin, cart_dir):
"""
Method returning a value
between bands band_i and band_j for k-point index, spin-channel and cartesian direction.
Args:
band_i (Integer): Index of band i
band_j (Integer):... | def get_orbital_derivative_between_states(self, band_i, band_j, kpoint, spin, cart_dir):
"""
Method returning a value
between bands band_i and band_j for k-point index, spin-channel and cartesian direction.
Args:
band_i (Integer): Index of band i
band_j (Integer):... | [
"Method",
"returning",
"a",
"value",
"between",
"bands",
"band_i",
"and",
"band_j",
"for",
"k",
"-",
"point",
"index",
"spin",
"-",
"channel",
"and",
"cartesian",
"direction",
".",
"Args",
":",
"band_i",
"(",
"Integer",
")",
":",
"Index",
"of",
"band",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L4453-L4474 | [
"def",
"get_orbital_derivative_between_states",
"(",
"self",
",",
"band_i",
",",
"band_j",
",",
"kpoint",
",",
"spin",
",",
"cart_dir",
")",
":",
"if",
"band_i",
"<",
"0",
"or",
"band_i",
">",
"self",
".",
"nbands",
"-",
"1",
"or",
"band_j",
"<",
"0",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.from_rotation_and_translation | Creates a symmetry operation from a rotation matrix and a translation
vector.
Args:
rotation_matrix (3x3 array): Rotation matrix.
translation_vec (3x1 array): Translation vector.
tol (float): Tolerance to determine if rotation matrix is valid.
Returns:
... | pymatgen/core/operations.py | def from_rotation_and_translation(
rotation_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)),
translation_vec=(0, 0, 0), tol=0.1):
"""
Creates a symmetry operation from a rotation matrix and a translation
vector.
Args:
rotation_matrix (3x3 array): Rotation ma... | def from_rotation_and_translation(
rotation_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)),
translation_vec=(0, 0, 0), tol=0.1):
"""
Creates a symmetry operation from a rotation matrix and a translation
vector.
Args:
rotation_matrix (3x3 array): Rotation ma... | [
"Creates",
"a",
"symmetry",
"operation",
"from",
"a",
"rotation",
"matrix",
"and",
"a",
"translation",
"vector",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L61-L86 | [
"def",
"from_rotation_and_translation",
"(",
"rotation_matrix",
"=",
"(",
"(",
"1",
",",
"0",
",",
"0",
")",
",",
"(",
"0",
",",
"1",
",",
"0",
")",
",",
"(",
"0",
",",
"0",
",",
"1",
")",
")",
",",
"translation_vec",
"=",
"(",
"0",
",",
"0",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.operate | Apply the operation on a point.
Args:
point: Cartesian coordinate.
Returns:
Coordinates of point after operation. | pymatgen/core/operations.py | def operate(self, point):
"""
Apply the operation on a point.
Args:
point: Cartesian coordinate.
Returns:
Coordinates of point after operation.
"""
affine_point = np.array([point[0], point[1], point[2], 1])
return np.dot(self.affine_matri... | def operate(self, point):
"""
Apply the operation on a point.
Args:
point: Cartesian coordinate.
Returns:
Coordinates of point after operation.
"""
affine_point = np.array([point[0], point[1], point[2], 1])
return np.dot(self.affine_matri... | [
"Apply",
"the",
"operation",
"on",
"a",
"point",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L103-L114 | [
"def",
"operate",
"(",
"self",
",",
"point",
")",
":",
"affine_point",
"=",
"np",
".",
"array",
"(",
"[",
"point",
"[",
"0",
"]",
",",
"point",
"[",
"1",
"]",
",",
"point",
"[",
"2",
"]",
",",
"1",
"]",
")",
"return",
"np",
".",
"dot",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.operate_multi | Apply the operation on a list of points.
Args:
points: List of Cartesian coordinates
Returns:
Numpy array of coordinates after operation | pymatgen/core/operations.py | def operate_multi(self, points):
"""
Apply the operation on a list of points.
Args:
points: List of Cartesian coordinates
Returns:
Numpy array of coordinates after operation
"""
points = np.array(points)
affine_points = np.concatenate(
... | def operate_multi(self, points):
"""
Apply the operation on a list of points.
Args:
points: List of Cartesian coordinates
Returns:
Numpy array of coordinates after operation
"""
points = np.array(points)
affine_points = np.concatenate(
... | [
"Apply",
"the",
"operation",
"on",
"a",
"list",
"of",
"points",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L116-L129 | [
"def",
"operate_multi",
"(",
"self",
",",
"points",
")",
":",
"points",
"=",
"np",
".",
"array",
"(",
"points",
")",
"affine_points",
"=",
"np",
".",
"concatenate",
"(",
"[",
"points",
",",
"np",
".",
"ones",
"(",
"points",
".",
"shape",
"[",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.transform_tensor | Applies rotation portion to a tensor. Note that tensor has to be in
full form, not the Voigt form.
Args:
tensor (numpy array): a rank n tensor
Returns:
Transformed tensor. | pymatgen/core/operations.py | def transform_tensor(self, tensor):
"""
Applies rotation portion to a tensor. Note that tensor has to be in
full form, not the Voigt form.
Args:
tensor (numpy array): a rank n tensor
Returns:
Transformed tensor.
"""
dim = tensor.shape
... | def transform_tensor(self, tensor):
"""
Applies rotation portion to a tensor. Note that tensor has to be in
full form, not the Voigt form.
Args:
tensor (numpy array): a rank n tensor
Returns:
Transformed tensor.
"""
dim = tensor.shape
... | [
"Applies",
"rotation",
"portion",
"to",
"a",
"tensor",
".",
"Note",
"that",
"tensor",
"has",
"to",
"be",
"in",
"full",
"form",
"not",
"the",
"Voigt",
"form",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L141-L162 | [
"def",
"transform_tensor",
"(",
"self",
",",
"tensor",
")",
":",
"dim",
"=",
"tensor",
".",
"shape",
"rank",
"=",
"len",
"(",
"dim",
")",
"assert",
"all",
"(",
"[",
"i",
"==",
"3",
"for",
"i",
"in",
"dim",
"]",
")",
"# Build einstein sum string",
"lc... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.are_symmetrically_related | Checks if two points are symmetrically related.
Args:
point_a (3x1 array): First point.
point_b (3x1 array): Second point.
tol (float): Absolute tolerance for checking distance.
Returns:
True if self.operate(point_a) == point_b or vice versa. | pymatgen/core/operations.py | def are_symmetrically_related(self, point_a, point_b, tol=0.001):
"""
Checks if two points are symmetrically related.
Args:
point_a (3x1 array): First point.
point_b (3x1 array): Second point.
tol (float): Absolute tolerance for checking distance.
Re... | def are_symmetrically_related(self, point_a, point_b, tol=0.001):
"""
Checks if two points are symmetrically related.
Args:
point_a (3x1 array): First point.
point_b (3x1 array): Second point.
tol (float): Absolute tolerance for checking distance.
Re... | [
"Checks",
"if",
"two",
"points",
"are",
"symmetrically",
"related",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L164-L180 | [
"def",
"are_symmetrically_related",
"(",
"self",
",",
"point_a",
",",
"point_b",
",",
"tol",
"=",
"0.001",
")",
":",
"if",
"np",
".",
"allclose",
"(",
"self",
".",
"operate",
"(",
"point_a",
")",
",",
"point_b",
",",
"atol",
"=",
"tol",
")",
":",
"re... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.inverse | Returns inverse of transformation. | pymatgen/core/operations.py | def inverse(self):
"""
Returns inverse of transformation.
"""
invr = np.linalg.inv(self.affine_matrix)
return SymmOp(invr) | def inverse(self):
"""
Returns inverse of transformation.
"""
invr = np.linalg.inv(self.affine_matrix)
return SymmOp(invr) | [
"Returns",
"inverse",
"of",
"transformation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L205-L210 | [
"def",
"inverse",
"(",
"self",
")",
":",
"invr",
"=",
"np",
".",
"linalg",
".",
"inv",
"(",
"self",
".",
"affine_matrix",
")",
"return",
"SymmOp",
"(",
"invr",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.from_axis_angle_and_translation | Generates a SymmOp for a rotation about a given axis plus translation.
Args:
axis: The axis of rotation in cartesian space. For example,
[1, 0, 0]indicates rotation about x-axis.
angle (float): Angle of rotation.
angle_in_radians (bool): Set to True if angles... | pymatgen/core/operations.py | def from_axis_angle_and_translation(axis, angle, angle_in_radians=False,
translation_vec=(0, 0, 0)):
"""
Generates a SymmOp for a rotation about a given axis plus translation.
Args:
axis: The axis of rotation in cartesian space. For example,
... | def from_axis_angle_and_translation(axis, angle, angle_in_radians=False,
translation_vec=(0, 0, 0)):
"""
Generates a SymmOp for a rotation about a given axis plus translation.
Args:
axis: The axis of rotation in cartesian space. For example,
... | [
"Generates",
"a",
"SymmOp",
"for",
"a",
"rotation",
"about",
"a",
"given",
"axis",
"plus",
"translation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L213-L252 | [
"def",
"from_axis_angle_and_translation",
"(",
"axis",
",",
"angle",
",",
"angle_in_radians",
"=",
"False",
",",
"translation_vec",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"if",
"isinstance",
"(",
"axis",
",",
"(",
"tuple",
",",
"list",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.from_origin_axis_angle | Generates a SymmOp for a rotation about a given axis through an
origin.
Args:
origin (3x1 array): The origin which the axis passes through.
axis (3x1 array): The axis of rotation in cartesian space. For
example, [1, 0, 0]indicates rotation about x-axis.
... | pymatgen/core/operations.py | def from_origin_axis_angle(origin, axis, angle, angle_in_radians=False):
"""
Generates a SymmOp for a rotation about a given axis through an
origin.
Args:
origin (3x1 array): The origin which the axis passes through.
axis (3x1 array): The axis of rotation in cart... | def from_origin_axis_angle(origin, axis, angle, angle_in_radians=False):
"""
Generates a SymmOp for a rotation about a given axis through an
origin.
Args:
origin (3x1 array): The origin which the axis passes through.
axis (3x1 array): The axis of rotation in cart... | [
"Generates",
"a",
"SymmOp",
"for",
"a",
"rotation",
"about",
"a",
"given",
"axis",
"through",
"an",
"origin",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L255-L310 | [
"def",
"from_origin_axis_angle",
"(",
"origin",
",",
"axis",
",",
"angle",
",",
"angle_in_radians",
"=",
"False",
")",
":",
"theta",
"=",
"angle",
"*",
"pi",
"/",
"180",
"if",
"not",
"angle_in_radians",
"else",
"angle",
"a",
"=",
"origin",
"[",
"0",
"]",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.reflection | Returns reflection symmetry operation.
Args:
normal (3x1 array): Vector of the normal to the plane of
reflection.
origin (3x1 array): A point in which the mirror plane passes
through.
Returns:
SymmOp for the reflection about the plane | pymatgen/core/operations.py | def reflection(normal, origin=(0, 0, 0)):
"""
Returns reflection symmetry operation.
Args:
normal (3x1 array): Vector of the normal to the plane of
reflection.
origin (3x1 array): A point in which the mirror plane passes
through.
... | def reflection(normal, origin=(0, 0, 0)):
"""
Returns reflection symmetry operation.
Args:
normal (3x1 array): Vector of the normal to the plane of
reflection.
origin (3x1 array): A point in which the mirror plane passes
through.
... | [
"Returns",
"reflection",
"symmetry",
"operation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L313-L346 | [
"def",
"reflection",
"(",
"normal",
",",
"origin",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"# Normalize the normal vector first.",
"n",
"=",
"np",
".",
"array",
"(",
"normal",
",",
"dtype",
"=",
"float",
")",
"/",
"np",
".",
"linalg",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.inversion | Inversion symmetry operation about axis.
Args:
origin (3x1 array): Origin of the inversion operation. Defaults
to [0, 0, 0].
Returns:
SymmOp representing an inversion operation about the origin. | pymatgen/core/operations.py | def inversion(origin=(0, 0, 0)):
"""
Inversion symmetry operation about axis.
Args:
origin (3x1 array): Origin of the inversion operation. Defaults
to [0, 0, 0].
Returns:
SymmOp representing an inversion operation about the origin.
"""
... | def inversion(origin=(0, 0, 0)):
"""
Inversion symmetry operation about axis.
Args:
origin (3x1 array): Origin of the inversion operation. Defaults
to [0, 0, 0].
Returns:
SymmOp representing an inversion operation about the origin.
"""
... | [
"Inversion",
"symmetry",
"operation",
"about",
"axis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L349-L363 | [
"def",
"inversion",
"(",
"origin",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"mat",
"=",
"-",
"np",
".",
"eye",
"(",
"4",
")",
"mat",
"[",
"3",
",",
"3",
"]",
"=",
"1",
"mat",
"[",
"0",
":",
"3",
",",
"3",
"]",
"=",
"2",
"*",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.rotoreflection | Returns a roto-reflection symmetry operation
Args:
axis (3x1 array): Axis of rotation / mirror normal
angle (float): Angle in degrees
origin (3x1 array): Point left invariant by roto-reflection.
Defaults to (0, 0, 0).
Return:
Roto-reflect... | pymatgen/core/operations.py | def rotoreflection(axis, angle, origin=(0, 0, 0)):
"""
Returns a roto-reflection symmetry operation
Args:
axis (3x1 array): Axis of rotation / mirror normal
angle (float): Angle in degrees
origin (3x1 array): Point left invariant by roto-reflection.
... | def rotoreflection(axis, angle, origin=(0, 0, 0)):
"""
Returns a roto-reflection symmetry operation
Args:
axis (3x1 array): Axis of rotation / mirror normal
angle (float): Angle in degrees
origin (3x1 array): Point left invariant by roto-reflection.
... | [
"Returns",
"a",
"roto",
"-",
"reflection",
"symmetry",
"operation"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L366-L382 | [
"def",
"rotoreflection",
"(",
"axis",
",",
"angle",
",",
"origin",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"rot",
"=",
"SymmOp",
".",
"from_origin_axis_angle",
"(",
"origin",
",",
"axis",
",",
"angle",
")",
"refl",
"=",
"SymmOp",
".",
"re... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.as_xyz_string | Returns a string of the form 'x, y, z', '-x, -y, z',
'-y+1/2, x+1/2, z+1/2', etc. Only works for integer rotation matrices | pymatgen/core/operations.py | def as_xyz_string(self):
"""
Returns a string of the form 'x, y, z', '-x, -y, z',
'-y+1/2, x+1/2, z+1/2', etc. Only works for integer rotation matrices
"""
xyz = ['x', 'y', 'z']
strings = []
# test for invalid rotation matrix
if not np.all(np.isclose(self... | def as_xyz_string(self):
"""
Returns a string of the form 'x, y, z', '-x, -y, z',
'-y+1/2, x+1/2, z+1/2', etc. Only works for integer rotation matrices
"""
xyz = ['x', 'y', 'z']
strings = []
# test for invalid rotation matrix
if not np.all(np.isclose(self... | [
"Returns",
"a",
"string",
"of",
"the",
"form",
"x",
"y",
"z",
"-",
"x",
"-",
"y",
"z",
"-",
"y",
"+",
"1",
"/",
"2",
"x",
"+",
"1",
"/",
"2",
"z",
"+",
"1",
"/",
"2",
"etc",
".",
"Only",
"works",
"for",
"integer",
"rotation",
"matrices"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L390-L403 | [
"def",
"as_xyz_string",
"(",
"self",
")",
":",
"xyz",
"=",
"[",
"'x'",
",",
"'y'",
",",
"'z'",
"]",
"strings",
"=",
"[",
"]",
"# test for invalid rotation matrix",
"if",
"not",
"np",
".",
"all",
"(",
"np",
".",
"isclose",
"(",
"self",
".",
"rotation_ma... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmOp.from_xyz_string | Args:
xyz_string: string of the form 'x, y, z', '-x, -y, z',
'-2y+1/2, 3x+1/2, z-y+1/2', etc.
Returns:
SymmOp | pymatgen/core/operations.py | def from_xyz_string(xyz_string):
"""
Args:
xyz_string: string of the form 'x, y, z', '-x, -y, z',
'-2y+1/2, 3x+1/2, z-y+1/2', etc.
Returns:
SymmOp
"""
rot_matrix = np.zeros((3, 3))
trans = np.zeros(3)
toks = xyz_string.strip... | def from_xyz_string(xyz_string):
"""
Args:
xyz_string: string of the form 'x, y, z', '-x, -y, z',
'-2y+1/2, 3x+1/2, z-y+1/2', etc.
Returns:
SymmOp
"""
rot_matrix = np.zeros((3, 3))
trans = np.zeros(3)
toks = xyz_string.strip... | [
"Args",
":",
"xyz_string",
":",
"string",
"of",
"the",
"form",
"x",
"y",
"z",
"-",
"x",
"-",
"y",
"z",
"-",
"2y",
"+",
"1",
"/",
"2",
"3x",
"+",
"1",
"/",
"2",
"z",
"-",
"y",
"+",
"1",
"/",
"2",
"etc",
".",
"Returns",
":",
"SymmOp"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L406-L434 | [
"def",
"from_xyz_string",
"(",
"xyz_string",
")",
":",
"rot_matrix",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
",",
"3",
")",
")",
"trans",
"=",
"np",
".",
"zeros",
"(",
"3",
")",
"toks",
"=",
"xyz_string",
".",
"strip",
"(",
")",
".",
"replace",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagSymmOp.operate_magmom | Apply time reversal operator on the magnetic moment. Note that
magnetic moments transform as axial vectors, not polar vectors.
See 'Symmetry and magnetic structures', Rodríguez-Carvajal and
Bourée for a good discussion. DOI: 10.1051/epjconf/20122200010
Args:
magmom: Magnet... | pymatgen/core/operations.py | def operate_magmom(self, magmom):
"""
Apply time reversal operator on the magnetic moment. Note that
magnetic moments transform as axial vectors, not polar vectors.
See 'Symmetry and magnetic structures', Rodríguez-Carvajal and
Bourée for a good discussion. DOI: 10.1051/epjconf... | def operate_magmom(self, magmom):
"""
Apply time reversal operator on the magnetic moment. Note that
magnetic moments transform as axial vectors, not polar vectors.
See 'Symmetry and magnetic structures', Rodríguez-Carvajal and
Bourée for a good discussion. DOI: 10.1051/epjconf... | [
"Apply",
"time",
"reversal",
"operator",
"on",
"the",
"magnetic",
"moment",
".",
"Note",
"that",
"magnetic",
"moments",
"transform",
"as",
"axial",
"vectors",
"not",
"polar",
"vectors",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L489-L511 | [
"def",
"operate_magmom",
"(",
"self",
",",
"magmom",
")",
":",
"magmom",
"=",
"Magmom",
"(",
"magmom",
")",
"# type casting to handle lists as input",
"transformed_moment",
"=",
"self",
".",
"apply_rotation_only",
"(",
"magmom",
".",
"global_moment",
")",
"*",
"np... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagSymmOp.from_symmop | Initialize a MagSymmOp from a SymmOp and time reversal operator.
Args:
symmop (SymmOp): SymmOp
time_reversal (int): Time reversal operator, +1 or -1.
Returns:
MagSymmOp object | pymatgen/core/operations.py | def from_symmop(cls, symmop, time_reversal):
"""
Initialize a MagSymmOp from a SymmOp and time reversal operator.
Args:
symmop (SymmOp): SymmOp
time_reversal (int): Time reversal operator, +1 or -1.
Returns:
MagSymmOp object
"... | def from_symmop(cls, symmop, time_reversal):
"""
Initialize a MagSymmOp from a SymmOp and time reversal operator.
Args:
symmop (SymmOp): SymmOp
time_reversal (int): Time reversal operator, +1 or -1.
Returns:
MagSymmOp object
"... | [
"Initialize",
"a",
"MagSymmOp",
"from",
"a",
"SymmOp",
"and",
"time",
"reversal",
"operator",
".",
"Args",
":",
"symmop",
"(",
"SymmOp",
")",
":",
"SymmOp",
"time_reversal",
"(",
"int",
")",
":",
"Time",
"reversal",
"operator",
"+",
"1",
"or",
"-",
"1",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L514-L526 | [
"def",
"from_symmop",
"(",
"cls",
",",
"symmop",
",",
"time_reversal",
")",
":",
"magsymmop",
"=",
"cls",
"(",
"symmop",
".",
"affine_matrix",
",",
"time_reversal",
",",
"symmop",
".",
"tol",
")",
"return",
"magsymmop"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagSymmOp.from_rotation_and_translation_and_time_reversal | Creates a symmetry operation from a rotation matrix, translation
vector and time reversal operator.
Args:
rotation_matrix (3x3 array): Rotation matrix.
translation_vec (3x1 array): Translation vector.
time_reversal (int): Time reversal operator, +1 or -1.
... | pymatgen/core/operations.py | def from_rotation_and_translation_and_time_reversal(
rotation_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)),
translation_vec=(0, 0, 0), time_reversal=1, tol=0.1):
"""
Creates a symmetry operation from a rotation matrix, translation
vector and time reversal operator.
A... | def from_rotation_and_translation_and_time_reversal(
rotation_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)),
translation_vec=(0, 0, 0), time_reversal=1, tol=0.1):
"""
Creates a symmetry operation from a rotation matrix, translation
vector and time reversal operator.
A... | [
"Creates",
"a",
"symmetry",
"operation",
"from",
"a",
"rotation",
"matrix",
"translation",
"vector",
"and",
"time",
"reversal",
"operator",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L529-L548 | [
"def",
"from_rotation_and_translation_and_time_reversal",
"(",
"rotation_matrix",
"=",
"(",
"(",
"1",
",",
"0",
",",
"0",
")",
",",
"(",
"0",
",",
"1",
",",
"0",
")",
",",
"(",
"0",
",",
"0",
",",
"1",
")",
")",
",",
"translation_vec",
"=",
"(",
"0... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagSymmOp.from_xyzt_string | Args:
xyz_string: string of the form 'x, y, z, +1', '-x, -y, z, -1',
'-2y+1/2, 3x+1/2, z-y+1/2, +1', etc.
Returns:
MagSymmOp object | pymatgen/core/operations.py | def from_xyzt_string(xyzt_string):
"""
Args:
xyz_string: string of the form 'x, y, z, +1', '-x, -y, z, -1',
'-2y+1/2, 3x+1/2, z-y+1/2, +1', etc.
Returns:
MagSymmOp object
"""
symmop = SymmOp.from_xyz_string(xyzt_string.rsplit(',', 1)[0])
... | def from_xyzt_string(xyzt_string):
"""
Args:
xyz_string: string of the form 'x, y, z, +1', '-x, -y, z, -1',
'-2y+1/2, 3x+1/2, z-y+1/2, +1', etc.
Returns:
MagSymmOp object
"""
symmop = SymmOp.from_xyz_string(xyzt_string.rsplit(',', 1)[0])
... | [
"Args",
":",
"xyz_string",
":",
"string",
"of",
"the",
"form",
"x",
"y",
"z",
"+",
"1",
"-",
"x",
"-",
"y",
"z",
"-",
"1",
"-",
"2y",
"+",
"1",
"/",
"2",
"3x",
"+",
"1",
"/",
"2",
"z",
"-",
"y",
"+",
"1",
"/",
"2",
"+",
"1",
"etc",
".... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L551-L564 | [
"def",
"from_xyzt_string",
"(",
"xyzt_string",
")",
":",
"symmop",
"=",
"SymmOp",
".",
"from_xyz_string",
"(",
"xyzt_string",
".",
"rsplit",
"(",
"','",
",",
"1",
")",
"[",
"0",
"]",
")",
"try",
":",
"time_reversal",
"=",
"int",
"(",
"xyzt_string",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MagSymmOp.as_xyzt_string | Returns a string of the form 'x, y, z, +1', '-x, -y, z, -1',
'-y+1/2, x+1/2, z+1/2, +1', etc. Only works for integer rotation matrices | pymatgen/core/operations.py | def as_xyzt_string(self):
"""
Returns a string of the form 'x, y, z, +1', '-x, -y, z, -1',
'-y+1/2, x+1/2, z+1/2, +1', etc. Only works for integer rotation matrices
"""
xyzt_string = SymmOp.as_xyz_string(self)
return xyzt_string + ", {:+}".format(self.time_reversal) | def as_xyzt_string(self):
"""
Returns a string of the form 'x, y, z, +1', '-x, -y, z, -1',
'-y+1/2, x+1/2, z+1/2, +1', etc. Only works for integer rotation matrices
"""
xyzt_string = SymmOp.as_xyz_string(self)
return xyzt_string + ", {:+}".format(self.time_reversal) | [
"Returns",
"a",
"string",
"of",
"the",
"form",
"x",
"y",
"z",
"+",
"1",
"-",
"x",
"-",
"y",
"z",
"-",
"1",
"-",
"y",
"+",
"1",
"/",
"2",
"x",
"+",
"1",
"/",
"2",
"z",
"+",
"1",
"/",
"2",
"+",
"1",
"etc",
".",
"Only",
"works",
"for",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/operations.py#L566-L572 | [
"def",
"as_xyzt_string",
"(",
"self",
")",
":",
"xyzt_string",
"=",
"SymmOp",
".",
"as_xyz_string",
"(",
"self",
")",
"return",
"xyzt_string",
"+",
"\", {:+}\"",
".",
"format",
"(",
"self",
".",
"time_reversal",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NwTask.from_molecule | Very flexible arguments to support many types of potential setups.
Users should use more friendly static methods unless they need the
flexibility.
Args:
mol: Input molecule
charge: Charge of the molecule. If None, charge on molecule is
used. Defaults to N... | pymatgen/io/nwchem.py | def from_molecule(cls, mol, theory, charge=None, spin_multiplicity=None,
basis_set="6-31g", basis_set_option="cartesian",
title=None, operation="optimize", theory_directives=None,
alternate_directives=None):
"""
Very flexible arguments to... | def from_molecule(cls, mol, theory, charge=None, spin_multiplicity=None,
basis_set="6-31g", basis_set_option="cartesian",
title=None, operation="optimize", theory_directives=None,
alternate_directives=None):
"""
Very flexible arguments to... | [
"Very",
"flexible",
"arguments",
"to",
"support",
"many",
"types",
"of",
"potential",
"setups",
".",
"Users",
"should",
"use",
"more",
"friendly",
"static",
"methods",
"unless",
"they",
"need",
"the",
"flexibility",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/nwchem.py#L216-L277 | [
"def",
"from_molecule",
"(",
"cls",
",",
"mol",
",",
"theory",
",",
"charge",
"=",
"None",
",",
"spin_multiplicity",
"=",
"None",
",",
"basis_set",
"=",
"\"6-31g\"",
",",
"basis_set_option",
"=",
"\"cartesian\"",
",",
"title",
"=",
"None",
",",
"operation",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NwTask.dft_task | A class method for quickly creating DFT tasks with optional
cosmo parameter .
Args:
mol: Input molecule
xc: Exchange correlation to use.
\\*\\*kwargs: Any of the other kwargs supported by NwTask. Note the
theory is always "dft" for a dft task. | pymatgen/io/nwchem.py | def dft_task(cls, mol, xc="b3lyp", **kwargs):
"""
A class method for quickly creating DFT tasks with optional
cosmo parameter .
Args:
mol: Input molecule
xc: Exchange correlation to use.
\\*\\*kwargs: Any of the other kwargs supported by NwTask. Note ... | def dft_task(cls, mol, xc="b3lyp", **kwargs):
"""
A class method for quickly creating DFT tasks with optional
cosmo parameter .
Args:
mol: Input molecule
xc: Exchange correlation to use.
\\*\\*kwargs: Any of the other kwargs supported by NwTask. Note ... | [
"A",
"class",
"method",
"for",
"quickly",
"creating",
"DFT",
"tasks",
"with",
"optional",
"cosmo",
"parameter",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/nwchem.py#L280-L294 | [
"def",
"dft_task",
"(",
"cls",
",",
"mol",
",",
"xc",
"=",
"\"b3lyp\"",
",",
"*",
"*",
"kwargs",
")",
":",
"t",
"=",
"NwTask",
".",
"from_molecule",
"(",
"mol",
",",
"theory",
"=",
"\"dft\"",
",",
"*",
"*",
"kwargs",
")",
"t",
".",
"theory_directiv... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NwInput.from_string | Read an NwInput from a string. Currently tested to work with
files generated from this class itself.
Args:
string_input: string_input to parse.
Returns:
NwInput object | pymatgen/io/nwchem.py | def from_string(cls, string_input):
"""
Read an NwInput from a string. Currently tested to work with
files generated from this class itself.
Args:
string_input: string_input to parse.
Returns:
NwInput object
"""
directives = []
ta... | def from_string(cls, string_input):
"""
Read an NwInput from a string. Currently tested to work with
files generated from this class itself.
Args:
string_input: string_input to parse.
Returns:
NwInput object
"""
directives = []
ta... | [
"Read",
"an",
"NwInput",
"from",
"a",
"string",
".",
"Currently",
"tested",
"to",
"work",
"with",
"files",
"generated",
"from",
"this",
"class",
"itself",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/nwchem.py#L392-L479 | [
"def",
"from_string",
"(",
"cls",
",",
"string_input",
")",
":",
"directives",
"=",
"[",
"]",
"tasks",
"=",
"[",
"]",
"charge",
"=",
"None",
"spin_multiplicity",
"=",
"None",
"title",
"=",
"None",
"basis_set",
"=",
"None",
"basis_set_option",
"=",
"None",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NwOutput.parse_tddft | Parses TDDFT roots. Adapted from nw_spectrum.py script.
Returns:
{
"singlet": [
{
"energy": float,
"osc_strength: float
}
],
"triplet": [
{
... | pymatgen/io/nwchem.py | def parse_tddft(self):
"""
Parses TDDFT roots. Adapted from nw_spectrum.py script.
Returns:
{
"singlet": [
{
"energy": float,
"osc_strength: float
}
],
... | def parse_tddft(self):
"""
Parses TDDFT roots. Adapted from nw_spectrum.py script.
Returns:
{
"singlet": [
{
"energy": float,
"osc_strength: float
}
],
... | [
"Parses",
"TDDFT",
"roots",
".",
"Adapted",
"from",
"nw_spectrum",
".",
"py",
"script",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/nwchem.py#L530-L583 | [
"def",
"parse_tddft",
"(",
"self",
")",
":",
"start_tag",
"=",
"\"Convergence criterion met\"",
"end_tag",
"=",
"\"Excited state energy\"",
"singlet_tag",
"=",
"\"singlet excited\"",
"triplet_tag",
"=",
"\"triplet excited\"",
"state",
"=",
"\"singlet\"",
"inside",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NwOutput.get_excitation_spectrum | Generate an excitation spectra from the singlet roots of TDDFT
calculations.
Args:
width (float): Width for Gaussian smearing.
npoints (int): Number of energy points. More points => smoother
curve.
Returns:
(ExcitationSpectrum) which can be p... | pymatgen/io/nwchem.py | def get_excitation_spectrum(self, width=0.1, npoints=2000):
"""
Generate an excitation spectra from the singlet roots of TDDFT
calculations.
Args:
width (float): Width for Gaussian smearing.
npoints (int): Number of energy points. More points => smoother
... | def get_excitation_spectrum(self, width=0.1, npoints=2000):
"""
Generate an excitation spectra from the singlet roots of TDDFT
calculations.
Args:
width (float): Width for Gaussian smearing.
npoints (int): Number of energy points. More points => smoother
... | [
"Generate",
"an",
"excitation",
"spectra",
"from",
"the",
"singlet",
"roots",
"of",
"TDDFT",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/nwchem.py#L585-L630 | [
"def",
"get_excitation_spectrum",
"(",
"self",
",",
"width",
"=",
"0.1",
",",
"npoints",
"=",
"2000",
")",
":",
"roots",
"=",
"self",
".",
"parse_tddft",
"(",
")",
"data",
"=",
"roots",
"[",
"\"singlet\"",
"]",
"en",
"=",
"np",
".",
"array",
"(",
"["... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Ion.formula | Returns a formula string, with elements sorted by electronegativity,
e.g., Li4 Fe4 P4 O16. | pymatgen/core/ion.py | def formula(self):
"""
Returns a formula string, with elements sorted by electronegativity,
e.g., Li4 Fe4 P4 O16.
"""
formula = super().formula
chg_str = ""
if self.charge > 0:
chg_str = " +" + formula_double_format(self.charge, False)
elif sel... | def formula(self):
"""
Returns a formula string, with elements sorted by electronegativity,
e.g., Li4 Fe4 P4 O16.
"""
formula = super().formula
chg_str = ""
if self.charge > 0:
chg_str = " +" + formula_double_format(self.charge, False)
elif sel... | [
"Returns",
"a",
"formula",
"string",
"with",
"elements",
"sorted",
"by",
"electronegativity",
"e",
".",
"g",
".",
"Li4",
"Fe4",
"P4",
"O16",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L70-L81 | [
"def",
"formula",
"(",
"self",
")",
":",
"formula",
"=",
"super",
"(",
")",
".",
"formula",
"chg_str",
"=",
"\"\"",
"if",
"self",
".",
"charge",
">",
"0",
":",
"chg_str",
"=",
"\" +\"",
"+",
"formula_double_format",
"(",
"self",
".",
"charge",
",",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Ion.anonymized_formula | An anonymized formula. Appends charge to the end
of anonymized composition | pymatgen/core/ion.py | def anonymized_formula(self):
"""
An anonymized formula. Appends charge to the end
of anonymized composition
"""
anon_formula = super().anonymized_formula
chg = self._charge
chg_str = ""
if chg > 0:
chg_str += ("{}{}".format('+', str(int(chg)))... | def anonymized_formula(self):
"""
An anonymized formula. Appends charge to the end
of anonymized composition
"""
anon_formula = super().anonymized_formula
chg = self._charge
chg_str = ""
if chg > 0:
chg_str += ("{}{}".format('+', str(int(chg)))... | [
"An",
"anonymized",
"formula",
".",
"Appends",
"charge",
"to",
"the",
"end",
"of",
"anonymized",
"composition"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L84-L96 | [
"def",
"anonymized_formula",
"(",
"self",
")",
":",
"anon_formula",
"=",
"super",
"(",
")",
".",
"anonymized_formula",
"chg",
"=",
"self",
".",
"_charge",
"chg_str",
"=",
"\"\"",
"if",
"chg",
">",
"0",
":",
"chg_str",
"+=",
"(",
"\"{}{}\"",
".",
"format"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Ion.reduced_formula | Returns a reduced formula string with appended charge. | pymatgen/core/ion.py | def reduced_formula(self):
"""
Returns a reduced formula string with appended charge.
"""
reduced_formula = super().reduced_formula
charge = self._charge / self.get_reduced_composition_and_factor()[1]
if charge > 0:
if abs(charge) == 1:
chg_str... | def reduced_formula(self):
"""
Returns a reduced formula string with appended charge.
"""
reduced_formula = super().reduced_formula
charge = self._charge / self.get_reduced_composition_and_factor()[1]
if charge > 0:
if abs(charge) == 1:
chg_str... | [
"Returns",
"a",
"reduced",
"formula",
"string",
"with",
"appended",
"charge",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L99-L118 | [
"def",
"reduced_formula",
"(",
"self",
")",
":",
"reduced_formula",
"=",
"super",
"(",
")",
".",
"reduced_formula",
"charge",
"=",
"self",
".",
"_charge",
"/",
"self",
".",
"get_reduced_composition_and_factor",
"(",
")",
"[",
"1",
"]",
"if",
"charge",
">",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Ion.alphabetical_formula | Returns a reduced formula string with appended charge | pymatgen/core/ion.py | def alphabetical_formula(self):
"""
Returns a reduced formula string with appended charge
"""
alph_formula = super().alphabetical_formula
chg_str = ""
if self.charge > 0:
chg_str = " +" + formula_double_format(self.charge, False)
elif self.charge < 0:
... | def alphabetical_formula(self):
"""
Returns a reduced formula string with appended charge
"""
alph_formula = super().alphabetical_formula
chg_str = ""
if self.charge > 0:
chg_str = " +" + formula_double_format(self.charge, False)
elif self.charge < 0:
... | [
"Returns",
"a",
"reduced",
"formula",
"string",
"with",
"appended",
"charge"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L121-L131 | [
"def",
"alphabetical_formula",
"(",
"self",
")",
":",
"alph_formula",
"=",
"super",
"(",
")",
".",
"alphabetical_formula",
"chg_str",
"=",
"\"\"",
"if",
"self",
".",
"charge",
">",
"0",
":",
"chg_str",
"=",
"\" +\"",
"+",
"formula_double_format",
"(",
"self"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Ion.from_dict | Generates an ion object from a dict created by as_dict().
Args:
d:
{symbol: amount} dict. | pymatgen/core/ion.py | def from_dict(cls, d):
"""
Generates an ion object from a dict created by as_dict().
Args:
d:
{symbol: amount} dict.
"""
charge = d.pop('charge')
composition = Composition(d)
return Ion(composition, charge) | def from_dict(cls, d):
"""
Generates an ion object from a dict created by as_dict().
Args:
d:
{symbol: amount} dict.
"""
charge = d.pop('charge')
composition = Composition(d)
return Ion(composition, charge) | [
"Generates",
"an",
"ion",
"object",
"from",
"a",
"dict",
"created",
"by",
"as_dict",
"()",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L150-L160 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"charge",
"=",
"d",
".",
"pop",
"(",
"'charge'",
")",
"composition",
"=",
"Composition",
"(",
"d",
")",
"return",
"Ion",
"(",
"composition",
",",
"charge",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Ion.to_reduced_dict | Returns:
dict with element symbol and reduced amount e.g.,
{"Fe": 2.0, "O":3.0}. | pymatgen/core/ion.py | def to_reduced_dict(self):
"""
Returns:
dict with element symbol and reduced amount e.g.,
{"Fe": 2.0, "O":3.0}.
"""
d = self.composition.to_reduced_dict
d['charge'] = self.charge
return d | def to_reduced_dict(self):
"""
Returns:
dict with element symbol and reduced amount e.g.,
{"Fe": 2.0, "O":3.0}.
"""
d = self.composition.to_reduced_dict
d['charge'] = self.charge
return d | [
"Returns",
":",
"dict",
"with",
"element",
"symbol",
"and",
"reduced",
"amount",
"e",
".",
"g",
".",
"{",
"Fe",
":",
"2",
".",
"0",
"O",
":",
"3",
".",
"0",
"}",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/ion.py#L163-L171 | [
"def",
"to_reduced_dict",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"composition",
".",
"to_reduced_dict",
"d",
"[",
"'charge'",
"]",
"=",
"self",
".",
"charge",
"return",
"d"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LinearAssignment.min_cost | Returns the cost of the best assignment | pymatgen/optimization/linear_assignment_numpy.py | def min_cost(self):
"""
Returns the cost of the best assignment
"""
if self._min_cost:
return self._min_cost
self._min_cost = np.sum(self.c[np.arange(self.nx), self.solution])
return self._min_cost | def min_cost(self):
"""
Returns the cost of the best assignment
"""
if self._min_cost:
return self._min_cost
self._min_cost = np.sum(self.c[np.arange(self.nx), self.solution])
return self._min_cost | [
"Returns",
"the",
"cost",
"of",
"the",
"best",
"assignment"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/optimization/linear_assignment_numpy.py#L91-L98 | [
"def",
"min_cost",
"(",
"self",
")",
":",
"if",
"self",
".",
"_min_cost",
":",
"return",
"self",
".",
"_min_cost",
"self",
".",
"_min_cost",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"c",
"[",
"np",
".",
"arange",
"(",
"self",
".",
"nx",
")",
",",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LinearAssignment._column_reduction | Column reduction and reduction transfer steps from LAPJV algorithm | pymatgen/optimization/linear_assignment_numpy.py | def _column_reduction(self):
"""
Column reduction and reduction transfer steps from LAPJV algorithm
"""
#assign each column to its lowest cost row, ensuring that only row
#or column is assigned once
i1, j = np.unique(np.argmin(self.c, axis=0), return_index=True)
s... | def _column_reduction(self):
"""
Column reduction and reduction transfer steps from LAPJV algorithm
"""
#assign each column to its lowest cost row, ensuring that only row
#or column is assigned once
i1, j = np.unique(np.argmin(self.c, axis=0), return_index=True)
s... | [
"Column",
"reduction",
"and",
"reduction",
"transfer",
"steps",
"from",
"LAPJV",
"algorithm"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/optimization/linear_assignment_numpy.py#L100-L122 | [
"def",
"_column_reduction",
"(",
"self",
")",
":",
"#assign each column to its lowest cost row, ensuring that only row",
"#or column is assigned once",
"i1",
",",
"j",
"=",
"np",
".",
"unique",
"(",
"np",
".",
"argmin",
"(",
"self",
".",
"c",
",",
"axis",
"=",
"0"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LinearAssignment._augmenting_row_reduction | Augmenting row reduction step from LAPJV algorithm | pymatgen/optimization/linear_assignment_numpy.py | def _augmenting_row_reduction(self):
"""
Augmenting row reduction step from LAPJV algorithm
"""
unassigned = np.where(self._x == -1)[0]
for i in unassigned:
for _ in range(self.c.size):
# Time in this loop can be proportional to 1/epsilon
... | def _augmenting_row_reduction(self):
"""
Augmenting row reduction step from LAPJV algorithm
"""
unassigned = np.where(self._x == -1)[0]
for i in unassigned:
for _ in range(self.c.size):
# Time in this loop can be proportional to 1/epsilon
... | [
"Augmenting",
"row",
"reduction",
"step",
"from",
"LAPJV",
"algorithm"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/optimization/linear_assignment_numpy.py#L124-L154 | [
"def",
"_augmenting_row_reduction",
"(",
"self",
")",
":",
"unassigned",
"=",
"np",
".",
"where",
"(",
"self",
".",
"_x",
"==",
"-",
"1",
")",
"[",
"0",
"]",
"for",
"i",
"in",
"unassigned",
":",
"for",
"_",
"in",
"range",
"(",
"self",
".",
"c",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LinearAssignment._update_cred | Updates the reduced costs with the values from the
dual solution | pymatgen/optimization/linear_assignment_numpy.py | def _update_cred(self):
"""
Updates the reduced costs with the values from the
dual solution
"""
ui = self.c[self._inds, self._x] - self._v[self._x]
self.cred = self.c - ui[:, None] - self._v[None, :] | def _update_cred(self):
"""
Updates the reduced costs with the values from the
dual solution
"""
ui = self.c[self._inds, self._x] - self._v[self._x]
self.cred = self.c - ui[:, None] - self._v[None, :] | [
"Updates",
"the",
"reduced",
"costs",
"with",
"the",
"values",
"from",
"the",
"dual",
"solution"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/optimization/linear_assignment_numpy.py#L156-L162 | [
"def",
"_update_cred",
"(",
"self",
")",
":",
"ui",
"=",
"self",
".",
"c",
"[",
"self",
".",
"_inds",
",",
"self",
".",
"_x",
"]",
"-",
"self",
".",
"_v",
"[",
"self",
".",
"_x",
"]",
"self",
".",
"cred",
"=",
"self",
".",
"c",
"-",
"ui",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LinearAssignment._augment | Finds a minimum cost path and adds it to the matching | pymatgen/optimization/linear_assignment_numpy.py | def _augment(self):
"""
Finds a minimum cost path and adds it to the matching
"""
#build a minimum cost tree
_pred, _ready, istar, j, mu = self._build_tree()
#update prices
self._v[_ready] += self._d[_ready] - mu
#augment the solution with the minimum co... | def _augment(self):
"""
Finds a minimum cost path and adds it to the matching
"""
#build a minimum cost tree
_pred, _ready, istar, j, mu = self._build_tree()
#update prices
self._v[_ready] += self._d[_ready] - mu
#augment the solution with the minimum co... | [
"Finds",
"a",
"minimum",
"cost",
"path",
"and",
"adds",
"it",
"to",
"the",
"matching"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/optimization/linear_assignment_numpy.py#L164-L185 | [
"def",
"_augment",
"(",
"self",
")",
":",
"#build a minimum cost tree",
"_pred",
",",
"_ready",
",",
"istar",
",",
"j",
",",
"mu",
"=",
"self",
".",
"_build_tree",
"(",
")",
"#update prices",
"self",
".",
"_v",
"[",
"_ready",
"]",
"+=",
"self",
".",
"_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LinearAssignment._build_tree | Builds the tree finding an augmenting path. Alternates along
matched and unmatched edges between X and Y. The paths are
stored in _pred (new predecessor of nodes in Y), and
self._x and self._y | pymatgen/optimization/linear_assignment_numpy.py | def _build_tree(self):
"""
Builds the tree finding an augmenting path. Alternates along
matched and unmatched edges between X and Y. The paths are
stored in _pred (new predecessor of nodes in Y), and
self._x and self._y
"""
#find unassigned i*
istar = np.a... | def _build_tree(self):
"""
Builds the tree finding an augmenting path. Alternates along
matched and unmatched edges between X and Y. The paths are
stored in _pred (new predecessor of nodes in Y), and
self._x and self._y
"""
#find unassigned i*
istar = np.a... | [
"Builds",
"the",
"tree",
"finding",
"an",
"augmenting",
"path",
".",
"Alternates",
"along",
"matched",
"and",
"unmatched",
"edges",
"between",
"X",
"and",
"Y",
".",
"The",
"paths",
"are",
"stored",
"in",
"_pred",
"(",
"new",
"predecessor",
"of",
"nodes",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/optimization/linear_assignment_numpy.py#L187-L244 | [
"def",
"_build_tree",
"(",
"self",
")",
":",
"#find unassigned i*",
"istar",
"=",
"np",
".",
"argmin",
"(",
"self",
".",
"_x",
")",
"#compute distances",
"self",
".",
"_d",
"=",
"self",
".",
"c",
"[",
"istar",
"]",
"-",
"self",
".",
"_v",
"_pred",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | pmg_serialize | Decorator for methods that add MSON serializations keys
to the dictionary. See documentation of MSON for more details | pymatgen/util/serialization.py | def pmg_serialize(method):
"""
Decorator for methods that add MSON serializations keys
to the dictionary. See documentation of MSON for more details
"""
@functools.wraps(method)
def wrapper(*args, **kwargs):
self = args[0]
d = method(*args, **kwargs)
# Add @module and @c... | def pmg_serialize(method):
"""
Decorator for methods that add MSON serializations keys
to the dictionary. See documentation of MSON for more details
"""
@functools.wraps(method)
def wrapper(*args, **kwargs):
self = args[0]
d = method(*args, **kwargs)
# Add @module and @c... | [
"Decorator",
"for",
"methods",
"that",
"add",
"MSON",
"serializations",
"keys",
"to",
"the",
"dictionary",
".",
"See",
"documentation",
"of",
"MSON",
"for",
"more",
"details"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/serialization.py#L25-L40 | [
"def",
"pmg_serialize",
"(",
"method",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"method",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
"=",
"args",
"[",
"0",
"]",
"d",
"=",
"method",
"(",
"*",
"args",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | json_pretty_dump | Serialize obj as a JSON formatted stream to the given filename (
pretty printing version) | pymatgen/util/serialization.py | def json_pretty_dump(obj, filename):
"""
Serialize obj as a JSON formatted stream to the given filename (
pretty printing version)
"""
with open(filename, "wt") as fh:
json.dump(obj, fh, indent=4, sort_keys=4) | def json_pretty_dump(obj, filename):
"""
Serialize obj as a JSON formatted stream to the given filename (
pretty printing version)
"""
with open(filename, "wt") as fh:
json.dump(obj, fh, indent=4, sort_keys=4) | [
"Serialize",
"obj",
"as",
"a",
"JSON",
"formatted",
"stream",
"to",
"the",
"given",
"filename",
"(",
"pretty",
"printing",
"version",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/serialization.py#L43-L49 | [
"def",
"json_pretty_dump",
"(",
"obj",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"wt\"",
")",
"as",
"fh",
":",
"json",
".",
"dump",
"(",
"obj",
",",
"fh",
",",
"indent",
"=",
"4",
",",
"sort_keys",
"=",
"4",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PmgPickler.persistent_id | Instead of pickling as a regular class instance, we emit a
persistent ID. | pymatgen/util/serialization.py | def persistent_id(self, obj):
"""Instead of pickling as a regular class instance, we emit a
persistent ID."""
if isinstance(obj, Element):
# Here, our persistent ID is simply a tuple, containing a tag and
# a key
return obj.__class__.__name__, obj.symbol
... | def persistent_id(self, obj):
"""Instead of pickling as a regular class instance, we emit a
persistent ID."""
if isinstance(obj, Element):
# Here, our persistent ID is simply a tuple, containing a tag and
# a key
return obj.__class__.__name__, obj.symbol
... | [
"Instead",
"of",
"pickling",
"as",
"a",
"regular",
"class",
"instance",
"we",
"emit",
"a",
"persistent",
"ID",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/serialization.py#L58-L68 | [
"def",
"persistent_id",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"Element",
")",
":",
"# Here, our persistent ID is simply a tuple, containing a tag and",
"# a key",
"return",
"obj",
".",
"__class__",
".",
"__name__",
",",
"obj",
"."... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PmgUnpickler.persistent_load | This method is invoked whenever a persistent ID is encountered.
Here, pid is the tuple returned by PmgPickler. | pymatgen/util/serialization.py | def persistent_load(self, pid):
"""
This method is invoked whenever a persistent ID is encountered.
Here, pid is the tuple returned by PmgPickler.
"""
try:
type_tag, key_id = pid
except Exception as exc:
# Sometimes we get a string such as ('Elemen... | def persistent_load(self, pid):
"""
This method is invoked whenever a persistent ID is encountered.
Here, pid is the tuple returned by PmgPickler.
"""
try:
type_tag, key_id = pid
except Exception as exc:
# Sometimes we get a string such as ('Elemen... | [
"This",
"method",
"is",
"invoked",
"whenever",
"a",
"persistent",
"ID",
"is",
"encountered",
".",
"Here",
"pid",
"is",
"the",
"tuple",
"returned",
"by",
"PmgPickler",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/serialization.py#L77-L98 | [
"def",
"persistent_load",
"(",
"self",
",",
"pid",
")",
":",
"try",
":",
"type_tag",
",",
"key_id",
"=",
"pid",
"except",
"Exception",
"as",
"exc",
":",
"# Sometimes we get a string such as ('Element', u'C') instead",
"# of a real tuple. Use ast to evalute the expression (m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | mongo_getattr | Get value from dict using MongoDB dot-separated path semantics.
For example:
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b') == 1
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'x') == 2
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b.c') is None
:param rec: mongodb document
... | pymatgen/io/abinit/db.py | def mongo_getattr(rec, key):
"""
Get value from dict using MongoDB dot-separated path semantics.
For example:
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b') == 1
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'x') == 2
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b.c') is N... | def mongo_getattr(rec, key):
"""
Get value from dict using MongoDB dot-separated path semantics.
For example:
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b') == 1
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'x') == 2
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b.c') is N... | [
"Get",
"value",
"from",
"dict",
"using",
"MongoDB",
"dot",
"-",
"separated",
"path",
"semantics",
".",
"For",
"example",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/db.py#L14-L44 | [
"def",
"mongo_getattr",
"(",
"rec",
",",
"key",
")",
":",
"if",
"not",
"isinstance",
"(",
"rec",
",",
"collections",
".",
"Mapping",
")",
":",
"raise",
"AttributeError",
"(",
"'input record must act like a dict'",
")",
"if",
"not",
"rec",
":",
"raise",
"Attr... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | scan_nestdict | Scan a nested dict d, and return the first value associated to the given key.
Returns None if key is not found.
>>> d = {0: 1, 1: {"hello": {"world": {None: [1,2,3]}}}, "foo": [{"bar": 1}, {"color": "red"}]}
>>> assert scan_nestdict(d, 1) == {"hello": {"world": {None: [1,2,3]}}}
>>> assert scan_nestdic... | pymatgen/io/abinit/db.py | def scan_nestdict(d, key):
"""
Scan a nested dict d, and return the first value associated to the given key.
Returns None if key is not found.
>>> d = {0: 1, 1: {"hello": {"world": {None: [1,2,3]}}}, "foo": [{"bar": 1}, {"color": "red"}]}
>>> assert scan_nestdict(d, 1) == {"hello": {"world": {None:... | def scan_nestdict(d, key):
"""
Scan a nested dict d, and return the first value associated to the given key.
Returns None if key is not found.
>>> d = {0: 1, 1: {"hello": {"world": {None: [1,2,3]}}}, "foo": [{"bar": 1}, {"color": "red"}]}
>>> assert scan_nestdict(d, 1) == {"hello": {"world": {None:... | [
"Scan",
"a",
"nested",
"dict",
"d",
"and",
"return",
"the",
"first",
"value",
"associated",
"to",
"the",
"given",
"key",
".",
"Returns",
"None",
"if",
"key",
"is",
"not",
"found",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/db.py#L47-L76 | [
"def",
"scan_nestdict",
"(",
"d",
",",
"key",
")",
":",
"if",
"isinstance",
"(",
"d",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"item",
"in",
"d",
":",
"res",
"=",
"scan_nestdict",
"(",
"item",
",",
"key",
")",
"if",
"res",
"is",
"n... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DBConnector.set_collection_name | Set the name of the collection, return old value | pymatgen/io/abinit/db.py | def set_collection_name(self, value):
"""Set the name of the collection, return old value"""
old = self.collection
self.collection = str(value)
return old | def set_collection_name(self, value):
"""Set the name of the collection, return old value"""
old = self.collection
self.collection = str(value)
return old | [
"Set",
"the",
"name",
"of",
"the",
"collection",
"return",
"old",
"value"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/db.py#L132-L136 | [
"def",
"set_collection_name",
"(",
"self",
",",
"value",
")",
":",
"old",
"=",
"self",
".",
"collection",
"self",
".",
"collection",
"=",
"str",
"(",
"value",
")",
"return",
"old"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DBConnector.get_collection | Establish a connection with the database.
Returns MongoDb collection | pymatgen/io/abinit/db.py | def get_collection(self, **kwargs):
"""
Establish a connection with the database.
Returns MongoDb collection
"""
from pymongo import MongoClient
if self.host and self.port:
client = MongoClient(host=config.host, port=config.port)
else:
cl... | def get_collection(self, **kwargs):
"""
Establish a connection with the database.
Returns MongoDb collection
"""
from pymongo import MongoClient
if self.host and self.port:
client = MongoClient(host=config.host, port=config.port)
else:
cl... | [
"Establish",
"a",
"connection",
"with",
"the",
"database",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/db.py#L138-L156 | [
"def",
"get_collection",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pymongo",
"import",
"MongoClient",
"if",
"self",
".",
"host",
"and",
"self",
".",
"port",
":",
"client",
"=",
"MongoClient",
"(",
"host",
"=",
"config",
".",
"host",
",",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _get_transformation_history | Checks for a transformations.json* file and returns the history. | pymatgen/apps/borg/hive.py | def _get_transformation_history(path):
"""
Checks for a transformations.json* file and returns the history.
"""
trans_json = glob.glob(os.path.join(path, "transformations.json*"))
if trans_json:
try:
with zopen(trans_json[0]) as f:
return json.load(f)["history"]
... | def _get_transformation_history(path):
"""
Checks for a transformations.json* file and returns the history.
"""
trans_json = glob.glob(os.path.join(path, "transformations.json*"))
if trans_json:
try:
with zopen(trans_json[0]) as f:
return json.load(f)["history"]
... | [
"Checks",
"for",
"a",
"transformations",
".",
"json",
"*",
"file",
"and",
"returns",
"the",
"history",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/hive.py#L382-L393 | [
"def",
"_get_transformation_history",
"(",
"path",
")",
":",
"trans_json",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"\"transformations.json*\"",
")",
")",
"if",
"trans_json",
":",
"try",
":",
"with",
"zopen",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | sg_symbol_from_int_number | Obtains a SpaceGroup name from its international number.
Args:
int_number (int): International number.
hexagonal (bool): For rhombohedral groups, whether to return the
hexagonal setting (default) or rhombohedral setting.
Returns:
(str) Spacegroup symbol | pymatgen/symmetry/groups.py | def sg_symbol_from_int_number(int_number, hexagonal=True):
"""
Obtains a SpaceGroup name from its international number.
Args:
int_number (int): International number.
hexagonal (bool): For rhombohedral groups, whether to return the
hexagonal setting (default) or rhombohedral sett... | def sg_symbol_from_int_number(int_number, hexagonal=True):
"""
Obtains a SpaceGroup name from its international number.
Args:
int_number (int): International number.
hexagonal (bool): For rhombohedral groups, whether to return the
hexagonal setting (default) or rhombohedral sett... | [
"Obtains",
"a",
"SpaceGroup",
"name",
"from",
"its",
"international",
"number",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/groups.py#L489-L512 | [
"def",
"sg_symbol_from_int_number",
"(",
"int_number",
",",
"hexagonal",
"=",
"True",
")",
":",
"syms",
"=",
"[",
"]",
"for",
"n",
",",
"v",
"in",
"get_symm_data",
"(",
"\"space_group_encoding\"",
")",
".",
"items",
"(",
")",
":",
"if",
"v",
"[",
"\"int_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | in_array_list | Extremely efficient nd-array comparison using numpy's broadcasting. This
function checks if a particular array a, is present in a list of arrays.
It works for arrays of any size, e.g., even matrix searches.
Args:
array_list ([array]): A list of arrays to compare to.
a (array): The test arra... | pymatgen/symmetry/groups.py | def in_array_list(array_list, a, tol=1e-5):
"""
Extremely efficient nd-array comparison using numpy's broadcasting. This
function checks if a particular array a, is present in a list of arrays.
It works for arrays of any size, e.g., even matrix searches.
Args:
array_list ([array]): A list o... | def in_array_list(array_list, a, tol=1e-5):
"""
Extremely efficient nd-array comparison using numpy's broadcasting. This
function checks if a particular array a, is present in a list of arrays.
It works for arrays of any size, e.g., even matrix searches.
Args:
array_list ([array]): A list o... | [
"Extremely",
"efficient",
"nd",
"-",
"array",
"comparison",
"using",
"numpy",
"s",
"broadcasting",
".",
"This",
"function",
"checks",
"if",
"a",
"particular",
"array",
"a",
"is",
"present",
"in",
"a",
"list",
"of",
"arrays",
".",
"It",
"works",
"for",
"arr... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/groups.py#L515-L536 | [
"def",
"in_array_list",
"(",
"array_list",
",",
"a",
",",
"tol",
"=",
"1e-5",
")",
":",
"if",
"len",
"(",
"array_list",
")",
"==",
"0",
":",
"return",
"False",
"axes",
"=",
"tuple",
"(",
"range",
"(",
"1",
",",
"a",
".",
"ndim",
"+",
"1",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmetryGroup.is_subgroup | True if this group is a subgroup of the supplied group.
Args:
supergroup (SymmetryGroup): Supergroup to test.
Returns:
True if this group is a subgroup of the supplied group. | pymatgen/symmetry/groups.py | def is_subgroup(self, supergroup):
"""
True if this group is a subgroup of the supplied group.
Args:
supergroup (SymmetryGroup): Supergroup to test.
Returns:
True if this group is a subgroup of the supplied group.
"""
warnings.warn("This is not f... | def is_subgroup(self, supergroup):
"""
True if this group is a subgroup of the supplied group.
Args:
supergroup (SymmetryGroup): Supergroup to test.
Returns:
True if this group is a subgroup of the supplied group.
"""
warnings.warn("This is not f... | [
"True",
"if",
"this",
"group",
"is",
"a",
"subgroup",
"of",
"the",
"supplied",
"group",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/groups.py#L66-L77 | [
"def",
"is_subgroup",
"(",
"self",
",",
"supergroup",
")",
":",
"warnings",
".",
"warn",
"(",
"\"This is not fully functional. Only trivial subsets are tested right now. \"",
")",
"return",
"set",
"(",
"self",
".",
"symmetry_ops",
")",
".",
"issubset",
"(",
"supergrou... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SymmetryGroup.is_supergroup | True if this group is a supergroup of the supplied group.
Args:
subgroup (SymmetryGroup): Subgroup to test.
Returns:
True if this group is a supergroup of the supplied group. | pymatgen/symmetry/groups.py | def is_supergroup(self, subgroup):
"""
True if this group is a supergroup of the supplied group.
Args:
subgroup (SymmetryGroup): Subgroup to test.
Returns:
True if this group is a supergroup of the supplied group.
"""
warnings.warn("This is not f... | def is_supergroup(self, subgroup):
"""
True if this group is a supergroup of the supplied group.
Args:
subgroup (SymmetryGroup): Subgroup to test.
Returns:
True if this group is a supergroup of the supplied group.
"""
warnings.warn("This is not f... | [
"True",
"if",
"this",
"group",
"is",
"a",
"supergroup",
"of",
"the",
"supplied",
"group",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/groups.py#L79-L91 | [
"def",
"is_supergroup",
"(",
"self",
",",
"subgroup",
")",
":",
"warnings",
".",
"warn",
"(",
"\"This is not fully functional. Only trivial subsets are \"",
"\"tested right now. \"",
")",
"return",
"set",
"(",
"subgroup",
".",
"symmetry_ops",
")",
".",
"issubset",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | clean_lines | Strips whitespace, carriage returns and empty lines from a list of strings.
Args:
string_list: List of strings
remove_empty_lines: Set to True to skip lines which are empty after
stripping.
Returns:
List of clean strings with no whitespaces. | pymatgen/util/io_utils.py | def clean_lines(string_list, remove_empty_lines=True):
"""
Strips whitespace, carriage returns and empty lines from a list of strings.
Args:
string_list: List of strings
remove_empty_lines: Set to True to skip lines which are empty after
stripping.
Returns:
List of ... | def clean_lines(string_list, remove_empty_lines=True):
"""
Strips whitespace, carriage returns and empty lines from a list of strings.
Args:
string_list: List of strings
remove_empty_lines: Set to True to skip lines which are empty after
stripping.
Returns:
List of ... | [
"Strips",
"whitespace",
"carriage",
"returns",
"and",
"empty",
"lines",
"from",
"a",
"list",
"of",
"strings",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/io_utils.py#L33-L53 | [
"def",
"clean_lines",
"(",
"string_list",
",",
"remove_empty_lines",
"=",
"True",
")",
":",
"for",
"s",
"in",
"string_list",
":",
"clean_s",
"=",
"s",
"if",
"'#'",
"in",
"s",
":",
"ind",
"=",
"s",
".",
"index",
"(",
"'#'",
")",
"clean_s",
"=",
"s",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | micro_pyawk | Small awk-mimicking search routine.
'file' is file to search through.
'search' is the "search program", a list of lists/tuples with 3 elements;
i.e. [[regex,test,run],[regex,test,run],...]
'results' is a an object that your search program will have access to for
storing results.
Here regex is ... | pymatgen/util/io_utils.py | def micro_pyawk(filename, search, results=None, debug=None, postdebug=None):
"""
Small awk-mimicking search routine.
'file' is file to search through.
'search' is the "search program", a list of lists/tuples with 3 elements;
i.e. [[regex,test,run],[regex,test,run],...]
'results' is a an object ... | def micro_pyawk(filename, search, results=None, debug=None, postdebug=None):
"""
Small awk-mimicking search routine.
'file' is file to search through.
'search' is the "search program", a list of lists/tuples with 3 elements;
i.e. [[regex,test,run],[regex,test,run],...]
'results' is a an object ... | [
"Small",
"awk",
"-",
"mimicking",
"search",
"routine",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/io_utils.py#L56-L102 | [
"def",
"micro_pyawk",
"(",
"filename",
",",
"search",
",",
"results",
"=",
"None",
",",
"debug",
"=",
"None",
",",
"postdebug",
"=",
"None",
")",
":",
"if",
"results",
"is",
"None",
":",
"results",
"=",
"{",
"}",
"# Compile strings into regexs",
"for",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _maketemp | Create a temporary file with the filename similar the given ``name``.
The permission bits are copied from the original file or ``createmode``.
Returns: the name of the temporary file. | pymatgen/util/io_utils.py | def _maketemp(name, createmode=None):
"""
Create a temporary file with the filename similar the given ``name``.
The permission bits are copied from the original file or ``createmode``.
Returns: the name of the temporary file.
"""
d, fn = os.path.split(name)
fd, tempname = tempfile.mkstemp(pr... | def _maketemp(name, createmode=None):
"""
Create a temporary file with the filename similar the given ``name``.
The permission bits are copied from the original file or ``createmode``.
Returns: the name of the temporary file.
"""
d, fn = os.path.split(name)
fd, tempname = tempfile.mkstemp(pr... | [
"Create",
"a",
"temporary",
"file",
"with",
"the",
"filename",
"similar",
"the",
"given",
"name",
".",
"The",
"permission",
"bits",
"are",
"copied",
"from",
"the",
"original",
"file",
"or",
"createmode",
".",
"Returns",
":",
"the",
"name",
"of",
"the",
"te... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/io_utils.py#L109-L133 | [
"def",
"_maketemp",
"(",
"name",
",",
"createmode",
"=",
"None",
")",
":",
"d",
",",
"fn",
"=",
"os",
".",
"path",
".",
"split",
"(",
"name",
")",
"fd",
",",
"tempname",
"=",
"tempfile",
".",
"mkstemp",
"(",
"prefix",
"=",
"\".%s-\"",
"%",
"fn",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_pmg_structure | Convert a PhonopyAtoms object to pymatgen Structure object.
Args:
phonopy_structure (PhonopyAtoms): A phonopy structure object. | pymatgen/io/phonopy.py | def get_pmg_structure(phonopy_structure):
"""
Convert a PhonopyAtoms object to pymatgen Structure object.
Args:
phonopy_structure (PhonopyAtoms): A phonopy structure object.
"""
lattice = phonopy_structure.get_cell()
frac_coords = phonopy_structure.get_scaled_positions()
symbols =... | def get_pmg_structure(phonopy_structure):
"""
Convert a PhonopyAtoms object to pymatgen Structure object.
Args:
phonopy_structure (PhonopyAtoms): A phonopy structure object.
"""
lattice = phonopy_structure.get_cell()
frac_coords = phonopy_structure.get_scaled_positions()
symbols =... | [
"Convert",
"a",
"PhonopyAtoms",
"object",
"to",
"pymatgen",
"Structure",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L21-L39 | [
"def",
"get_pmg_structure",
"(",
"phonopy_structure",
")",
":",
"lattice",
"=",
"phonopy_structure",
".",
"get_cell",
"(",
")",
"frac_coords",
"=",
"phonopy_structure",
".",
"get_scaled_positions",
"(",
")",
"symbols",
"=",
"phonopy_structure",
".",
"get_chemical_symb... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_phonopy_structure | Convert a pymatgen Structure object to a PhonopyAtoms object.
Args:
pmg_structure (pymatgen Structure): A Pymatgen structure object. | pymatgen/io/phonopy.py | def get_phonopy_structure(pmg_structure):
"""
Convert a pymatgen Structure object to a PhonopyAtoms object.
Args:
pmg_structure (pymatgen Structure): A Pymatgen structure object.
"""
symbols = [site.specie.symbol for site in pmg_structure]
return PhonopyAtoms(symbols=symbols, cell=pm... | def get_phonopy_structure(pmg_structure):
"""
Convert a pymatgen Structure object to a PhonopyAtoms object.
Args:
pmg_structure (pymatgen Structure): A Pymatgen structure object.
"""
symbols = [site.specie.symbol for site in pmg_structure]
return PhonopyAtoms(symbols=symbols, cell=pm... | [
"Convert",
"a",
"pymatgen",
"Structure",
"object",
"to",
"a",
"PhonopyAtoms",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L43-L55 | [
"def",
"get_phonopy_structure",
"(",
"pmg_structure",
")",
":",
"symbols",
"=",
"[",
"site",
".",
"specie",
".",
"symbol",
"for",
"site",
"in",
"pmg_structure",
"]",
"return",
"PhonopyAtoms",
"(",
"symbols",
"=",
"symbols",
",",
"cell",
"=",
"pmg_structure",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_structure_from_dict | Extracts a structure from the dictionary extracted from the output
files of phonopy like phonopy.yaml or band.yaml.
Adds "phonopy_masses" in the site_properties of the structures.
Compatible with older phonopy versions. | pymatgen/io/phonopy.py | def get_structure_from_dict(d):
"""
Extracts a structure from the dictionary extracted from the output
files of phonopy like phonopy.yaml or band.yaml.
Adds "phonopy_masses" in the site_properties of the structures.
Compatible with older phonopy versions.
"""
species = []
frac_coords = ... | def get_structure_from_dict(d):
"""
Extracts a structure from the dictionary extracted from the output
files of phonopy like phonopy.yaml or band.yaml.
Adds "phonopy_masses" in the site_properties of the structures.
Compatible with older phonopy versions.
"""
species = []
frac_coords = ... | [
"Extracts",
"a",
"structure",
"from",
"the",
"dictionary",
"extracted",
"from",
"the",
"output",
"files",
"of",
"phonopy",
"like",
"phonopy",
".",
"yaml",
"or",
"band",
".",
"yaml",
".",
"Adds",
"phonopy_masses",
"in",
"the",
"site_properties",
"of",
"the",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L58-L83 | [
"def",
"get_structure_from_dict",
"(",
"d",
")",
":",
"species",
"=",
"[",
"]",
"frac_coords",
"=",
"[",
"]",
"masses",
"=",
"[",
"]",
"if",
"'points'",
"in",
"d",
":",
"for",
"p",
"in",
"d",
"[",
"'points'",
"]",
":",
"species",
".",
"append",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | eigvec_to_eigdispl | Converts a single eigenvector to an eigendisplacement in the primitive cell
according to the formula::
exp(2*pi*i*(frac_coords \\dot q) / sqrt(mass) * v
Compared to the modulation option in phonopy, here all the additional
multiplicative and phase factors are set to 1.
Args:
... | pymatgen/io/phonopy.py | def eigvec_to_eigdispl(v, q, frac_coords, mass):
"""
Converts a single eigenvector to an eigendisplacement in the primitive cell
according to the formula::
exp(2*pi*i*(frac_coords \\dot q) / sqrt(mass) * v
Compared to the modulation option in phonopy, here all the additional
mu... | def eigvec_to_eigdispl(v, q, frac_coords, mass):
"""
Converts a single eigenvector to an eigendisplacement in the primitive cell
according to the formula::
exp(2*pi*i*(frac_coords \\dot q) / sqrt(mass) * v
Compared to the modulation option in phonopy, here all the additional
mu... | [
"Converts",
"a",
"single",
"eigenvector",
"to",
"an",
"eigendisplacement",
"in",
"the",
"primitive",
"cell",
"according",
"to",
"the",
"formula",
"::",
"exp",
"(",
"2",
"*",
"pi",
"*",
"i",
"*",
"(",
"frac_coords",
"\\\\",
"dot",
"q",
")",
"/",
"sqrt",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L86-L105 | [
"def",
"eigvec_to_eigdispl",
"(",
"v",
",",
"q",
",",
"frac_coords",
",",
"mass",
")",
":",
"c",
"=",
"np",
".",
"exp",
"(",
"2j",
"*",
"np",
".",
"pi",
"*",
"np",
".",
"dot",
"(",
"frac_coords",
",",
"q",
")",
")",
"/",
"np",
".",
"sqrt",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_ph_bs_symm_line_from_dict | Creates a pymatgen PhononBandStructure object from the dictionary
extracted by the band.yaml file produced by phonopy. The labels
will be extracted from the dictionary, if present. If the 'eigenvector'
key is found the eigendisplacements will be calculated according to the
formula::
ex... | pymatgen/io/phonopy.py | def get_ph_bs_symm_line_from_dict(bands_dict, has_nac=False, labels_dict=None):
"""
Creates a pymatgen PhononBandStructure object from the dictionary
extracted by the band.yaml file produced by phonopy. The labels
will be extracted from the dictionary, if present. If the 'eigenvector'
key is found t... | def get_ph_bs_symm_line_from_dict(bands_dict, has_nac=False, labels_dict=None):
"""
Creates a pymatgen PhononBandStructure object from the dictionary
extracted by the band.yaml file produced by phonopy. The labels
will be extracted from the dictionary, if present. If the 'eigenvector'
key is found t... | [
"Creates",
"a",
"pymatgen",
"PhononBandStructure",
"object",
"from",
"the",
"dictionary",
"extracted",
"by",
"the",
"band",
".",
"yaml",
"file",
"produced",
"by",
"phonopy",
".",
"The",
"labels",
"will",
"be",
"extracted",
"from",
"the",
"dictionary",
"if",
"p... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L108-L171 | [
"def",
"get_ph_bs_symm_line_from_dict",
"(",
"bands_dict",
",",
"has_nac",
"=",
"False",
",",
"labels_dict",
"=",
"None",
")",
":",
"structure",
"=",
"get_structure_from_dict",
"(",
"bands_dict",
")",
"qpts",
"=",
"[",
"]",
"frequencies",
"=",
"[",
"]",
"eigen... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_ph_bs_symm_line | Creates a pymatgen PhononBandStructure from a band.yaml file.
The labels will be extracted from the dictionary, if present.
If the 'eigenvector' key is found the eigendisplacements will be
calculated according to the formula:
\\exp(2*pi*i*(frac_coords \\dot q) / sqrt(mass) * v
and added to the obj... | pymatgen/io/phonopy.py | def get_ph_bs_symm_line(bands_path, has_nac=False, labels_dict=None):
"""
Creates a pymatgen PhononBandStructure from a band.yaml file.
The labels will be extracted from the dictionary, if present.
If the 'eigenvector' key is found the eigendisplacements will be
calculated according to the formula:... | def get_ph_bs_symm_line(bands_path, has_nac=False, labels_dict=None):
"""
Creates a pymatgen PhononBandStructure from a band.yaml file.
The labels will be extracted from the dictionary, if present.
If the 'eigenvector' key is found the eigendisplacements will be
calculated according to the formula:... | [
"Creates",
"a",
"pymatgen",
"PhononBandStructure",
"from",
"a",
"band",
".",
"yaml",
"file",
".",
"The",
"labels",
"will",
"be",
"extracted",
"from",
"the",
"dictionary",
"if",
"present",
".",
"If",
"the",
"eigenvector",
"key",
"is",
"found",
"the",
"eigendi... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L174-L190 | [
"def",
"get_ph_bs_symm_line",
"(",
"bands_path",
",",
"has_nac",
"=",
"False",
",",
"labels_dict",
"=",
"None",
")",
":",
"return",
"get_ph_bs_symm_line_from_dict",
"(",
"loadfn",
"(",
"bands_path",
")",
",",
"has_nac",
",",
"labels_dict",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_complete_ph_dos | Creates a pymatgen CompletePhononDos from a partial_dos.dat and
phonopy.yaml files.
The second is produced when generating a Dos and is needed to extract
the structure.
Args:
partial_dos_path: path to the partial_dos.dat file.
phonopy_yaml_path: path to the phonopy.yaml file. | pymatgen/io/phonopy.py | def get_complete_ph_dos(partial_dos_path, phonopy_yaml_path):
"""
Creates a pymatgen CompletePhononDos from a partial_dos.dat and
phonopy.yaml files.
The second is produced when generating a Dos and is needed to extract
the structure.
Args:
partial_dos_path: path to the partial_dos.dat ... | def get_complete_ph_dos(partial_dos_path, phonopy_yaml_path):
"""
Creates a pymatgen CompletePhononDos from a partial_dos.dat and
phonopy.yaml files.
The second is produced when generating a Dos and is needed to extract
the structure.
Args:
partial_dos_path: path to the partial_dos.dat ... | [
"Creates",
"a",
"pymatgen",
"CompletePhononDos",
"from",
"a",
"partial_dos",
".",
"dat",
"and",
"phonopy",
".",
"yaml",
"files",
".",
"The",
"second",
"is",
"produced",
"when",
"generating",
"a",
"Dos",
"and",
"is",
"needed",
"to",
"extract",
"the",
"structu... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L204-L226 | [
"def",
"get_complete_ph_dos",
"(",
"partial_dos_path",
",",
"phonopy_yaml_path",
")",
":",
"a",
"=",
"np",
".",
"loadtxt",
"(",
"partial_dos_path",
")",
".",
"transpose",
"(",
")",
"d",
"=",
"loadfn",
"(",
"phonopy_yaml_path",
")",
"structure",
"=",
"get_struc... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_displaced_structures | Generate a set of symmetrically inequivalent displaced structures for
phonon calculations.
Args:
pmg_structure (Structure): A pymatgen structure object.
atom_disp (float): Atomic displacement. Default is 0.01 $\\AA$.
supercell_matrix (3x3 array): Scaling matrix for supercell.
ya... | pymatgen/io/phonopy.py | def get_displaced_structures(pmg_structure, atom_disp=0.01,
supercell_matrix=None, yaml_fname=None, **kwargs):
"""
Generate a set of symmetrically inequivalent displaced structures for
phonon calculations.
Args:
pmg_structure (Structure): A pymatgen structure object... | def get_displaced_structures(pmg_structure, atom_disp=0.01,
supercell_matrix=None, yaml_fname=None, **kwargs):
"""
Generate a set of symmetrically inequivalent displaced structures for
phonon calculations.
Args:
pmg_structure (Structure): A pymatgen structure object... | [
"Generate",
"a",
"set",
"of",
"symmetrically",
"inequivalent",
"displaced",
"structures",
"for",
"phonon",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/phonopy.py#L230-L282 | [
"def",
"get_displaced_structures",
"(",
"pmg_structure",
",",
"atom_disp",
"=",
"0.01",
",",
"supercell_matrix",
"=",
"None",
",",
"yaml_fname",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"is_plusminus",
"=",
"kwargs",
".",
"get",
"(",
"\"is_plusminus\"",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_unique_families | Returns unique families of Miller indices. Families must be permutations
of each other.
Args:
hkls ([h, k, l]): List of Miller indices.
Returns:
{hkl: multiplicity}: A dict with unique hkl and multiplicity. | pymatgen/analysis/diffraction/core.py | def get_unique_families(hkls):
"""
Returns unique families of Miller indices. Families must be permutations
of each other.
Args:
hkls ([h, k, l]): List of Miller indices.
Returns:
{hkl: multiplicity}: A dict with unique hkl and multiplicity.
"""
# TODO: Definitely can be sp... | def get_unique_families(hkls):
"""
Returns unique families of Miller indices. Families must be permutations
of each other.
Args:
hkls ([h, k, l]): List of Miller indices.
Returns:
{hkl: multiplicity}: A dict with unique hkl and multiplicity.
"""
# TODO: Definitely can be sp... | [
"Returns",
"unique",
"families",
"of",
"Miller",
"indices",
".",
"Families",
"must",
"be",
"permutations",
"of",
"each",
"other",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/diffraction/core.py#L181-L213 | [
"def",
"get_unique_families",
"(",
"hkls",
")",
":",
"# TODO: Definitely can be sped up.",
"def",
"is_perm",
"(",
"hkl1",
",",
"hkl2",
")",
":",
"h1",
"=",
"np",
".",
"abs",
"(",
"hkl1",
")",
"h2",
"=",
"np",
".",
"abs",
"(",
"hkl2",
")",
"return",
"al... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbstractDiffractionPatternCalculator.get_plot | Returns the diffraction plot as a matplotlib.pyplot.
Args:
structure: Input structure
two_theta_range ([float of length 2]): Tuple for range of
two_thetas to calculate in degrees. Defaults to (0, 90). Set to
None if you want all diffracted beams within th... | pymatgen/analysis/diffraction/core.py | def get_plot(self, structure, two_theta_range=(0, 90),
annotate_peaks=True, ax=None, with_labels=True,
fontsize=16):
"""
Returns the diffraction plot as a matplotlib.pyplot.
Args:
structure: Input structure
two_theta_range ([float of len... | def get_plot(self, structure, two_theta_range=(0, 90),
annotate_peaks=True, ax=None, with_labels=True,
fontsize=16):
"""
Returns the diffraction plot as a matplotlib.pyplot.
Args:
structure: Input structure
two_theta_range ([float of len... | [
"Returns",
"the",
"diffraction",
"plot",
"as",
"a",
"matplotlib",
".",
"pyplot",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/diffraction/core.py#L85-L133 | [
"def",
"get_plot",
"(",
"self",
",",
"structure",
",",
"two_theta_range",
"=",
"(",
"0",
",",
"90",
")",
",",
"annotate_peaks",
"=",
"True",
",",
"ax",
"=",
"None",
",",
"with_labels",
"=",
"True",
",",
"fontsize",
"=",
"16",
")",
":",
"if",
"ax",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbstractDiffractionPatternCalculator.plot_structures | Plot diffraction patterns for multiple structures on the same figure.
Args:
structures (Structure): List of structures
two_theta_range ([float of length 2]): Tuple for range of
two_thetas to calculate in degrees. Defaults to (0, 90). Set to
None if you wa... | pymatgen/analysis/diffraction/core.py | def plot_structures(self, structures, fontsize=6, **kwargs):
"""
Plot diffraction patterns for multiple structures on the same figure.
Args:
structures (Structure): List of structures
two_theta_range ([float of length 2]): Tuple for range of
two_thetas to... | def plot_structures(self, structures, fontsize=6, **kwargs):
"""
Plot diffraction patterns for multiple structures on the same figure.
Args:
structures (Structure): List of structures
two_theta_range ([float of length 2]): Tuple for range of
two_thetas to... | [
"Plot",
"diffraction",
"patterns",
"for",
"multiple",
"structures",
"on",
"the",
"same",
"figure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/diffraction/core.py#L151-L178 | [
"def",
"plot_structures",
"(",
"self",
",",
"structures",
",",
"fontsize",
"=",
"6",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"nrows",
"=",
"len",
"(",
"structures",
")",
"fig",
",",
"axes",
"=",
"plt",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | quick_view | A function to visualize pymatgen Structure objects in jupyter notebook using chemview package.
Args:
structure: pymatgen Structure
bonds: (bool) visualize bonds. Bonds are found by comparing distances
to added covalent radii of pairs. Defaults to True.
conventional: ... | pymatgen/vis/structure_chemview.py | def quick_view(structure, bonds=True, conventional=False, transform=None, show_box=True, bond_tol=0.2, stick_radius=0.1):
"""
A function to visualize pymatgen Structure objects in jupyter notebook using chemview package.
Args:
structure: pymatgen Structure
bonds: (bool) visualize bonds. Bon... | def quick_view(structure, bonds=True, conventional=False, transform=None, show_box=True, bond_tol=0.2, stick_radius=0.1):
"""
A function to visualize pymatgen Structure objects in jupyter notebook using chemview package.
Args:
structure: pymatgen Structure
bonds: (bool) visualize bonds. Bon... | [
"A",
"function",
"to",
"visualize",
"pymatgen",
"Structure",
"objects",
"in",
"jupyter",
"notebook",
"using",
"chemview",
"package",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_chemview.py#L16-L74 | [
"def",
"quick_view",
"(",
"structure",
",",
"bonds",
"=",
"True",
",",
"conventional",
"=",
"False",
",",
"transform",
"=",
"None",
",",
"show_box",
"=",
"True",
",",
"bond_tol",
"=",
"0.2",
",",
"stick_radius",
"=",
"0.1",
")",
":",
"s",
"=",
"structu... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Spectrum.normalize | Normalize the spectrum with respect to the sum of intensity
Args:
mode (str): Normalization mode. Supported modes are "max" (set the
max y value to value, e.g., in XRD patterns), "sum" (set the
sum of y to a value, i.e., like a probability density).
value... | pymatgen/core/spectrum.py | def normalize(self, mode="max", value=1):
"""
Normalize the spectrum with respect to the sum of intensity
Args:
mode (str): Normalization mode. Supported modes are "max" (set the
max y value to value, e.g., in XRD patterns), "sum" (set the
sum of y to... | def normalize(self, mode="max", value=1):
"""
Normalize the spectrum with respect to the sum of intensity
Args:
mode (str): Normalization mode. Supported modes are "max" (set the
max y value to value, e.g., in XRD patterns), "sum" (set the
sum of y to... | [
"Normalize",
"the",
"spectrum",
"with",
"respect",
"to",
"the",
"sum",
"of",
"intensity"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/spectrum.py#L70-L87 | [
"def",
"normalize",
"(",
"self",
",",
"mode",
"=",
"\"max\"",
",",
"value",
"=",
"1",
")",
":",
"if",
"mode",
".",
"lower",
"(",
")",
"==",
"\"sum\"",
":",
"factor",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"y",
",",
"axis",
"=",
"0",
")",
"e... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Spectrum.smear | Apply Gaussian smearing to spectrum y value.
Args:
sigma: Std dev for Gaussian smear function | pymatgen/core/spectrum.py | def smear(self, sigma):
"""
Apply Gaussian smearing to spectrum y value.
Args:
sigma: Std dev for Gaussian smear function
"""
diff = [self.x[i + 1] - self.x[i] for i in range(len(self.x) - 1)]
avg_x_per_step = np.sum(diff) / len(diff)
if len(self.ydim... | def smear(self, sigma):
"""
Apply Gaussian smearing to spectrum y value.
Args:
sigma: Std dev for Gaussian smear function
"""
diff = [self.x[i + 1] - self.x[i] for i in range(len(self.x) - 1)]
avg_x_per_step = np.sum(diff) / len(diff)
if len(self.ydim... | [
"Apply",
"Gaussian",
"smearing",
"to",
"spectrum",
"y",
"value",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/spectrum.py#L89-L103 | [
"def",
"smear",
"(",
"self",
",",
"sigma",
")",
":",
"diff",
"=",
"[",
"self",
".",
"x",
"[",
"i",
"+",
"1",
"]",
"-",
"self",
".",
"x",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"x",
")",
"-",
"1",
")",
"]... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Spectrum.get_interpolated_value | Returns an interpolated y value for a particular x value.
Args:
x: x value to return the y value for
Returns:
Value of y at x | pymatgen/core/spectrum.py | def get_interpolated_value(self, x):
"""
Returns an interpolated y value for a particular x value.
Args:
x: x value to return the y value for
Returns:
Value of y at x
"""
if len(self.ydim) == 1:
return get_linear_interpolated_value(s... | def get_interpolated_value(self, x):
"""
Returns an interpolated y value for a particular x value.
Args:
x: x value to return the y value for
Returns:
Value of y at x
"""
if len(self.ydim) == 1:
return get_linear_interpolated_value(s... | [
"Returns",
"an",
"interpolated",
"y",
"value",
"for",
"a",
"particular",
"x",
"value",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/spectrum.py#L105-L119 | [
"def",
"get_interpolated_value",
"(",
"self",
",",
"x",
")",
":",
"if",
"len",
"(",
"self",
".",
"ydim",
")",
"==",
"1",
":",
"return",
"get_linear_interpolated_value",
"(",
"self",
".",
"x",
",",
"self",
".",
"y",
",",
"x",
")",
"else",
":",
"return... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Spectrum.copy | Returns:
Copy of Spectrum object. | pymatgen/core/spectrum.py | def copy(self):
"""
Returns:
Copy of Spectrum object.
"""
return self.__class__(self.x, self.y, *self._args, **self._kwargs) | def copy(self):
"""
Returns:
Copy of Spectrum object.
"""
return self.__class__(self.x, self.y, *self._args, **self._kwargs) | [
"Returns",
":",
"Copy",
"of",
"Spectrum",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/spectrum.py#L121-L126 | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"x",
",",
"self",
".",
"y",
",",
"*",
"self",
".",
"_args",
",",
"*",
"*",
"self",
".",
"_kwargs",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _write_all_magnetic_space_groups_to_file | Write all magnetic space groups to a human-readable text file.
Should contain same information as text files provided by ISO-MAG.
:param filename:
:return: | pymatgen/symmetry/maggroups.py | def _write_all_magnetic_space_groups_to_file(filename):
"""
Write all magnetic space groups to a human-readable text file.
Should contain same information as text files provided by ISO-MAG.
:param filename:
:return:
"""
s = ('Data parsed from raw data from:\n'
'ISO-MAG, ISOTROPY S... | def _write_all_magnetic_space_groups_to_file(filename):
"""
Write all magnetic space groups to a human-readable text file.
Should contain same information as text files provided by ISO-MAG.
:param filename:
:return:
"""
s = ('Data parsed from raw data from:\n'
'ISO-MAG, ISOTROPY S... | [
"Write",
"all",
"magnetic",
"space",
"groups",
"to",
"a",
"human",
"-",
"readable",
"text",
"file",
".",
"Should",
"contain",
"same",
"information",
"as",
"text",
"files",
"provided",
"by",
"ISO",
"-",
"MAG",
".",
":",
"param",
"filename",
":",
":",
"ret... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/maggroups.py#L484-L502 | [
"def",
"_write_all_magnetic_space_groups_to_file",
"(",
"filename",
")",
":",
"s",
"=",
"(",
"'Data parsed from raw data from:\\n'",
"'ISO-MAG, ISOTROPY Software Suite, iso.byu.edu\\n'",
"'http://stokes.byu.edu/iso/magnetic_data.txt\\n'",
"'Used with kind permission from Professor Branton Ca... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | combine_neb_plots | neb_analyses: a list of NEBAnalysis objects
arranged_neb_analyses: The code connects two end points with the
smallest-energy difference. If all end points have very close energies, it's
likely to result in an inaccurate connection. Manually arrange neb_analyses
if the combined plot is not as expected c... | pymatgen/analysis/transition_state.py | def combine_neb_plots(neb_analyses, arranged_neb_analyses=False,
reverse_plot=False):
"""
neb_analyses: a list of NEBAnalysis objects
arranged_neb_analyses: The code connects two end points with the
smallest-energy difference. If all end points have very close energies, it's
l... | def combine_neb_plots(neb_analyses, arranged_neb_analyses=False,
reverse_plot=False):
"""
neb_analyses: a list of NEBAnalysis objects
arranged_neb_analyses: The code connects two end points with the
smallest-energy difference. If all end points have very close energies, it's
l... | [
"neb_analyses",
":",
"a",
"list",
"of",
"NEBAnalysis",
"objects"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L309-L406 | [
"def",
"combine_neb_plots",
"(",
"neb_analyses",
",",
"arranged_neb_analyses",
"=",
"False",
",",
"reverse_plot",
"=",
"False",
")",
":",
"x",
"=",
"StructureMatcher",
"(",
")",
"for",
"neb_index",
"in",
"range",
"(",
"len",
"(",
"neb_analyses",
")",
")",
":... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NEBAnalysis.setup_spline | Setup of the options for the spline interpolation
Args:
spline_options (dict): Options for cubic spline. For example,
{"saddle_point": "zero_slope"} forces the slope at the saddle to
be zero. | pymatgen/analysis/transition_state.py | def setup_spline(self, spline_options=None):
"""
Setup of the options for the spline interpolation
Args:
spline_options (dict): Options for cubic spline. For example,
{"saddle_point": "zero_slope"} forces the slope at the saddle to
be zero.
""... | def setup_spline(self, spline_options=None):
"""
Setup of the options for the spline interpolation
Args:
spline_options (dict): Options for cubic spline. For example,
{"saddle_point": "zero_slope"} forces the slope at the saddle to
be zero.
""... | [
"Setup",
"of",
"the",
"options",
"for",
"the",
"spline",
"interpolation"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L75-L105 | [
"def",
"setup_spline",
"(",
"self",
",",
"spline_options",
"=",
"None",
")",
":",
"self",
".",
"spline_options",
"=",
"spline_options",
"relative_energies",
"=",
"self",
".",
"energies",
"-",
"self",
".",
"energies",
"[",
"0",
"]",
"if",
"scipy_old_piecewisepo... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NEBAnalysis.from_outcars | Initializes an NEBAnalysis from Outcar and Structure objects. Use
the static constructors, e.g., :class:`from_dir` instead if you
prefer to have these automatically generated from a directory of NEB
calculations.
Args:
outcars ([Outcar]): List of Outcar objects. Note that th... | pymatgen/analysis/transition_state.py | def from_outcars(cls, outcars, structures, **kwargs):
"""
Initializes an NEBAnalysis from Outcar and Structure objects. Use
the static constructors, e.g., :class:`from_dir` instead if you
prefer to have these automatically generated from a directory of NEB
calculations.
... | def from_outcars(cls, outcars, structures, **kwargs):
"""
Initializes an NEBAnalysis from Outcar and Structure objects. Use
the static constructors, e.g., :class:`from_dir` instead if you
prefer to have these automatically generated from a directory of NEB
calculations.
... | [
"Initializes",
"an",
"NEBAnalysis",
"from",
"Outcar",
"and",
"Structure",
"objects",
".",
"Use",
"the",
"static",
"constructors",
"e",
".",
"g",
".",
":",
"class",
":",
"from_dir",
"instead",
"if",
"you",
"prefer",
"to",
"have",
"these",
"automatically",
"ge... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L108-L151 | [
"def",
"from_outcars",
"(",
"cls",
",",
"outcars",
",",
"structures",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"outcars",
")",
"!=",
"len",
"(",
"structures",
")",
":",
"raise",
"ValueError",
"(",
"\"# of Outcars must be same as # of Structures\"",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NEBAnalysis.get_extrema | Returns the positions of the extrema along the MEP. Both local
minimums and maximums are returned.
Args:
normalize_rxn_coordinate (bool): Whether to normalize the
reaction coordinate to between 0 and 1. Defaults to True.
Returns:
(min_extrema, max_extrem... | pymatgen/analysis/transition_state.py | def get_extrema(self, normalize_rxn_coordinate=True):
"""
Returns the positions of the extrema along the MEP. Both local
minimums and maximums are returned.
Args:
normalize_rxn_coordinate (bool): Whether to normalize the
reaction coordinate to between 0 and 1... | def get_extrema(self, normalize_rxn_coordinate=True):
"""
Returns the positions of the extrema along the MEP. Both local
minimums and maximums are returned.
Args:
normalize_rxn_coordinate (bool): Whether to normalize the
reaction coordinate to between 0 and 1... | [
"Returns",
"the",
"positions",
"of",
"the",
"extrema",
"along",
"the",
"MEP",
".",
"Both",
"local",
"minimums",
"and",
"maximums",
"are",
"returned",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L153-L177 | [
"def",
"get_extrema",
"(",
"self",
",",
"normalize_rxn_coordinate",
"=",
"True",
")",
":",
"x",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"np",
".",
"max",
"(",
"self",
".",
"r",
")",
",",
"0.01",
")",
"y",
"=",
"self",
".",
"spline",
"(",
"x",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NEBAnalysis.get_plot | Returns the NEB plot. Uses Henkelman's approach of spline fitting
each section of the reaction path based on tangent force and energies.
Args:
normalize_rxn_coordinate (bool): Whether to normalize the
reaction coordinate to between 0 and 1. Defaults to True.
labe... | pymatgen/analysis/transition_state.py | def get_plot(self, normalize_rxn_coordinate=True, label_barrier=True):
"""
Returns the NEB plot. Uses Henkelman's approach of spline fitting
each section of the reaction path based on tangent force and energies.
Args:
normalize_rxn_coordinate (bool): Whether to normalize the... | def get_plot(self, normalize_rxn_coordinate=True, label_barrier=True):
"""
Returns the NEB plot. Uses Henkelman's approach of spline fitting
each section of the reaction path based on tangent force and energies.
Args:
normalize_rxn_coordinate (bool): Whether to normalize the... | [
"Returns",
"the",
"NEB",
"plot",
".",
"Uses",
"Henkelman",
"s",
"approach",
"of",
"spline",
"fitting",
"each",
"section",
"of",
"the",
"reaction",
"path",
"based",
"on",
"tangent",
"force",
"and",
"energies",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L179-L211 | [
"def",
"get_plot",
"(",
"self",
",",
"normalize_rxn_coordinate",
"=",
"True",
",",
"label_barrier",
"=",
"True",
")",
":",
"plt",
"=",
"pretty_plot",
"(",
"12",
",",
"8",
")",
"scale",
"=",
"1",
"if",
"not",
"normalize_rxn_coordinate",
"else",
"1",
"/",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NEBAnalysis.from_dir | Initializes a NEBAnalysis object from a directory of a NEB run.
Note that OUTCARs must be present in all image directories. For the
terminal OUTCARs from relaxation calculations, you can specify the
locations using relaxation_dir. If these are not specified, the code
will attempt to look... | pymatgen/analysis/transition_state.py | def from_dir(cls, root_dir, relaxation_dirs=None, **kwargs):
"""
Initializes a NEBAnalysis object from a directory of a NEB run.
Note that OUTCARs must be present in all image directories. For the
terminal OUTCARs from relaxation calculations, you can specify the
locations using ... | def from_dir(cls, root_dir, relaxation_dirs=None, **kwargs):
"""
Initializes a NEBAnalysis object from a directory of a NEB run.
Note that OUTCARs must be present in all image directories. For the
terminal OUTCARs from relaxation calculations, you can specify the
locations using ... | [
"Initializes",
"a",
"NEBAnalysis",
"object",
"from",
"a",
"directory",
"of",
"a",
"NEB",
"run",
".",
"Note",
"that",
"OUTCARs",
"must",
"be",
"present",
"in",
"all",
"image",
"directories",
".",
"For",
"the",
"terminal",
"OUTCARs",
"from",
"relaxation",
"cal... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L214-L292 | [
"def",
"from_dir",
"(",
"cls",
",",
"root_dir",
",",
"relaxation_dirs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"neb_dirs",
"=",
"[",
"]",
"for",
"d",
"in",
"os",
".",
"listdir",
"(",
"root_dir",
")",
":",
"pth",
"=",
"os",
".",
"path",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.