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 | BoltztrapAnalyzer.parse_transdos | Parses .transdos (total DOS) and .transdos_x_y (partial DOS) files
Args:
path_dir: (str) dir containing DOS files
efermi: (float) Fermi energy
dos_spin: (int) -1 for spin down, +1 for spin up
trim_dos: (bool) whether to post-process / trim DOS
Returns:
... | pymatgen/electronic_structure/boltztrap.py | def parse_transdos(path_dir, efermi, dos_spin=1, trim_dos=False):
"""
Parses .transdos (total DOS) and .transdos_x_y (partial DOS) files
Args:
path_dir: (str) dir containing DOS files
efermi: (float) Fermi energy
dos_spin: (int) -1 for spin down, +1 for spin ... | def parse_transdos(path_dir, efermi, dos_spin=1, trim_dos=False):
"""
Parses .transdos (total DOS) and .transdos_x_y (partial DOS) files
Args:
path_dir: (str) dir containing DOS files
efermi: (float) Fermi energy
dos_spin: (int) -1 for spin down, +1 for spin ... | [
"Parses",
".",
"transdos",
"(",
"total",
"DOS",
")",
"and",
".",
"transdos_x_y",
"(",
"partial",
"DOS",
")",
"files",
"Args",
":",
"path_dir",
":",
"(",
"str",
")",
"dir",
"containing",
"DOS",
"files",
"efermi",
":",
"(",
"float",
")",
"Fermi",
"energy... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1765-L1841 | [
"def",
"parse_transdos",
"(",
"path_dir",
",",
"efermi",
",",
"dos_spin",
"=",
"1",
",",
"trim_dos",
"=",
"False",
")",
":",
"data_dos",
"=",
"{",
"'total'",
":",
"[",
"]",
",",
"'partial'",
":",
"{",
"}",
"}",
"# parse the total DOS data",
"## format is e... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.parse_intrans | Parses boltztrap.intrans mainly to extract the value of scissor applied to the bands or some other inputs
Args:
path_dir: (str) dir containing the boltztrap.intrans file
Returns:
intrans (dict): a dictionary containing various inputs that had been used in the Boltztrap run. | pymatgen/electronic_structure/boltztrap.py | def parse_intrans(path_dir):
"""
Parses boltztrap.intrans mainly to extract the value of scissor applied to the bands or some other inputs
Args:
path_dir: (str) dir containing the boltztrap.intrans file
Returns:
intrans (dict): a dictionary containing various inpu... | def parse_intrans(path_dir):
"""
Parses boltztrap.intrans mainly to extract the value of scissor applied to the bands or some other inputs
Args:
path_dir: (str) dir containing the boltztrap.intrans file
Returns:
intrans (dict): a dictionary containing various inpu... | [
"Parses",
"boltztrap",
".",
"intrans",
"mainly",
"to",
"extract",
"the",
"value",
"of",
"scissor",
"applied",
"to",
"the",
"bands",
"or",
"some",
"other",
"inputs",
"Args",
":",
"path_dir",
":",
"(",
"str",
")",
"dir",
"containing",
"the",
"boltztrap",
"."... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1844-L1860 | [
"def",
"parse_intrans",
"(",
"path_dir",
")",
":",
"intrans",
"=",
"{",
"}",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path_dir",
",",
"\"boltztrap.intrans\"",
")",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.parse_struct | Parses boltztrap.struct file (only the volume)
Args:
path_dir: (str) dir containing the boltztrap.struct file
Returns:
(float) volume | pymatgen/electronic_structure/boltztrap.py | def parse_struct(path_dir):
"""
Parses boltztrap.struct file (only the volume)
Args:
path_dir: (str) dir containing the boltztrap.struct file
Returns:
(float) volume
"""
with open(os.path.join(path_dir, "boltztrap.struct"), 'r') as f:
... | def parse_struct(path_dir):
"""
Parses boltztrap.struct file (only the volume)
Args:
path_dir: (str) dir containing the boltztrap.struct file
Returns:
(float) volume
"""
with open(os.path.join(path_dir, "boltztrap.struct"), 'r') as f:
... | [
"Parses",
"boltztrap",
".",
"struct",
"file",
"(",
"only",
"the",
"volume",
")",
"Args",
":",
"path_dir",
":",
"(",
"str",
")",
"dir",
"containing",
"the",
"boltztrap",
".",
"struct",
"file"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1863-L1876 | [
"def",
"parse_struct",
"(",
"path_dir",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path_dir",
",",
"\"boltztrap.struct\"",
")",
",",
"'r'",
")",
"as",
"f",
":",
"tokens",
"=",
"f",
".",
"readlines",
"(",
")",
"return",
"Latt... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.parse_cond_and_hall | Parses the conductivity and Hall tensors
Args:
path_dir: Path containing .condtens / .halltens files
doping_levels: ([float]) - doping lvls, parse outtrans to get this
Returns:
mu_steps, cond, seebeck, kappa, hall, pn_doping_levels,
mu_doping, seebeck_dop... | pymatgen/electronic_structure/boltztrap.py | def parse_cond_and_hall(path_dir, doping_levels=None):
"""
Parses the conductivity and Hall tensors
Args:
path_dir: Path containing .condtens / .halltens files
doping_levels: ([float]) - doping lvls, parse outtrans to get this
Returns:
mu_steps, cond,... | def parse_cond_and_hall(path_dir, doping_levels=None):
"""
Parses the conductivity and Hall tensors
Args:
path_dir: Path containing .condtens / .halltens files
doping_levels: ([float]) - doping lvls, parse outtrans to get this
Returns:
mu_steps, cond,... | [
"Parses",
"the",
"conductivity",
"and",
"Hall",
"tensors",
"Args",
":",
"path_dir",
":",
"Path",
"containing",
".",
"condtens",
"/",
".",
"halltens",
"files",
"doping_levels",
":",
"(",
"[",
"float",
"]",
")",
"-",
"doping",
"lvls",
"parse",
"outtrans",
"t... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1879-L2010 | [
"def",
"parse_cond_and_hall",
"(",
"path_dir",
",",
"doping_levels",
"=",
"None",
")",
":",
"# Step 1: parse raw data but do not convert to final format",
"t_steps",
"=",
"set",
"(",
")",
"mu_steps",
"=",
"set",
"(",
")",
"data_full",
"=",
"[",
"]",
"data_hall",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.from_files | get a BoltztrapAnalyzer object from a set of files
Args:
path_dir: directory where the boltztrap files are
dos_spin: in DOS mode, set to 1 for spin up and -1 for spin down
Returns:
a BoltztrapAnalyzer object | pymatgen/electronic_structure/boltztrap.py | def from_files(path_dir, dos_spin=1):
"""
get a BoltztrapAnalyzer object from a set of files
Args:
path_dir: directory where the boltztrap files are
dos_spin: in DOS mode, set to 1 for spin up and -1 for spin down
Returns:
a BoltztrapAnalyzer object
... | def from_files(path_dir, dos_spin=1):
"""
get a BoltztrapAnalyzer object from a set of files
Args:
path_dir: directory where the boltztrap files are
dos_spin: in DOS mode, set to 1 for spin up and -1 for spin down
Returns:
a BoltztrapAnalyzer object
... | [
"get",
"a",
"BoltztrapAnalyzer",
"object",
"from",
"a",
"set",
"of",
"files"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L2013-L2076 | [
"def",
"from_files",
"(",
"path_dir",
",",
"dos_spin",
"=",
"1",
")",
":",
"run_type",
",",
"warning",
",",
"efermi",
",",
"gap",
",",
"doping_levels",
"=",
"BoltztrapAnalyzer",
".",
"parse_outputtrans",
"(",
"path_dir",
")",
"vol",
"=",
"BoltztrapAnalyzer",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SchedulerErrorHandler.check | Check for the defined errors, put all found errors in self.errors, return True if any were found False if no
errors were found | pymatgen/io/abinit/scheduler_error_handlers.py | def check(self):
"""
Check for the defined errors, put all found errors in self.errors, return True if any were found False if no
errors were found
"""
parser = get_parser(self.scheduler_adapter.name, err_file=self.err_file, out_file=self.out_file,
run... | def check(self):
"""
Check for the defined errors, put all found errors in self.errors, return True if any were found False if no
errors were found
"""
parser = get_parser(self.scheduler_adapter.name, err_file=self.err_file, out_file=self.out_file,
run... | [
"Check",
"for",
"the",
"defined",
"errors",
"put",
"all",
"found",
"errors",
"in",
"self",
".",
"errors",
"return",
"True",
"if",
"any",
"were",
"found",
"False",
"if",
"no",
"errors",
"were",
"found"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/scheduler_error_handlers.py#L47-L59 | [
"def",
"check",
"(",
"self",
")",
":",
"parser",
"=",
"get_parser",
"(",
"self",
".",
"scheduler_adapter",
".",
"name",
",",
"err_file",
"=",
"self",
".",
"err_file",
",",
"out_file",
"=",
"self",
".",
"out_file",
",",
"run_err_file",
"=",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SchedulerErrorHandler.apply_corrections | Method to directly apply the corrections. | pymatgen/io/abinit/scheduler_error_handlers.py | def apply_corrections(self):
"""
Method to directly apply the corrections.
"""
for error in self.errors:
for solution in error.scheduler_adapter_solutions:
if self.scheduler_adapter is not None:
if self.scheduler_adapter.__getattribut__(sol... | def apply_corrections(self):
"""
Method to directly apply the corrections.
"""
for error in self.errors:
for solution in error.scheduler_adapter_solutions:
if self.scheduler_adapter is not None:
if self.scheduler_adapter.__getattribut__(sol... | [
"Method",
"to",
"directly",
"apply",
"the",
"corrections",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/scheduler_error_handlers.py#L75-L88 | [
"def",
"apply_corrections",
"(",
"self",
")",
":",
"for",
"error",
"in",
"self",
".",
"errors",
":",
"for",
"solution",
"in",
"error",
".",
"scheduler_adapter_solutions",
":",
"if",
"self",
".",
"scheduler_adapter",
"is",
"not",
"None",
":",
"if",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | parse_lammps_dumps | Generator that parses dump file(s).
Args:
file_pattern (str): Filename to parse. The timestep wildcard
(e.g., dump.atom.'*') is supported and the files are parsed
in the sequence of timestep.
Yields:
LammpsDump for each available snapshot. | pymatgen/io/lammps/outputs.py | def parse_lammps_dumps(file_pattern):
"""
Generator that parses dump file(s).
Args:
file_pattern (str): Filename to parse. The timestep wildcard
(e.g., dump.atom.'*') is supported and the files are parsed
in the sequence of timestep.
Yields:
LammpsDump for each ... | def parse_lammps_dumps(file_pattern):
"""
Generator that parses dump file(s).
Args:
file_pattern (str): Filename to parse. The timestep wildcard
(e.g., dump.atom.'*') is supported and the files are parsed
in the sequence of timestep.
Yields:
LammpsDump for each ... | [
"Generator",
"that",
"parses",
"dump",
"file",
"(",
"s",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/outputs.py#L97-L127 | [
"def",
"parse_lammps_dumps",
"(",
"file_pattern",
")",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"file_pattern",
")",
"if",
"len",
"(",
"files",
")",
">",
"1",
":",
"pattern",
"=",
"r\"%s\"",
"%",
"file_pattern",
".",
"replace",
"(",
"\"*\"",
",",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | parse_lammps_log | Parses log file with focus on thermo data. Both one and multi line
formats are supported. Any incomplete runs (no "Loop time" marker)
will not be parsed.
Notes:
SHAKE stats printed with thermo data are not supported yet.
They are ignored in multi line format, while they may cause
is... | pymatgen/io/lammps/outputs.py | def parse_lammps_log(filename="log.lammps"):
"""
Parses log file with focus on thermo data. Both one and multi line
formats are supported. Any incomplete runs (no "Loop time" marker)
will not be parsed.
Notes:
SHAKE stats printed with thermo data are not supported yet.
They are igno... | def parse_lammps_log(filename="log.lammps"):
"""
Parses log file with focus on thermo data. Both one and multi line
formats are supported. Any incomplete runs (no "Loop time" marker)
will not be parsed.
Notes:
SHAKE stats printed with thermo data are not supported yet.
They are igno... | [
"Parses",
"log",
"file",
"with",
"focus",
"on",
"thermo",
"data",
".",
"Both",
"one",
"and",
"multi",
"line",
"formats",
"are",
"supported",
".",
"Any",
"incomplete",
"runs",
"(",
"no",
"Loop",
"time",
"marker",
")",
"will",
"not",
"be",
"parsed",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/outputs.py#L130-L189 | [
"def",
"parse_lammps_log",
"(",
"filename",
"=",
"\"log.lammps\"",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"begin_flag",
"=",
"(",
"\"Memory usage per processor =\"",
",",
"\"Per MPI rank m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | LammpsDump.from_string | Constructor from string parsing.
Args:
string (str): Input string. | pymatgen/io/lammps/outputs.py | def from_string(cls, string):
"""
Constructor from string parsing.
Args:
string (str): Input string.
"""
lines = string.split("\n")
timestep = int(lines[1])
natoms = int(lines[3])
box_arr = np.loadtxt(StringIO("\n".join(lines[5:8])))
... | def from_string(cls, string):
"""
Constructor from string parsing.
Args:
string (str): Input string.
"""
lines = string.split("\n")
timestep = int(lines[1])
natoms = int(lines[3])
box_arr = np.loadtxt(StringIO("\n".join(lines[5:8])))
... | [
"Constructor",
"from",
"string",
"parsing",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/outputs.py#L54-L77 | [
"def",
"from_string",
"(",
"cls",
",",
"string",
")",
":",
"lines",
"=",
"string",
".",
"split",
"(",
"\"\\n\"",
")",
"timestep",
"=",
"int",
"(",
"lines",
"[",
"1",
"]",
")",
"natoms",
"=",
"int",
"(",
"lines",
"[",
"3",
"]",
")",
"box_arr",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | run_aconvasp_command | Helper function for calling aconvasp with different arguments | pymatgen/command_line/aconvasp_caller.py | def run_aconvasp_command(command, structure):
"""
Helper function for calling aconvasp with different arguments
"""
poscar = Poscar(structure)
p = subprocess.Popen(command, stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
ou... | def run_aconvasp_command(command, structure):
"""
Helper function for calling aconvasp with different arguments
"""
poscar = Poscar(structure)
p = subprocess.Popen(command, stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
ou... | [
"Helper",
"function",
"for",
"calling",
"aconvasp",
"with",
"different",
"arguments"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/aconvasp_caller.py#L25-L34 | [
"def",
"run_aconvasp_command",
"(",
"command",
",",
"structure",
")",
":",
"poscar",
"=",
"Poscar",
"(",
"structure",
")",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stdin",
"=",
"subprocess",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_num_division_kpoints | Get kpoint divisions for a given k-point density (per reciprocal-atom):
kppa and a given structure | pymatgen/command_line/aconvasp_caller.py | def get_num_division_kpoints(structure, kppa):
"""
Get kpoint divisions for a given k-point density (per reciprocal-atom):
kppa and a given structure
"""
output = run_aconvasp_command(["aconvasp", "--kpoints", str(kppa)],
structure)
tmp = output[0].rsplit("\n")[... | def get_num_division_kpoints(structure, kppa):
"""
Get kpoint divisions for a given k-point density (per reciprocal-atom):
kppa and a given structure
"""
output = run_aconvasp_command(["aconvasp", "--kpoints", str(kppa)],
structure)
tmp = output[0].rsplit("\n")[... | [
"Get",
"kpoint",
"divisions",
"for",
"a",
"given",
"k",
"-",
"point",
"density",
"(",
"per",
"reciprocal",
"-",
"atom",
")",
":",
"kppa",
"and",
"a",
"given",
"structure"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/aconvasp_caller.py#L37-L45 | [
"def",
"get_num_division_kpoints",
"(",
"structure",
",",
"kppa",
")",
":",
"output",
"=",
"run_aconvasp_command",
"(",
"[",
"\"aconvasp\"",
",",
"\"--kpoints\"",
",",
"str",
"(",
"kppa",
")",
"]",
",",
"structure",
")",
"tmp",
"=",
"output",
"[",
"0",
"]"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_minkowski_red | Get a minkowski reduced structure | pymatgen/command_line/aconvasp_caller.py | def get_minkowski_red(structure):
"""
Get a minkowski reduced structure
"""
output = run_aconvasp_command(["aconvasp", "--kpath"], structure)
started = False
poscar_string = ""
if "ERROR" in output[1]:
raise AconvaspError(output[1])
for line in output[0].split("\n"):
if s... | def get_minkowski_red(structure):
"""
Get a minkowski reduced structure
"""
output = run_aconvasp_command(["aconvasp", "--kpath"], structure)
started = False
poscar_string = ""
if "ERROR" in output[1]:
raise AconvaspError(output[1])
for line in output[0].split("\n"):
if s... | [
"Get",
"a",
"minkowski",
"reduced",
"structure"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/aconvasp_caller.py#L48-L64 | [
"def",
"get_minkowski_red",
"(",
"structure",
")",
":",
"output",
"=",
"run_aconvasp_command",
"(",
"[",
"\"aconvasp\"",
",",
"\"--kpath\"",
"]",
",",
"structure",
")",
"started",
"=",
"False",
"poscar_string",
"=",
"\"\"",
"if",
"\"ERROR\"",
"in",
"output",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_conv_struct | Get a minkowski reduced structure | pymatgen/command_line/aconvasp_caller.py | def get_conv_struct(structure):
"""
Get a minkowski reduced structure
"""
output = run_aconvasp_command(["aconvasp", "--std_conv"], structure)
if "ERROR" in output[1]:
raise AconvaspError(output[1])
tmp = Poscar.from_string(output[0])
return {'struct': tmp.structure, 'comm': tmp.comm... | def get_conv_struct(structure):
"""
Get a minkowski reduced structure
"""
output = run_aconvasp_command(["aconvasp", "--std_conv"], structure)
if "ERROR" in output[1]:
raise AconvaspError(output[1])
tmp = Poscar.from_string(output[0])
return {'struct': tmp.structure, 'comm': tmp.comm... | [
"Get",
"a",
"minkowski",
"reduced",
"structure"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/aconvasp_caller.py#L67-L75 | [
"def",
"get_conv_struct",
"(",
"structure",
")",
":",
"output",
"=",
"run_aconvasp_command",
"(",
"[",
"\"aconvasp\"",
",",
"\"--std_conv\"",
"]",
",",
"structure",
")",
"if",
"\"ERROR\"",
"in",
"output",
"[",
"1",
"]",
":",
"raise",
"AconvaspError",
"(",
"o... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_vasp_kpoint_file_sym | get a kpoint file ready to be ran in VASP along the symmetry lines of the
Brillouin Zone | pymatgen/command_line/aconvasp_caller.py | def get_vasp_kpoint_file_sym(structure):
"""
get a kpoint file ready to be ran in VASP along the symmetry lines of the
Brillouin Zone
"""
output = run_aconvasp_command(["aconvasp", "--kpath"], structure)
if "ERROR" in output[1]:
raise AconvaspError(output[1])
started = False
kpoi... | def get_vasp_kpoint_file_sym(structure):
"""
get a kpoint file ready to be ran in VASP along the symmetry lines of the
Brillouin Zone
"""
output = run_aconvasp_command(["aconvasp", "--kpath"], structure)
if "ERROR" in output[1]:
raise AconvaspError(output[1])
started = False
kpoi... | [
"get",
"a",
"kpoint",
"file",
"ready",
"to",
"be",
"ran",
"in",
"VASP",
"along",
"the",
"symmetry",
"lines",
"of",
"the",
"Brillouin",
"Zone"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/aconvasp_caller.py#L89-L107 | [
"def",
"get_vasp_kpoint_file_sym",
"(",
"structure",
")",
":",
"output",
"=",
"run_aconvasp_command",
"(",
"[",
"\"aconvasp\"",
",",
"\"--kpath\"",
"]",
",",
"structure",
")",
"if",
"\"ERROR\"",
"in",
"output",
"[",
"1",
"]",
":",
"raise",
"AconvaspError",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _my_partial | Partial returns a partial object and therefore we cannot inherit class
methods defined in FloatWithUnit. This function calls partial and patches
the new class before returning. | pymatgen/core/units.py | def _my_partial(func, *args, **kwargs):
"""
Partial returns a partial object and therefore we cannot inherit class
methods defined in FloatWithUnit. This function calls partial and patches
the new class before returning.
"""
newobj = partial(func, *args, **kwargs)
# monkey patch
newobj.f... | def _my_partial(func, *args, **kwargs):
"""
Partial returns a partial object and therefore we cannot inherit class
methods defined in FloatWithUnit. This function calls partial and patches
the new class before returning.
"""
newobj = partial(func, *args, **kwargs)
# monkey patch
newobj.f... | [
"Partial",
"returns",
"a",
"partial",
"object",
"and",
"therefore",
"we",
"cannot",
"inherit",
"class",
"methods",
"defined",
"in",
"FloatWithUnit",
".",
"This",
"function",
"calls",
"partial",
"and",
"patches",
"the",
"new",
"class",
"before",
"returning",
"."
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L720-L729 | [
"def",
"_my_partial",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"newobj",
"=",
"partial",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# monkey patch",
"newobj",
".",
"from_string",
"=",
"FloatWithUnit",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | obj_with_unit | Returns a `FloatWithUnit` instance if obj is scalar, a dictionary of
objects with units if obj is a dict, else an instance of
`ArrayWithFloatWithUnit`.
Args:
unit: Specific units (eV, Ha, m, ang, etc.). | pymatgen/core/units.py | def obj_with_unit(obj, unit):
"""
Returns a `FloatWithUnit` instance if obj is scalar, a dictionary of
objects with units if obj is a dict, else an instance of
`ArrayWithFloatWithUnit`.
Args:
unit: Specific units (eV, Ha, m, ang, etc.).
"""
unit_type = _UNAME2UTYPE[unit]
if isi... | def obj_with_unit(obj, unit):
"""
Returns a `FloatWithUnit` instance if obj is scalar, a dictionary of
objects with units if obj is a dict, else an instance of
`ArrayWithFloatWithUnit`.
Args:
unit: Specific units (eV, Ha, m, ang, etc.).
"""
unit_type = _UNAME2UTYPE[unit]
if isi... | [
"Returns",
"a",
"FloatWithUnit",
"instance",
"if",
"obj",
"is",
"scalar",
"a",
"dictionary",
"of",
"objects",
"with",
"units",
"if",
"obj",
"is",
"a",
"dict",
"else",
"an",
"instance",
"of",
"ArrayWithFloatWithUnit",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L808-L824 | [
"def",
"obj_with_unit",
"(",
"obj",
",",
"unit",
")",
":",
"unit_type",
"=",
"_UNAME2UTYPE",
"[",
"unit",
"]",
"if",
"isinstance",
"(",
"obj",
",",
"numbers",
".",
"Number",
")",
":",
"return",
"FloatWithUnit",
"(",
"obj",
",",
"unit",
"=",
"unit",
","... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | unitized | Useful decorator to assign units to the output of a function. You can also
use it to standardize the output units of a function that already returns
a FloatWithUnit or ArrayWithUnit. For sequences, all values in the sequences
are assigned the same unit. It works with Python sequences only. The creation
... | pymatgen/core/units.py | def unitized(unit):
"""
Useful decorator to assign units to the output of a function. You can also
use it to standardize the output units of a function that already returns
a FloatWithUnit or ArrayWithUnit. For sequences, all values in the sequences
are assigned the same unit. It works with Python s... | def unitized(unit):
"""
Useful decorator to assign units to the output of a function. You can also
use it to standardize the output units of a function that already returns
a FloatWithUnit or ArrayWithUnit. For sequences, all values in the sequences
are assigned the same unit. It works with Python s... | [
"Useful",
"decorator",
"to",
"assign",
"units",
"to",
"the",
"output",
"of",
"a",
"function",
".",
"You",
"can",
"also",
"use",
"it",
"to",
"standardize",
"the",
"output",
"units",
"of",
"a",
"function",
"that",
"already",
"returns",
"a",
"FloatWithUnit",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L827-L871 | [
"def",
"unitized",
"(",
"unit",
")",
":",
"def",
"wrap",
"(",
"f",
")",
":",
"def",
"wrapped_f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"unit_type",
"=",
"_UNAME2UTY... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Unit.as_base_units | Converts all units to base SI units, including derived units.
Returns:
(base_units_dict, scaling factor). base_units_dict will not
contain any constants, which are gathered in the scaling factor. | pymatgen/core/units.py | def as_base_units(self):
"""
Converts all units to base SI units, including derived units.
Returns:
(base_units_dict, scaling factor). base_units_dict will not
contain any constants, which are gathered in the scaling factor.
"""
b = collections.defaultdic... | def as_base_units(self):
"""
Converts all units to base SI units, including derived units.
Returns:
(base_units_dict, scaling factor). base_units_dict will not
contain any constants, which are gathered in the scaling factor.
"""
b = collections.defaultdic... | [
"Converts",
"all",
"units",
"to",
"base",
"SI",
"units",
"including",
"derived",
"units",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L266-L291 | [
"def",
"as_base_units",
"(",
"self",
")",
":",
"b",
"=",
"collections",
".",
"defaultdict",
"(",
"int",
")",
"factor",
"=",
"1",
"for",
"k",
",",
"v",
"in",
"self",
".",
"items",
"(",
")",
":",
"derived",
"=",
"False",
"for",
"d",
"in",
"DERIVED_UN... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Unit.get_conversion_factor | Returns a conversion factor between this unit and a new unit.
Compound units are supported, but must have the same powers in each
unit type.
Args:
new_unit: The new unit. | pymatgen/core/units.py | def get_conversion_factor(self, new_unit):
"""
Returns a conversion factor between this unit and a new unit.
Compound units are supported, but must have the same powers in each
unit type.
Args:
new_unit: The new unit.
"""
uo_base, ofactor = self.as_ba... | def get_conversion_factor(self, new_unit):
"""
Returns a conversion factor between this unit and a new unit.
Compound units are supported, but must have the same powers in each
unit type.
Args:
new_unit: The new unit.
"""
uo_base, ofactor = self.as_ba... | [
"Returns",
"a",
"conversion",
"factor",
"between",
"this",
"unit",
"and",
"a",
"new",
"unit",
".",
"Compound",
"units",
"are",
"supported",
"but",
"must",
"have",
"the",
"same",
"powers",
"in",
"each",
"unit",
"type",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L293-L314 | [
"def",
"get_conversion_factor",
"(",
"self",
",",
"new_unit",
")",
":",
"uo_base",
",",
"ofactor",
"=",
"self",
".",
"as_base_units",
"un_base",
",",
"nfactor",
"=",
"Unit",
"(",
"new_unit",
")",
".",
"as_base_units",
"units_new",
"=",
"sorted",
"(",
"un_bas... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FloatWithUnit.from_string | Initialize a FloatWithUnit from a string. Example Memory.from_string("1. Mb") | pymatgen/core/units.py | def from_string(cls, s):
"""
Initialize a FloatWithUnit from a string. Example Memory.from_string("1. Mb")
"""
# Extract num and unit string.
s = s.strip()
for i, char in enumerate(s):
if char.isalpha() or char.isspace():
break
else:
... | def from_string(cls, s):
"""
Initialize a FloatWithUnit from a string. Example Memory.from_string("1. Mb")
"""
# Extract num and unit string.
s = s.strip()
for i, char in enumerate(s):
if char.isalpha() or char.isspace():
break
else:
... | [
"Initialize",
"a",
"FloatWithUnit",
"from",
"a",
"string",
".",
"Example",
"Memory",
".",
"from_string",
"(",
"1",
".",
"Mb",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L342-L362 | [
"def",
"from_string",
"(",
"cls",
",",
"s",
")",
":",
"# Extract num and unit string.",
"s",
"=",
"s",
".",
"strip",
"(",
")",
"for",
"i",
",",
"char",
"in",
"enumerate",
"(",
"s",
")",
":",
"if",
"char",
".",
"isalpha",
"(",
")",
"or",
"char",
"."... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FloatWithUnit.to | Conversion to a new_unit. Right now, only supports 1 to 1 mapping of
units of each type.
Args:
new_unit: New unit type.
Returns:
A FloatWithUnit object in the new units.
Example usage:
>>> e = Energy(1.1, "eV")
>>> e = Energy(1.1, "Ha")
... | pymatgen/core/units.py | def to(self, new_unit):
"""
Conversion to a new_unit. Right now, only supports 1 to 1 mapping of
units of each type.
Args:
new_unit: New unit type.
Returns:
A FloatWithUnit object in the new units.
Example usage:
>>> e = Energy(1.1, "eV"... | def to(self, new_unit):
"""
Conversion to a new_unit. Right now, only supports 1 to 1 mapping of
units of each type.
Args:
new_unit: New unit type.
Returns:
A FloatWithUnit object in the new units.
Example usage:
>>> e = Energy(1.1, "eV"... | [
"Conversion",
"to",
"a",
"new_unit",
".",
"Right",
"now",
"only",
"supports",
"1",
"to",
"1",
"mapping",
"of",
"units",
"of",
"each",
"type",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L488-L508 | [
"def",
"to",
"(",
"self",
",",
"new_unit",
")",
":",
"return",
"FloatWithUnit",
"(",
"self",
"*",
"self",
".",
"unit",
".",
"get_conversion_factor",
"(",
"new_unit",
")",
",",
"unit_type",
"=",
"self",
".",
"_unit_type",
",",
"unit",
"=",
"new_unit",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ArrayWithUnit.to | Conversion to a new_unit.
Args:
new_unit:
New unit type.
Returns:
A ArrayWithFloatWithUnit object in the new units.
Example usage:
>>> e = EnergyArray([1, 1.1], "Ha")
>>> e.to("eV")
array([ 27.21138386, 29.93252225]) eV | pymatgen/core/units.py | def to(self, new_unit):
"""
Conversion to a new_unit.
Args:
new_unit:
New unit type.
Returns:
A ArrayWithFloatWithUnit object in the new units.
Example usage:
>>> e = EnergyArray([1, 1.1], "Ha")
>>> e.to("eV")
arr... | def to(self, new_unit):
"""
Conversion to a new_unit.
Args:
new_unit:
New unit type.
Returns:
A ArrayWithFloatWithUnit object in the new units.
Example usage:
>>> e = EnergyArray([1, 1.1], "Ha")
>>> e.to("eV")
arr... | [
"Conversion",
"to",
"a",
"new_unit",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L673-L691 | [
"def",
"to",
"(",
"self",
",",
"new_unit",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"np",
".",
"array",
"(",
"self",
")",
"*",
"self",
".",
"unit",
".",
"get_conversion_factor",
"(",
"new_unit",
")",
",",
"unit_type",
"=",
"self",
".",
"uni... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ArrayWithUnit.conversions | Returns a string showing the available conversions.
Useful tool in interactive mode. | pymatgen/core/units.py | def conversions(self):
"""
Returns a string showing the available conversions.
Useful tool in interactive mode.
"""
return "\n".join(str(self.to(unit)) for unit in self.supported_units) | def conversions(self):
"""
Returns a string showing the available conversions.
Useful tool in interactive mode.
"""
return "\n".join(str(self.to(unit)) for unit in self.supported_units) | [
"Returns",
"a",
"string",
"showing",
"the",
"available",
"conversions",
".",
"Useful",
"tool",
"in",
"interactive",
"mode",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/units.py#L712-L717 | [
"def",
"conversions",
"(",
"self",
")",
":",
"return",
"\"\\n\"",
".",
"join",
"(",
"str",
"(",
"self",
".",
"to",
"(",
"unit",
")",
")",
"for",
"unit",
"in",
"self",
".",
"supported_units",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_integer_index | Attempt to convert a vector of floats to whole numbers.
Args:
miller_index (list of float): A list miller indexes.
round_dp (int, optional): The number of decimal places to round the
miller index to.
verbose (bool, optional): Whether to print warnings.
Returns:
(tup... | pymatgen/core/lattice.py | def get_integer_index(
miller_index: bool, round_dp: int = 4, verbose: bool = True
) -> Tuple[int, int, int]:
"""
Attempt to convert a vector of floats to whole numbers.
Args:
miller_index (list of float): A list miller indexes.
round_dp (int, optional): The number of decimal places to ... | def get_integer_index(
miller_index: bool, round_dp: int = 4, verbose: bool = True
) -> Tuple[int, int, int]:
"""
Attempt to convert a vector of floats to whole numbers.
Args:
miller_index (list of float): A list miller indexes.
round_dp (int, optional): The number of decimal places to ... | [
"Attempt",
"to",
"convert",
"a",
"vector",
"of",
"floats",
"to",
"whole",
"numbers",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L1274-L1330 | [
"def",
"get_integer_index",
"(",
"miller_index",
":",
"bool",
",",
"round_dp",
":",
"int",
"=",
"4",
",",
"verbose",
":",
"bool",
"=",
"True",
")",
"->",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
":",
"miller_index",
"=",
"np",
".",
"asarray"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.angles | Returns the angles (alpha, beta, gamma) of the lattice. | pymatgen/core/lattice.py | def angles(self) -> Tuple[float]:
"""
Returns the angles (alpha, beta, gamma) of the lattice.
"""
m = self._matrix
lengths = self.lengths
angles = np.zeros(3)
for i in range(3):
j = (i + 1) % 3
k = (i + 2) % 3
angles[i] = abs_ca... | def angles(self) -> Tuple[float]:
"""
Returns the angles (alpha, beta, gamma) of the lattice.
"""
m = self._matrix
lengths = self.lengths
angles = np.zeros(3)
for i in range(3):
j = (i + 1) % 3
k = (i + 2) % 3
angles[i] = abs_ca... | [
"Returns",
"the",
"angles",
"(",
"alpha",
"beta",
"gamma",
")",
"of",
"the",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L78-L90 | [
"def",
"angles",
"(",
"self",
")",
"->",
"Tuple",
"[",
"float",
"]",
":",
"m",
"=",
"self",
".",
"_matrix",
"lengths",
"=",
"self",
".",
"lengths",
"angles",
"=",
"np",
".",
"zeros",
"(",
"3",
")",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.inv_matrix | Inverse of lattice matrix. | pymatgen/core/lattice.py | def inv_matrix(self) -> np.ndarray:
"""
Inverse of lattice matrix.
"""
if self._inv_matrix is None:
self._inv_matrix = inv(self._matrix)
self._inv_matrix.setflags(write=False)
return self._inv_matrix | def inv_matrix(self) -> np.ndarray:
"""
Inverse of lattice matrix.
"""
if self._inv_matrix is None:
self._inv_matrix = inv(self._matrix)
self._inv_matrix.setflags(write=False)
return self._inv_matrix | [
"Inverse",
"of",
"lattice",
"matrix",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L132-L139 | [
"def",
"inv_matrix",
"(",
"self",
")",
"->",
"np",
".",
"ndarray",
":",
"if",
"self",
".",
"_inv_matrix",
"is",
"None",
":",
"self",
".",
"_inv_matrix",
"=",
"inv",
"(",
"self",
".",
"_matrix",
")",
"self",
".",
"_inv_matrix",
".",
"setflags",
"(",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.metric_tensor | The metric tensor of the lattice. | pymatgen/core/lattice.py | def metric_tensor(self) -> np.ndarray:
"""
The metric tensor of the lattice.
"""
return dot(self._matrix, self._matrix.T) | def metric_tensor(self) -> np.ndarray:
"""
The metric tensor of the lattice.
"""
return dot(self._matrix, self._matrix.T) | [
"The",
"metric",
"tensor",
"of",
"the",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L142-L146 | [
"def",
"metric_tensor",
"(",
"self",
")",
"->",
"np",
".",
"ndarray",
":",
"return",
"dot",
"(",
"self",
".",
"_matrix",
",",
"self",
".",
"_matrix",
".",
"T",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_cartesian_coords | Returns the cartesian coordinates given fractional coordinates.
Args:
fractional_coords (3x1 array): Fractional coords.
Returns:
Cartesian coordinates | pymatgen/core/lattice.py | def get_cartesian_coords(self, fractional_coords: Vector3Like) -> np.ndarray:
"""
Returns the cartesian coordinates given fractional coordinates.
Args:
fractional_coords (3x1 array): Fractional coords.
Returns:
Cartesian coordinates
"""
return do... | def get_cartesian_coords(self, fractional_coords: Vector3Like) -> np.ndarray:
"""
Returns the cartesian coordinates given fractional coordinates.
Args:
fractional_coords (3x1 array): Fractional coords.
Returns:
Cartesian coordinates
"""
return do... | [
"Returns",
"the",
"cartesian",
"coordinates",
"given",
"fractional",
"coordinates",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L148-L158 | [
"def",
"get_cartesian_coords",
"(",
"self",
",",
"fractional_coords",
":",
"Vector3Like",
")",
"->",
"np",
".",
"ndarray",
":",
"return",
"dot",
"(",
"fractional_coords",
",",
"self",
".",
"_matrix",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_fractional_coords | Returns the fractional coordinates given cartesian coordinates.
Args:
cart_coords (3x1 array): Cartesian coords.
Returns:
Fractional coordinates. | pymatgen/core/lattice.py | def get_fractional_coords(self, cart_coords: Vector3Like) -> np.ndarray:
"""
Returns the fractional coordinates given cartesian coordinates.
Args:
cart_coords (3x1 array): Cartesian coords.
Returns:
Fractional coordinates.
"""
return dot(cart_coo... | def get_fractional_coords(self, cart_coords: Vector3Like) -> np.ndarray:
"""
Returns the fractional coordinates given cartesian coordinates.
Args:
cart_coords (3x1 array): Cartesian coords.
Returns:
Fractional coordinates.
"""
return dot(cart_coo... | [
"Returns",
"the",
"fractional",
"coordinates",
"given",
"cartesian",
"coordinates",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L160-L170 | [
"def",
"get_fractional_coords",
"(",
"self",
",",
"cart_coords",
":",
"Vector3Like",
")",
"->",
"np",
".",
"ndarray",
":",
"return",
"dot",
"(",
"cart_coords",
",",
"self",
".",
"inv_matrix",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.d_hkl | Returns the distance between the hkl plane and the origin
Args:
miller_index ([h,k,l]): Miller index of plane
Returns:
d_hkl (float) | pymatgen/core/lattice.py | def d_hkl(self, miller_index: Vector3Like) -> float:
"""
Returns the distance between the hkl plane and the origin
Args:
miller_index ([h,k,l]): Miller index of plane
Returns:
d_hkl (float)
"""
gstar = self.reciprocal_lattice_crystallographic.me... | def d_hkl(self, miller_index: Vector3Like) -> float:
"""
Returns the distance between the hkl plane and the origin
Args:
miller_index ([h,k,l]): Miller index of plane
Returns:
d_hkl (float)
"""
gstar = self.reciprocal_lattice_crystallographic.me... | [
"Returns",
"the",
"distance",
"between",
"the",
"hkl",
"plane",
"and",
"the",
"origin"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L192-L205 | [
"def",
"d_hkl",
"(",
"self",
",",
"miller_index",
":",
"Vector3Like",
")",
"->",
"float",
":",
"gstar",
"=",
"self",
".",
"reciprocal_lattice_crystallographic",
".",
"metric_tensor",
"hkl",
"=",
"np",
".",
"array",
"(",
"miller_index",
")",
"return",
"1",
"/... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.tetragonal | Convenience constructor for a tetragonal lattice.
Args:
a (float): *a* lattice parameter of the tetragonal cell.
c (float): *c* lattice parameter of the tetragonal cell.
Returns:
Tetragonal lattice of dimensions a x a x c. | pymatgen/core/lattice.py | def tetragonal(a: float, c: float):
"""
Convenience constructor for a tetragonal lattice.
Args:
a (float): *a* lattice parameter of the tetragonal cell.
c (float): *c* lattice parameter of the tetragonal cell.
Returns:
Tetragonal lattice of dimension... | def tetragonal(a: float, c: float):
"""
Convenience constructor for a tetragonal lattice.
Args:
a (float): *a* lattice parameter of the tetragonal cell.
c (float): *c* lattice parameter of the tetragonal cell.
Returns:
Tetragonal lattice of dimension... | [
"Convenience",
"constructor",
"for",
"a",
"tetragonal",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L221-L232 | [
"def",
"tetragonal",
"(",
"a",
":",
"float",
",",
"c",
":",
"float",
")",
":",
"return",
"Lattice",
".",
"from_parameters",
"(",
"a",
",",
"a",
",",
"c",
",",
"90",
",",
"90",
",",
"90",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.orthorhombic | Convenience constructor for an orthorhombic lattice.
Args:
a (float): *a* lattice parameter of the orthorhombic cell.
b (float): *b* lattice parameter of the orthorhombic cell.
c (float): *c* lattice parameter of the orthorhombic cell.
Returns:
Orthorhom... | pymatgen/core/lattice.py | def orthorhombic(a: float, b: float, c: float):
"""
Convenience constructor for an orthorhombic lattice.
Args:
a (float): *a* lattice parameter of the orthorhombic cell.
b (float): *b* lattice parameter of the orthorhombic cell.
c (float): *c* lattice paramet... | def orthorhombic(a: float, b: float, c: float):
"""
Convenience constructor for an orthorhombic lattice.
Args:
a (float): *a* lattice parameter of the orthorhombic cell.
b (float): *b* lattice parameter of the orthorhombic cell.
c (float): *c* lattice paramet... | [
"Convenience",
"constructor",
"for",
"an",
"orthorhombic",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L235-L247 | [
"def",
"orthorhombic",
"(",
"a",
":",
"float",
",",
"b",
":",
"float",
",",
"c",
":",
"float",
")",
":",
"return",
"Lattice",
".",
"from_parameters",
"(",
"a",
",",
"b",
",",
"c",
",",
"90",
",",
"90",
",",
"90",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.monoclinic | Convenience constructor for a monoclinic lattice.
Args:
a (float): *a* lattice parameter of the monoclinc cell.
b (float): *b* lattice parameter of the monoclinc cell.
c (float): *c* lattice parameter of the monoclinc cell.
beta (float): *beta* angle between latt... | pymatgen/core/lattice.py | def monoclinic(a: float, b: float, c: float, beta: float):
"""
Convenience constructor for a monoclinic lattice.
Args:
a (float): *a* lattice parameter of the monoclinc cell.
b (float): *b* lattice parameter of the monoclinc cell.
c (float): *c* lattice param... | def monoclinic(a: float, b: float, c: float, beta: float):
"""
Convenience constructor for a monoclinic lattice.
Args:
a (float): *a* lattice parameter of the monoclinc cell.
b (float): *b* lattice parameter of the monoclinc cell.
c (float): *c* lattice param... | [
"Convenience",
"constructor",
"for",
"a",
"monoclinic",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L250-L265 | [
"def",
"monoclinic",
"(",
"a",
":",
"float",
",",
"b",
":",
"float",
",",
"c",
":",
"float",
",",
"beta",
":",
"float",
")",
":",
"return",
"Lattice",
".",
"from_parameters",
"(",
"a",
",",
"b",
",",
"c",
",",
"90",
",",
"beta",
",",
"90",
")"
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.hexagonal | Convenience constructor for a hexagonal lattice.
Args:
a (float): *a* lattice parameter of the hexagonal cell.
c (float): *c* lattice parameter of the hexagonal cell.
Returns:
Hexagonal lattice of dimensions a x a x c. | pymatgen/core/lattice.py | def hexagonal(a: float, c: float):
"""
Convenience constructor for a hexagonal lattice.
Args:
a (float): *a* lattice parameter of the hexagonal cell.
c (float): *c* lattice parameter of the hexagonal cell.
Returns:
Hexagonal lattice of dimensions a x... | def hexagonal(a: float, c: float):
"""
Convenience constructor for a hexagonal lattice.
Args:
a (float): *a* lattice parameter of the hexagonal cell.
c (float): *c* lattice parameter of the hexagonal cell.
Returns:
Hexagonal lattice of dimensions a x... | [
"Convenience",
"constructor",
"for",
"a",
"hexagonal",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L268-L279 | [
"def",
"hexagonal",
"(",
"a",
":",
"float",
",",
"c",
":",
"float",
")",
":",
"return",
"Lattice",
".",
"from_parameters",
"(",
"a",
",",
"a",
",",
"c",
",",
"90",
",",
"90",
",",
"120",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.rhombohedral | Convenience constructor for a rhombohedral lattice.
Args:
a (float): *a* lattice parameter of the rhombohedral cell.
alpha (float): Angle for the rhombohedral lattice in degrees.
Returns:
Rhombohedral lattice of dimensions a x a x a. | pymatgen/core/lattice.py | def rhombohedral(a: float, alpha: float):
"""
Convenience constructor for a rhombohedral lattice.
Args:
a (float): *a* lattice parameter of the rhombohedral cell.
alpha (float): Angle for the rhombohedral lattice in degrees.
Returns:
Rhombohedral lat... | def rhombohedral(a: float, alpha: float):
"""
Convenience constructor for a rhombohedral lattice.
Args:
a (float): *a* lattice parameter of the rhombohedral cell.
alpha (float): Angle for the rhombohedral lattice in degrees.
Returns:
Rhombohedral lat... | [
"Convenience",
"constructor",
"for",
"a",
"rhombohedral",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L282-L293 | [
"def",
"rhombohedral",
"(",
"a",
":",
"float",
",",
"alpha",
":",
"float",
")",
":",
"return",
"Lattice",
".",
"from_parameters",
"(",
"a",
",",
"a",
",",
"a",
",",
"alpha",
",",
"alpha",
",",
"alpha",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.from_lengths_and_angles | Create a Lattice using unit cell lengths and angles (in degrees).
Args:
abc (3x1 array): Lattice parameters, e.g. (4, 4, 5).
ang (3x1 array): Lattice angles in degrees, e.g., (90,90,120).
Returns:
A Lattice with the specified lattice parameters. | pymatgen/core/lattice.py | def from_lengths_and_angles(abc: List[float], ang: List[float]):
"""
Create a Lattice using unit cell lengths and angles (in degrees).
Args:
abc (3x1 array): Lattice parameters, e.g. (4, 4, 5).
ang (3x1 array): Lattice angles in degrees, e.g., (90,90,120).
Retur... | def from_lengths_and_angles(abc: List[float], ang: List[float]):
"""
Create a Lattice using unit cell lengths and angles (in degrees).
Args:
abc (3x1 array): Lattice parameters, e.g. (4, 4, 5).
ang (3x1 array): Lattice angles in degrees, e.g., (90,90,120).
Retur... | [
"Create",
"a",
"Lattice",
"using",
"unit",
"cell",
"lengths",
"and",
"angles",
"(",
"in",
"degrees",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L296-L307 | [
"def",
"from_lengths_and_angles",
"(",
"abc",
":",
"List",
"[",
"float",
"]",
",",
"ang",
":",
"List",
"[",
"float",
"]",
")",
":",
"return",
"Lattice",
".",
"from_parameters",
"(",
"abc",
"[",
"0",
"]",
",",
"abc",
"[",
"1",
"]",
",",
"abc",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.from_parameters | Create a Lattice using unit cell lengths and angles (in degrees).
Args:
a (float): *a* lattice parameter.
b (float): *b* lattice parameter.
c (float): *c* lattice parameter.
alpha (float): *alpha* angle in degrees.
beta (float): *beta* angle in degree... | pymatgen/core/lattice.py | def from_parameters(
cls,
a: float,
b: float,
c: float,
alpha: float,
beta: float,
gamma: float,
vesta: bool = False,
):
"""
Create a Lattice using unit cell lengths and angles (in degrees).
Args:
a (float): *a* lat... | def from_parameters(
cls,
a: float,
b: float,
c: float,
alpha: float,
beta: float,
gamma: float,
vesta: bool = False,
):
"""
Create a Lattice using unit cell lengths and angles (in degrees).
Args:
a (float): *a* lat... | [
"Create",
"a",
"Lattice",
"using",
"unit",
"cell",
"lengths",
"and",
"angles",
"(",
"in",
"degrees",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L310-L362 | [
"def",
"from_parameters",
"(",
"cls",
",",
"a",
":",
"float",
",",
"b",
":",
"float",
",",
"c",
":",
"float",
",",
"alpha",
":",
"float",
",",
"beta",
":",
"float",
",",
"gamma",
":",
"float",
",",
"vesta",
":",
"bool",
"=",
"False",
",",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.from_dict | Create a Lattice from a dictionary containing the a, b, c, alpha, beta,
and gamma parameters if fmt is None.
If fmt == "abivars", the function build a `Lattice` object from a
dictionary with the Abinit variables `acell` and `rprim` in Bohr.
If acell is not given, the Abinit default is u... | pymatgen/core/lattice.py | def from_dict(cls, d: Dict, fmt: str = None, **kwargs):
"""
Create a Lattice from a dictionary containing the a, b, c, alpha, beta,
and gamma parameters if fmt is None.
If fmt == "abivars", the function build a `Lattice` object from a
dictionary with the Abinit variables `acell`... | def from_dict(cls, d: Dict, fmt: str = None, **kwargs):
"""
Create a Lattice from a dictionary containing the a, b, c, alpha, beta,
and gamma parameters if fmt is None.
If fmt == "abivars", the function build a `Lattice` object from a
dictionary with the Abinit variables `acell`... | [
"Create",
"a",
"Lattice",
"from",
"a",
"dictionary",
"containing",
"the",
"a",
"b",
"c",
"alpha",
"beta",
"and",
"gamma",
"parameters",
"if",
"fmt",
"is",
"None",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L365-L389 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
":",
"Dict",
",",
"fmt",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"fmt",
"==",
"\"abivars\"",
":",
"from",
"pymatgen",
".",
"io",
".",
"abinit",
".",
"abiobjects",
"import",
"lattic... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.volume | Volume of the unit cell. | pymatgen/core/lattice.py | def volume(self) -> float:
"""
Volume of the unit cell.
"""
m = self._matrix
return float(abs(dot(np.cross(m[0], m[1]), m[2]))) | def volume(self) -> float:
"""
Volume of the unit cell.
"""
m = self._matrix
return float(abs(dot(np.cross(m[0], m[1]), m[2]))) | [
"Volume",
"of",
"the",
"unit",
"cell",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L441-L446 | [
"def",
"volume",
"(",
"self",
")",
"->",
"float",
":",
"m",
"=",
"self",
".",
"_matrix",
"return",
"float",
"(",
"abs",
"(",
"dot",
"(",
"np",
".",
"cross",
"(",
"m",
"[",
"0",
"]",
",",
"m",
"[",
"1",
"]",
")",
",",
"m",
"[",
"2",
"]",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.lengths_and_angles | Returns (lattice lengths, lattice angles). | pymatgen/core/lattice.py | def lengths_and_angles(self) -> Tuple[Tuple[float, float, float], Tuple[float, float, float]]:
"""
Returns (lattice lengths, lattice angles).
"""
return self.lengths, self.angles | def lengths_and_angles(self) -> Tuple[Tuple[float, float, float], Tuple[float, float, float]]:
"""
Returns (lattice lengths, lattice angles).
"""
return self.lengths, self.angles | [
"Returns",
"(",
"lattice",
"lengths",
"lattice",
"angles",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L449-L453 | [
"def",
"lengths_and_angles",
"(",
"self",
")",
"->",
"Tuple",
"[",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
",",
"Tuple",
"[",
"float",
",",
"float",
",",
"float",
"]",
"]",
":",
"return",
"self",
".",
"lengths",
",",
"self",
".",
"a... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.reciprocal_lattice | Return the reciprocal lattice. Note that this is the standard
reciprocal lattice used for solid state physics with a factor of 2 *
pi. If you are looking for the crystallographic reciprocal lattice,
use the reciprocal_lattice_crystallographic property.
The property is lazily generated fo... | pymatgen/core/lattice.py | def reciprocal_lattice(self) -> "Lattice":
"""
Return the reciprocal lattice. Note that this is the standard
reciprocal lattice used for solid state physics with a factor of 2 *
pi. If you are looking for the crystallographic reciprocal lattice,
use the reciprocal_lattice_crystal... | def reciprocal_lattice(self) -> "Lattice":
"""
Return the reciprocal lattice. Note that this is the standard
reciprocal lattice used for solid state physics with a factor of 2 *
pi. If you are looking for the crystallographic reciprocal lattice,
use the reciprocal_lattice_crystal... | [
"Return",
"the",
"reciprocal",
"lattice",
".",
"Note",
"that",
"this",
"is",
"the",
"standard",
"reciprocal",
"lattice",
"used",
"for",
"solid",
"state",
"physics",
"with",
"a",
"factor",
"of",
"2",
"*",
"pi",
".",
"If",
"you",
"are",
"looking",
"for",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L456-L465 | [
"def",
"reciprocal_lattice",
"(",
"self",
")",
"->",
"\"Lattice\"",
":",
"v",
"=",
"np",
".",
"linalg",
".",
"inv",
"(",
"self",
".",
"_matrix",
")",
".",
"T",
"return",
"Lattice",
"(",
"v",
"*",
"2",
"*",
"np",
".",
"pi",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.as_dict | Json-serialization dict representation of the Lattice.
Args:
verbosity (int): Verbosity level. Default of 0 only includes the
matrix representation. Set to 1 for more details. | pymatgen/core/lattice.py | def as_dict(self, verbosity: int = 0) -> Dict:
"""""
Json-serialization dict representation of the Lattice.
Args:
verbosity (int): Verbosity level. Default of 0 only includes the
matrix representation. Set to 1 for more details.
"""
d = {
... | def as_dict(self, verbosity: int = 0) -> Dict:
"""""
Json-serialization dict representation of the Lattice.
Args:
verbosity (int): Verbosity level. Default of 0 only includes the
matrix representation. Set to 1 for more details.
"""
d = {
... | [
"Json",
"-",
"serialization",
"dict",
"representation",
"of",
"the",
"Lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L527-L555 | [
"def",
"as_dict",
"(",
"self",
",",
"verbosity",
":",
"int",
"=",
"0",
")",
"->",
"Dict",
":",
"d",
"=",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.find_all_mappings | Finds all mappings between current lattice and another lattice.
Args:
other_lattice (Lattice): Another lattice that is equivalent to
this one.
ltol (float): Tolerance for matching lengths. Defaults to 1e-5.
atol (float): Tolerance for matching angles. Default... | pymatgen/core/lattice.py | def find_all_mappings(
self,
other_lattice: "Lattice",
ltol: float = 1e-5,
atol: float = 1,
skip_rotation_matrix: bool = False,
) -> Iterator[Tuple["Lattice", Optional[np.ndarray], np.ndarray]]:
"""
Finds all mappings between current lattice and another lattic... | def find_all_mappings(
self,
other_lattice: "Lattice",
ltol: float = 1e-5,
atol: float = 1,
skip_rotation_matrix: bool = False,
) -> Iterator[Tuple["Lattice", Optional[np.ndarray], np.ndarray]]:
"""
Finds all mappings between current lattice and another lattic... | [
"Finds",
"all",
"mappings",
"between",
"current",
"lattice",
"and",
"another",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L557-L634 | [
"def",
"find_all_mappings",
"(",
"self",
",",
"other_lattice",
":",
"\"Lattice\"",
",",
"ltol",
":",
"float",
"=",
"1e-5",
",",
"atol",
":",
"float",
"=",
"1",
",",
"skip_rotation_matrix",
":",
"bool",
"=",
"False",
",",
")",
"->",
"Iterator",
"[",
"Tupl... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.find_mapping | Finds a mapping between current lattice and another lattice. There
are an infinite number of choices of basis vectors for two entirely
equivalent lattices. This method returns a mapping that maps
other_lattice to this lattice.
Args:
other_lattice (Lattice): Another lattice t... | pymatgen/core/lattice.py | def find_mapping(
self,
other_lattice: "Lattice",
ltol: float = 1e-5,
atol: float = 1,
skip_rotation_matrix: bool = False,
) -> Optional[Tuple["Lattice", Optional[np.ndarray], np.ndarray]]:
"""
Finds a mapping between current lattice and another lattice. There... | def find_mapping(
self,
other_lattice: "Lattice",
ltol: float = 1e-5,
atol: float = 1,
skip_rotation_matrix: bool = False,
) -> Optional[Tuple["Lattice", Optional[np.ndarray], np.ndarray]]:
"""
Finds a mapping between current lattice and another lattice. There... | [
"Finds",
"a",
"mapping",
"between",
"current",
"lattice",
"and",
"another",
"lattice",
".",
"There",
"are",
"an",
"infinite",
"number",
"of",
"choices",
"of",
"basis",
"vectors",
"for",
"two",
"entirely",
"equivalent",
"lattices",
".",
"This",
"method",
"retur... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L636-L674 | [
"def",
"find_mapping",
"(",
"self",
",",
"other_lattice",
":",
"\"Lattice\"",
",",
"ltol",
":",
"float",
"=",
"1e-5",
",",
"atol",
":",
"float",
"=",
"1",
",",
"skip_rotation_matrix",
":",
"bool",
"=",
"False",
",",
")",
"->",
"Optional",
"[",
"Tuple",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice._calculate_lll | Performs a Lenstra-Lenstra-Lovasz lattice basis reduction to obtain a
c-reduced basis. This method returns a basis which is as "good" as
possible, with "good" defined by orthongonality of the lattice vectors.
This basis is used for all the periodic boundary condition calculations.
Args... | pymatgen/core/lattice.py | def _calculate_lll(self, delta: float = 0.75) -> Tuple[np.ndarray, np.ndarray]:
"""
Performs a Lenstra-Lenstra-Lovasz lattice basis reduction to obtain a
c-reduced basis. This method returns a basis which is as "good" as
possible, with "good" defined by orthongonality of the lattice vect... | def _calculate_lll(self, delta: float = 0.75) -> Tuple[np.ndarray, np.ndarray]:
"""
Performs a Lenstra-Lenstra-Lovasz lattice basis reduction to obtain a
c-reduced basis. This method returns a basis which is as "good" as
possible, with "good" defined by orthongonality of the lattice vect... | [
"Performs",
"a",
"Lenstra",
"-",
"Lenstra",
"-",
"Lovasz",
"lattice",
"basis",
"reduction",
"to",
"obtain",
"a",
"c",
"-",
"reduced",
"basis",
".",
"This",
"method",
"returns",
"a",
"basis",
"which",
"is",
"as",
"good",
"as",
"possible",
"with",
"good",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L681-L763 | [
"def",
"_calculate_lll",
"(",
"self",
",",
"delta",
":",
"float",
"=",
"0.75",
")",
"->",
"Tuple",
"[",
"np",
".",
"ndarray",
",",
"np",
".",
"ndarray",
"]",
":",
"# Transpose the lattice matrix first so that basis vectors are columns.",
"# Makes life easier.",
"a",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_lll_frac_coords | Given fractional coordinates in the lattice basis, returns corresponding
fractional coordinates in the lll basis. | pymatgen/core/lattice.py | def get_lll_frac_coords(self, frac_coords: Vector3Like) -> np.ndarray:
"""
Given fractional coordinates in the lattice basis, returns corresponding
fractional coordinates in the lll basis.
"""
return dot(frac_coords, self.lll_inverse) | def get_lll_frac_coords(self, frac_coords: Vector3Like) -> np.ndarray:
"""
Given fractional coordinates in the lattice basis, returns corresponding
fractional coordinates in the lll basis.
"""
return dot(frac_coords, self.lll_inverse) | [
"Given",
"fractional",
"coordinates",
"in",
"the",
"lattice",
"basis",
"returns",
"corresponding",
"fractional",
"coordinates",
"in",
"the",
"lll",
"basis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L765-L770 | [
"def",
"get_lll_frac_coords",
"(",
"self",
",",
"frac_coords",
":",
"Vector3Like",
")",
"->",
"np",
".",
"ndarray",
":",
"return",
"dot",
"(",
"frac_coords",
",",
"self",
".",
"lll_inverse",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_frac_coords_from_lll | Given fractional coordinates in the lll basis, returns corresponding
fractional coordinates in the lattice basis. | pymatgen/core/lattice.py | def get_frac_coords_from_lll(self, lll_frac_coords: Vector3Like) -> np.ndarray:
"""
Given fractional coordinates in the lll basis, returns corresponding
fractional coordinates in the lattice basis.
"""
return dot(lll_frac_coords, self.lll_mapping) | def get_frac_coords_from_lll(self, lll_frac_coords: Vector3Like) -> np.ndarray:
"""
Given fractional coordinates in the lll basis, returns corresponding
fractional coordinates in the lattice basis.
"""
return dot(lll_frac_coords, self.lll_mapping) | [
"Given",
"fractional",
"coordinates",
"in",
"the",
"lll",
"basis",
"returns",
"corresponding",
"fractional",
"coordinates",
"in",
"the",
"lattice",
"basis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L772-L777 | [
"def",
"get_frac_coords_from_lll",
"(",
"self",
",",
"lll_frac_coords",
":",
"Vector3Like",
")",
"->",
"np",
".",
"ndarray",
":",
"return",
"dot",
"(",
"lll_frac_coords",
",",
"self",
".",
"lll_mapping",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_niggli_reduced_lattice | Get the Niggli reduced lattice using the numerically stable algo
proposed by R. W. Grosse-Kunstleve, N. K. Sauter, & P. D. Adams,
Acta Crystallographica Section A Foundations of Crystallography, 2003,
60(1), 1-6. doi:10.1107/S010876730302186X
Args:
tol (float): The numerical... | pymatgen/core/lattice.py | def get_niggli_reduced_lattice(self, tol: float = 1e-5) -> "Lattice":
"""
Get the Niggli reduced lattice using the numerically stable algo
proposed by R. W. Grosse-Kunstleve, N. K. Sauter, & P. D. Adams,
Acta Crystallographica Section A Foundations of Crystallography, 2003,
60(1)... | def get_niggli_reduced_lattice(self, tol: float = 1e-5) -> "Lattice":
"""
Get the Niggli reduced lattice using the numerically stable algo
proposed by R. W. Grosse-Kunstleve, N. K. Sauter, & P. D. Adams,
Acta Crystallographica Section A Foundations of Crystallography, 2003,
60(1)... | [
"Get",
"the",
"Niggli",
"reduced",
"lattice",
"using",
"the",
"numerically",
"stable",
"algo",
"proposed",
"by",
"R",
".",
"W",
".",
"Grosse",
"-",
"Kunstleve",
"N",
".",
"K",
".",
"Sauter",
"&",
"P",
".",
"D",
".",
"Adams",
"Acta",
"Crystallographica",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L779-L926 | [
"def",
"get_niggli_reduced_lattice",
"(",
"self",
",",
"tol",
":",
"float",
"=",
"1e-5",
")",
"->",
"\"Lattice\"",
":",
"# lll reduction is more stable for skewed cells",
"matrix",
"=",
"self",
".",
"lll_matrix",
"a",
"=",
"matrix",
"[",
"0",
"]",
"b",
"=",
"m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.scale | Return a new Lattice with volume new_volume by performing a
scaling of the lattice vectors so that length proportions and angles
are preserved.
Args:
new_volume:
New volume to scale to.
Returns:
New lattice with desired volume. | pymatgen/core/lattice.py | def scale(self, new_volume: float) -> "Lattice":
"""
Return a new Lattice with volume new_volume by performing a
scaling of the lattice vectors so that length proportions and angles
are preserved.
Args:
new_volume:
New volume to scale to.
Ret... | def scale(self, new_volume: float) -> "Lattice":
"""
Return a new Lattice with volume new_volume by performing a
scaling of the lattice vectors so that length proportions and angles
are preserved.
Args:
new_volume:
New volume to scale to.
Ret... | [
"Return",
"a",
"new",
"Lattice",
"with",
"volume",
"new_volume",
"by",
"performing",
"a",
"scaling",
"of",
"the",
"lattice",
"vectors",
"so",
"that",
"length",
"proportions",
"and",
"angles",
"are",
"preserved",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L928-L949 | [
"def",
"scale",
"(",
"self",
",",
"new_volume",
":",
"float",
")",
"->",
"\"Lattice\"",
":",
"versors",
"=",
"self",
".",
"matrix",
"/",
"self",
".",
"abc",
"geo_factor",
"=",
"abs",
"(",
"dot",
"(",
"np",
".",
"cross",
"(",
"versors",
"[",
"0",
"]... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_wigner_seitz_cell | Returns the Wigner-Seitz cell for the given lattice.
Returns:
A list of list of coordinates.
Each element in the list is a "facet" of the boundary of the
Wigner Seitz cell. For instance, a list of four coordinates will
represent a square facet. | pymatgen/core/lattice.py | def get_wigner_seitz_cell(self) -> List[List[np.ndarray]]:
"""
Returns the Wigner-Seitz cell for the given lattice.
Returns:
A list of list of coordinates.
Each element in the list is a "facet" of the boundary of the
Wigner Seitz cell. For instance, a list of... | def get_wigner_seitz_cell(self) -> List[List[np.ndarray]]:
"""
Returns the Wigner-Seitz cell for the given lattice.
Returns:
A list of list of coordinates.
Each element in the list is a "facet" of the boundary of the
Wigner Seitz cell. For instance, a list of... | [
"Returns",
"the",
"Wigner",
"-",
"Seitz",
"cell",
"for",
"the",
"given",
"lattice",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L951-L976 | [
"def",
"get_wigner_seitz_cell",
"(",
"self",
")",
"->",
"List",
"[",
"List",
"[",
"np",
".",
"ndarray",
"]",
"]",
":",
"vec1",
"=",
"self",
".",
"_matrix",
"[",
"0",
"]",
"vec2",
"=",
"self",
".",
"_matrix",
"[",
"1",
"]",
"vec3",
"=",
"self",
".... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.dot | Compute the scalar product of vector(s).
Args:
coords_a, coords_b: Array-like objects with the coordinates.
frac_coords (bool): Boolean stating whether the vector
corresponds to fractional or cartesian coordinates.
Returns:
one-dimensional `numpy` ar... | pymatgen/core/lattice.py | def dot(
self, coords_a: Vector3Like, coords_b: Vector3Like, frac_coords: bool = False
) -> np.ndarray:
"""
Compute the scalar product of vector(s).
Args:
coords_a, coords_b: Array-like objects with the coordinates.
frac_coords (bool): Boolean stating whether... | def dot(
self, coords_a: Vector3Like, coords_b: Vector3Like, frac_coords: bool = False
) -> np.ndarray:
"""
Compute the scalar product of vector(s).
Args:
coords_a, coords_b: Array-like objects with the coordinates.
frac_coords (bool): Boolean stating whether... | [
"Compute",
"the",
"scalar",
"product",
"of",
"vector",
"(",
"s",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L991-L1026 | [
"def",
"dot",
"(",
"self",
",",
"coords_a",
":",
"Vector3Like",
",",
"coords_b",
":",
"Vector3Like",
",",
"frac_coords",
":",
"bool",
"=",
"False",
")",
"->",
"np",
".",
"ndarray",
":",
"coords_a",
",",
"coords_b",
"=",
"(",
"np",
".",
"reshape",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.norm | Compute the norm of vector(s).
Args:
coords:
Array-like object with the coordinates.
frac_coords:
Boolean stating whether the vector corresponds to fractional or
cartesian coordinates.
Returns:
one-dimensional `numpy` ... | pymatgen/core/lattice.py | def norm(self, coords: Vector3Like, frac_coords: bool = True) -> float:
"""
Compute the norm of vector(s).
Args:
coords:
Array-like object with the coordinates.
frac_coords:
Boolean stating whether the vector corresponds to fractional or
... | def norm(self, coords: Vector3Like, frac_coords: bool = True) -> float:
"""
Compute the norm of vector(s).
Args:
coords:
Array-like object with the coordinates.
frac_coords:
Boolean stating whether the vector corresponds to fractional or
... | [
"Compute",
"the",
"norm",
"of",
"vector",
"(",
"s",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L1028-L1042 | [
"def",
"norm",
"(",
"self",
",",
"coords",
":",
"Vector3Like",
",",
"frac_coords",
":",
"bool",
"=",
"True",
")",
"->",
"float",
":",
"return",
"np",
".",
"sqrt",
"(",
"self",
".",
"dot",
"(",
"coords",
",",
"coords",
",",
"frac_coords",
"=",
"frac_c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_points_in_sphere | Find all points within a sphere from the point taking into account
periodic boundary conditions. This includes sites in other periodic
images.
Algorithm:
1. place sphere of radius r in crystal and determine minimum supercell
(parallelpiped) which would contain a sphere of ra... | pymatgen/core/lattice.py | def get_points_in_sphere(
self,
frac_points: List[Vector3Like],
center: Vector3Like,
r: float,
zip_results=True,
) -> Union[
List[Tuple[np.ndarray, float, int, np.ndarray]],
Tuple[List[np.ndarray], List[float], List[int], List[np.ndarray]],
]:
"""
... | def get_points_in_sphere(
self,
frac_points: List[Vector3Like],
center: Vector3Like,
r: float,
zip_results=True,
) -> Union[
List[Tuple[np.ndarray, float, int, np.ndarray]],
Tuple[List[np.ndarray], List[float], List[int], List[np.ndarray]],
]:
"""
... | [
"Find",
"all",
"points",
"within",
"a",
"sphere",
"from",
"the",
"point",
"taking",
"into",
"account",
"periodic",
"boundary",
"conditions",
".",
"This",
"includes",
"sites",
"in",
"other",
"periodic",
"images",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L1044-L1144 | [
"def",
"get_points_in_sphere",
"(",
"self",
",",
"frac_points",
":",
"List",
"[",
"Vector3Like",
"]",
",",
"center",
":",
"Vector3Like",
",",
"r",
":",
"float",
",",
"zip_results",
"=",
"True",
",",
")",
"->",
"Union",
"[",
"List",
"[",
"Tuple",
"[",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_all_distances | Returns the distances between two lists of coordinates taking into
account periodic boundary conditions and the lattice. Note that this
computes an MxN array of distances (i.e. the distance between each
point in fcoords1 and every coordinate in fcoords2). This is
different functionality ... | pymatgen/core/lattice.py | def get_all_distances(
self,
fcoords1: Union[Vector3Like, List[Vector3Like]],
fcoords2: Union[Vector3Like, List[Vector3Like]],
) -> np.ndarray:
"""
Returns the distances between two lists of coordinates taking into
account periodic boundary conditions and the lattice.... | def get_all_distances(
self,
fcoords1: Union[Vector3Like, List[Vector3Like]],
fcoords2: Union[Vector3Like, List[Vector3Like]],
) -> np.ndarray:
"""
Returns the distances between two lists of coordinates taking into
account periodic boundary conditions and the lattice.... | [
"Returns",
"the",
"distances",
"between",
"two",
"lists",
"of",
"coordinates",
"taking",
"into",
"account",
"periodic",
"boundary",
"conditions",
"and",
"the",
"lattice",
".",
"Note",
"that",
"this",
"computes",
"an",
"MxN",
"array",
"of",
"distances",
"(",
"i... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L1146-L1169 | [
"def",
"get_all_distances",
"(",
"self",
",",
"fcoords1",
":",
"Union",
"[",
"Vector3Like",
",",
"List",
"[",
"Vector3Like",
"]",
"]",
",",
"fcoords2",
":",
"Union",
"[",
"Vector3Like",
",",
"List",
"[",
"Vector3Like",
"]",
"]",
",",
")",
"->",
"np",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_distance_and_image | Gets distance between two frac_coords assuming periodic boundary
conditions. If the index jimage is not specified it selects the j
image nearest to the i atom and returns the distance and jimage
indices in terms of lattice vector translations. If the index jimage
is specified it returns ... | pymatgen/core/lattice.py | def get_distance_and_image(
self,
frac_coords1: Vector3Like,
frac_coords2: Vector3Like,
jimage: Optional[Union[List[int], np.ndarray]] = None,
) -> Tuple[float, np.ndarray]:
"""
Gets distance between two frac_coords assuming periodic boundary
conditions. If th... | def get_distance_and_image(
self,
frac_coords1: Vector3Like,
frac_coords2: Vector3Like,
jimage: Optional[Union[List[int], np.ndarray]] = None,
) -> Tuple[float, np.ndarray]:
"""
Gets distance between two frac_coords assuming periodic boundary
conditions. If th... | [
"Gets",
"distance",
"between",
"two",
"frac_coords",
"assuming",
"periodic",
"boundary",
"conditions",
".",
"If",
"the",
"index",
"jimage",
"is",
"not",
"specified",
"it",
"selects",
"the",
"j",
"image",
"nearest",
"to",
"the",
"i",
"atom",
"and",
"returns",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L1190-L1229 | [
"def",
"get_distance_and_image",
"(",
"self",
",",
"frac_coords1",
":",
"Vector3Like",
",",
"frac_coords2",
":",
"Vector3Like",
",",
"jimage",
":",
"Optional",
"[",
"Union",
"[",
"List",
"[",
"int",
"]",
",",
"np",
".",
"ndarray",
"]",
"]",
"=",
"None",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Lattice.get_miller_index_from_coords | Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 sets of coordinates are required. If more than 3 sets of
coordinates are given, the best plane that minimises the distance to all
points will be calculated.
Args:
coords (iterable): A list or nu... | pymatgen/core/lattice.py | def get_miller_index_from_coords(
self,
coords: Vector3Like,
coords_are_cartesian: bool = True,
round_dp: int = 4,
verbose: bool = True,
) -> Tuple[int, int, int]:
"""
Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 set... | def get_miller_index_from_coords(
self,
coords: Vector3Like,
coords_are_cartesian: bool = True,
round_dp: int = 4,
verbose: bool = True,
) -> Tuple[int, int, int]:
"""
Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 set... | [
"Get",
"the",
"Miller",
"index",
"of",
"a",
"plane",
"from",
"a",
"list",
"of",
"site",
"coordinates",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/lattice.py#L1231-L1271 | [
"def",
"get_miller_index_from_coords",
"(",
"self",
",",
"coords",
":",
"Vector3Like",
",",
"coords_are_cartesian",
":",
"bool",
"=",
"True",
",",
"round_dp",
":",
"int",
"=",
"4",
",",
"verbose",
":",
"bool",
"=",
"True",
",",
")",
"->",
"Tuple",
"[",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | read_route_line | read route line in gaussian input/output and return functional basis_set
and a dictionary of other route parameters
Args:
route (str) : the route line
return
functional (str) : the method (HF, PBE ...)
basis_set (str) : the basis set
route (dict) : dictionary of parameters | pymatgen/io/gaussian.py | def read_route_line(route):
"""
read route line in gaussian input/output and return functional basis_set
and a dictionary of other route parameters
Args:
route (str) : the route line
return
functional (str) : the method (HF, PBE ...)
basis_set (str) : the basis set
... | def read_route_line(route):
"""
read route line in gaussian input/output and return functional basis_set
and a dictionary of other route parameters
Args:
route (str) : the route line
return
functional (str) : the method (HF, PBE ...)
basis_set (str) : the basis set
... | [
"read",
"route",
"line",
"in",
"gaussian",
"input",
"/",
"output",
"and",
"return",
"functional",
"basis_set",
"and",
"a",
"dictionary",
"of",
"other",
"route",
"parameters"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L33-L83 | [
"def",
"read_route_line",
"(",
"route",
")",
":",
"scrf_patt",
"=",
"re",
".",
"compile",
"(",
"r\"^([sS][cC][rR][fF])\\s*=\\s*(.+)\"",
")",
"multi_params_patt",
"=",
"re",
".",
"compile",
"(",
"r\"^([A-z]+[0-9]*)[\\s=]+\\((.*)\\)$\"",
")",
"functional",
"=",
"None",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput._parse_coords | Helper method to parse coordinates. | pymatgen/io/gaussian.py | def _parse_coords(coord_lines):
"""
Helper method to parse coordinates.
"""
paras = {}
var_pattern = re.compile(r"^([A-Za-z]+\S*)[\s=,]+([\d\-\.]+)$")
for l in coord_lines:
m = var_pattern.match(l.strip())
if m:
paras[m.group(1).str... | def _parse_coords(coord_lines):
"""
Helper method to parse coordinates.
"""
paras = {}
var_pattern = re.compile(r"^([A-Za-z]+\S*)[\s=,]+([\d\-\.]+)$")
for l in coord_lines:
m = var_pattern.match(l.strip())
if m:
paras[m.group(1).str... | [
"Helper",
"method",
"to",
"parse",
"coordinates",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L155-L263 | [
"def",
"_parse_coords",
"(",
"coord_lines",
")",
":",
"paras",
"=",
"{",
"}",
"var_pattern",
"=",
"re",
".",
"compile",
"(",
"r\"^([A-Za-z]+\\S*)[\\s=,]+([\\d\\-\\.]+)$\"",
")",
"for",
"l",
"in",
"coord_lines",
":",
"m",
"=",
"var_pattern",
".",
"match",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput.from_string | Creates GaussianInput from a string.
Args:
contents: String representing an Gaussian input file.
Returns:
GaussianInput object | pymatgen/io/gaussian.py | def from_string(contents):
"""
Creates GaussianInput from a string.
Args:
contents: String representing an Gaussian input file.
Returns:
GaussianInput object
"""
lines = [l.strip() for l in contents.split("\n")]
link0_patt = re.compile(r... | def from_string(contents):
"""
Creates GaussianInput from a string.
Args:
contents: String representing an Gaussian input file.
Returns:
GaussianInput object
"""
lines = [l.strip() for l in contents.split("\n")]
link0_patt = re.compile(r... | [
"Creates",
"GaussianInput",
"from",
"a",
"string",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L266-L328 | [
"def",
"from_string",
"(",
"contents",
")",
":",
"lines",
"=",
"[",
"l",
".",
"strip",
"(",
")",
"for",
"l",
"in",
"contents",
".",
"split",
"(",
"\"\\n\"",
")",
"]",
"link0_patt",
"=",
"re",
".",
"compile",
"(",
"r\"^(%.+)\\s*=\\s*(.+)\"",
")",
"link0... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput._find_nn_pos_before_site | Returns index of nearest neighbor atoms. | pymatgen/io/gaussian.py | def _find_nn_pos_before_site(self, siteindex):
"""
Returns index of nearest neighbor atoms.
"""
alldist = [(self._mol.get_distance(siteindex, i), i)
for i in range(siteindex)]
alldist = sorted(alldist, key=lambda x: x[0])
return [d[1] for d in alldist] | def _find_nn_pos_before_site(self, siteindex):
"""
Returns index of nearest neighbor atoms.
"""
alldist = [(self._mol.get_distance(siteindex, i), i)
for i in range(siteindex)]
alldist = sorted(alldist, key=lambda x: x[0])
return [d[1] for d in alldist] | [
"Returns",
"index",
"of",
"nearest",
"neighbor",
"atoms",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L344-L351 | [
"def",
"_find_nn_pos_before_site",
"(",
"self",
",",
"siteindex",
")",
":",
"alldist",
"=",
"[",
"(",
"self",
".",
"_mol",
".",
"get_distance",
"(",
"siteindex",
",",
"i",
")",
",",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"siteindex",
")",
"]",
"al... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput.get_zmatrix | Returns a z-matrix representation of the molecule. | pymatgen/io/gaussian.py | def get_zmatrix(self):
"""
Returns a z-matrix representation of the molecule.
"""
output = []
outputvar = []
for i, site in enumerate(self._mol):
if i == 0:
output.append("{}".format(site.specie))
elif i == 1:
nn = s... | def get_zmatrix(self):
"""
Returns a z-matrix representation of the molecule.
"""
output = []
outputvar = []
for i, site in enumerate(self._mol):
if i == 0:
output.append("{}".format(site.specie))
elif i == 1:
nn = s... | [
"Returns",
"a",
"z",
"-",
"matrix",
"representation",
"of",
"the",
"molecule",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L353-L388 | [
"def",
"get_zmatrix",
"(",
"self",
")",
":",
"output",
"=",
"[",
"]",
"outputvar",
"=",
"[",
"]",
"for",
"i",
",",
"site",
"in",
"enumerate",
"(",
"self",
".",
"_mol",
")",
":",
"if",
"i",
"==",
"0",
":",
"output",
".",
"append",
"(",
"\"{}\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput.get_cart_coords | Return the cartesian coordinates of the molecule | pymatgen/io/gaussian.py | def get_cart_coords(self):
"""
Return the cartesian coordinates of the molecule
"""
def to_s(x):
return "%0.6f" % x
outs = []
for i, site in enumerate(self._mol):
outs.append(" ".join([site.species_string,
" ".joi... | def get_cart_coords(self):
"""
Return the cartesian coordinates of the molecule
"""
def to_s(x):
return "%0.6f" % x
outs = []
for i, site in enumerate(self._mol):
outs.append(" ".join([site.species_string,
" ".joi... | [
"Return",
"the",
"cartesian",
"coordinates",
"of",
"the",
"molecule"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L390-L401 | [
"def",
"get_cart_coords",
"(",
"self",
")",
":",
"def",
"to_s",
"(",
"x",
")",
":",
"return",
"\"%0.6f\"",
"%",
"x",
"outs",
"=",
"[",
"]",
"for",
"i",
",",
"site",
"in",
"enumerate",
"(",
"self",
".",
"_mol",
")",
":",
"outs",
".",
"append",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput.to_string | Return GaussianInput string
Option: whe cart_coords sets to True return the cartesian coordinates
instead of the z-matrix | pymatgen/io/gaussian.py | def to_string(self, cart_coords=False):
"""
Return GaussianInput string
Option: whe cart_coords sets to True return the cartesian coordinates
instead of the z-matrix
"""
def para_dict_to_string(para, joiner=" "):
para_str = []
# sorted is... | def to_string(self, cart_coords=False):
"""
Return GaussianInput string
Option: whe cart_coords sets to True return the cartesian coordinates
instead of the z-matrix
"""
def para_dict_to_string(para, joiner=" "):
para_str = []
# sorted is... | [
"Return",
"GaussianInput",
"string"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L406-L451 | [
"def",
"to_string",
"(",
"self",
",",
"cart_coords",
"=",
"False",
")",
":",
"def",
"para_dict_to_string",
"(",
"para",
",",
"joiner",
"=",
"\" \"",
")",
":",
"para_str",
"=",
"[",
"]",
"# sorted is only done to make unittests work reliably",
"for",
"par",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianInput.write_file | Write the input string into a file
Option: see __str__ method | pymatgen/io/gaussian.py | def write_file(self, filename, cart_coords=False):
"""
Write the input string into a file
Option: see __str__ method
"""
with zopen(filename, "w") as f:
f.write(self.to_string(cart_coords)) | def write_file(self, filename, cart_coords=False):
"""
Write the input string into a file
Option: see __str__ method
"""
with zopen(filename, "w") as f:
f.write(self.to_string(cart_coords)) | [
"Write",
"the",
"input",
"string",
"into",
"a",
"file"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L453-L460 | [
"def",
"write_file",
"(",
"self",
",",
"filename",
",",
"cart_coords",
"=",
"False",
")",
":",
"with",
"zopen",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"self",
".",
"to_string",
"(",
"cart_coords",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.as_dict | Json-serializable dict representation. | pymatgen/io/gaussian.py | def as_dict(self):
"""
Json-serializable dict representation.
"""
structure = self.final_structure
d = {"has_gaussian_completed": self.properly_terminated,
"nsites": len(structure)}
comp = structure.composition
d["unit_cell_formula"] = comp.as_dict()
... | def as_dict(self):
"""
Json-serializable dict representation.
"""
structure = self.final_structure
d = {"has_gaussian_completed": self.properly_terminated,
"nsites": len(structure)}
comp = structure.composition
d["unit_cell_formula"] = comp.as_dict()
... | [
"Json",
"-",
"serializable",
"dict",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1156-L1199 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"structure",
"=",
"self",
".",
"final_structure",
"d",
"=",
"{",
"\"has_gaussian_completed\"",
":",
"self",
".",
"properly_terminated",
",",
"\"nsites\"",
":",
"len",
"(",
"structure",
")",
"}",
"comp",
"=",
"structur... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.read_scan | Read a potential energy surface from a gaussian scan calculation.
Returns:
A dict: {"energies": [ values ],
"coords": {"d1": [ values ], "A2", [ values ], ... }}
"energies" are the energies of all points of the potential energy
surface. "coords" are th... | pymatgen/io/gaussian.py | def read_scan(self):
"""
Read a potential energy surface from a gaussian scan calculation.
Returns:
A dict: {"energies": [ values ],
"coords": {"d1": [ values ], "A2", [ values ], ... }}
"energies" are the energies of all points of the potential en... | def read_scan(self):
"""
Read a potential energy surface from a gaussian scan calculation.
Returns:
A dict: {"energies": [ values ],
"coords": {"d1": [ values ], "A2", [ values ], ... }}
"energies" are the energies of all points of the potential en... | [
"Read",
"a",
"potential",
"energy",
"surface",
"from",
"a",
"gaussian",
"scan",
"calculation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1201-L1265 | [
"def",
"read_scan",
"(",
"self",
")",
":",
"def",
"floatList",
"(",
"l",
")",
":",
"\"\"\" return a list of float from a list of string \"\"\"",
"return",
"[",
"float",
"(",
"v",
")",
"for",
"v",
"in",
"l",
"]",
"scan_patt",
"=",
"re",
".",
"compile",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.get_scan_plot | Get a matplotlib plot of the potential energy surface.
Args:
coords: internal coordinate name to use as abcissa. | pymatgen/io/gaussian.py | def get_scan_plot(self, coords=None):
"""
Get a matplotlib plot of the potential energy surface.
Args:
coords: internal coordinate name to use as abcissa.
"""
from pymatgen.util.plotting import pretty_plot
plt = pretty_plot(12, 8)
d = self.read_scan... | def get_scan_plot(self, coords=None):
"""
Get a matplotlib plot of the potential energy surface.
Args:
coords: internal coordinate name to use as abcissa.
"""
from pymatgen.util.plotting import pretty_plot
plt = pretty_plot(12, 8)
d = self.read_scan... | [
"Get",
"a",
"matplotlib",
"plot",
"of",
"the",
"potential",
"energy",
"surface",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1267-L1293 | [
"def",
"get_scan_plot",
"(",
"self",
",",
"coords",
"=",
"None",
")",
":",
"from",
"pymatgen",
".",
"util",
".",
"plotting",
"import",
"pretty_plot",
"plt",
"=",
"pretty_plot",
"(",
"12",
",",
"8",
")",
"d",
"=",
"self",
".",
"read_scan",
"(",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.save_scan_plot | Save matplotlib plot of the potential energy surface to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
coords: internal coordinate name to use as abcissa. | pymatgen/io/gaussian.py | def save_scan_plot(self, filename="scan.pdf",
img_format="pdf", coords=None):
"""
Save matplotlib plot of the potential energy surface to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
co... | def save_scan_plot(self, filename="scan.pdf",
img_format="pdf", coords=None):
"""
Save matplotlib plot of the potential energy surface to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
co... | [
"Save",
"matplotlib",
"plot",
"of",
"the",
"potential",
"energy",
"surface",
"to",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1295-L1306 | [
"def",
"save_scan_plot",
"(",
"self",
",",
"filename",
"=",
"\"scan.pdf\"",
",",
"img_format",
"=",
"\"pdf\"",
",",
"coords",
"=",
"None",
")",
":",
"plt",
"=",
"self",
".",
"get_scan_plot",
"(",
"coords",
")",
"plt",
".",
"savefig",
"(",
"filename",
","... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.read_excitation_energies | Read a excitation energies after a TD-DFT calculation.
Returns:
A list: A list of tuple for each transition such as
[(energie (eV), lambda (nm), oscillatory strength), ... ] | pymatgen/io/gaussian.py | def read_excitation_energies(self):
"""
Read a excitation energies after a TD-DFT calculation.
Returns:
A list: A list of tuple for each transition such as
[(energie (eV), lambda (nm), oscillatory strength), ... ]
"""
transitions = list()
... | def read_excitation_energies(self):
"""
Read a excitation energies after a TD-DFT calculation.
Returns:
A list: A list of tuple for each transition such as
[(energie (eV), lambda (nm), oscillatory strength), ... ]
"""
transitions = list()
... | [
"Read",
"a",
"excitation",
"energies",
"after",
"a",
"TD",
"-",
"DFT",
"calculation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1308-L1333 | [
"def",
"read_excitation_energies",
"(",
"self",
")",
":",
"transitions",
"=",
"list",
"(",
")",
"# read in file",
"with",
"zopen",
"(",
"self",
".",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"line",
"=",
"f",
".",
"readline",
"(",
")",
"td",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.get_spectre_plot | Get a matplotlib plot of the UV-visible xas. Transition are plotted
as vertical lines and as a sum of normal functions with sigma with. The
broadening is applied in energy and the xas is plotted as a function
of the wavelength.
Args:
sigma: Full width at half maximum in eV f... | pymatgen/io/gaussian.py | def get_spectre_plot(self, sigma=0.05, step=0.01):
"""
Get a matplotlib plot of the UV-visible xas. Transition are plotted
as vertical lines and as a sum of normal functions with sigma with. The
broadening is applied in energy and the xas is plotted as a function
of the wavelengt... | def get_spectre_plot(self, sigma=0.05, step=0.01):
"""
Get a matplotlib plot of the UV-visible xas. Transition are plotted
as vertical lines and as a sum of normal functions with sigma with. The
broadening is applied in energy and the xas is plotted as a function
of the wavelengt... | [
"Get",
"a",
"matplotlib",
"plot",
"of",
"the",
"UV",
"-",
"visible",
"xas",
".",
"Transition",
"are",
"plotted",
"as",
"vertical",
"lines",
"and",
"as",
"a",
"sum",
"of",
"normal",
"functions",
"with",
"sigma",
"with",
".",
"The",
"broadening",
"is",
"ap... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1335-L1387 | [
"def",
"get_spectre_plot",
"(",
"self",
",",
"sigma",
"=",
"0.05",
",",
"step",
"=",
"0.01",
")",
":",
"from",
"pymatgen",
".",
"util",
".",
"plotting",
"import",
"pretty_plot",
"from",
"matplotlib",
".",
"mlab",
"import",
"normpdf",
"plt",
"=",
"pretty_pl... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.save_spectre_plot | Save matplotlib plot of the spectre to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
sigma: Full width at half maximum in eV for normal functions.
step: bin interval in eV | pymatgen/io/gaussian.py | def save_spectre_plot(self, filename="spectre.pdf", img_format="pdf",
sigma=0.05, step=0.01):
"""
Save matplotlib plot of the spectre to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
... | def save_spectre_plot(self, filename="spectre.pdf", img_format="pdf",
sigma=0.05, step=0.01):
"""
Save matplotlib plot of the spectre to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
... | [
"Save",
"matplotlib",
"plot",
"of",
"the",
"spectre",
"to",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1389-L1401 | [
"def",
"save_spectre_plot",
"(",
"self",
",",
"filename",
"=",
"\"spectre.pdf\"",
",",
"img_format",
"=",
"\"pdf\"",
",",
"sigma",
"=",
"0.05",
",",
"step",
"=",
"0.01",
")",
":",
"d",
",",
"plt",
"=",
"self",
".",
"get_spectre_plot",
"(",
"sigma",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GaussianOutput.to_input | Create a new input object using by default the last geometry read in
the output file and with the same calculation parameters. Arguments
are the same as GaussianInput class.
Returns
gaunip (GaussianInput) : the gaussian input object | pymatgen/io/gaussian.py | def to_input(self, mol=None, charge=None,
spin_multiplicity=None, title=None, functional=None,
basis_set=None, route_parameters=None, input_parameters=None,
link0_parameters=None, dieze_tag=None, cart_coords=False):
"""
Create a new input object using ... | def to_input(self, mol=None, charge=None,
spin_multiplicity=None, title=None, functional=None,
basis_set=None, route_parameters=None, input_parameters=None,
link0_parameters=None, dieze_tag=None, cart_coords=False):
"""
Create a new input object using ... | [
"Create",
"a",
"new",
"input",
"object",
"using",
"by",
"default",
"the",
"last",
"geometry",
"read",
"in",
"the",
"output",
"file",
"and",
"with",
"the",
"same",
"calculation",
"parameters",
".",
"Arguments",
"are",
"the",
"same",
"as",
"GaussianInput",
"cl... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/gaussian.py#L1403-L1451 | [
"def",
"to_input",
"(",
"self",
",",
"mol",
"=",
"None",
",",
"charge",
"=",
"None",
",",
"spin_multiplicity",
"=",
"None",
",",
"title",
"=",
"None",
",",
"functional",
"=",
"None",
",",
"basis_set",
"=",
"None",
",",
"route_parameters",
"=",
"None",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SubstitutionPredictor.list_prediction | Args:
species:
list of species
to_this_composition:
If true, substitutions with this as a final composition
will be found. If false, substitutions with this as a
starting composition will be found (these are slightly
... | pymatgen/analysis/structure_prediction/substitution_probability.py | def list_prediction(self, species, to_this_composition=True):
"""
Args:
species:
list of species
to_this_composition:
If true, substitutions with this as a final composition
will be found. If false, substitutions with this as a
... | def list_prediction(self, species, to_this_composition=True):
"""
Args:
species:
list of species
to_this_composition:
If true, substitutions with this as a final composition
will be found. If false, substitutions with this as a
... | [
"Args",
":",
"species",
":",
"list",
"of",
"species",
"to_this_composition",
":",
"If",
"true",
"substitutions",
"with",
"this",
"as",
"a",
"final",
"composition",
"will",
"be",
"found",
".",
"If",
"false",
"substitutions",
"with",
"this",
"as",
"a",
"starti... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitution_probability.py#L165-L221 | [
"def",
"list_prediction",
"(",
"self",
",",
"species",
",",
"to_this_composition",
"=",
"True",
")",
":",
"for",
"sp",
"in",
"species",
":",
"if",
"get_el_sp",
"(",
"sp",
")",
"not",
"in",
"self",
".",
"p",
".",
"species",
":",
"raise",
"ValueError",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SubstitutionPredictor.composition_prediction | Returns charged balanced substitutions from a starting or ending
composition.
Args:
composition:
starting or ending composition
to_this_composition:
If true, substitutions with this as a final composition
will be found. If false, s... | pymatgen/analysis/structure_prediction/substitution_probability.py | def composition_prediction(self, composition, to_this_composition=True):
"""
Returns charged balanced substitutions from a starting or ending
composition.
Args:
composition:
starting or ending composition
to_this_composition:
If tr... | def composition_prediction(self, composition, to_this_composition=True):
"""
Returns charged balanced substitutions from a starting or ending
composition.
Args:
composition:
starting or ending composition
to_this_composition:
If tr... | [
"Returns",
"charged",
"balanced",
"substitutions",
"from",
"a",
"starting",
"or",
"ending",
"composition",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_prediction/substitution_probability.py#L223-L258 | [
"def",
"composition_prediction",
"(",
"self",
",",
"composition",
",",
"to_this_composition",
"=",
"True",
")",
":",
"preds",
"=",
"self",
".",
"list_prediction",
"(",
"list",
"(",
"composition",
".",
"keys",
"(",
")",
")",
",",
"to_this_composition",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_parser | Factory function to provide the parser for the specified scheduler. If the scheduler is not implemented None is
returned. The files, string, correspond to file names of the out and err files:
err_file stderr of the scheduler
out_file stdout of the scheduler
run_err_file stderr of the ap... | pymatgen/io/abinit/scheduler_error_parsers.py | def get_parser(scheduler, err_file, out_file=None, run_err_file=None, batch_err_file=None):
"""
Factory function to provide the parser for the specified scheduler. If the scheduler is not implemented None is
returned. The files, string, correspond to file names of the out and err files:
err_file ... | def get_parser(scheduler, err_file, out_file=None, run_err_file=None, batch_err_file=None):
"""
Factory function to provide the parser for the specified scheduler. If the scheduler is not implemented None is
returned. The files, string, correspond to file names of the out and err files:
err_file ... | [
"Factory",
"function",
"to",
"provide",
"the",
"parser",
"for",
"the",
"specified",
"scheduler",
".",
"If",
"the",
"scheduler",
"is",
"not",
"implemented",
"None",
"is",
"returned",
".",
"The",
"files",
"string",
"correspond",
"to",
"file",
"names",
"of",
"t... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/scheduler_error_parsers.py#L406-L419 | [
"def",
"get_parser",
"(",
"scheduler",
",",
"err_file",
",",
"out_file",
"=",
"None",
",",
"run_err_file",
"=",
"None",
",",
"batch_err_file",
"=",
"None",
")",
":",
"cls",
"=",
"ALL_PARSERS",
".",
"get",
"(",
"scheduler",
")",
"return",
"cls",
"if",
"cl... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbstractErrorParser.parse_single | Parse the provided files for the corresponding strings. | pymatgen/io/abinit/scheduler_error_parsers.py | def parse_single(self, errmsg):
"""
Parse the provided files for the corresponding strings.
"""
found = False
message = None
metadata = None
for k in errmsg.keys():
if self.files[k] is not None:
#print('parsing ', self.files[k], ' for '... | def parse_single(self, errmsg):
"""
Parse the provided files for the corresponding strings.
"""
found = False
message = None
metadata = None
for k in errmsg.keys():
if self.files[k] is not None:
#print('parsing ', self.files[k], ' for '... | [
"Parse",
"the",
"provided",
"files",
"for",
"the",
"corresponding",
"strings",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/scheduler_error_parsers.py#L269-L295 | [
"def",
"parse_single",
"(",
"self",
",",
"errmsg",
")",
":",
"found",
"=",
"False",
"message",
"=",
"None",
"metadata",
"=",
"None",
"for",
"k",
"in",
"errmsg",
".",
"keys",
"(",
")",
":",
"if",
"self",
".",
"files",
"[",
"k",
"]",
"is",
"not",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbstractErrorParser.parse | Parse for the occurens of all errors defined in ERRORS | pymatgen/io/abinit/scheduler_error_parsers.py | def parse(self):
"""
Parse for the occurens of all errors defined in ERRORS
"""
errors_tested = 0
for error in self.error_definitions:
errors_tested += 1
result = self.parse_single(self.error_definitions[error])
if result[0]:
se... | def parse(self):
"""
Parse for the occurens of all errors defined in ERRORS
"""
errors_tested = 0
for error in self.error_definitions:
errors_tested += 1
result = self.parse_single(self.error_definitions[error])
if result[0]:
se... | [
"Parse",
"for",
"the",
"occurens",
"of",
"all",
"errors",
"defined",
"in",
"ERRORS"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/scheduler_error_parsers.py#L297-L312 | [
"def",
"parse",
"(",
"self",
")",
":",
"errors_tested",
"=",
"0",
"for",
"error",
"in",
"self",
".",
"error_definitions",
":",
"errors_tested",
"+=",
"1",
"result",
"=",
"self",
".",
"parse_single",
"(",
"self",
".",
"error_definitions",
"[",
"error",
"]",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | iterative_symmetrize | Returns a symmetrized molecule
The equivalent atoms obtained via
:meth:`~pymatgen.symmetry.analyzer.PointGroupAnalyzer.get_equivalent_atoms`
are rotated, mirrored... unto one position.
Then the average position is calculated.
The average position is rotated, mirrored... back with the inverse
of... | pymatgen/symmetry/analyzer.py | def iterative_symmetrize(mol, max_n=10, tolerance=0.3, epsilon=1e-2):
"""Returns a symmetrized molecule
The equivalent atoms obtained via
:meth:`~pymatgen.symmetry.analyzer.PointGroupAnalyzer.get_equivalent_atoms`
are rotated, mirrored... unto one position.
Then the average position is calculated.
... | def iterative_symmetrize(mol, max_n=10, tolerance=0.3, epsilon=1e-2):
"""Returns a symmetrized molecule
The equivalent atoms obtained via
:meth:`~pymatgen.symmetry.analyzer.PointGroupAnalyzer.get_equivalent_atoms`
are rotated, mirrored... unto one position.
Then the average position is calculated.
... | [
"Returns",
"a",
"symmetrized",
"molecule"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1419-L1468 | [
"def",
"iterative_symmetrize",
"(",
"mol",
",",
"max_n",
"=",
"10",
",",
"tolerance",
"=",
"0.3",
",",
"epsilon",
"=",
"1e-2",
")",
":",
"new",
"=",
"mol",
"n",
"=",
"0",
"finished",
"=",
"False",
"while",
"not",
"finished",
"and",
"n",
"<=",
"max_n"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | cluster_sites | Cluster sites based on distance and species type.
Args:
mol (Molecule): Molecule **with origin at center of mass**.
tol (float): Tolerance to use.
Returns:
(origin_site, clustered_sites): origin_site is a site at the center
of mass (None if there are no origin atoms). clustered... | pymatgen/symmetry/analyzer.py | def cluster_sites(mol, tol, give_only_index=False):
"""
Cluster sites based on distance and species type.
Args:
mol (Molecule): Molecule **with origin at center of mass**.
tol (float): Tolerance to use.
Returns:
(origin_site, clustered_sites): origin_site is a site at the cente... | def cluster_sites(mol, tol, give_only_index=False):
"""
Cluster sites based on distance and species type.
Args:
mol (Molecule): Molecule **with origin at center of mass**.
tol (float): Tolerance to use.
Returns:
(origin_site, clustered_sites): origin_site is a site at the cente... | [
"Cluster",
"sites",
"based",
"on",
"distance",
"and",
"species",
"type",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1471-L1508 | [
"def",
"cluster_sites",
"(",
"mol",
",",
"tol",
",",
"give_only_index",
"=",
"False",
")",
":",
"# Cluster works for dim > 2 data. We just add a dummy 0 for second",
"# coordinate.",
"dists",
"=",
"[",
"[",
"np",
".",
"linalg",
".",
"norm",
"(",
"site",
".",
"coor... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | generate_full_symmops | Recursive algorithm to permute through all possible combinations of the
initially supplied symmetry operations to arrive at a complete set of
operations mapping a single atom to all other equivalent atoms in the
point group. This assumes that the initial number already uniquely
identifies all operation... | pymatgen/symmetry/analyzer.py | def generate_full_symmops(symmops, tol):
"""
Recursive algorithm to permute through all possible combinations of the
initially supplied symmetry operations to arrive at a complete set of
operations mapping a single atom to all other equivalent atoms in the
point group. This assumes that the initial... | def generate_full_symmops(symmops, tol):
"""
Recursive algorithm to permute through all possible combinations of the
initially supplied symmetry operations to arrive at a complete set of
operations mapping a single atom to all other equivalent atoms in the
point group. This assumes that the initial... | [
"Recursive",
"algorithm",
"to",
"permute",
"through",
"all",
"possible",
"combinations",
"of",
"the",
"initially",
"supplied",
"symmetry",
"operations",
"to",
"arrive",
"at",
"a",
"complete",
"set",
"of",
"operations",
"mapping",
"a",
"single",
"atom",
"to",
"al... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1511-L1547 | [
"def",
"generate_full_symmops",
"(",
"symmops",
",",
"tol",
")",
":",
"# Uses an algorithm described in:",
"# Gregory Butler. Fundamental Algorithms for Permutation Groups.",
"# Lecture Notes in Computer Science (Book 559). Springer, 1991. page 15",
"UNIT",
"=",
"np",
".",
"eye",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_point_group_symbol | Get the point group associated with the structure.
Returns:
(Pointgroup): Point group for structure. | pymatgen/symmetry/analyzer.py | def get_point_group_symbol(self):
"""
Get the point group associated with the structure.
Returns:
(Pointgroup): Point group for structure.
"""
rotations = self._space_group_data["rotations"]
# passing a 0-length rotations list to spglib can segfault
i... | def get_point_group_symbol(self):
"""
Get the point group associated with the structure.
Returns:
(Pointgroup): Point group for structure.
"""
rotations = self._space_group_data["rotations"]
# passing a 0-length rotations list to spglib can segfault
i... | [
"Get",
"the",
"point",
"group",
"associated",
"with",
"the",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L156-L167 | [
"def",
"get_point_group_symbol",
"(",
"self",
")",
":",
"rotations",
"=",
"self",
".",
"_space_group_data",
"[",
"\"rotations\"",
"]",
"# passing a 0-length rotations list to spglib can segfault",
"if",
"len",
"(",
"rotations",
")",
"==",
"0",
":",
"return",
"'1'",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_crystal_system | Get the crystal system for the structure, e.g., (triclinic,
orthorhombic, cubic, etc.).
Returns:
(str): Crystal system for structure or None if system cannot be detected. | pymatgen/symmetry/analyzer.py | def get_crystal_system(self):
"""
Get the crystal system for the structure, e.g., (triclinic,
orthorhombic, cubic, etc.).
Returns:
(str): Crystal system for structure or None if system cannot be detected.
"""
n = self._space_group_data["number"]
f = ... | def get_crystal_system(self):
"""
Get the crystal system for the structure, e.g., (triclinic,
orthorhombic, cubic, etc.).
Returns:
(str): Crystal system for structure or None if system cannot be detected.
"""
n = self._space_group_data["number"]
f = ... | [
"Get",
"the",
"crystal",
"system",
"for",
"the",
"structure",
"e",
".",
"g",
".",
"(",
"triclinic",
"orthorhombic",
"cubic",
"etc",
".",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L169-L191 | [
"def",
"get_crystal_system",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"_space_group_data",
"[",
"\"number\"",
"]",
"f",
"=",
"lambda",
"i",
",",
"j",
":",
"i",
"<=",
"n",
"<=",
"j",
"cs",
"=",
"{",
"\"triclinic\"",
":",
"(",
"1",
",",
"2",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_lattice_type | Get the lattice for the structure, e.g., (triclinic,
orthorhombic, cubic, etc.).This is the same than the
crystal system with the exception of the hexagonal/rhombohedral
lattice
Returns:
(str): Lattice type for structure or None if type cannot be detected. | pymatgen/symmetry/analyzer.py | def get_lattice_type(self):
"""
Get the lattice for the structure, e.g., (triclinic,
orthorhombic, cubic, etc.).This is the same than the
crystal system with the exception of the hexagonal/rhombohedral
lattice
Returns:
(str): Lattice type for structure or Non... | def get_lattice_type(self):
"""
Get the lattice for the structure, e.g., (triclinic,
orthorhombic, cubic, etc.).This is the same than the
crystal system with the exception of the hexagonal/rhombohedral
lattice
Returns:
(str): Lattice type for structure or Non... | [
"Get",
"the",
"lattice",
"for",
"the",
"structure",
"e",
".",
"g",
".",
"(",
"triclinic",
"orthorhombic",
"cubic",
"etc",
".",
")",
".",
"This",
"is",
"the",
"same",
"than",
"the",
"crystal",
"system",
"with",
"the",
"exception",
"of",
"the",
"hexagonal"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L193-L210 | [
"def",
"get_lattice_type",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"_space_group_data",
"[",
"\"number\"",
"]",
"system",
"=",
"self",
".",
"get_crystal_system",
"(",
")",
"if",
"n",
"in",
"[",
"146",
",",
"148",
",",
"155",
",",
"160",
",",
"1... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer._get_symmetry | Get the symmetry operations associated with the structure.
Returns:
Symmetry operations as a tuple of two equal length sequences.
(rotations, translations). "rotations" is the numpy integer array
of the rotation matrices for scaled positions
"translations" gives ... | pymatgen/symmetry/analyzer.py | def _get_symmetry(self):
"""
Get the symmetry operations associated with the structure.
Returns:
Symmetry operations as a tuple of two equal length sequences.
(rotations, translations). "rotations" is the numpy integer array
of the rotation matrices for scale... | def _get_symmetry(self):
"""
Get the symmetry operations associated with the structure.
Returns:
Symmetry operations as a tuple of two equal length sequences.
(rotations, translations). "rotations" is the numpy integer array
of the rotation matrices for scale... | [
"Get",
"the",
"symmetry",
"operations",
"associated",
"with",
"the",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L231-L256 | [
"def",
"_get_symmetry",
"(",
"self",
")",
":",
"d",
"=",
"spglib",
".",
"get_symmetry",
"(",
"self",
".",
"_cell",
",",
"symprec",
"=",
"self",
".",
"_symprec",
",",
"angle_tolerance",
"=",
"self",
".",
"_angle_tol",
")",
"# Sometimes spglib returns small tran... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_symmetry_operations | Return symmetry operations as a list of SymmOp objects.
By default returns fractional coord symmops.
But cartesian can be returned too.
Returns:
([SymmOp]): List of symmetry operations. | pymatgen/symmetry/analyzer.py | def get_symmetry_operations(self, cartesian=False):
"""
Return symmetry operations as a list of SymmOp objects.
By default returns fractional coord symmops.
But cartesian can be returned too.
Returns:
([SymmOp]): List of symmetry operations.
"""
rotat... | def get_symmetry_operations(self, cartesian=False):
"""
Return symmetry operations as a list of SymmOp objects.
By default returns fractional coord symmops.
But cartesian can be returned too.
Returns:
([SymmOp]): List of symmetry operations.
"""
rotat... | [
"Return",
"symmetry",
"operations",
"as",
"a",
"list",
"of",
"SymmOp",
"objects",
".",
"By",
"default",
"returns",
"fractional",
"coord",
"symmops",
".",
"But",
"cartesian",
"can",
"be",
"returned",
"too",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L258-L277 | [
"def",
"get_symmetry_operations",
"(",
"self",
",",
"cartesian",
"=",
"False",
")",
":",
"rotation",
",",
"translation",
"=",
"self",
".",
"_get_symmetry",
"(",
")",
"symmops",
"=",
"[",
"]",
"mat",
"=",
"self",
".",
"_structure",
".",
"lattice",
".",
"m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_symmetrized_structure | Get a symmetrized structure. A symmetrized structure is one where the
sites have been grouped into symmetrically equivalent groups.
Returns:
:class:`pymatgen.symmetry.structure.SymmetrizedStructure` object. | pymatgen/symmetry/analyzer.py | def get_symmetrized_structure(self):
"""
Get a symmetrized structure. A symmetrized structure is one where the
sites have been grouped into symmetrically equivalent groups.
Returns:
:class:`pymatgen.symmetry.structure.SymmetrizedStructure` object.
"""
ds = se... | def get_symmetrized_structure(self):
"""
Get a symmetrized structure. A symmetrized structure is one where the
sites have been grouped into symmetrically equivalent groups.
Returns:
:class:`pymatgen.symmetry.structure.SymmetrizedStructure` object.
"""
ds = se... | [
"Get",
"a",
"symmetrized",
"structure",
".",
"A",
"symmetrized",
"structure",
"is",
"one",
"where",
"the",
"sites",
"have",
"been",
"grouped",
"into",
"symmetrically",
"equivalent",
"groups",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L303-L317 | [
"def",
"get_symmetrized_structure",
"(",
"self",
")",
":",
"ds",
"=",
"self",
".",
"get_symmetry_dataset",
"(",
")",
"sg",
"=",
"SpacegroupOperations",
"(",
"self",
".",
"get_space_group_symbol",
"(",
")",
",",
"self",
".",
"get_space_group_number",
"(",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_refined_structure | Get the refined structure based on detected symmetry. The refined
structure is a *conventional* cell setting with atoms moved to the
expected symmetry positions.
Returns:
Refined structure. | pymatgen/symmetry/analyzer.py | def get_refined_structure(self):
"""
Get the refined structure based on detected symmetry. The refined
structure is a *conventional* cell setting with atoms moved to the
expected symmetry positions.
Returns:
Refined structure.
"""
# Atomic positions h... | def get_refined_structure(self):
"""
Get the refined structure based on detected symmetry. The refined
structure is a *conventional* cell setting with atoms moved to the
expected symmetry positions.
Returns:
Refined structure.
"""
# Atomic positions h... | [
"Get",
"the",
"refined",
"structure",
"based",
"on",
"detected",
"symmetry",
".",
"The",
"refined",
"structure",
"is",
"a",
"*",
"conventional",
"*",
"cell",
"setting",
"with",
"atoms",
"moved",
"to",
"the",
"expected",
"symmetry",
"positions",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L319-L334 | [
"def",
"get_refined_structure",
"(",
"self",
")",
":",
"# Atomic positions have to be specified by scaled positions for spglib.",
"lattice",
",",
"scaled_positions",
",",
"numbers",
"=",
"spglib",
".",
"refine_cell",
"(",
"self",
".",
"_cell",
",",
"self",
".",
"_sympre... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.find_primitive | Find a primitive version of the unit cell.
Returns:
A primitive cell in the input cell is searched and returned
as an Structure object. If no primitive cell is found, None is
returned. | pymatgen/symmetry/analyzer.py | def find_primitive(self):
"""
Find a primitive version of the unit cell.
Returns:
A primitive cell in the input cell is searched and returned
as an Structure object. If no primitive cell is found, None is
returned.
"""
lattice, scaled_position... | def find_primitive(self):
"""
Find a primitive version of the unit cell.
Returns:
A primitive cell in the input cell is searched and returned
as an Structure object. If no primitive cell is found, None is
returned.
"""
lattice, scaled_position... | [
"Find",
"a",
"primitive",
"version",
"of",
"the",
"unit",
"cell",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L336-L351 | [
"def",
"find_primitive",
"(",
"self",
")",
":",
"lattice",
",",
"scaled_positions",
",",
"numbers",
"=",
"spglib",
".",
"find_primitive",
"(",
"self",
".",
"_cell",
",",
"symprec",
"=",
"self",
".",
"_symprec",
")",
"species",
"=",
"[",
"self",
".",
"_un... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_ir_reciprocal_mesh | k-point mesh of the Brillouin zone generated taken into account
symmetry.The method returns the irreducible kpoints of the mesh
and their weights
Args:
mesh (3x1 array): The number of kpoint for the mesh needed in
each direction
is_shift (3x1 array): Whet... | pymatgen/symmetry/analyzer.py | def get_ir_reciprocal_mesh(self, mesh=(10, 10, 10), is_shift=(0, 0, 0)):
"""
k-point mesh of the Brillouin zone generated taken into account
symmetry.The method returns the irreducible kpoints of the mesh
and their weights
Args:
mesh (3x1 array): The number of kpoint... | def get_ir_reciprocal_mesh(self, mesh=(10, 10, 10), is_shift=(0, 0, 0)):
"""
k-point mesh of the Brillouin zone generated taken into account
symmetry.The method returns the irreducible kpoints of the mesh
and their weights
Args:
mesh (3x1 array): The number of kpoint... | [
"k",
"-",
"point",
"mesh",
"of",
"the",
"Brillouin",
"zone",
"generated",
"taken",
"into",
"account",
"symmetry",
".",
"The",
"method",
"returns",
"the",
"irreducible",
"kpoints",
"of",
"the",
"mesh",
"and",
"their",
"weights"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L353-L378 | [
"def",
"get_ir_reciprocal_mesh",
"(",
"self",
",",
"mesh",
"=",
"(",
"10",
",",
"10",
",",
"10",
")",
",",
"is_shift",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"shift",
"=",
"np",
".",
"array",
"(",
"[",
"1",
"if",
"i",
"else",
"0",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_conventional_to_primitive_transformation_matrix | Gives the transformation matrix to transform a conventional
unit cell to a primitive cell according to certain standards
the standards are defined in Setyawan, W., & Curtarolo, S. (2010).
High-throughput electronic band structure calculations:
Challenges and tools. Computational Material... | pymatgen/symmetry/analyzer.py | def get_conventional_to_primitive_transformation_matrix(self, international_monoclinic=True):
"""
Gives the transformation matrix to transform a conventional
unit cell to a primitive cell according to certain standards
the standards are defined in Setyawan, W., & Curtarolo, S. (2010).
... | def get_conventional_to_primitive_transformation_matrix(self, international_monoclinic=True):
"""
Gives the transformation matrix to transform a conventional
unit cell to a primitive cell according to certain standards
the standards are defined in Setyawan, W., & Curtarolo, S. (2010).
... | [
"Gives",
"the",
"transformation",
"matrix",
"to",
"transform",
"a",
"conventional",
"unit",
"cell",
"to",
"a",
"primitive",
"cell",
"according",
"to",
"certain",
"standards",
"the",
"standards",
"are",
"defined",
"in",
"Setyawan",
"W",
".",
"&",
"Curtarolo",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L380-L425 | [
"def",
"get_conventional_to_primitive_transformation_matrix",
"(",
"self",
",",
"international_monoclinic",
"=",
"True",
")",
":",
"conv",
"=",
"self",
".",
"get_conventional_standard_structure",
"(",
"international_monoclinic",
"=",
"international_monoclinic",
")",
"lattice"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_primitive_standard_structure | Gives a structure with a primitive cell according to certain standards
the standards are defined in Setyawan, W., & Curtarolo, S. (2010).
High-throughput electronic band structure calculations:
Challenges and tools. Computational Materials Science,
49(2), 299-312. doi:10.1016/j.commatsci... | pymatgen/symmetry/analyzer.py | def get_primitive_standard_structure(self, international_monoclinic=True):
"""
Gives a structure with a primitive cell according to certain standards
the standards are defined in Setyawan, W., & Curtarolo, S. (2010).
High-throughput electronic band structure calculations:
Challen... | def get_primitive_standard_structure(self, international_monoclinic=True):
"""
Gives a structure with a primitive cell according to certain standards
the standards are defined in Setyawan, W., & Curtarolo, S. (2010).
High-throughput electronic band structure calculations:
Challen... | [
"Gives",
"a",
"structure",
"with",
"a",
"primitive",
"cell",
"according",
"to",
"certain",
"standards",
"the",
"standards",
"are",
"defined",
"in",
"Setyawan",
"W",
".",
"&",
"Curtarolo",
"S",
".",
"(",
"2010",
")",
".",
"High",
"-",
"throughput",
"electro... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L427-L478 | [
"def",
"get_primitive_standard_structure",
"(",
"self",
",",
"international_monoclinic",
"=",
"True",
")",
":",
"conv",
"=",
"self",
".",
"get_conventional_standard_structure",
"(",
"international_monoclinic",
"=",
"international_monoclinic",
")",
"lattice",
"=",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_conventional_standard_structure | Gives a structure with a conventional cell according to certain
standards. The standards are defined in Setyawan, W., & Curtarolo,
S. (2010). High-throughput electronic band structure calculations:
Challenges and tools. Computational Materials Science,
49(2), 299-312. doi:10.1016/j.comma... | pymatgen/symmetry/analyzer.py | def get_conventional_standard_structure(
self, international_monoclinic=True):
"""
Gives a structure with a conventional cell according to certain
standards. The standards are defined in Setyawan, W., & Curtarolo,
S. (2010). High-throughput electronic band structure calculati... | def get_conventional_standard_structure(
self, international_monoclinic=True):
"""
Gives a structure with a conventional cell according to certain
standards. The standards are defined in Setyawan, W., & Curtarolo,
S. (2010). High-throughput electronic band structure calculati... | [
"Gives",
"a",
"structure",
"with",
"a",
"conventional",
"cell",
"according",
"to",
"certain",
"standards",
".",
"The",
"standards",
"are",
"defined",
"in",
"Setyawan",
"W",
".",
"&",
"Curtarolo",
"S",
".",
"(",
"2010",
")",
".",
"High",
"-",
"throughput",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L480-L757 | [
"def",
"get_conventional_standard_structure",
"(",
"self",
",",
"international_monoclinic",
"=",
"True",
")",
":",
"tol",
"=",
"1e-5",
"struct",
"=",
"self",
".",
"get_refined_structure",
"(",
")",
"latt",
"=",
"struct",
".",
"lattice",
"latt_type",
"=",
"self",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SpacegroupAnalyzer.get_kpoint_weights | Calculate the weights for a list of kpoints.
Args:
kpoints (Sequence): Sequence of kpoints. np.arrays is fine. Note
that the code does not check that the list of kpoints
provided does not contain duplicates.
atol (float): Tolerance for fractional coordina... | pymatgen/symmetry/analyzer.py | def get_kpoint_weights(self, kpoints, atol=1e-5):
"""
Calculate the weights for a list of kpoints.
Args:
kpoints (Sequence): Sequence of kpoints. np.arrays is fine. Note
that the code does not check that the list of kpoints
provided does not contain d... | def get_kpoint_weights(self, kpoints, atol=1e-5):
"""
Calculate the weights for a list of kpoints.
Args:
kpoints (Sequence): Sequence of kpoints. np.arrays is fine. Note
that the code does not check that the list of kpoints
provided does not contain d... | [
"Calculate",
"the",
"weights",
"for",
"a",
"list",
"of",
"kpoints",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L759-L807 | [
"def",
"get_kpoint_weights",
"(",
"self",
",",
"kpoints",
",",
"atol",
"=",
"1e-5",
")",
":",
"kpts",
"=",
"np",
".",
"array",
"(",
"kpoints",
")",
"shift",
"=",
"[",
"]",
"mesh",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"n... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._proc_asym_top | Handles assymetric top molecules, which cannot contain rotational
symmetry larger than 2. | pymatgen/symmetry/analyzer.py | def _proc_asym_top(self):
"""
Handles assymetric top molecules, which cannot contain rotational
symmetry larger than 2.
"""
self._check_R2_axes_asym()
if len(self.rot_sym) == 0:
logger.debug("No rotation symmetries detected.")
self._proc_no_rot_sym... | def _proc_asym_top(self):
"""
Handles assymetric top molecules, which cannot contain rotational
symmetry larger than 2.
"""
self._check_R2_axes_asym()
if len(self.rot_sym) == 0:
logger.debug("No rotation symmetries detected.")
self._proc_no_rot_sym... | [
"Handles",
"assymetric",
"top",
"molecules",
"which",
"cannot",
"contain",
"rotational",
"symmetry",
"larger",
"than",
"2",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L923-L937 | [
"def",
"_proc_asym_top",
"(",
"self",
")",
":",
"self",
".",
"_check_R2_axes_asym",
"(",
")",
"if",
"len",
"(",
"self",
".",
"rot_sym",
")",
"==",
"0",
":",
"logger",
".",
"debug",
"(",
"\"No rotation symmetries detected.\"",
")",
"self",
".",
"_proc_no_rot_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._proc_sym_top | Handles symetric top molecules which has one unique eigenvalue whose
corresponding principal axis is a unique rotational axis. More complex
handling required to look for R2 axes perpendicular to this unique
axis. | pymatgen/symmetry/analyzer.py | def _proc_sym_top(self):
"""
Handles symetric top molecules which has one unique eigenvalue whose
corresponding principal axis is a unique rotational axis. More complex
handling required to look for R2 axes perpendicular to this unique
axis.
"""
if abs(self.eigva... | def _proc_sym_top(self):
"""
Handles symetric top molecules which has one unique eigenvalue whose
corresponding principal axis is a unique rotational axis. More complex
handling required to look for R2 axes perpendicular to this unique
axis.
"""
if abs(self.eigva... | [
"Handles",
"symetric",
"top",
"molecules",
"which",
"has",
"one",
"unique",
"eigenvalue",
"whose",
"corresponding",
"principal",
"axis",
"is",
"a",
"unique",
"rotational",
"axis",
".",
"More",
"complex",
"handling",
"required",
"to",
"look",
"for",
"R2",
"axes",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L939-L964 | [
"def",
"_proc_sym_top",
"(",
"self",
")",
":",
"if",
"abs",
"(",
"self",
".",
"eigvals",
"[",
"0",
"]",
"-",
"self",
".",
"eigvals",
"[",
"1",
"]",
")",
"<",
"self",
".",
"eig_tol",
":",
"ind",
"=",
"2",
"elif",
"abs",
"(",
"self",
".",
"eigval... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._proc_no_rot_sym | Handles molecules with no rotational symmetry. Only possible point
groups are C1, Cs and Ci. | pymatgen/symmetry/analyzer.py | def _proc_no_rot_sym(self):
"""
Handles molecules with no rotational symmetry. Only possible point
groups are C1, Cs and Ci.
"""
self.sch_symbol = "C1"
if self.is_valid_op(PointGroupAnalyzer.inversion_op):
self.sch_symbol = "Ci"
self.symmops.append... | def _proc_no_rot_sym(self):
"""
Handles molecules with no rotational symmetry. Only possible point
groups are C1, Cs and Ci.
"""
self.sch_symbol = "C1"
if self.is_valid_op(PointGroupAnalyzer.inversion_op):
self.sch_symbol = "Ci"
self.symmops.append... | [
"Handles",
"molecules",
"with",
"no",
"rotational",
"symmetry",
".",
"Only",
"possible",
"point",
"groups",
"are",
"C1",
"Cs",
"and",
"Ci",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L966-L980 | [
"def",
"_proc_no_rot_sym",
"(",
"self",
")",
":",
"self",
".",
"sch_symbol",
"=",
"\"C1\"",
"if",
"self",
".",
"is_valid_op",
"(",
"PointGroupAnalyzer",
".",
"inversion_op",
")",
":",
"self",
".",
"sch_symbol",
"=",
"\"Ci\"",
"self",
".",
"symmops",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._proc_cyclic | Handles cyclic group molecules. | pymatgen/symmetry/analyzer.py | def _proc_cyclic(self):
"""
Handles cyclic group molecules.
"""
main_axis, rot = max(self.rot_sym, key=lambda v: v[1])
self.sch_symbol = "C{}".format(rot)
mirror_type = self._find_mirror(main_axis)
if mirror_type == "h":
self.sch_symbol += "h"
... | def _proc_cyclic(self):
"""
Handles cyclic group molecules.
"""
main_axis, rot = max(self.rot_sym, key=lambda v: v[1])
self.sch_symbol = "C{}".format(rot)
mirror_type = self._find_mirror(main_axis)
if mirror_type == "h":
self.sch_symbol += "h"
... | [
"Handles",
"cyclic",
"group",
"molecules",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L982-L996 | [
"def",
"_proc_cyclic",
"(",
"self",
")",
":",
"main_axis",
",",
"rot",
"=",
"max",
"(",
"self",
".",
"rot_sym",
",",
"key",
"=",
"lambda",
"v",
":",
"v",
"[",
"1",
"]",
")",
"self",
".",
"sch_symbol",
"=",
"\"C{}\"",
".",
"format",
"(",
"rot",
")... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._proc_dihedral | Handles dihedral group molecules, i.e those with intersecting R2 axes
and a main axis. | pymatgen/symmetry/analyzer.py | def _proc_dihedral(self):
"""
Handles dihedral group molecules, i.e those with intersecting R2 axes
and a main axis.
"""
main_axis, rot = max(self.rot_sym, key=lambda v: v[1])
self.sch_symbol = "D{}".format(rot)
mirror_type = self._find_mirror(main_axis)
i... | def _proc_dihedral(self):
"""
Handles dihedral group molecules, i.e those with intersecting R2 axes
and a main axis.
"""
main_axis, rot = max(self.rot_sym, key=lambda v: v[1])
self.sch_symbol = "D{}".format(rot)
mirror_type = self._find_mirror(main_axis)
i... | [
"Handles",
"dihedral",
"group",
"molecules",
"i",
".",
"e",
"those",
"with",
"intersecting",
"R2",
"axes",
"and",
"a",
"main",
"axis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L998-L1009 | [
"def",
"_proc_dihedral",
"(",
"self",
")",
":",
"main_axis",
",",
"rot",
"=",
"max",
"(",
"self",
".",
"rot_sym",
",",
"key",
"=",
"lambda",
"v",
":",
"v",
"[",
"1",
"]",
")",
"self",
".",
"sch_symbol",
"=",
"\"D{}\"",
".",
"format",
"(",
"rot",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PointGroupAnalyzer._check_R2_axes_asym | Test for 2-fold rotation along the principal axes. Used to handle
asymetric top molecules. | pymatgen/symmetry/analyzer.py | def _check_R2_axes_asym(self):
"""
Test for 2-fold rotation along the principal axes. Used to handle
asymetric top molecules.
"""
for v in self.principal_axes:
op = SymmOp.from_axis_angle_and_translation(v, 180)
if self.is_valid_op(op):
sel... | def _check_R2_axes_asym(self):
"""
Test for 2-fold rotation along the principal axes. Used to handle
asymetric top molecules.
"""
for v in self.principal_axes:
op = SymmOp.from_axis_angle_and_translation(v, 180)
if self.is_valid_op(op):
sel... | [
"Test",
"for",
"2",
"-",
"fold",
"rotation",
"along",
"the",
"principal",
"axes",
".",
"Used",
"to",
"handle",
"asymetric",
"top",
"molecules",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/symmetry/analyzer.py#L1011-L1020 | [
"def",
"_check_R2_axes_asym",
"(",
"self",
")",
":",
"for",
"v",
"in",
"self",
".",
"principal_axes",
":",
"op",
"=",
"SymmOp",
".",
"from_axis_angle_and_translation",
"(",
"v",
",",
"180",
")",
"if",
"self",
".",
"is_valid_op",
"(",
"op",
")",
":",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.