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
ScrTask.open_scr
Open the SIGRES file located in the in self.outdir. Returns :class:`ScrFile` object, None if file could not be found or file is not readable.
pymatgen/io/abinit/tasks.py
def open_scr(self): """ Open the SIGRES file located in the in self.outdir. Returns :class:`ScrFile` object, None if file could not be found or file is not readable. """ scr_path = self.scr_path if not scr_path: logger.critical("%s didn't produce a SCR.nc fil...
def open_scr(self): """ Open the SIGRES file located in the in self.outdir. Returns :class:`ScrFile` object, None if file could not be found or file is not readable. """ scr_path = self.scr_path if not scr_path: logger.critical("%s didn't produce a SCR.nc fil...
[ "Open", "the", "SIGRES", "file", "located", "in", "the", "in", "self", ".", "outdir", ".", "Returns", ":", "class", ":", "ScrFile", "object", "None", "if", "file", "could", "not", "be", "found", "or", "file", "is", "not", "readable", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L3887-L3904
[ "def", "open_scr", "(", "self", ")", ":", "scr_path", "=", "self", ".", "scr_path", "if", "not", "scr_path", ":", "logger", ".", "critical", "(", "\"%s didn't produce a SCR.nc file in %s\"", "%", "(", "self", ",", "self", ".", "outdir", ")", ")", "return", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SigmaTask.sigres_path
Absolute path of the SIGRES file. Empty string if file is not present.
pymatgen/io/abinit/tasks.py
def sigres_path(self): """Absolute path of the SIGRES file. Empty string if file is not present.""" # Lazy property to avoid multiple calls to has_abiext. try: return self._sigres_path except AttributeError: path = self.outdir.has_abiext("SIGRES") if p...
def sigres_path(self): """Absolute path of the SIGRES file. Empty string if file is not present.""" # Lazy property to avoid multiple calls to has_abiext. try: return self._sigres_path except AttributeError: path = self.outdir.has_abiext("SIGRES") if p...
[ "Absolute", "path", "of", "the", "SIGRES", "file", ".", "Empty", "string", "if", "file", "is", "not", "present", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L3939-L3947
[ "def", "sigres_path", "(", "self", ")", ":", "# Lazy property to avoid multiple calls to has_abiext.", "try", ":", "return", "self", ".", "_sigres_path", "except", "AttributeError", ":", "path", "=", "self", ".", "outdir", ".", "has_abiext", "(", "\"SIGRES\"", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SigmaTask.open_sigres
Open the SIGRES file located in the in self.outdir. Returns :class:`SigresFile` object, None if file could not be found or file is not readable.
pymatgen/io/abinit/tasks.py
def open_sigres(self): """ Open the SIGRES file located in the in self.outdir. Returns :class:`SigresFile` object, None if file could not be found or file is not readable. """ sigres_path = self.sigres_path if not sigres_path: logger.critical("%s didn't produ...
def open_sigres(self): """ Open the SIGRES file located in the in self.outdir. Returns :class:`SigresFile` object, None if file could not be found or file is not readable. """ sigres_path = self.sigres_path if not sigres_path: logger.critical("%s didn't produ...
[ "Open", "the", "SIGRES", "file", "located", "in", "the", "in", "self", ".", "outdir", ".", "Returns", ":", "class", ":", "SigresFile", "object", "None", "if", "file", "could", "not", "be", "found", "or", "file", "is", "not", "readable", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L3949-L3966
[ "def", "open_sigres", "(", "self", ")", ":", "sigres_path", "=", "self", ".", "sigres_path", "if", "not", "sigres_path", ":", "logger", ".", "critical", "(", "\"%s didn't produce a SIGRES file in %s\"", "%", "(", "self", ",", "self", ".", "outdir", ")", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SigmaTask.get_scissors_builder
Returns an instance of :class:`ScissorsBuilder` from the SIGRES file. Raise: `RuntimeError` if SIGRES file is not found.
pymatgen/io/abinit/tasks.py
def get_scissors_builder(self): """ Returns an instance of :class:`ScissorsBuilder` from the SIGRES file. Raise: `RuntimeError` if SIGRES file is not found. """ from abipy.electrons.scissors import ScissorsBuilder if self.sigres_path: return Sciss...
def get_scissors_builder(self): """ Returns an instance of :class:`ScissorsBuilder` from the SIGRES file. Raise: `RuntimeError` if SIGRES file is not found. """ from abipy.electrons.scissors import ScissorsBuilder if self.sigres_path: return Sciss...
[ "Returns", "an", "instance", "of", ":", "class", ":", "ScissorsBuilder", "from", "the", "SIGRES", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L3968-L3979
[ "def", "get_scissors_builder", "(", "self", ")", ":", "from", "abipy", ".", "electrons", ".", "scissors", "import", "ScissorsBuilder", "if", "self", ".", "sigres_path", ":", "return", "ScissorsBuilder", ".", "from_file", "(", "self", ".", "sigres_path", ")", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BseTask.restart
BSE calculations with Haydock can be restarted only if we have the excitonic Hamiltonian and the HAYDR_SAVE file.
pymatgen/io/abinit/tasks.py
def restart(self): """ BSE calculations with Haydock can be restarted only if we have the excitonic Hamiltonian and the HAYDR_SAVE file. """ # TODO: This version seems to work but the main output file is truncated # TODO: Handle restart if CG method is used # TODO...
def restart(self): """ BSE calculations with Haydock can be restarted only if we have the excitonic Hamiltonian and the HAYDR_SAVE file. """ # TODO: This version seems to work but the main output file is truncated # TODO: Handle restart if CG method is used # TODO...
[ "BSE", "calculations", "with", "Haydock", "can", "be", "restarted", "only", "if", "we", "have", "the", "excitonic", "Hamiltonian", "and", "the", "HAYDR_SAVE", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4008-L4060
[ "def", "restart", "(", "self", ")", ":", "# TODO: This version seems to work but the main output file is truncated", "# TODO: Handle restart if CG method is used", "# TODO: restart should receive a list of critical events", "# the log file is complete though.", "irdvars", "=", "{", "}", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BseTask.mdf_path
Absolute path of the MDF file. Empty string if file is not present.
pymatgen/io/abinit/tasks.py
def mdf_path(self): """Absolute path of the MDF file. Empty string if file is not present.""" # Lazy property to avoid multiple calls to has_abiext. try: return self._mdf_path except AttributeError: path = self.outdir.has_abiext("MDF.nc") if path: self...
def mdf_path(self): """Absolute path of the MDF file. Empty string if file is not present.""" # Lazy property to avoid multiple calls to has_abiext. try: return self._mdf_path except AttributeError: path = self.outdir.has_abiext("MDF.nc") if path: self...
[ "Absolute", "path", "of", "the", "MDF", "file", ".", "Empty", "string", "if", "file", "is", "not", "present", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4075-L4083
[ "def", "mdf_path", "(", "self", ")", ":", "# Lazy property to avoid multiple calls to has_abiext.", "try", ":", "return", "self", ".", "_mdf_path", "except", "AttributeError", ":", "path", "=", "self", ".", "outdir", ".", "has_abiext", "(", "\"MDF.nc\"", ")", "if"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
BseTask.open_mdf
Open the MDF file located in the in self.outdir. Returns :class:`MdfFile` object, None if file could not be found or file is not readable.
pymatgen/io/abinit/tasks.py
def open_mdf(self): """ Open the MDF file located in the in self.outdir. Returns :class:`MdfFile` object, None if file could not be found or file is not readable. """ mdf_path = self.mdf_path if not mdf_path: logger.critical("%s didn't produce a MDF file in %s...
def open_mdf(self): """ Open the MDF file located in the in self.outdir. Returns :class:`MdfFile` object, None if file could not be found or file is not readable. """ mdf_path = self.mdf_path if not mdf_path: logger.critical("%s didn't produce a MDF file in %s...
[ "Open", "the", "MDF", "file", "located", "in", "the", "in", "self", ".", "outdir", ".", "Returns", ":", "class", ":", "MdfFile", "object", "None", "if", "file", "could", "not", "be", "found", "or", "file", "is", "not", "readable", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4085-L4101
[ "def", "open_mdf", "(", "self", ")", ":", "mdf_path", "=", "self", ".", "mdf_path", "if", "not", "mdf_path", ":", "logger", ".", "critical", "(", "\"%s didn't produce a MDF file in %s\"", "%", "(", "self", ",", "self", ".", "outdir", ")", ")", "return", "N...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
OpticTask.set_workdir
Set the working directory of the task.
pymatgen/io/abinit/tasks.py
def set_workdir(self, workdir, chroot=False): """Set the working directory of the task.""" super().set_workdir(workdir, chroot=chroot) # Small hack: the log file of optics is actually the main output file. self.output_file = self.log_file
def set_workdir(self, workdir, chroot=False): """Set the working directory of the task.""" super().set_workdir(workdir, chroot=chroot) # Small hack: the log file of optics is actually the main output file. self.output_file = self.log_file
[ "Set", "the", "working", "directory", "of", "the", "task", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4149-L4153
[ "def", "set_workdir", "(", "self", ",", "workdir", ",", "chroot", "=", "False", ")", ":", "super", "(", ")", ".", "set_workdir", "(", "workdir", ",", "chroot", "=", "chroot", ")", "# Small hack: the log file of optics is actually the main output file.", "self", "....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
OpticTask.set_vars
Optic does not use `get` or `ird` variables hence we should never try to change the input when we connect this task
pymatgen/io/abinit/tasks.py
def set_vars(self, *args, **kwargs): """ Optic does not use `get` or `ird` variables hence we should never try to change the input when we connect this task """ kwargs.update(dict(*args)) self.history.info("OpticTask intercepted set_vars with args %s" % kwargs) i...
def set_vars(self, *args, **kwargs): """ Optic does not use `get` or `ird` variables hence we should never try to change the input when we connect this task """ kwargs.update(dict(*args)) self.history.info("OpticTask intercepted set_vars with args %s" % kwargs) i...
[ "Optic", "does", "not", "use", "get", "or", "ird", "variables", "hence", "we", "should", "never", "try", "to", "change", "the", "input", "when", "we", "connect", "this", "task" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4155-L4164
[ "def", "set_vars", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "dict", "(", "*", "args", ")", ")", "self", ".", "history", ".", "info", "(", "\"OpticTask intercepted set_vars with args %s\"", "%", "kwar...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
OpticTask.filesfile_string
String with the list of files and prefixes needed to execute ABINIT.
pymatgen/io/abinit/tasks.py
def filesfile_string(self): """String with the list of files and prefixes needed to execute ABINIT.""" lines = [] app = lines.append #optic.in ! Name of input file #optic.out ! Unused #optic ! Root name for all files that will be produced app(self.i...
def filesfile_string(self): """String with the list of files and prefixes needed to execute ABINIT.""" lines = [] app = lines.append #optic.in ! Name of input file #optic.out ! Unused #optic ! Root name for all files that will be produced app(self.i...
[ "String", "with", "the", "list", "of", "files", "and", "prefixes", "needed", "to", "execute", "ABINIT", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4175-L4187
[ "def", "filesfile_string", "(", "self", ")", ":", "lines", "=", "[", "]", "app", "=", "lines", ".", "append", "#optic.in ! Name of input file", "#optic.out ! Unused", "#optic ! Root name for all files that will be produced", "app", "(", "self", ".", "input_f...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
OpticTask.ddk_filepaths
Returns (at runtime) the absolute path of the DDK files produced by the DDK runs.
pymatgen/io/abinit/tasks.py
def ddk_filepaths(self): """Returns (at runtime) the absolute path of the DDK files produced by the DDK runs.""" # This to support new version of optic that used DDK.nc paths = [ddk_task.outdir.has_abiext("DDK.nc") for ddk_task in self.ddk_nodes] if all(p for p in paths): ret...
def ddk_filepaths(self): """Returns (at runtime) the absolute path of the DDK files produced by the DDK runs.""" # This to support new version of optic that used DDK.nc paths = [ddk_task.outdir.has_abiext("DDK.nc") for ddk_task in self.ddk_nodes] if all(p for p in paths): ret...
[ "Returns", "(", "at", "runtime", ")", "the", "absolute", "path", "of", "the", "DDK", "files", "produced", "by", "the", "DDK", "runs", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4195-L4203
[ "def", "ddk_filepaths", "(", "self", ")", ":", "# This to support new version of optic that used DDK.nc", "paths", "=", "[", "ddk_task", ".", "outdir", ".", "has_abiext", "(", "\"DDK.nc\"", ")", "for", "ddk_task", "in", "self", ".", "ddk_nodes", "]", "if", "all", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
OpticTask.make_input
Construct and write the input file of the calculation.
pymatgen/io/abinit/tasks.py
def make_input(self): """Construct and write the input file of the calculation.""" # Set the file paths. all_files ={"ddkfile_" + str(n + 1): ddk for n, ddk in enumerate(self.ddk_filepaths)} all_files.update({"wfkfile": self.wfk_filepath}) files_nml = {"FILES": all_files} ...
def make_input(self): """Construct and write the input file of the calculation.""" # Set the file paths. all_files ={"ddkfile_" + str(n + 1): ddk for n, ddk in enumerate(self.ddk_filepaths)} all_files.update({"wfkfile": self.wfk_filepath}) files_nml = {"FILES": all_files} ...
[ "Construct", "and", "write", "the", "input", "file", "of", "the", "calculation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4205-L4217
[ "def", "make_input", "(", "self", ")", ":", "# Set the file paths.", "all_files", "=", "{", "\"ddkfile_\"", "+", "str", "(", "n", "+", "1", ")", ":", "ddk", "for", "n", ",", "ddk", "in", "enumerate", "(", "self", ".", "ddk_filepaths", ")", "}", "all_fi...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
OpticTask.reset_from_scratch
restart from scratch, this is to be used if a job is restarted with more resources after a crash
pymatgen/io/abinit/tasks.py
def reset_from_scratch(self): """ restart from scratch, this is to be used if a job is restarted with more resources after a crash """ # Move output files produced in workdir to _reset otherwise check_status continues # to see the task as crashed even if the job did not run ...
def reset_from_scratch(self): """ restart from scratch, this is to be used if a job is restarted with more resources after a crash """ # Move output files produced in workdir to _reset otherwise check_status continues # to see the task as crashed even if the job did not run ...
[ "restart", "from", "scratch", "this", "is", "to", "be", "used", "if", "a", "job", "is", "restarted", "with", "more", "resources", "after", "a", "crash" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4238-L4273
[ "def", "reset_from_scratch", "(", "self", ")", ":", "# Move output files produced in workdir to _reset otherwise check_status continues", "# to see the task as crashed even if the job did not run", "# Create reset directory if not already done.", "reset_dir", "=", "os", ".", "path", ".",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.temp_shell_task
Build a :class:`AnaddbTask` with a temporary workdir. The task is executed via the shell with 1 MPI proc. Mainly used for post-processing the DDB files. Args: mpi_procs: Number of MPI processes to use. anaddb_input: string with the anaddb variables. ddb_node: The nod...
pymatgen/io/abinit/tasks.py
def temp_shell_task(cls, inp, ddb_node, mpi_procs=1, gkk_node=None, md_node=None, ddk_node=None, workdir=None, manager=None): """ Build a :class:`AnaddbTask` with a temporary workdir. The task is executed via the shell with 1 MPI proc. Mainly used for post-processing the ...
def temp_shell_task(cls, inp, ddb_node, mpi_procs=1, gkk_node=None, md_node=None, ddk_node=None, workdir=None, manager=None): """ Build a :class:`AnaddbTask` with a temporary workdir. The task is executed via the shell with 1 MPI proc. Mainly used for post-processing the ...
[ "Build", "a", ":", "class", ":", "AnaddbTask", "with", "a", "temporary", "workdir", ".", "The", "task", "is", "executed", "via", "the", "shell", "with", "1", "MPI", "proc", ".", "Mainly", "used", "for", "post", "-", "processing", "the", "DDB", "files", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4524-L4545
[ "def", "temp_shell_task", "(", "cls", ",", "inp", ",", "ddb_node", ",", "mpi_procs", "=", "1", ",", "gkk_node", "=", "None", ",", "md_node", "=", "None", ",", "ddk_node", "=", "None", ",", "workdir", "=", "None", ",", "manager", "=", "None", ")", ":"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.filesfile_string
String with the list of files and prefixes needed to execute ABINIT.
pymatgen/io/abinit/tasks.py
def filesfile_string(self): """String with the list of files and prefixes needed to execute ABINIT.""" lines = [] app = lines.append app(self.input_file.path) # 1) Path of the input file app(self.output_file.path) # 2) Path of the output file app(self.dd...
def filesfile_string(self): """String with the list of files and prefixes needed to execute ABINIT.""" lines = [] app = lines.append app(self.input_file.path) # 1) Path of the input file app(self.output_file.path) # 2) Path of the output file app(self.dd...
[ "String", "with", "the", "list", "of", "files", "and", "prefixes", "needed", "to", "execute", "ABINIT", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4556-L4569
[ "def", "filesfile_string", "(", "self", ")", ":", "lines", "=", "[", "]", "app", "=", "lines", ".", "append", "app", "(", "self", ".", "input_file", ".", "path", ")", "# 1) Path of the input file", "app", "(", "self", ".", "output_file", ".", "path", ")"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.ddb_filepath
Returns (at runtime) the absolute path of the input DDB file.
pymatgen/io/abinit/tasks.py
def ddb_filepath(self): """Returns (at runtime) the absolute path of the input DDB file.""" # This is not very elegant! A possible approach could to be path self.ddb_node.outdir! if isinstance(self.ddb_node, FileNode): return self.ddb_node.filepath path = self.ddb_node.outdir.has_abiext(...
def ddb_filepath(self): """Returns (at runtime) the absolute path of the input DDB file.""" # This is not very elegant! A possible approach could to be path self.ddb_node.outdir! if isinstance(self.ddb_node, FileNode): return self.ddb_node.filepath path = self.ddb_node.outdir.has_abiext(...
[ "Returns", "(", "at", "runtime", ")", "the", "absolute", "path", "of", "the", "input", "DDB", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4572-L4577
[ "def", "ddb_filepath", "(", "self", ")", ":", "# This is not very elegant! A possible approach could to be path self.ddb_node.outdir!", "if", "isinstance", "(", "self", ".", "ddb_node", ",", "FileNode", ")", ":", "return", "self", ".", "ddb_node", ".", "filepath", "path...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.md_filepath
Returns (at runtime) the absolute path of the input MD file.
pymatgen/io/abinit/tasks.py
def md_filepath(self): """Returns (at runtime) the absolute path of the input MD file.""" if self.md_node is None: return "MD_FILE_DOES_NOT_EXIST" if isinstance(self.md_node, FileNode): return self.md_node.filepath path = self.md_node.outdir.has_abiext("MD") return path if path ...
def md_filepath(self): """Returns (at runtime) the absolute path of the input MD file.""" if self.md_node is None: return "MD_FILE_DOES_NOT_EXIST" if isinstance(self.md_node, FileNode): return self.md_node.filepath path = self.md_node.outdir.has_abiext("MD") return path if path ...
[ "Returns", "(", "at", "runtime", ")", "the", "absolute", "path", "of", "the", "input", "MD", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4580-L4586
[ "def", "md_filepath", "(", "self", ")", ":", "if", "self", ".", "md_node", "is", "None", ":", "return", "\"MD_FILE_DOES_NOT_EXIST\"", "if", "isinstance", "(", "self", ".", "md_node", ",", "FileNode", ")", ":", "return", "self", ".", "md_node", ".", "filepa...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.gkk_filepath
Returns (at runtime) the absolute path of the input GKK file.
pymatgen/io/abinit/tasks.py
def gkk_filepath(self): """Returns (at runtime) the absolute path of the input GKK file.""" if self.gkk_node is None: return "GKK_FILE_DOES_NOT_EXIST" if isinstance(self.gkk_node, FileNode): return self.gkk_node.filepath path = self.gkk_node.outdir.has_abiext("GKK") return path ...
def gkk_filepath(self): """Returns (at runtime) the absolute path of the input GKK file.""" if self.gkk_node is None: return "GKK_FILE_DOES_NOT_EXIST" if isinstance(self.gkk_node, FileNode): return self.gkk_node.filepath path = self.gkk_node.outdir.has_abiext("GKK") return path ...
[ "Returns", "(", "at", "runtime", ")", "the", "absolute", "path", "of", "the", "input", "GKK", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4589-L4595
[ "def", "gkk_filepath", "(", "self", ")", ":", "if", "self", ".", "gkk_node", "is", "None", ":", "return", "\"GKK_FILE_DOES_NOT_EXIST\"", "if", "isinstance", "(", "self", ".", "gkk_node", ",", "FileNode", ")", ":", "return", "self", ".", "gkk_node", ".", "f...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.ddk_filepath
Returns (at runtime) the absolute path of the input DKK file.
pymatgen/io/abinit/tasks.py
def ddk_filepath(self): """Returns (at runtime) the absolute path of the input DKK file.""" if self.ddk_node is None: return "DDK_FILE_DOES_NOT_EXIST" if isinstance(self.ddk_node, FileNode): return self.ddk_node.filepath path = self.ddk_node.outdir.has_abiext("DDK") return path ...
def ddk_filepath(self): """Returns (at runtime) the absolute path of the input DKK file.""" if self.ddk_node is None: return "DDK_FILE_DOES_NOT_EXIST" if isinstance(self.ddk_node, FileNode): return self.ddk_node.filepath path = self.ddk_node.outdir.has_abiext("DDK") return path ...
[ "Returns", "(", "at", "runtime", ")", "the", "absolute", "path", "of", "the", "input", "DKK", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4598-L4604
[ "def", "ddk_filepath", "(", "self", ")", ":", "if", "self", ".", "ddk_node", "is", "None", ":", "return", "\"DDK_FILE_DOES_NOT_EXIST\"", "if", "isinstance", "(", "self", ".", "ddk_node", ",", "FileNode", ")", ":", "return", "self", ".", "ddk_node", ".", "f...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.open_phbst
Open PHBST file produced by Anaddb and returns :class:`PhbstFile` object.
pymatgen/io/abinit/tasks.py
def open_phbst(self): """Open PHBST file produced by Anaddb and returns :class:`PhbstFile` object.""" from abipy.dfpt.phonons import PhbstFile phbst_path = os.path.join(self.workdir, "run.abo_PHBST.nc") if not phbst_path: if self.status == self.S_OK: logger.cr...
def open_phbst(self): """Open PHBST file produced by Anaddb and returns :class:`PhbstFile` object.""" from abipy.dfpt.phonons import PhbstFile phbst_path = os.path.join(self.workdir, "run.abo_PHBST.nc") if not phbst_path: if self.status == self.S_OK: logger.cr...
[ "Open", "PHBST", "file", "produced", "by", "Anaddb", "and", "returns", ":", "class", ":", "PhbstFile", "object", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4615-L4628
[ "def", "open_phbst", "(", "self", ")", ":", "from", "abipy", ".", "dfpt", ".", "phonons", "import", "PhbstFile", "phbst_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "workdir", ",", "\"run.abo_PHBST.nc\"", ")", "if", "not", "phbst_path", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AnaddbTask.open_phdos
Open PHDOS file produced by Anaddb and returns :class:`PhdosFile` object.
pymatgen/io/abinit/tasks.py
def open_phdos(self): """Open PHDOS file produced by Anaddb and returns :class:`PhdosFile` object.""" from abipy.dfpt.phonons import PhdosFile phdos_path = os.path.join(self.workdir, "run.abo_PHDOS.nc") if not phdos_path: if self.status == self.S_OK: logger.cr...
def open_phdos(self): """Open PHDOS file produced by Anaddb and returns :class:`PhdosFile` object.""" from abipy.dfpt.phonons import PhdosFile phdos_path = os.path.join(self.workdir, "run.abo_PHDOS.nc") if not phdos_path: if self.status == self.S_OK: logger.cr...
[ "Open", "PHDOS", "file", "produced", "by", "Anaddb", "and", "returns", ":", "class", ":", "PhdosFile", "object", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/tasks.py#L4630-L4643
[ "def", "open_phdos", "(", "self", ")", ":", "from", "abipy", ".", "dfpt", ".", "phonons", "import", "PhdosFile", "phdos_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "workdir", ",", "\"run.abo_PHDOS.nc\"", ")", "if", "not", "phdos_path", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
structure_from_ncdata
Reads and returns a pymatgen structure from a NetCDF file containing crystallographic data in the ETSF-IO format. Args: ncdata: filename or NetcdfReader instance. site_properties: Dictionary with site properties. cls: The Structure class to instanciate.
pymatgen/io/abinit/netcdf.py
def structure_from_ncdata(ncdata, site_properties=None, cls=Structure): """ Reads and returns a pymatgen structure from a NetCDF file containing crystallographic data in the ETSF-IO format. Args: ncdata: filename or NetcdfReader instance. site_properties: Dictionary with site properties...
def structure_from_ncdata(ncdata, site_properties=None, cls=Structure): """ Reads and returns a pymatgen structure from a NetCDF file containing crystallographic data in the ETSF-IO format. Args: ncdata: filename or NetcdfReader instance. site_properties: Dictionary with site properties...
[ "Reads", "and", "returns", "a", "pymatgen", "structure", "from", "a", "NetCDF", "file", "containing", "crystallographic", "data", "in", "the", "ETSF", "-", "IO", "format", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L317-L364
[ "def", "structure_from_ncdata", "(", "ncdata", ",", "site_properties", "=", "None", ",", "cls", "=", "Structure", ")", ":", "ncdata", ",", "closeit", "=", "as_ncreader", "(", "ncdata", ")", "# TODO check whether atomic units are used", "lattice", "=", "ArrayWithUnit...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NetcdfReader.walk_tree
Navigate all the groups in the file starting from top. If top is None, the root group is used.
pymatgen/io/abinit/netcdf.py
def walk_tree(self, top=None): """ Navigate all the groups in the file starting from top. If top is None, the root group is used. """ if top is None: top = self.rootgrp values = top.groups.values() yield values for value in top.groups.values()...
def walk_tree(self, top=None): """ Navigate all the groups in the file starting from top. If top is None, the root group is used. """ if top is None: top = self.rootgrp values = top.groups.values() yield values for value in top.groups.values()...
[ "Navigate", "all", "the", "groups", "in", "the", "file", "starting", "from", "top", ".", "If", "top", "is", "None", "the", "root", "group", "is", "used", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L123-L135
[ "def", "walk_tree", "(", "self", ",", "top", "=", "None", ")", ":", "if", "top", "is", "None", ":", "top", "=", "self", ".", "rootgrp", "values", "=", "top", ".", "groups", ".", "values", "(", ")", "yield", "values", "for", "value", "in", "top", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NetcdfReader.read_dimvalue
Returns the value of a dimension. Args: dimname: Name of the variable path: path to the group. default: return `default` if `dimname` is not present and `default` is not `NO_DEFAULT` else raise self.Error.
pymatgen/io/abinit/netcdf.py
def read_dimvalue(self, dimname, path="/", default=NO_DEFAULT): """ Returns the value of a dimension. Args: dimname: Name of the variable path: path to the group. default: return `default` if `dimname` is not present and `default` is not `NO_D...
def read_dimvalue(self, dimname, path="/", default=NO_DEFAULT): """ Returns the value of a dimension. Args: dimname: Name of the variable path: path to the group. default: return `default` if `dimname` is not present and `default` is not `NO_D...
[ "Returns", "the", "value", "of", "a", "dimension", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L142-L157
[ "def", "read_dimvalue", "(", "self", ",", "dimname", ",", "path", "=", "\"/\"", ",", "default", "=", "NO_DEFAULT", ")", ":", "try", ":", "dim", "=", "self", ".", "_read_dimensions", "(", "dimname", ",", "path", "=", "path", ")", "[", "0", "]", "retur...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NetcdfReader.read_varnames
List of variable names stored in the group specified by path.
pymatgen/io/abinit/netcdf.py
def read_varnames(self, path="/"): """List of variable names stored in the group specified by path.""" if path == "/": return self.rootgrp.variables.keys() else: group = self.path2group[path] return group.variables.keys()
def read_varnames(self, path="/"): """List of variable names stored in the group specified by path.""" if path == "/": return self.rootgrp.variables.keys() else: group = self.path2group[path] return group.variables.keys()
[ "List", "of", "variable", "names", "stored", "in", "the", "group", "specified", "by", "path", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L159-L165
[ "def", "read_varnames", "(", "self", ",", "path", "=", "\"/\"", ")", ":", "if", "path", "==", "\"/\"", ":", "return", "self", ".", "rootgrp", ".", "variables", ".", "keys", "(", ")", "else", ":", "group", "=", "self", ".", "path2group", "[", "path", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NetcdfReader.read_value
Returns the values of variable with name varname in the group specified by path. Args: varname: Name of the variable path: path to the group. cmode: if cmode=="c", a complex ndarrays is constructed and returned (netcdf does not provide native support from com...
pymatgen/io/abinit/netcdf.py
def read_value(self, varname, path="/", cmode=None, default=NO_DEFAULT): """ Returns the values of variable with name varname in the group specified by path. Args: varname: Name of the variable path: path to the group. cmode: if cmode=="c", a complex ndarrays...
def read_value(self, varname, path="/", cmode=None, default=NO_DEFAULT): """ Returns the values of variable with name varname in the group specified by path. Args: varname: Name of the variable path: path to the group. cmode: if cmode=="c", a complex ndarrays...
[ "Returns", "the", "values", "of", "variable", "with", "name", "varname", "in", "the", "group", "specified", "by", "path", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L167-L201
[ "def", "read_value", "(", "self", ",", "varname", ",", "path", "=", "\"/\"", ",", "cmode", "=", "None", ",", "default", "=", "NO_DEFAULT", ")", ":", "try", ":", "var", "=", "self", ".", "read_variable", "(", "varname", ",", "path", "=", "path", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NetcdfReader.read_keys
Read a list of variables/dimensions from file. If a key is not present the corresponding entry in the output dictionary is set to None.
pymatgen/io/abinit/netcdf.py
def read_keys(self, keys, dict_cls=AttrDict, path="/"): """ Read a list of variables/dimensions from file. If a key is not present the corresponding entry in the output dictionary is set to None. """ od = dict_cls() for k in keys: try: # Try to...
def read_keys(self, keys, dict_cls=AttrDict, path="/"): """ Read a list of variables/dimensions from file. If a key is not present the corresponding entry in the output dictionary is set to None. """ od = dict_cls() for k in keys: try: # Try to...
[ "Read", "a", "list", "of", "variables", "/", "dimensions", "from", "file", ".", "If", "a", "key", "is", "not", "present", "the", "corresponding", "entry", "in", "the", "output", "dictionary", "is", "set", "to", "None", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L233-L250
[ "def", "read_keys", "(", "self", ",", "keys", ",", "dict_cls", "=", "AttrDict", ",", "path", "=", "\"/\"", ")", ":", "od", "=", "dict_cls", "(", ")", "for", "k", "in", "keys", ":", "try", ":", "# Try to read a variable.", "od", "[", "k", "]", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
ETSF_Reader.chemical_symbols
Chemical symbols char [number of atom species][symbol length].
pymatgen/io/abinit/netcdf.py
def chemical_symbols(self): """Chemical symbols char [number of atom species][symbol length].""" charr = self.read_value("chemical_symbols") symbols = [] for v in charr: s = "".join(c.decode("utf-8") for c in v) symbols.append(s.strip()) return symbols
def chemical_symbols(self): """Chemical symbols char [number of atom species][symbol length].""" charr = self.read_value("chemical_symbols") symbols = [] for v in charr: s = "".join(c.decode("utf-8") for c in v) symbols.append(s.strip()) return symbols
[ "Chemical", "symbols", "char", "[", "number", "of", "atom", "species", "]", "[", "symbol", "length", "]", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L260-L268
[ "def", "chemical_symbols", "(", "self", ")", ":", "charr", "=", "self", ".", "read_value", "(", "\"chemical_symbols\"", ")", "symbols", "=", "[", "]", "for", "v", "in", "charr", ":", "s", "=", "\"\"", ".", "join", "(", "c", ".", "decode", "(", "\"utf...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
ETSF_Reader.read_structure
Returns the crystalline structure.
pymatgen/io/abinit/netcdf.py
def read_structure(self, cls=Structure): """Returns the crystalline structure.""" if self.ngroups != 1: raise NotImplementedError("In file %s: ngroups != 1" % self.path) return structure_from_ncdata(self, cls=cls)
def read_structure(self, cls=Structure): """Returns the crystalline structure.""" if self.ngroups != 1: raise NotImplementedError("In file %s: ngroups != 1" % self.path) return structure_from_ncdata(self, cls=cls)
[ "Returns", "the", "crystalline", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L274-L279
[ "def", "read_structure", "(", "self", ",", "cls", "=", "Structure", ")", ":", "if", "self", ".", "ngroups", "!=", "1", ":", "raise", "NotImplementedError", "(", "\"In file %s: ngroups != 1\"", "%", "self", ".", "path", ")", "return", "structure_from_ncdata", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
ETSF_Reader.read_abinit_hdr
Read the variables associated to the Abinit header. Return :class:`AbinitHeader`
pymatgen/io/abinit/netcdf.py
def read_abinit_hdr(self): """ Read the variables associated to the Abinit header. Return :class:`AbinitHeader` """ d = {} for hvar in _HDR_VARIABLES.values(): ncname = hvar.etsf_name if hvar.etsf_name is not None else hvar.name if ncname in self....
def read_abinit_hdr(self): """ Read the variables associated to the Abinit header. Return :class:`AbinitHeader` """ d = {} for hvar in _HDR_VARIABLES.values(): ncname = hvar.etsf_name if hvar.etsf_name is not None else hvar.name if ncname in self....
[ "Read", "the", "variables", "associated", "to", "the", "Abinit", "header", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L288-L314
[ "def", "read_abinit_hdr", "(", "self", ")", ":", "d", "=", "{", "}", "for", "hvar", "in", "_HDR_VARIABLES", ".", "values", "(", ")", ":", "ncname", "=", "hvar", ".", "etsf_name", "if", "hvar", ".", "etsf_name", "is", "not", "None", "else", "hvar", "....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AbinitHeader.to_string
String representation. kwargs are passed to `pprint.pformat`. Args: verbose: Verbosity level title: Title string.
pymatgen/io/abinit/netcdf.py
def to_string(self, verbose=0, title=None, **kwargs): """ String representation. kwargs are passed to `pprint.pformat`. Args: verbose: Verbosity level title: Title string. """ from pprint import pformat s = pformat(self, **kwargs) if title...
def to_string(self, verbose=0, title=None, **kwargs): """ String representation. kwargs are passed to `pprint.pformat`. Args: verbose: Verbosity level title: Title string. """ from pprint import pformat s = pformat(self, **kwargs) if title...
[ "String", "representation", ".", "kwargs", "are", "passed", "to", "pprint", ".", "pformat", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/netcdf.py#L458-L470
[ "def", "to_string", "(", "self", ",", "verbose", "=", "0", ",", "title", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "pprint", "import", "pformat", "s", "=", "pformat", "(", "self", ",", "*", "*", "kwargs", ")", "if", "title", "is", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VoltageProfilePlotter.add_electrode
Add an electrode to the plot. Args: electrode: An electrode. All electrodes satisfying the AbstractElectrode interface should work. label: A label for the electrode. If None, defaults to a counting system, i.e. 'Electrode 1', 'Electrode 2', ...
pymatgen/apps/battery/plotter.py
def add_electrode(self, electrode, label=None): """ Add an electrode to the plot. Args: electrode: An electrode. All electrodes satisfying the AbstractElectrode interface should work. label: A label for the electrode. If None, defaults to a counting ...
def add_electrode(self, electrode, label=None): """ Add an electrode to the plot. Args: electrode: An electrode. All electrodes satisfying the AbstractElectrode interface should work. label: A label for the electrode. If None, defaults to a counting ...
[ "Add", "an", "electrode", "to", "the", "plot", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/plotter.py#L36-L48
[ "def", "add_electrode", "(", "self", ",", "electrode", ",", "label", "=", "None", ")", ":", "if", "not", "label", ":", "label", "=", "\"Electrode {}\"", ".", "format", "(", "len", "(", "self", ".", "_electrodes", ")", "+", "1", ")", "self", ".", "_el...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VoltageProfilePlotter.get_plot
Returns a plot object. Args: width: Width of the plot. Defaults to 8 in. height: Height of the plot. Defaults to 6 in. Returns: A matplotlib plot object.
pymatgen/apps/battery/plotter.py
def get_plot(self, width=8, height=8): """ Returns a plot object. Args: width: Width of the plot. Defaults to 8 in. height: Height of the plot. Defaults to 6 in. Returns: A matplotlib plot object. """ plt = pretty_plot(width, height) ...
def get_plot(self, width=8, height=8): """ Returns a plot object. Args: width: Width of the plot. Defaults to 8 in. height: Height of the plot. Defaults to 6 in. Returns: A matplotlib plot object. """ plt = pretty_plot(width, height) ...
[ "Returns", "a", "plot", "object", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/plotter.py#L71-L94
[ "def", "get_plot", "(", "self", ",", "width", "=", "8", ",", "height", "=", "8", ")", ":", "plt", "=", "pretty_plot", "(", "width", ",", "height", ")", "for", "label", ",", "electrode", "in", "self", ".", "_electrodes", ".", "items", "(", ")", ":",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VoltageProfilePlotter.save
Save the plot to an image file. Args: filename: Filename to save to. image_format: Format to save to. Defaults to eps.
pymatgen/apps/battery/plotter.py
def save(self, filename, image_format="eps", width=8, height=6): """ Save the plot to an image file. Args: filename: Filename to save to. image_format: Format to save to. Defaults to eps. """ self.get_plot(width, height).savefig(filename, format=image_for...
def save(self, filename, image_format="eps", width=8, height=6): """ Save the plot to an image file. Args: filename: Filename to save to. image_format: Format to save to. Defaults to eps. """ self.get_plot(width, height).savefig(filename, format=image_for...
[ "Save", "the", "plot", "to", "an", "image", "file", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/battery/plotter.py#L106-L114
[ "def", "save", "(", "self", ",", "filename", ",", "image_format", "=", "\"eps\"", ",", "width", "=", "8", ",", "height", "=", "6", ")", ":", "self", ".", "get_plot", "(", "width", ",", "height", ")", ".", "savefig", "(", "filename", ",", "format", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_structure_from_prev_run
Process structure from previous run. Args: vasprun (Vasprun): Vasprun that contains the final structure from previous run. outcar (Outcar): Outcar that contains the magnetization info from previous run. sym_prec (float): Tolerance for symmetry finding for standardiza...
pymatgen/io/vasp/sets.py
def get_structure_from_prev_run(vasprun, outcar=None, sym_prec=0.1, international_monoclinic=True): """ Process structure from previous run. Args: vasprun (Vasprun): Vasprun that contains the final structure from previous run. outcar (Outcar): Out...
def get_structure_from_prev_run(vasprun, outcar=None, sym_prec=0.1, international_monoclinic=True): """ Process structure from previous run. Args: vasprun (Vasprun): Vasprun that contains the final structure from previous run. outcar (Outcar): Out...
[ "Process", "structure", "from", "previous", "run", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1941-L2008
[ "def", "get_structure_from_prev_run", "(", "vasprun", ",", "outcar", "=", "None", ",", "sym_prec", "=", "0.1", ",", "international_monoclinic", "=", "True", ")", ":", "structure", "=", "vasprun", ".", "final_structure", "site_properties", "=", "{", "}", "# magmo...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
batch_write_input
Batch write vasp input for a sequence of structures to output_dir, following the format output_dir/{group}/{formula}_{number}. Args: structures ([Structure]): Sequence of Structures. vasp_input_set (VaspInputSet): VaspInputSet class that creates vasp input files from structures. Not...
pymatgen/io/vasp/sets.py
def batch_write_input(structures, vasp_input_set=MPRelaxSet, output_dir=".", make_dir_if_not_present=True, subfolder=None, sanitize=False, include_cif=False, **kwargs): """ Batch write vasp input for a sequence of structures to output_dir, following the format out...
def batch_write_input(structures, vasp_input_set=MPRelaxSet, output_dir=".", make_dir_if_not_present=True, subfolder=None, sanitize=False, include_cif=False, **kwargs): """ Batch write vasp input for a sequence of structures to output_dir, following the format out...
[ "Batch", "write", "vasp", "input", "for", "a", "sequence", "of", "structures", "to", "output_dir", "following", "the", "format", "output_dir", "/", "{", "group", "}", "/", "{", "formula", "}", "_", "{", "number", "}", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L2015-L2054
[ "def", "batch_write_input", "(", "structures", ",", "vasp_input_set", "=", "MPRelaxSet", ",", "output_dir", "=", "\".\"", ",", "make_dir_if_not_present", "=", "True", ",", "subfolder", "=", "None", ",", "sanitize", "=", "False", ",", "include_cif", "=", "False",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VaspInputSet.potcar_symbols
List of POTCAR symbols.
pymatgen/io/vasp/sets.py
def potcar_symbols(self): """ List of POTCAR symbols. """ elements = self.poscar.site_symbols potcar_symbols = [] settings = self._config_dict["POTCAR"] if isinstance(settings[elements[-1]], dict): for el in elements: potcar_symbols.ap...
def potcar_symbols(self): """ List of POTCAR symbols. """ elements = self.poscar.site_symbols potcar_symbols = [] settings = self._config_dict["POTCAR"] if isinstance(settings[elements[-1]], dict): for el in elements: potcar_symbols.ap...
[ "List", "of", "POTCAR", "symbols", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L101-L117
[ "def", "potcar_symbols", "(", "self", ")", ":", "elements", "=", "self", ".", "poscar", ".", "site_symbols", "potcar_symbols", "=", "[", "]", "settings", "=", "self", ".", "_config_dict", "[", "\"POTCAR\"", "]", "if", "isinstance", "(", "settings", "[", "e...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VaspInputSet.all_input
Returns all input files as a dict of {filename: vasp object} Returns: dict of {filename: object}, e.g., {'INCAR': Incar object, ...}
pymatgen/io/vasp/sets.py
def all_input(self): """ Returns all input files as a dict of {filename: vasp object} Returns: dict of {filename: object}, e.g., {'INCAR': Incar object, ...} """ return {'INCAR': self.incar, 'KPOINTS': self.kpoints, 'POSCAR': self.posc...
def all_input(self): """ Returns all input files as a dict of {filename: vasp object} Returns: dict of {filename: object}, e.g., {'INCAR': Incar object, ...} """ return {'INCAR': self.incar, 'KPOINTS': self.kpoints, 'POSCAR': self.posc...
[ "Returns", "all", "input", "files", "as", "a", "dict", "of", "{", "filename", ":", "vasp", "object", "}" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L128-L138
[ "def", "all_input", "(", "self", ")", ":", "return", "{", "'INCAR'", ":", "self", ".", "incar", ",", "'KPOINTS'", ":", "self", ".", "kpoints", ",", "'POSCAR'", ":", "self", ".", "poscar", ",", "'POTCAR'", ":", "self", ".", "potcar", "}" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VaspInputSet.write_input
Writes a set of VASP input to a directory. Args: output_dir (str): Directory to output the VASP input files make_dir_if_not_present (bool): Set to True if you want the directory (and the whole path) to be created if it is not present. include_...
pymatgen/io/vasp/sets.py
def write_input(self, output_dir, make_dir_if_not_present=True, include_cif=False): """ Writes a set of VASP input to a directory. Args: output_dir (str): Directory to output the VASP input files make_dir_if_not_present (bool): Set to True if you want...
def write_input(self, output_dir, make_dir_if_not_present=True, include_cif=False): """ Writes a set of VASP input to a directory. Args: output_dir (str): Directory to output the VASP input files make_dir_if_not_present (bool): Set to True if you want...
[ "Writes", "a", "set", "of", "VASP", "input", "to", "a", "directory", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L151-L170
[ "def", "write_input", "(", "self", ",", "output_dir", ",", "make_dir_if_not_present", "=", "True", ",", "include_cif", "=", "False", ")", ":", "vinput", "=", "self", ".", "get_vasp_input", "(", ")", "vinput", ".", "write_input", "(", "output_dir", ",", "make...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DictSet.nelect
Gets the default number of electrons for a given structure.
pymatgen/io/vasp/sets.py
def nelect(self): """ Gets the default number of electrons for a given structure. """ # if structure is not sorted this can cause problems, so must take # care to remove redundant symbols when counting electrons site_symbols = list(set(self.poscar.site_symbols)) n...
def nelect(self): """ Gets the default number of electrons for a given structure. """ # if structure is not sorted this can cause problems, so must take # care to remove redundant symbols when counting electrons site_symbols = list(set(self.poscar.site_symbols)) n...
[ "Gets", "the", "default", "number", "of", "electrons", "for", "a", "given", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L406-L423
[ "def", "nelect", "(", "self", ")", ":", "# if structure is not sorted this can cause problems, so must take", "# care to remove redundant symbols when counting electrons", "site_symbols", "=", "list", "(", "set", "(", "self", ".", "poscar", ".", "site_symbols", ")", ")", "n...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DictSet.kpoints
Writes out a KPOINTS file using the fully automated grid method. Uses Gamma centered meshes for hexagonal cells and Monk grids otherwise. Algorithm: Uses a simple approach scaling the number of divisions along each reciprocal lattice vector proportional to its length.
pymatgen/io/vasp/sets.py
def kpoints(self): """ Writes out a KPOINTS file using the fully automated grid method. Uses Gamma centered meshes for hexagonal cells and Monk grids otherwise. Algorithm: Uses a simple approach scaling the number of divisions along each reciprocal lattice vector...
def kpoints(self): """ Writes out a KPOINTS file using the fully automated grid method. Uses Gamma centered meshes for hexagonal cells and Monk grids otherwise. Algorithm: Uses a simple approach scaling the number of divisions along each reciprocal lattice vector...
[ "Writes", "out", "a", "KPOINTS", "file", "using", "the", "fully", "automated", "grid", "method", ".", "Uses", "Gamma", "centered", "meshes", "for", "hexagonal", "cells", "and", "Monk", "grids", "otherwise", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L426-L464
[ "def", "kpoints", "(", "self", ")", ":", "settings", "=", "self", ".", "user_kpoints_settings", "or", "self", ".", "_config_dict", "[", "\"KPOINTS\"", "]", "if", "isinstance", "(", "settings", ",", "Kpoints", ")", ":", "return", "settings", "# If grid_density ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MPStaticSet.from_prev_calc
Generate a set of Vasp input files for static calculations from a directory of previous Vasp run. Args: prev_calc_dir (str): Directory containing the outputs( vasprun.xml and OUTCAR) of previous vasp run. standardize (float): Whether to standardize to a primitive...
pymatgen/io/vasp/sets.py
def from_prev_calc(cls, prev_calc_dir, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, small_gap_multiply=None, **kwargs): """ Generate a set of Vasp input files for static calculations from a directory of prev...
def from_prev_calc(cls, prev_calc_dir, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, small_gap_multiply=None, **kwargs): """ Generate a set of Vasp input files for static calculations from a directory of prev...
[ "Generate", "a", "set", "of", "Vasp", "input", "files", "for", "static", "calculations", "from", "a", "directory", "of", "previous", "Vasp", "run", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L659-L711
[ "def", "from_prev_calc", "(", "cls", ",", "prev_calc_dir", ",", "standardize", "=", "False", ",", "sym_prec", "=", "0.1", ",", "international_monoclinic", "=", "True", ",", "reciprocal_density", "=", "100", ",", "small_gap_multiply", "=", "None", ",", "*", "*"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MPHSEBSSet.from_prev_calc
Generate a set of Vasp input files for HSE calculations from a directory of previous Vasp run. if mode=="gap", it explicitly adds VBM and CBM of the prev run to the k-point list of this run. Args: prev_calc_dir (str): Directory containing the outputs (vasprun.xml and...
pymatgen/io/vasp/sets.py
def from_prev_calc(cls, prev_calc_dir, mode="gap", reciprocal_density=50, copy_chgcar=True, **kwargs): """ Generate a set of Vasp input files for HSE calculations from a directory of previous Vasp run. if mode=="gap", it explicitly adds VBM and CBM of the prev run ...
def from_prev_calc(cls, prev_calc_dir, mode="gap", reciprocal_density=50, copy_chgcar=True, **kwargs): """ Generate a set of Vasp input files for HSE calculations from a directory of previous Vasp run. if mode=="gap", it explicitly adds VBM and CBM of the prev run ...
[ "Generate", "a", "set", "of", "Vasp", "input", "files", "for", "HSE", "calculations", "from", "a", "directory", "of", "previous", "Vasp", "run", ".", "if", "mode", "==", "gap", "it", "explicitly", "adds", "VBM", "and", "CBM", "of", "the", "prev", "run", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L805-L848
[ "def", "from_prev_calc", "(", "cls", ",", "prev_calc_dir", ",", "mode", "=", "\"gap\"", ",", "reciprocal_density", "=", "50", ",", "copy_chgcar", "=", "True", ",", "*", "*", "kwargs", ")", ":", "vasprun", ",", "outcar", "=", "get_vasprun_outcar", "(", "pre...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MPNonSCFSet.from_prev_calc
Generate a set of Vasp input files for NonSCF calculations from a directory of previous static Vasp run. Args: prev_calc_dir (str): The directory contains the outputs( vasprun.xml and OUTCAR) of previous vasp run. copy_chgcar: Whether to copy the old CHGCAR. Defa...
pymatgen/io/vasp/sets.py
def from_prev_calc(cls, prev_calc_dir, copy_chgcar=True, nbands_factor=1.2, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, kpoints_line_density=20, small_gap_multiply=None, **kwargs): ...
def from_prev_calc(cls, prev_calc_dir, copy_chgcar=True, nbands_factor=1.2, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, kpoints_line_density=20, small_gap_multiply=None, **kwargs): ...
[ "Generate", "a", "set", "of", "Vasp", "input", "files", "for", "NonSCF", "calculations", "from", "a", "directory", "of", "previous", "static", "Vasp", "run", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L959-L1036
[ "def", "from_prev_calc", "(", "cls", ",", "prev_calc_dir", ",", "copy_chgcar", "=", "True", ",", "nbands_factor", "=", "1.2", ",", "standardize", "=", "False", ",", "sym_prec", "=", "0.1", ",", "international_monoclinic", "=", "True", ",", "reciprocal_density", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MPSOCSet.from_prev_calc
Generate a set of Vasp input files for SOC calculations from a directory of previous static Vasp run. SOC calc requires all 3 components for MAGMOM for each atom in the structure. Args: prev_calc_dir (str): The directory contains the outputs( vasprun.xml and OUTCAR) ...
pymatgen/io/vasp/sets.py
def from_prev_calc(cls, prev_calc_dir, copy_chgcar=True, nbands_factor=1.2, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, small_gap_multiply=None, **kwargs): """ Generate a set of Vasp input fi...
def from_prev_calc(cls, prev_calc_dir, copy_chgcar=True, nbands_factor=1.2, standardize=False, sym_prec=0.1, international_monoclinic=True, reciprocal_density=100, small_gap_multiply=None, **kwargs): """ Generate a set of Vasp input fi...
[ "Generate", "a", "set", "of", "Vasp", "input", "files", "for", "SOC", "calculations", "from", "a", "directory", "of", "previous", "static", "Vasp", "run", ".", "SOC", "calc", "requires", "all", "3", "components", "for", "MAGMOM", "for", "each", "atom", "in...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1079-L1163
[ "def", "from_prev_calc", "(", "cls", ",", "prev_calc_dir", ",", "copy_chgcar", "=", "True", ",", "nbands_factor", "=", "1.2", ",", "standardize", "=", "False", ",", "sym_prec", "=", "0.1", ",", "international_monoclinic", "=", "True", ",", "reciprocal_density", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MVLGWSet.kpoints
Generate gamma center k-points mesh grid for GW calc, which is requested by GW calculation.
pymatgen/io/vasp/sets.py
def kpoints(self): """ Generate gamma center k-points mesh grid for GW calc, which is requested by GW calculation. """ return Kpoints.automatic_density_by_vol(self.structure, self.reciprocal_density, ...
def kpoints(self): """ Generate gamma center k-points mesh grid for GW calc, which is requested by GW calculation. """ return Kpoints.automatic_density_by_vol(self.structure, self.reciprocal_density, ...
[ "Generate", "gamma", "center", "k", "-", "points", "mesh", "grid", "for", "GW", "calc", "which", "is", "requested", "by", "GW", "calculation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1303-L1310
[ "def", "kpoints", "(", "self", ")", ":", "return", "Kpoints", ".", "automatic_density_by_vol", "(", "self", ".", "structure", ",", "self", ".", "reciprocal_density", ",", "force_gamma", "=", "True", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MVLGWSet.from_prev_calc
Generate a set of Vasp input files for GW or BSE calculations from a directory of previous Exact Diag Vasp run. Args: prev_calc_dir (str): The directory contains the outputs( vasprun.xml of previous vasp run. copy_wavecar: Whether to copy the old WAVECAR, WAVEDER...
pymatgen/io/vasp/sets.py
def from_prev_calc(cls, prev_calc_dir, copy_wavecar=True, mode="DIAG", nbands_factor=5, ncores=16, **kwargs): """ Generate a set of Vasp input files for GW or BSE calculations from a directory of previous Exact Diag Vasp run. Args: prev_calc_dir (str):...
def from_prev_calc(cls, prev_calc_dir, copy_wavecar=True, mode="DIAG", nbands_factor=5, ncores=16, **kwargs): """ Generate a set of Vasp input files for GW or BSE calculations from a directory of previous Exact Diag Vasp run. Args: prev_calc_dir (str):...
[ "Generate", "a", "set", "of", "Vasp", "input", "files", "for", "GW", "or", "BSE", "calculations", "from", "a", "directory", "of", "previous", "Exact", "Diag", "Vasp", "run", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1355-L1401
[ "def", "from_prev_calc", "(", "cls", ",", "prev_calc_dir", ",", "copy_wavecar", "=", "True", ",", "mode", "=", "\"DIAG\"", ",", "nbands_factor", "=", "5", ",", "ncores", "=", "16", ",", "*", "*", "kwargs", ")", ":", "vasprun", ",", "outcar", "=", "get_...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MVLSlabSet.kpoints
k_product, default to 50, is kpoint number * length for a & b directions, also for c direction in bulk calculations Automatic mesh & Gamma is the default setting.
pymatgen/io/vasp/sets.py
def kpoints(self): """ k_product, default to 50, is kpoint number * length for a & b directions, also for c direction in bulk calculations Automatic mesh & Gamma is the default setting. """ # To get input sets, the input structure has to has the same number #...
def kpoints(self): """ k_product, default to 50, is kpoint number * length for a & b directions, also for c direction in bulk calculations Automatic mesh & Gamma is the default setting. """ # To get input sets, the input structure has to has the same number #...
[ "k_product", "default", "to", "50", "is", "kpoint", "number", "*", "length", "for", "a", "&", "b", "directions", "also", "for", "c", "direction", "in", "bulk", "calculations", "Automatic", "mesh", "&", "Gamma", "is", "the", "default", "setting", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1455-L1482
[ "def", "kpoints", "(", "self", ")", ":", "# To get input sets, the input structure has to has the same number", "# of required parameters as a Structure object (ie. 4). Slab", "# attributes aren't going to affect the VASP inputs anyways so", "# converting the slab into a structure should not matte...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MVLGBSet.kpoints
k_product, default to 40, is kpoint number * length for a & b directions, also for c direction in bulk calculations Automatic mesh & Gamma is the default setting.
pymatgen/io/vasp/sets.py
def kpoints(self): """ k_product, default to 40, is kpoint number * length for a & b directions, also for c direction in bulk calculations Automatic mesh & Gamma is the default setting. """ # To get input sets, the input structure has to has the same number # of ...
def kpoints(self): """ k_product, default to 40, is kpoint number * length for a & b directions, also for c direction in bulk calculations Automatic mesh & Gamma is the default setting. """ # To get input sets, the input structure has to has the same number # of ...
[ "k_product", "default", "to", "40", "is", "kpoint", "number", "*", "length", "for", "a", "&", "b", "directions", "also", "for", "c", "direction", "in", "bulk", "calculations", "Automatic", "mesh", "&", "Gamma", "is", "the", "default", "setting", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1521-L1546
[ "def", "kpoints", "(", "self", ")", ":", "# To get input sets, the input structure has to has the same number", "# of required parameters as a Structure object.", "kpt", "=", "super", "(", ")", ".", "kpoints", "kpt", ".", "comment", "=", "\"Generated by pymatgen's MVLGBSet\"", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MITNEBSet._process_structures
Remove any atom jumps across the cell
pymatgen/io/vasp/sets.py
def _process_structures(structures): """ Remove any atom jumps across the cell """ input_structures = structures structures = [input_structures[0]] for s in input_structures[1:]: prev = structures[-1] for i in range(len(s)): t = np....
def _process_structures(structures): """ Remove any atom jumps across the cell """ input_structures = structures structures = [input_structures[0]] for s in input_structures[1:]: prev = structures[-1] for i in range(len(s)): t = np....
[ "Remove", "any", "atom", "jumps", "across", "the", "cell" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1648-L1661
[ "def", "_process_structures", "(", "structures", ")", ":", "input_structures", "=", "structures", "structures", "=", "[", "input_structures", "[", "0", "]", "]", "for", "s", "in", "input_structures", "[", "1", ":", "]", ":", "prev", "=", "structures", "[", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
MITNEBSet.write_input
NEB inputs has a special directory structure where inputs are in 00, 01, 02, .... Args: output_dir (str): Directory to output the VASP input files make_dir_if_not_present (bool): Set to True if you want the directory (and the whole path) to be created if it is no...
pymatgen/io/vasp/sets.py
def write_input(self, output_dir, make_dir_if_not_present=True, write_cif=False, write_path_cif=False, write_endpoint_inputs=False): """ NEB inputs has a special directory structure where inputs are in 00, 01, 02, .... Args: output_dir...
def write_input(self, output_dir, make_dir_if_not_present=True, write_cif=False, write_path_cif=False, write_endpoint_inputs=False): """ NEB inputs has a special directory structure where inputs are in 00, 01, 02, .... Args: output_dir...
[ "NEB", "inputs", "has", "a", "special", "directory", "structure", "where", "inputs", "are", "in", "00", "01", "02", "...." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/sets.py#L1663-L1713
[ "def", "write_input", "(", "self", ",", "output_dir", ",", "make_dir_if_not_present", "=", "True", ",", "write_cif", "=", "False", ",", "write_path_cif", "=", "False", ",", "write_endpoint_inputs", "=", "False", ")", ":", "output_dir", "=", "Path", "(", "outpu...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_uvec
Gets a unit vector parallel to input vector
pymatgen/core/tensors.py
def get_uvec(vec): """ Gets a unit vector parallel to input vector""" l = np.linalg.norm(vec) if l < 1e-8: return vec return vec / l
def get_uvec(vec): """ Gets a unit vector parallel to input vector""" l = np.linalg.norm(vec) if l < 1e-8: return vec return vec / l
[ "Gets", "a", "unit", "vector", "parallel", "to", "input", "vector" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L917-L922
[ "def", "get_uvec", "(", "vec", ")", ":", "l", "=", "np", ".", "linalg", ".", "norm", "(", "vec", ")", "if", "l", "<", "1e-8", ":", "return", "vec", "return", "vec", "/", "l" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
symmetry_reduce
Function that converts a list of tensors corresponding to a structure and returns a dictionary consisting of unique tensor keys with symmop values corresponding to transformations that will result in derivative tensors from the original list Args: tensors (list of tensors): list of Tensor objec...
pymatgen/core/tensors.py
def symmetry_reduce(tensors, structure, tol=1e-8, **kwargs): """ Function that converts a list of tensors corresponding to a structure and returns a dictionary consisting of unique tensor keys with symmop values corresponding to transformations that will result in derivative tensors from the origina...
def symmetry_reduce(tensors, structure, tol=1e-8, **kwargs): """ Function that converts a list of tensors corresponding to a structure and returns a dictionary consisting of unique tensor keys with symmop values corresponding to transformations that will result in derivative tensors from the origina...
[ "Function", "that", "converts", "a", "list", "of", "tensors", "corresponding", "to", "a", "structure", "and", "returns", "a", "dictionary", "consisting", "of", "unique", "tensor", "keys", "with", "symmop", "values", "corresponding", "to", "transformations", "that"...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L925-L956
[ "def", "symmetry_reduce", "(", "tensors", ",", "structure", ",", "tol", "=", "1e-8", ",", "*", "*", "kwargs", ")", ":", "sga", "=", "SpacegroupAnalyzer", "(", "structure", ",", "*", "*", "kwargs", ")", "symmops", "=", "sga", ".", "get_symmetry_operations",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_tkd_value
Helper function to find a value in a tensor-keyed- dictionary using an approximation to the key. This is useful if rounding errors in construction occur or hashing issues arise in tensor-keyed-dictionaries (e. g. from symmetry_reduce). Resolves most hashing issues, and is preferable to redefining ...
pymatgen/core/tensors.py
def get_tkd_value(tensor_keyed_dict, tensor, allclose_kwargs=None): """ Helper function to find a value in a tensor-keyed- dictionary using an approximation to the key. This is useful if rounding errors in construction occur or hashing issues arise in tensor-keyed-dictionaries (e. g. from symme...
def get_tkd_value(tensor_keyed_dict, tensor, allclose_kwargs=None): """ Helper function to find a value in a tensor-keyed- dictionary using an approximation to the key. This is useful if rounding errors in construction occur or hashing issues arise in tensor-keyed-dictionaries (e. g. from symme...
[ "Helper", "function", "to", "find", "a", "value", "in", "a", "tensor", "-", "keyed", "-", "dictionary", "using", "an", "approximation", "to", "the", "key", ".", "This", "is", "useful", "if", "rounding", "errors", "in", "construction", "occur", "or", "hashi...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L1041-L1061
[ "def", "get_tkd_value", "(", "tensor_keyed_dict", ",", "tensor", ",", "allclose_kwargs", "=", "None", ")", ":", "if", "allclose_kwargs", "is", "None", ":", "allclose_kwargs", "=", "{", "}", "for", "tkey", ",", "value", "in", "tensor_keyed_dict", ".", "items", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.zeroed
returns the matrix with all entries below a certain threshold (i.e. tol) set to zero
pymatgen/core/tensors.py
def zeroed(self, tol=1e-3): """ returns the matrix with all entries below a certain threshold (i.e. tol) set to zero """ new_tensor = self.copy() new_tensor[abs(new_tensor) < tol] = 0 return new_tensor
def zeroed(self, tol=1e-3): """ returns the matrix with all entries below a certain threshold (i.e. tol) set to zero """ new_tensor = self.copy() new_tensor[abs(new_tensor) < tol] = 0 return new_tensor
[ "returns", "the", "matrix", "with", "all", "entries", "below", "a", "certain", "threshold", "(", "i", ".", "e", ".", "tol", ")", "set", "to", "zero" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L112-L119
[ "def", "zeroed", "(", "self", ",", "tol", "=", "1e-3", ")", ":", "new_tensor", "=", "self", ".", "copy", "(", ")", "new_tensor", "[", "abs", "(", "new_tensor", ")", "<", "tol", "]", "=", "0", "return", "new_tensor" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.rotate
Applies a rotation directly, and tests input matrix to ensure a valid rotation. Args: matrix (3x3 array-like): rotation matrix to be applied to tensor tol (float): tolerance for testing rotation matrix validity
pymatgen/core/tensors.py
def rotate(self, matrix, tol=1e-3): """ Applies a rotation directly, and tests input matrix to ensure a valid rotation. Args: matrix (3x3 array-like): rotation matrix to be applied to tensor tol (float): tolerance for testing rotation matrix validity """ ...
def rotate(self, matrix, tol=1e-3): """ Applies a rotation directly, and tests input matrix to ensure a valid rotation. Args: matrix (3x3 array-like): rotation matrix to be applied to tensor tol (float): tolerance for testing rotation matrix validity """ ...
[ "Applies", "a", "rotation", "directly", "and", "tests", "input", "matrix", "to", "ensure", "a", "valid", "rotation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L130-L144
[ "def", "rotate", "(", "self", ",", "matrix", ",", "tol", "=", "1e-3", ")", ":", "matrix", "=", "SquareTensor", "(", "matrix", ")", "if", "not", "matrix", ".", "is_rotation", "(", "tol", ")", ":", "raise", "ValueError", "(", "\"Rotation matrix is not valid....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.einsum_sequence
Calculates the result of an einstein summation expression
pymatgen/core/tensors.py
def einsum_sequence(self, other_arrays, einsum_string=None): """ Calculates the result of an einstein summation expression """ if not isinstance(other_arrays, list): raise ValueError("other tensors must be list of " "tensors or tensor input") ...
def einsum_sequence(self, other_arrays, einsum_string=None): """ Calculates the result of an einstein summation expression """ if not isinstance(other_arrays, list): raise ValueError("other tensors must be list of " "tensors or tensor input") ...
[ "Calculates", "the", "result", "of", "an", "einstein", "summation", "expression" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L146-L165
[ "def", "einsum_sequence", "(", "self", ",", "other_arrays", ",", "einsum_string", "=", "None", ")", ":", "if", "not", "isinstance", "(", "other_arrays", ",", "list", ")", ":", "raise", "ValueError", "(", "\"other tensors must be list of \"", "\"tensors or tensor inp...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.project
Convenience method for projection of a tensor into a vector. Returns the tensor dotted into a unit vector along the input n. Args: n (3x1 array-like): direction to project onto Returns (float): scalar value corresponding to the projection of the ten...
pymatgen/core/tensors.py
def project(self, n): """ Convenience method for projection of a tensor into a vector. Returns the tensor dotted into a unit vector along the input n. Args: n (3x1 array-like): direction to project onto Returns (float): scalar value correspondin...
def project(self, n): """ Convenience method for projection of a tensor into a vector. Returns the tensor dotted into a unit vector along the input n. Args: n (3x1 array-like): direction to project onto Returns (float): scalar value correspondin...
[ "Convenience", "method", "for", "projection", "of", "a", "tensor", "into", "a", "vector", ".", "Returns", "the", "tensor", "dotted", "into", "a", "unit", "vector", "along", "the", "input", "n", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L167-L182
[ "def", "project", "(", "self", ",", "n", ")", ":", "n", "=", "get_uvec", "(", "n", ")", "return", "self", ".", "einsum_sequence", "(", "[", "n", "]", "*", "self", ".", "rank", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.average_over_unit_sphere
Method for averaging the tensor projection over the unit with option for custom quadrature. Args: quad (dict): quadrature for integration, should be dictionary with "points" and "weights" keys defaults to quadpy.sphere.Lebedev(19) as read from file R...
pymatgen/core/tensors.py
def average_over_unit_sphere(self, quad=None): """ Method for averaging the tensor projection over the unit with option for custom quadrature. Args: quad (dict): quadrature for integration, should be dictionary with "points" and "weights" keys defaults ...
def average_over_unit_sphere(self, quad=None): """ Method for averaging the tensor projection over the unit with option for custom quadrature. Args: quad (dict): quadrature for integration, should be dictionary with "points" and "weights" keys defaults ...
[ "Method", "for", "averaging", "the", "tensor", "projection", "over", "the", "unit", "with", "option", "for", "custom", "quadrature", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L184-L200
[ "def", "average_over_unit_sphere", "(", "self", ",", "quad", "=", "None", ")", ":", "quad", "=", "quad", "or", "DEFAULT_QUAD", "weights", ",", "points", "=", "quad", "[", "'weights'", "]", ",", "quad", "[", "'points'", "]", "return", "sum", "(", "[", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.get_grouped_indices
Gets index sets for equivalent tensor values Args: voigt (bool): whether to get grouped indices of voigt or full notation tensor, defaults to false **kwargs: keyword args for np.isclose. Can take atol and rtol for absolute and relative to...
pymatgen/core/tensors.py
def get_grouped_indices(self, voigt=False, **kwargs): """ Gets index sets for equivalent tensor values Args: voigt (bool): whether to get grouped indices of voigt or full notation tensor, defaults to false **kwargs: keyword args for np.isc...
def get_grouped_indices(self, voigt=False, **kwargs): """ Gets index sets for equivalent tensor values Args: voigt (bool): whether to get grouped indices of voigt or full notation tensor, defaults to false **kwargs: keyword args for np.isc...
[ "Gets", "index", "sets", "for", "equivalent", "tensor", "values" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L202-L241
[ "def", "get_grouped_indices", "(", "self", ",", "voigt", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "voigt", ":", "array", "=", "self", ".", "voigt", "else", ":", "array", "=", "self", "indices", "=", "list", "(", "itertools", ".", "produ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.get_symbol_dict
Creates a summary dict for tensor with associated symbol Args: voigt (bool): whether to get symbol dict for voigt notation tensor, as opposed to full notation, defaults to true zero_index (bool): whether to set initial index to zero, defau...
pymatgen/core/tensors.py
def get_symbol_dict(self, voigt=True, zero_index=False, **kwargs): """ Creates a summary dict for tensor with associated symbol Args: voigt (bool): whether to get symbol dict for voigt notation tensor, as opposed to full notation, defaults to true ...
def get_symbol_dict(self, voigt=True, zero_index=False, **kwargs): """ Creates a summary dict for tensor with associated symbol Args: voigt (bool): whether to get symbol dict for voigt notation tensor, as opposed to full notation, defaults to true ...
[ "Creates", "a", "summary", "dict", "for", "tensor", "with", "associated", "symbol" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L243-L286
[ "def", "get_symbol_dict", "(", "self", ",", "voigt", "=", "True", ",", "zero_index", "=", "False", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "}", "if", "voigt", ":", "array", "=", "self", ".", "voigt", "else", ":", "array", "=", "self", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.round
Wrapper around numpy.round to ensure object of same type is returned Args: decimals :Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. Returns (Tensor): ...
pymatgen/core/tensors.py
def round(self, decimals=0): """ Wrapper around numpy.round to ensure object of same type is returned Args: decimals :Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left ...
def round(self, decimals=0): """ Wrapper around numpy.round to ensure object of same type is returned Args: decimals :Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left ...
[ "Wrapper", "around", "numpy", ".", "round", "to", "ensure", "object", "of", "same", "type", "is", "returned" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L288-L302
[ "def", "round", "(", "self", ",", "decimals", "=", "0", ")", ":", "return", "self", ".", "__class__", "(", "np", ".", "round", "(", "self", ",", "decimals", "=", "decimals", ")", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.symmetrized
Returns a generally symmetrized tensor, calculated by taking the sum of the tensor and its transpose with respect to all possible permutations of indices
pymatgen/core/tensors.py
def symmetrized(self): """ Returns a generally symmetrized tensor, calculated by taking the sum of the tensor and its transpose with respect to all possible permutations of indices """ perms = list(itertools.permutations(range(self.rank))) return sum([np.transpose...
def symmetrized(self): """ Returns a generally symmetrized tensor, calculated by taking the sum of the tensor and its transpose with respect to all possible permutations of indices """ perms = list(itertools.permutations(range(self.rank))) return sum([np.transpose...
[ "Returns", "a", "generally", "symmetrized", "tensor", "calculated", "by", "taking", "the", "sum", "of", "the", "tensor", "and", "its", "transpose", "with", "respect", "to", "all", "possible", "permutations", "of", "indices" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L305-L312
[ "def", "symmetrized", "(", "self", ")", ":", "perms", "=", "list", "(", "itertools", ".", "permutations", "(", "range", "(", "self", ".", "rank", ")", ")", ")", "return", "sum", "(", "[", "np", ".", "transpose", "(", "self", ",", "ind", ")", "for",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.voigt_symmetrized
Returns a "voigt"-symmetrized tensor, i. e. a voigt-notation tensor such that it is invariant wrt permutation of indices
pymatgen/core/tensors.py
def voigt_symmetrized(self): """ Returns a "voigt"-symmetrized tensor, i. e. a voigt-notation tensor such that it is invariant wrt permutation of indices """ if not (self.rank % 2 == 0 and self.rank >= 2): raise ValueError("V-symmetrization requires rank even and >= 2...
def voigt_symmetrized(self): """ Returns a "voigt"-symmetrized tensor, i. e. a voigt-notation tensor such that it is invariant wrt permutation of indices """ if not (self.rank % 2 == 0 and self.rank >= 2): raise ValueError("V-symmetrization requires rank even and >= 2...
[ "Returns", "a", "voigt", "-", "symmetrized", "tensor", "i", ".", "e", ".", "a", "voigt", "-", "notation", "tensor", "such", "that", "it", "is", "invariant", "wrt", "permutation", "of", "indices" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L315-L326
[ "def", "voigt_symmetrized", "(", "self", ")", ":", "if", "not", "(", "self", ".", "rank", "%", "2", "==", "0", "and", "self", ".", "rank", ">=", "2", ")", ":", "raise", "ValueError", "(", "\"V-symmetrization requires rank even and >= 2\"", ")", "v", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.fit_to_structure
Returns a tensor that is invariant with respect to symmetry operations corresponding to a structure Args: structure (Structure): structure from which to generate symmetry operations symprec (float): symmetry tolerance for the Spacegroup Analyzer u...
pymatgen/core/tensors.py
def fit_to_structure(self, structure, symprec=0.1): """ Returns a tensor that is invariant with respect to symmetry operations corresponding to a structure Args: structure (Structure): structure from which to generate symmetry operations symprec (...
def fit_to_structure(self, structure, symprec=0.1): """ Returns a tensor that is invariant with respect to symmetry operations corresponding to a structure Args: structure (Structure): structure from which to generate symmetry operations symprec (...
[ "Returns", "a", "tensor", "that", "is", "invariant", "with", "respect", "to", "symmetry", "operations", "corresponding", "to", "a", "structure" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L338-L352
[ "def", "fit_to_structure", "(", "self", ",", "structure", ",", "symprec", "=", "0.1", ")", ":", "sga", "=", "SpacegroupAnalyzer", "(", "structure", ",", "symprec", ")", "symm_ops", "=", "sga", ".", "get_symmetry_operations", "(", "cartesian", "=", "True", ")...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.is_fit_to_structure
Tests whether a tensor is invariant with respect to the symmetry operations of a particular structure by testing whether the residual of the symmetric portion is below a tolerance Args: structure (Structure): structure to be fit to tol (float): tolerance for symm...
pymatgen/core/tensors.py
def is_fit_to_structure(self, structure, tol=1e-2): """ Tests whether a tensor is invariant with respect to the symmetry operations of a particular structure by testing whether the residual of the symmetric portion is below a tolerance Args: structure (Struct...
def is_fit_to_structure(self, structure, tol=1e-2): """ Tests whether a tensor is invariant with respect to the symmetry operations of a particular structure by testing whether the residual of the symmetric portion is below a tolerance Args: structure (Struct...
[ "Tests", "whether", "a", "tensor", "is", "invariant", "with", "respect", "to", "the", "symmetry", "operations", "of", "a", "particular", "structure", "by", "testing", "whether", "the", "residual", "of", "the", "symmetric", "portion", "is", "below", "a", "toler...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L354-L365
[ "def", "is_fit_to_structure", "(", "self", ",", "structure", ",", "tol", "=", "1e-2", ")", ":", "return", "(", "self", "-", "self", ".", "fit_to_structure", "(", "structure", ")", "<", "tol", ")", ".", "all", "(", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.voigt
Returns the tensor in Voigt notation
pymatgen/core/tensors.py
def voigt(self): """ Returns the tensor in Voigt notation """ v_matrix = np.zeros(self._vscale.shape, dtype=self.dtype) this_voigt_map = self.get_voigt_dict(self.rank) for ind in this_voigt_map: v_matrix[this_voigt_map[ind]] = self[ind] if not self.is_...
def voigt(self): """ Returns the tensor in Voigt notation """ v_matrix = np.zeros(self._vscale.shape, dtype=self.dtype) this_voigt_map = self.get_voigt_dict(self.rank) for ind in this_voigt_map: v_matrix[this_voigt_map[ind]] = self[ind] if not self.is_...
[ "Returns", "the", "tensor", "in", "Voigt", "notation" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L368-L379
[ "def", "voigt", "(", "self", ")", ":", "v_matrix", "=", "np", ".", "zeros", "(", "self", ".", "_vscale", ".", "shape", ",", "dtype", "=", "self", ".", "dtype", ")", "this_voigt_map", "=", "self", ".", "get_voigt_dict", "(", "self", ".", "rank", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.is_voigt_symmetric
Tests symmetry of tensor to that necessary for voigt-conversion by grouping indices into pairs and constructing a sequence of possible permutations to be used in a tensor transpose
pymatgen/core/tensors.py
def is_voigt_symmetric(self, tol=1e-6): """ Tests symmetry of tensor to that necessary for voigt-conversion by grouping indices into pairs and constructing a sequence of possible permutations to be used in a tensor transpose """ transpose_pieces = [[[0 for i in range(self...
def is_voigt_symmetric(self, tol=1e-6): """ Tests symmetry of tensor to that necessary for voigt-conversion by grouping indices into pairs and constructing a sequence of possible permutations to be used in a tensor transpose """ transpose_pieces = [[[0 for i in range(self...
[ "Tests", "symmetry", "of", "tensor", "to", "that", "necessary", "for", "voigt", "-", "conversion", "by", "grouping", "indices", "into", "pairs", "and", "constructing", "a", "sequence", "of", "possible", "permutations", "to", "be", "used", "in", "a", "tensor", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L381-L397
[ "def", "is_voigt_symmetric", "(", "self", ",", "tol", "=", "1e-6", ")", ":", "transpose_pieces", "=", "[", "[", "[", "0", "for", "i", "in", "range", "(", "self", ".", "rank", "%", "2", ")", "]", "]", "]", "transpose_pieces", "+=", "[", "[", "range"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.get_voigt_dict
Returns a dictionary that maps indices in the tensor to those in a voigt representation based on input rank Args: rank (int): Tensor rank to generate the voigt map
pymatgen/core/tensors.py
def get_voigt_dict(rank): """ Returns a dictionary that maps indices in the tensor to those in a voigt representation based on input rank Args: rank (int): Tensor rank to generate the voigt map """ vdict = {} for ind in itertools.product(*[range(3)] *...
def get_voigt_dict(rank): """ Returns a dictionary that maps indices in the tensor to those in a voigt representation based on input rank Args: rank (int): Tensor rank to generate the voigt map """ vdict = {} for ind in itertools.product(*[range(3)] *...
[ "Returns", "a", "dictionary", "that", "maps", "indices", "in", "the", "tensor", "to", "those", "in", "a", "voigt", "representation", "based", "on", "input", "rank" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L400-L415
[ "def", "get_voigt_dict", "(", "rank", ")", ":", "vdict", "=", "{", "}", "for", "ind", "in", "itertools", ".", "product", "(", "*", "[", "range", "(", "3", ")", "]", "*", "rank", ")", ":", "v_ind", "=", "ind", "[", ":", "rank", "%", "2", "]", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.from_voigt
Constructor based on the voigt notation vector or matrix. Args: voigt_input (array-like): voigt input for a given tensor
pymatgen/core/tensors.py
def from_voigt(cls, voigt_input): """ Constructor based on the voigt notation vector or matrix. Args: voigt_input (array-like): voigt input for a given tensor """ voigt_input = np.array(voigt_input) rank = sum(voigt_input.shape) // 3 t = cls(np.zeros(...
def from_voigt(cls, voigt_input): """ Constructor based on the voigt notation vector or matrix. Args: voigt_input (array-like): voigt input for a given tensor """ voigt_input = np.array(voigt_input) rank = sum(voigt_input.shape) // 3 t = cls(np.zeros(...
[ "Constructor", "based", "on", "the", "voigt", "notation", "vector", "or", "matrix", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L418-L434
[ "def", "from_voigt", "(", "cls", ",", "voigt_input", ")", ":", "voigt_input", "=", "np", ".", "array", "(", "voigt_input", ")", "rank", "=", "sum", "(", "voigt_input", ".", "shape", ")", "//", "3", "t", "=", "cls", "(", "np", ".", "zeros", "(", "["...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.get_ieee_rotation
Given a structure associated with a tensor, determines the rotation matrix for IEEE conversion according to the 1987 IEEE standards. Args: structure (Structure): a structure associated with the tensor to be converted to the IEEE standard refine_rotation (...
pymatgen/core/tensors.py
def get_ieee_rotation(structure, refine_rotation=True): """ Given a structure associated with a tensor, determines the rotation matrix for IEEE conversion according to the 1987 IEEE standards. Args: structure (Structure): a structure associated with the ...
def get_ieee_rotation(structure, refine_rotation=True): """ Given a structure associated with a tensor, determines the rotation matrix for IEEE conversion according to the 1987 IEEE standards. Args: structure (Structure): a structure associated with the ...
[ "Given", "a", "structure", "associated", "with", "a", "tensor", "determines", "the", "rotation", "matrix", "for", "IEEE", "conversion", "according", "to", "the", "1987", "IEEE", "standards", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L437-L512
[ "def", "get_ieee_rotation", "(", "structure", ",", "refine_rotation", "=", "True", ")", ":", "# Check conventional setting:", "sga", "=", "SpacegroupAnalyzer", "(", "structure", ")", "dataset", "=", "sga", ".", "get_symmetry_dataset", "(", ")", "trans_mat", "=", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.convert_to_ieee
Given a structure associated with a tensor, attempts a calculation of the tensor in IEEE format according to the 1987 IEEE standards. Args: structure (Structure): a structure associated with the tensor to be converted to the IEEE standard initial_fit (boo...
pymatgen/core/tensors.py
def convert_to_ieee(self, structure, initial_fit=True, refine_rotation=True): """ Given a structure associated with a tensor, attempts a calculation of the tensor in IEEE format according to the 1987 IEEE standards. Args: structure (Structure)...
def convert_to_ieee(self, structure, initial_fit=True, refine_rotation=True): """ Given a structure associated with a tensor, attempts a calculation of the tensor in IEEE format according to the 1987 IEEE standards. Args: structure (Structure)...
[ "Given", "a", "structure", "associated", "with", "a", "tensor", "attempts", "a", "calculation", "of", "the", "tensor", "in", "IEEE", "format", "according", "to", "the", "1987", "IEEE", "standards", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L514-L537
[ "def", "convert_to_ieee", "(", "self", ",", "structure", ",", "initial_fit", "=", "True", ",", "refine_rotation", "=", "True", ")", ":", "rotation", "=", "self", ".", "get_ieee_rotation", "(", "structure", ",", "refine_rotation", ")", "result", "=", "self", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.structure_transform
Transforms a tensor from one basis for an original structure into a new basis defined by a new structure. Args: original_structure (Structure): structure corresponding to the basis of the current tensor new_structure (Structure): structure corresponding to the ...
pymatgen/core/tensors.py
def structure_transform(self, original_structure, new_structure, refine_rotation=True): """ Transforms a tensor from one basis for an original structure into a new basis defined by a new structure. Args: original_structure (Structure): structure c...
def structure_transform(self, original_structure, new_structure, refine_rotation=True): """ Transforms a tensor from one basis for an original structure into a new basis defined by a new structure. Args: original_structure (Structure): structure c...
[ "Transforms", "a", "tensor", "from", "one", "basis", "for", "an", "original", "structure", "into", "a", "new", "basis", "defined", "by", "a", "new", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L539-L566
[ "def", "structure_transform", "(", "self", ",", "original_structure", ",", "new_structure", ",", "refine_rotation", "=", "True", ")", ":", "sm", "=", "StructureMatcher", "(", ")", "if", "not", "sm", ".", "fit", "(", "original_structure", ",", "new_structure", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.from_values_indices
Creates a tensor from values and indices, with options for populating the remainder of the tensor. Args: values (floats): numbers to place at indices indices (array-likes): indices to place values at populate (bool): whether to populate the tensor structu...
pymatgen/core/tensors.py
def from_values_indices(cls, values, indices, populate=False, structure=None, voigt_rank=None, vsym=True, verbose=False): """ Creates a tensor from values and indices, with options for populating the remainder of the tensor. Args: ...
def from_values_indices(cls, values, indices, populate=False, structure=None, voigt_rank=None, vsym=True, verbose=False): """ Creates a tensor from values and indices, with options for populating the remainder of the tensor. Args: ...
[ "Creates", "a", "tensor", "from", "values", "and", "indices", "with", "options", "for", "populating", "the", "remainder", "of", "the", "tensor", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L569-L610
[ "def", "from_values_indices", "(", "cls", ",", "values", ",", "indices", ",", "populate", "=", "False", ",", "structure", "=", "None", ",", "voigt_rank", "=", "None", ",", "vsym", "=", "True", ",", "verbose", "=", "False", ")", ":", "# auto-detect voigt no...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.populate
Takes a partially populated tensor, and populates the non-zero entries according to the following procedure, iterated until the desired convergence (specified via prec) is achieved. 1. Find non-zero entries 2. Symmetrize the tensor with respect to crystal symmetry and (option...
pymatgen/core/tensors.py
def populate(self, structure, prec=1e-5, maxiter=200, verbose=False, precond=True, vsym=True): """ Takes a partially populated tensor, and populates the non-zero entries according to the following procedure, iterated until the desired convergence (specified via prec) is ...
def populate(self, structure, prec=1e-5, maxiter=200, verbose=False, precond=True, vsym=True): """ Takes a partially populated tensor, and populates the non-zero entries according to the following procedure, iterated until the desired convergence (specified via prec) is ...
[ "Takes", "a", "partially", "populated", "tensor", "and", "populates", "the", "non", "-", "zero", "entries", "according", "to", "the", "following", "procedure", "iterated", "until", "the", "desired", "convergence", "(", "specified", "via", "prec", ")", "is", "a...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L612-L686
[ "def", "populate", "(", "self", ",", "structure", ",", "prec", "=", "1e-5", ",", "maxiter", "=", "200", ",", "verbose", "=", "False", ",", "precond", "=", "True", ",", "vsym", "=", "True", ")", ":", "if", "precond", ":", "# Generate the guess from popula...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Tensor.as_dict
Serializes the tensor object Args: voigt (bool): flag for whether to store entries in voigt-notation. Defaults to false, as information may be lost in conversion. Returns (Dict): serialized format tensor object
pymatgen/core/tensors.py
def as_dict(self, voigt=False): """ Serializes the tensor object Args: voigt (bool): flag for whether to store entries in voigt-notation. Defaults to false, as information may be lost in conversion. Returns (Dict): serialized for...
def as_dict(self, voigt=False): """ Serializes the tensor object Args: voigt (bool): flag for whether to store entries in voigt-notation. Defaults to false, as information may be lost in conversion. Returns (Dict): serialized for...
[ "Serializes", "the", "tensor", "object" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L688-L707
[ "def", "as_dict", "(", "self", ",", "voigt", "=", "False", ")", ":", "input_array", "=", "self", ".", "voigt", "if", "voigt", "else", "self", "d", "=", "{", "\"@module\"", ":", "self", ".", "__class__", ".", "__module__", ",", "\"@class\"", ":", "self"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SquareTensor.inv
shorthand for matrix inverse on SquareTensor
pymatgen/core/tensors.py
def inv(self): """ shorthand for matrix inverse on SquareTensor """ if self.det == 0: raise ValueError("SquareTensor is non-invertible") return SquareTensor(np.linalg.inv(self))
def inv(self): """ shorthand for matrix inverse on SquareTensor """ if self.det == 0: raise ValueError("SquareTensor is non-invertible") return SquareTensor(np.linalg.inv(self))
[ "shorthand", "for", "matrix", "inverse", "on", "SquareTensor" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L837-L843
[ "def", "inv", "(", "self", ")", ":", "if", "self", ".", "det", "==", "0", ":", "raise", "ValueError", "(", "\"SquareTensor is non-invertible\"", ")", "return", "SquareTensor", "(", "np", ".", "linalg", ".", "inv", "(", "self", ")", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SquareTensor.is_rotation
Test to see if tensor is a valid rotation matrix, performs a test to check whether the inverse is equal to the transpose and if the determinant is equal to one within the specified tolerance Args: tol (float): tolerance to both tests of whether the the determ...
pymatgen/core/tensors.py
def is_rotation(self, tol=1e-3, include_improper=True): """ Test to see if tensor is a valid rotation matrix, performs a test to check whether the inverse is equal to the transpose and if the determinant is equal to one within the specified tolerance Args: to...
def is_rotation(self, tol=1e-3, include_improper=True): """ Test to see if tensor is a valid rotation matrix, performs a test to check whether the inverse is equal to the transpose and if the determinant is equal to one within the specified tolerance Args: to...
[ "Test", "to", "see", "if", "tensor", "is", "a", "valid", "rotation", "matrix", "performs", "a", "test", "to", "check", "whether", "the", "inverse", "is", "equal", "to", "the", "transpose", "and", "if", "the", "determinant", "is", "equal", "to", "one", "w...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L852-L870
[ "def", "is_rotation", "(", "self", ",", "tol", "=", "1e-3", ",", "include_improper", "=", "True", ")", ":", "det", "=", "np", ".", "abs", "(", "np", ".", "linalg", ".", "det", "(", "self", ")", ")", "if", "include_improper", ":", "det", "=", "np", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SquareTensor.refine_rotation
Helper method for refining rotation matrix by ensuring that second and third rows are perpindicular to the first. Gets new y vector from an orthogonal projection of x onto y and the new z vector from a cross product of the new x and y Args: tol to test for rotation ...
pymatgen/core/tensors.py
def refine_rotation(self): """ Helper method for refining rotation matrix by ensuring that second and third rows are perpindicular to the first. Gets new y vector from an orthogonal projection of x onto y and the new z vector from a cross product of the new x and y Args:...
def refine_rotation(self): """ Helper method for refining rotation matrix by ensuring that second and third rows are perpindicular to the first. Gets new y vector from an orthogonal projection of x onto y and the new z vector from a cross product of the new x and y Args:...
[ "Helper", "method", "for", "refining", "rotation", "matrix", "by", "ensuring", "that", "second", "and", "third", "rows", "are", "perpindicular", "to", "the", "first", ".", "Gets", "new", "y", "vector", "from", "an", "orthogonal", "projection", "of", "x", "on...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/tensors.py#L872-L889
[ "def", "refine_rotation", "(", "self", ")", ":", "new_x", ",", "y", "=", "get_uvec", "(", "self", "[", "0", "]", ")", ",", "get_uvec", "(", "self", "[", "1", "]", ")", "# Get a projection on y", "new_y", "=", "y", "-", "np", ".", "dot", "(", "new_x...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
compute_average_oxidation_state
Calculates the average oxidation state of a site Args: site: Site to compute average oxidation state Returns: Average oxidation state of site.
pymatgen/analysis/ewald.py
def compute_average_oxidation_state(site): """ Calculates the average oxidation state of a site Args: site: Site to compute average oxidation state Returns: Average oxidation state of site. """ try: avg_oxi = sum([sp.oxi_state * occu for sp, occu ...
def compute_average_oxidation_state(site): """ Calculates the average oxidation state of a site Args: site: Site to compute average oxidation state Returns: Average oxidation state of site. """ try: avg_oxi = sum([sp.oxi_state * occu for sp, occu ...
[ "Calculates", "the", "average", "oxidation", "state", "of", "a", "site" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L640-L662
[ "def", "compute_average_oxidation_state", "(", "site", ")", ":", "try", ":", "avg_oxi", "=", "sum", "(", "[", "sp", ".", "oxi_state", "*", "occu", "for", "sp", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")", "if", "sp", "is", "not"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation.compute_partial_energy
Gives total ewald energy for certain sites being removed, i.e. zeroed out.
pymatgen/analysis/ewald.py
def compute_partial_energy(self, removed_indices): """ Gives total ewald energy for certain sites being removed, i.e. zeroed out. """ total_energy_matrix = self.total_energy_matrix.copy() for i in removed_indices: total_energy_matrix[i, :] = 0 tota...
def compute_partial_energy(self, removed_indices): """ Gives total ewald energy for certain sites being removed, i.e. zeroed out. """ total_energy_matrix = self.total_energy_matrix.copy() for i in removed_indices: total_energy_matrix[i, :] = 0 tota...
[ "Gives", "total", "ewald", "energy", "for", "certain", "sites", "being", "removed", "i", ".", "e", ".", "zeroed", "out", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L118-L127
[ "def", "compute_partial_energy", "(", "self", ",", "removed_indices", ")", ":", "total_energy_matrix", "=", "self", ".", "total_energy_matrix", ".", "copy", "(", ")", "for", "i", "in", "removed_indices", ":", "total_energy_matrix", "[", "i", ",", ":", "]", "="...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation.compute_sub_structure
Gives total ewald energy for an sub structure in the same lattice. The sub_structure must be a subset of the original structure, with possible different charges. Args: substructure (Structure): Substructure to compute Ewald sum for. tol (float): Tolerance for site matchi...
pymatgen/analysis/ewald.py
def compute_sub_structure(self, sub_structure, tol=1e-3): """ Gives total ewald energy for an sub structure in the same lattice. The sub_structure must be a subset of the original structure, with possible different charges. Args: substructure (Structure): Substructur...
def compute_sub_structure(self, sub_structure, tol=1e-3): """ Gives total ewald energy for an sub structure in the same lattice. The sub_structure must be a subset of the original structure, with possible different charges. Args: substructure (Structure): Substructur...
[ "Gives", "total", "ewald", "energy", "for", "an", "sub", "structure", "in", "the", "same", "lattice", ".", "The", "sub_structure", "must", "be", "a", "subset", "of", "the", "original", "structure", "with", "possible", "different", "charges", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L129-L174
[ "def", "compute_sub_structure", "(", "self", ",", "sub_structure", ",", "tol", "=", "1e-3", ")", ":", "total_energy_matrix", "=", "self", ".", "total_energy_matrix", ".", "copy", "(", ")", "def", "find_match", "(", "site", ")", ":", "for", "test_site", "in",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation.total_energy
The total energy.
pymatgen/analysis/ewald.py
def total_energy(self): """ The total energy. """ return sum(sum(self._recip)) + sum(sum(self._real)) + sum(self._point) + self._charged_cell_energy
def total_energy(self): """ The total energy. """ return sum(sum(self._recip)) + sum(sum(self._real)) + sum(self._point) + self._charged_cell_energy
[ "The", "total", "energy", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L223-L227
[ "def", "total_energy", "(", "self", ")", ":", "return", "sum", "(", "sum", "(", "self", ".", "_recip", ")", ")", "+", "sum", "(", "sum", "(", "self", ".", "_real", ")", ")", "+", "sum", "(", "self", ".", "_point", ")", "+", "self", ".", "_charg...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation.total_energy_matrix
The total energy matrix. Each matrix element (i, j) corresponds to the total interaction energy between site i and site j. Note that this does not include the charged-cell energy, which is only important when the simulation cell is not charge balanced.
pymatgen/analysis/ewald.py
def total_energy_matrix(self): """ The total energy matrix. Each matrix element (i, j) corresponds to the total interaction energy between site i and site j. Note that this does not include the charged-cell energy, which is only important when the simulation cell is not charge b...
def total_energy_matrix(self): """ The total energy matrix. Each matrix element (i, j) corresponds to the total interaction energy between site i and site j. Note that this does not include the charged-cell energy, which is only important when the simulation cell is not charge b...
[ "The", "total", "energy", "matrix", ".", "Each", "matrix", "element", "(", "i", "j", ")", "corresponds", "to", "the", "total", "interaction", "energy", "between", "site", "i", "and", "site", "j", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L230-L241
[ "def", "total_energy_matrix", "(", "self", ")", ":", "totalenergy", "=", "self", ".", "_recip", "+", "self", ".", "_real", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_point", ")", ")", ":", "totalenergy", "[", "i", ",", "i", "]", "+=...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation.get_site_energy
Compute the energy for a single site in the structure Args: site_index (int): Index of site ReturnS: (float) - Energy of that site
pymatgen/analysis/ewald.py
def get_site_energy(self, site_index): """Compute the energy for a single site in the structure Args: site_index (int): Index of site ReturnS: (float) - Energy of that site""" if self._charged: warn('Per atom energies for charged structures no...
def get_site_energy(self, site_index): """Compute the energy for a single site in the structure Args: site_index (int): Index of site ReturnS: (float) - Energy of that site""" if self._charged: warn('Per atom energies for charged structures no...
[ "Compute", "the", "energy", "for", "a", "single", "site", "in", "the", "structure", "Args", ":", "site_index", "(", "int", ")", ":", "Index", "of", "site", "ReturnS", ":", "(", "float", ")", "-", "Energy", "of", "that", "site" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L254-L264
[ "def", "get_site_energy", "(", "self", ",", "site_index", ")", ":", "if", "self", ".", "_charged", ":", "warn", "(", "'Per atom energies for charged structures not supported in EwaldSummation'", ")", "return", "np", ".", "sum", "(", "self", ".", "_recip", "[", ":"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation._calc_recip
Perform the reciprocal space summation. Calculates the quantity E_recip = 1/(2PiV) sum_{G < Gmax} exp(-(G.G/4/eta))/(G.G) S(G)S(-G) where S(G) = sum_{k=1,N} q_k exp(-i G.r_k) S(G)S(-G) = |S(G)|**2 This method is heavily vectorized to utilize numpy's C backend for speed.
pymatgen/analysis/ewald.py
def _calc_recip(self): """ Perform the reciprocal space summation. Calculates the quantity E_recip = 1/(2PiV) sum_{G < Gmax} exp(-(G.G/4/eta))/(G.G) S(G)S(-G) where S(G) = sum_{k=1,N} q_k exp(-i G.r_k) S(G)S(-G) = |S(G)|**2 This method is heavily vectorized to ut...
def _calc_recip(self): """ Perform the reciprocal space summation. Calculates the quantity E_recip = 1/(2PiV) sum_{G < Gmax} exp(-(G.G/4/eta))/(G.G) S(G)S(-G) where S(G) = sum_{k=1,N} q_k exp(-i G.r_k) S(G)S(-G) = |S(G)|**2 This method is heavily vectorized to ut...
[ "Perform", "the", "reciprocal", "space", "summation", ".", "Calculates", "the", "quantity", "E_recip", "=", "1", "/", "(", "2PiV", ")", "sum_", "{", "G", "<", "Gmax", "}", "exp", "(", "-", "(", "G", ".", "G", "/", "4", "/", "eta", "))", "/", "(",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L266-L321
[ "def", "_calc_recip", "(", "self", ")", ":", "numsites", "=", "self", ".", "_s", ".", "num_sites", "prefactor", "=", "2", "*", "pi", "/", "self", ".", "_vol", "erecip", "=", "np", ".", "zeros", "(", "(", "numsites", ",", "numsites", ")", ",", "dtyp...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldSummation._calc_real_and_point
Determines the self energy -(eta/pi)**(1/2) * sum_{i=1}^{N} q_i**2
pymatgen/analysis/ewald.py
def _calc_real_and_point(self): """ Determines the self energy -(eta/pi)**(1/2) * sum_{i=1}^{N} q_i**2 """ fcoords = self._s.frac_coords forcepf = 2.0 * self._sqrt_eta / sqrt(pi) coords = self._coords numsites = self._s.num_sites ereal = np.empty((numsites...
def _calc_real_and_point(self): """ Determines the self energy -(eta/pi)**(1/2) * sum_{i=1}^{N} q_i**2 """ fcoords = self._s.frac_coords forcepf = 2.0 * self._sqrt_eta / sqrt(pi) coords = self._coords numsites = self._s.num_sites ereal = np.empty((numsites...
[ "Determines", "the", "self", "energy", "-", "(", "eta", "/", "pi", ")", "**", "(", "1", "/", "2", ")", "*", "sum_", "{", "i", "=", "1", "}", "^", "{", "N", "}", "q_i", "**", "2" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L323-L370
[ "def", "_calc_real_and_point", "(", "self", ")", ":", "fcoords", "=", "self", ".", "_s", ".", "frac_coords", "forcepf", "=", "2.0", "*", "self", ".", "_sqrt_eta", "/", "sqrt", "(", "pi", ")", "coords", "=", "self", ".", "_coords", "numsites", "=", "sel...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldMinimizer.minimize_matrix
This method finds and returns the permutations that produce the lowest ewald sum calls recursive function to iterate through permutations
pymatgen/analysis/ewald.py
def minimize_matrix(self): """ This method finds and returns the permutations that produce the lowest ewald sum calls recursive function to iterate through permutations """ if self._algo == EwaldMinimizer.ALGO_FAST or \ self._algo == EwaldMinimizer.ALGO_BE...
def minimize_matrix(self): """ This method finds and returns the permutations that produce the lowest ewald sum calls recursive function to iterate through permutations """ if self._algo == EwaldMinimizer.ALGO_FAST or \ self._algo == EwaldMinimizer.ALGO_BE...
[ "This", "method", "finds", "and", "returns", "the", "permutations", "that", "produce", "the", "lowest", "ewald", "sum", "calls", "recursive", "function", "to", "iterate", "through", "permutations" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L473-L481
[ "def", "minimize_matrix", "(", "self", ")", ":", "if", "self", ".", "_algo", "==", "EwaldMinimizer", ".", "ALGO_FAST", "or", "self", ".", "_algo", "==", "EwaldMinimizer", ".", "ALGO_BEST_FIRST", ":", "return", "self", ".", "_recurse", "(", "self", ".", "_m...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldMinimizer.add_m_list
This adds an m_list to the output_lists and updates the current minimum if the list is full.
pymatgen/analysis/ewald.py
def add_m_list(self, matrix_sum, m_list): """ This adds an m_list to the output_lists and updates the current minimum if the list is full. """ if self._output_lists is None: self._output_lists = [[matrix_sum, m_list]] else: bisect.insort(self._outp...
def add_m_list(self, matrix_sum, m_list): """ This adds an m_list to the output_lists and updates the current minimum if the list is full. """ if self._output_lists is None: self._output_lists = [[matrix_sum, m_list]] else: bisect.insort(self._outp...
[ "This", "adds", "an", "m_list", "to", "the", "output_lists", "and", "updates", "the", "current", "minimum", "if", "the", "list", "is", "full", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L483-L498
[ "def", "add_m_list", "(", "self", ",", "matrix_sum", ",", "m_list", ")", ":", "if", "self", ".", "_output_lists", "is", "None", ":", "self", ".", "_output_lists", "=", "[", "[", "matrix_sum", ",", "m_list", "]", "]", "else", ":", "bisect", ".", "insort...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldMinimizer.best_case
Computes a best case given a matrix and manipulation list. Args: matrix: the current matrix (with some permutations already performed) m_list: [(multiplication fraction, number_of_indices, indices, species)] describing the manipulation indices...
pymatgen/analysis/ewald.py
def best_case(self, matrix, m_list, indices_left): """ Computes a best case given a matrix and manipulation list. Args: matrix: the current matrix (with some permutations already performed) m_list: [(multiplication fraction, number_of_indices, indices, ...
def best_case(self, matrix, m_list, indices_left): """ Computes a best case given a matrix and manipulation list. Args: matrix: the current matrix (with some permutations already performed) m_list: [(multiplication fraction, number_of_indices, indices, ...
[ "Computes", "a", "best", "case", "given", "a", "matrix", "and", "manipulation", "list", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L500-L553
[ "def", "best_case", "(", "self", ",", "matrix", ",", "m_list", ",", "indices_left", ")", ":", "m_indices", "=", "[", "]", "fraction_list", "=", "[", "]", "for", "m", "in", "m_list", ":", "m_indices", ".", "extend", "(", "m", "[", "2", "]", ")", "fr...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldMinimizer.get_next_index
Returns an index that should have the most negative effect on the matrix sum
pymatgen/analysis/ewald.py
def get_next_index(self, matrix, manipulation, indices_left): """ Returns an index that should have the most negative effect on the matrix sum """ f = manipulation[0] indices = list(indices_left.intersection(manipulation[2])) sums = np.sum(matrix[indices], axis=1)...
def get_next_index(self, matrix, manipulation, indices_left): """ Returns an index that should have the most negative effect on the matrix sum """ f = manipulation[0] indices = list(indices_left.intersection(manipulation[2])) sums = np.sum(matrix[indices], axis=1)...
[ "Returns", "an", "index", "that", "should", "have", "the", "most", "negative", "effect", "on", "the", "matrix", "sum" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L555-L568
[ "def", "get_next_index", "(", "self", ",", "matrix", ",", "manipulation", ",", "indices_left", ")", ":", "f", "=", "manipulation", "[", "0", "]", "indices", "=", "list", "(", "indices_left", ".", "intersection", "(", "manipulation", "[", "2", "]", ")", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
EwaldMinimizer._recurse
This method recursively finds the minimal permutations using a binary tree search strategy. Args: matrix: The current matrix (with some permutations already performed). m_list: The list of permutations still to be performed indices: Set of indices whi...
pymatgen/analysis/ewald.py
def _recurse(self, matrix, m_list, indices, output_m_list=[]): """ This method recursively finds the minimal permutations using a binary tree search strategy. Args: matrix: The current matrix (with some permutations already performed). m_list: The...
def _recurse(self, matrix, m_list, indices, output_m_list=[]): """ This method recursively finds the minimal permutations using a binary tree search strategy. Args: matrix: The current matrix (with some permutations already performed). m_list: The...
[ "This", "method", "recursively", "finds", "the", "minimal", "permutations", "using", "a", "binary", "tree", "search", "strategy", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/ewald.py#L570-L625
[ "def", "_recurse", "(", "self", ",", "matrix", ",", "m_list", ",", "indices", ",", "output_m_list", "=", "[", "]", ")", ":", "# check to see if we've found all the solutions that we need", "if", "self", ".", "_finished", ":", "return", "# if we're done with the curren...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
average_coordination_number
Calculates the ensemble averaged Voronoi coordination numbers of a list of Structures using VoronoiNN. Typically used for analyzing the output of a Molecular Dynamics run. Args: structures (list): list of Structures. freq (int): sampling frequency of coordination number [every freq steps]. ...
pymatgen/analysis/structure_analyzer.py
def average_coordination_number(structures, freq=10): """ Calculates the ensemble averaged Voronoi coordination numbers of a list of Structures using VoronoiNN. Typically used for analyzing the output of a Molecular Dynamics run. Args: structures (list): list of Structures. freq (int...
def average_coordination_number(structures, freq=10): """ Calculates the ensemble averaged Voronoi coordination numbers of a list of Structures using VoronoiNN. Typically used for analyzing the output of a Molecular Dynamics run. Args: structures (list): list of Structures. freq (int...
[ "Calculates", "the", "ensemble", "averaged", "Voronoi", "coordination", "numbers", "of", "a", "list", "of", "Structures", "using", "VoronoiNN", ".", "Typically", "used", "for", "analyzing", "the", "output", "of", "a", "Molecular", "Dynamics", "run", ".", "Args",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L40-L67
[ "def", "average_coordination_number", "(", "structures", ",", "freq", "=", "10", ")", ":", "coordination_numbers", "=", "{", "}", "for", "spec", "in", "structures", "[", "0", "]", ".", "composition", ".", "as_dict", "(", ")", ".", "keys", "(", ")", ":", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
solid_angle
Helper method to calculate the solid angle of a set of coords from the center. Args: center (3x1 array): Center to measure solid angle from. coords (Nx3 array): List of coords to determine solid angle. Returns: The solid angle.
pymatgen/analysis/structure_analyzer.py
def solid_angle(center, coords): """ Helper method to calculate the solid angle of a set of coords from the center. Args: center (3x1 array): Center to measure solid angle from. coords (Nx3 array): List of coords to determine solid angle. Returns: The solid angle. """ ...
def solid_angle(center, coords): """ Helper method to calculate the solid angle of a set of coords from the center. Args: center (3x1 array): Center to measure solid angle from. coords (Nx3 array): List of coords to determine solid angle. Returns: The solid angle. """ ...
[ "Helper", "method", "to", "calculate", "the", "solid", "angle", "of", "a", "set", "of", "coords", "from", "the", "center", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L366-L389
[ "def", "solid_angle", "(", "center", ",", "coords", ")", ":", "o", "=", "np", ".", "array", "(", "center", ")", "r", "=", "[", "np", ".", "array", "(", "c", ")", "-", "o", "for", "c", "in", "coords", "]", "r", ".", "append", "(", "r", "[", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_max_bond_lengths
Provides max bond length estimates for a structure based on the JMol table and algorithms. Args: structure: (structure) el_radius_updates: (dict) symbol->float to update atomic radii Returns: (dict) - (Element1, Element2) -> float. The two elements are ordered by Z.
pymatgen/analysis/structure_analyzer.py
def get_max_bond_lengths(structure, el_radius_updates=None): """ Provides max bond length estimates for a structure based on the JMol table and algorithms. Args: structure: (structure) el_radius_updates: (dict) symbol->float to update atomic radii Returns: (dict) - (Element...
def get_max_bond_lengths(structure, el_radius_updates=None): """ Provides max bond length estimates for a structure based on the JMol table and algorithms. Args: structure: (structure) el_radius_updates: (dict) symbol->float to update atomic radii Returns: (dict) - (Element...
[ "Provides", "max", "bond", "length", "estimates", "for", "a", "structure", "based", "on", "the", "JMol", "table", "and", "algorithms", ".", "Args", ":", "structure", ":", "(", "structure", ")", "el_radius_updates", ":", "(", "dict", ")", "symbol", "-", ">"...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L392-L415
[ "def", "get_max_bond_lengths", "(", "structure", ",", "el_radius_updates", "=", "None", ")", ":", "#jmc = JMolCoordFinder(el_radius_updates)", "jmnn", "=", "JmolNN", "(", "el_radius_updates", "=", "el_radius_updates", ")", "bonds_lens", "=", "{", "}", "els", "=", "s...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_dimensionality
This method returns whether a structure is 3D, 2D (layered), or 1D (linear chains or molecules) according to the algorithm published in Gorai, P., Toberer, E. & Stevanovic, V. Computational Identification of Promising Thermoelectric Materials Among Known Quasi-2D Binary Compounds. J. Mater. Chem. A 2, 4...
pymatgen/analysis/structure_analyzer.py
def get_dimensionality(structure, max_hkl=2, el_radius_updates=None, min_slab_size=5, min_vacuum_size=5, standardize=True, bonds=None): """ This method returns whether a structure is 3D, 2D (layered), or 1D (linear chains or molecules) according to the algorithm...
def get_dimensionality(structure, max_hkl=2, el_radius_updates=None, min_slab_size=5, min_vacuum_size=5, standardize=True, bonds=None): """ This method returns whether a structure is 3D, 2D (layered), or 1D (linear chains or molecules) according to the algorithm...
[ "This", "method", "returns", "whether", "a", "structure", "is", "3D", "2D", "(", "layered", ")", "or", "1D", "(", "linear", "chains", "or", "molecules", ")", "according", "to", "the", "algorithm", "published", "in", "Gorai", "P", ".", "Toberer", "E", "."...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L421-L476
[ "def", "get_dimensionality", "(", "structure", ",", "max_hkl", "=", "2", ",", "el_radius_updates", "=", "None", ",", "min_slab_size", "=", "5", ",", "min_vacuum_size", "=", "5", ",", "standardize", "=", "True", ",", "bonds", "=", "None", ")", ":", "if", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
contains_peroxide
Determines if a structure contains peroxide anions. Args: structure (Structure): Input structure. relative_cutoff: The peroxide bond distance is 1.49 Angstrom. Relative_cutoff * 1.49 stipulates the maximum distance two O atoms must be to each other to be considered a peroxid...
pymatgen/analysis/structure_analyzer.py
def contains_peroxide(structure, relative_cutoff=1.1): """ Determines if a structure contains peroxide anions. Args: structure (Structure): Input structure. relative_cutoff: The peroxide bond distance is 1.49 Angstrom. Relative_cutoff * 1.49 stipulates the maximum distance two O...
def contains_peroxide(structure, relative_cutoff=1.1): """ Determines if a structure contains peroxide anions. Args: structure (Structure): Input structure. relative_cutoff: The peroxide bond distance is 1.49 Angstrom. Relative_cutoff * 1.49 stipulates the maximum distance two O...
[ "Determines", "if", "a", "structure", "contains", "peroxide", "anions", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L479-L496
[ "def", "contains_peroxide", "(", "structure", ",", "relative_cutoff", "=", "1.1", ")", ":", "ox_type", "=", "oxide_type", "(", "structure", ",", "relative_cutoff", ")", "if", "ox_type", "==", "\"peroxide\"", ":", "return", "True", "else", ":", "return", "False...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
oxide_type
Determines if an oxide is a peroxide/superoxide/ozonide/normal oxide Args: structure (Structure): Input structure. relative_cutoff (float): Relative_cutoff * act. cutoff stipulates the max distance two O atoms must be from each other. return_nbonds (bool): Should number of bonds...
pymatgen/analysis/structure_analyzer.py
def oxide_type(structure, relative_cutoff=1.1, return_nbonds=False): """ Determines if an oxide is a peroxide/superoxide/ozonide/normal oxide Args: structure (Structure): Input structure. relative_cutoff (float): Relative_cutoff * act. cutoff stipulates the max distance two O at...
def oxide_type(structure, relative_cutoff=1.1, return_nbonds=False): """ Determines if an oxide is a peroxide/superoxide/ozonide/normal oxide Args: structure (Structure): Input structure. relative_cutoff (float): Relative_cutoff * act. cutoff stipulates the max distance two O at...
[ "Determines", "if", "an", "oxide", "is", "a", "peroxide", "/", "superoxide", "/", "ozonide", "/", "normal", "oxide" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L589-L604
[ "def", "oxide_type", "(", "structure", ",", "relative_cutoff", "=", "1.1", ",", "return_nbonds", "=", "False", ")", ":", "ox_obj", "=", "OxideType", "(", "structure", ",", "relative_cutoff", ")", "if", "return_nbonds", ":", "return", "ox_obj", ".", "oxide_type...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
sulfide_type
Determines if a structure is a sulfide/polysulfide Args: structure (Structure): Input structure. Returns: (str) sulfide/polysulfide/sulfate
pymatgen/analysis/structure_analyzer.py
def sulfide_type(structure): """ Determines if a structure is a sulfide/polysulfide Args: structure (Structure): Input structure. Returns: (str) sulfide/polysulfide/sulfate """ structure = structure.copy() structure.remove_oxidation_states() s = Element("S") comp = ...
def sulfide_type(structure): """ Determines if a structure is a sulfide/polysulfide Args: structure (Structure): Input structure. Returns: (str) sulfide/polysulfide/sulfate """ structure = structure.copy() structure.remove_oxidation_states() s = Element("S") comp = ...
[ "Determines", "if", "a", "structure", "is", "a", "sulfide", "/", "polysulfide" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L607-L659
[ "def", "sulfide_type", "(", "structure", ")", ":", "structure", "=", "structure", ".", "copy", "(", ")", "structure", ".", "remove_oxidation_states", "(", ")", "s", "=", "Element", "(", "\"S\"", ")", "comp", "=", "structure", ".", "composition", "if", "com...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
VoronoiAnalyzer.analyze
Performs Voronoi analysis and returns the polyhedra around atom n in Schlaefli notation. Args: structure (Structure): structure to analyze n (int): index of the center atom in structure Returns: voronoi index of n: <c3,c4,c6,c6,c7,c8,c9,c10> ...
pymatgen/analysis/structure_analyzer.py
def analyze(self, structure, n=0): """ Performs Voronoi analysis and returns the polyhedra around atom n in Schlaefli notation. Args: structure (Structure): structure to analyze n (int): index of the center atom in structure Returns: voronoi ...
def analyze(self, structure, n=0): """ Performs Voronoi analysis and returns the polyhedra around atom n in Schlaefli notation. Args: structure (Structure): structure to analyze n (int): index of the center atom in structure Returns: voronoi ...
[ "Performs", "Voronoi", "analysis", "and", "returns", "the", "polyhedra", "around", "atom", "n", "in", "Schlaefli", "notation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_analyzer.py#L94-L124
[ "def", "analyze", "(", "self", ",", "structure", ",", "n", "=", "0", ")", ":", "center", "=", "structure", "[", "n", "]", "neighbors", "=", "structure", ".", "get_sites_in_sphere", "(", "center", ".", "coords", ",", "self", ".", "cutoff", ")", "neighbo...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da