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 | Work.set_flow | Set the flow associated to this :class:`Work`. | pymatgen/io/abinit/works.py | def set_flow(self, flow):
"""Set the flow associated to this :class:`Work`."""
if not hasattr(self, "_flow"):
self._flow = flow
else:
if self._flow != flow:
raise ValueError("self._flow != flow") | def set_flow(self, flow):
"""Set the flow associated to this :class:`Work`."""
if not hasattr(self, "_flow"):
self._flow = flow
else:
if self._flow != flow:
raise ValueError("self._flow != flow") | [
"Set",
"the",
"flow",
"associated",
"to",
"this",
":",
"class",
":",
"Work",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L505-L511 | [
"def",
"set_flow",
"(",
"self",
",",
"flow",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_flow\"",
")",
":",
"self",
".",
"_flow",
"=",
"flow",
"else",
":",
"if",
"self",
".",
"_flow",
"!=",
"flow",
":",
"raise",
"ValueError",
"(",
"\"se... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.status_counter | Returns a `Counter` object that counts the number of task with
given status (use the string representation of the status as key). | pymatgen/io/abinit/works.py | def status_counter(self):
"""
Returns a `Counter` object that counts the number of task with
given status (use the string representation of the status as key).
"""
counter = collections.Counter()
for task in self:
counter[str(task.status)] += 1
retur... | def status_counter(self):
"""
Returns a `Counter` object that counts the number of task with
given status (use the string representation of the status as key).
"""
counter = collections.Counter()
for task in self:
counter[str(task.status)] += 1
retur... | [
"Returns",
"a",
"Counter",
"object",
"that",
"counts",
"the",
"number",
"of",
"task",
"with",
"given",
"status",
"(",
"use",
"the",
"string",
"representation",
"of",
"the",
"status",
"as",
"key",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L597-L607 | [
"def",
"status_counter",
"(",
"self",
")",
":",
"counter",
"=",
"collections",
".",
"Counter",
"(",
")",
"for",
"task",
"in",
"self",
":",
"counter",
"[",
"str",
"(",
"task",
".",
"status",
")",
"]",
"+=",
"1",
"return",
"counter"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.allocate | This function is called once we have completed the initialization
of the :class:`Work`. It sets the manager of each task (if not already done)
and defines the working directories of the tasks.
Args:
manager: :class:`TaskManager` object or None | pymatgen/io/abinit/works.py | def allocate(self, manager=None):
"""
This function is called once we have completed the initialization
of the :class:`Work`. It sets the manager of each task (if not already done)
and defines the working directories of the tasks.
Args:
manager: :class:`TaskManager` ... | def allocate(self, manager=None):
"""
This function is called once we have completed the initialization
of the :class:`Work`. It sets the manager of each task (if not already done)
and defines the working directories of the tasks.
Args:
manager: :class:`TaskManager` ... | [
"This",
"function",
"is",
"called",
"once",
"we",
"have",
"completed",
"the",
"initialization",
"of",
"the",
":",
"class",
":",
"Work",
".",
"It",
"sets",
"the",
"manager",
"of",
"each",
"task",
"(",
"if",
"not",
"already",
"done",
")",
"and",
"defines",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L609-L638 | [
"def",
"allocate",
"(",
"self",
",",
"manager",
"=",
"None",
")",
":",
"for",
"i",
",",
"task",
"in",
"enumerate",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"task",
",",
"\"manager\"",
")",
":",
"# Set the manager",
"# Use the one provided in inp... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.register | Registers a new :class:`Task` and add it to the internal list, taking into account possible dependencies.
Args:
obj: :class:`AbinitInput` instance or `Task` object.
deps: Dictionary specifying the dependency of this node or list of dependencies
None means that this obj... | pymatgen/io/abinit/works.py | def register(self, obj, deps=None, required_files=None, manager=None, task_class=None):
"""
Registers a new :class:`Task` and add it to the internal list, taking into account possible dependencies.
Args:
obj: :class:`AbinitInput` instance or `Task` object.
deps: Dictiona... | def register(self, obj, deps=None, required_files=None, manager=None, task_class=None):
"""
Registers a new :class:`Task` and add it to the internal list, taking into account possible dependencies.
Args:
obj: :class:`AbinitInput` instance or `Task` object.
deps: Dictiona... | [
"Registers",
"a",
"new",
":",
"class",
":",
"Task",
"and",
"add",
"it",
"to",
"the",
"internal",
"list",
"taking",
"into",
"account",
"possible",
"dependencies",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L640-L686 | [
"def",
"register",
"(",
"self",
",",
"obj",
",",
"deps",
"=",
"None",
",",
"required_files",
"=",
"None",
",",
"manager",
"=",
"None",
",",
"task_class",
"=",
"None",
")",
":",
"task_workdir",
"=",
"None",
"if",
"hasattr",
"(",
"self",
",",
"\"workdir\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.build | Creates the top level directory. | pymatgen/io/abinit/works.py | def build(self, *args, **kwargs):
"""Creates the top level directory."""
# Create the directories of the work.
self.indir.makedirs()
self.outdir.makedirs()
self.tmpdir.makedirs()
# Build dirs and files of each task.
for task in self:
task.build(*args,... | def build(self, *args, **kwargs):
"""Creates the top level directory."""
# Create the directories of the work.
self.indir.makedirs()
self.outdir.makedirs()
self.tmpdir.makedirs()
# Build dirs and files of each task.
for task in self:
task.build(*args,... | [
"Creates",
"the",
"top",
"level",
"directory",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L701-L713 | [
"def",
"build",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Create the directories of the work.",
"self",
".",
"indir",
".",
"makedirs",
"(",
")",
"self",
".",
"outdir",
".",
"makedirs",
"(",
")",
"self",
".",
"tmpdir",
".",
"m... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.get_all_status | Returns a list with the status of the tasks in self.
Args:
only_min: If True, the minimum of the status is returned. | pymatgen/io/abinit/works.py | def get_all_status(self, only_min=False):
"""
Returns a list with the status of the tasks in self.
Args:
only_min: If True, the minimum of the status is returned.
"""
if len(self) == 0:
# The work will be created in the future.
if only_min:
... | def get_all_status(self, only_min=False):
"""
Returns a list with the status of the tasks in self.
Args:
only_min: If True, the minimum of the status is returned.
"""
if len(self) == 0:
# The work will be created in the future.
if only_min:
... | [
"Returns",
"a",
"list",
"with",
"the",
"status",
"of",
"the",
"tasks",
"in",
"self",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L722-L742 | [
"def",
"get_all_status",
"(",
"self",
",",
"only_min",
"=",
"False",
")",
":",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"# The work will be created in the future.",
"if",
"only_min",
":",
"return",
"self",
".",
"S_INIT",
"else",
":",
"return",
"[",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.check_status | Check the status of the tasks. | pymatgen/io/abinit/works.py | def check_status(self):
"""Check the status of the tasks."""
# Recompute the status of the tasks
# Ignore OK and LOCKED tasks.
for task in self:
if task.status in (task.S_OK, task.S_LOCKED): continue
task.check_status()
# Take into account possible depend... | def check_status(self):
"""Check the status of the tasks."""
# Recompute the status of the tasks
# Ignore OK and LOCKED tasks.
for task in self:
if task.status in (task.S_OK, task.S_LOCKED): continue
task.check_status()
# Take into account possible depend... | [
"Check",
"the",
"status",
"of",
"the",
"tasks",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L744-L756 | [
"def",
"check_status",
"(",
"self",
")",
":",
"# Recompute the status of the tasks",
"# Ignore OK and LOCKED tasks.",
"for",
"task",
"in",
"self",
":",
"if",
"task",
".",
"status",
"in",
"(",
"task",
".",
"S_OK",
",",
"task",
".",
"S_LOCKED",
")",
":",
"contin... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.rmtree | Remove all files and directories in the working directory
Args:
exclude_wildcard: Optional string with regular expressions separated by `|`.
Files matching one of the regular expressions will be preserved.
example: exclude_wildard="*.nc|*.txt" preserves all the files... | pymatgen/io/abinit/works.py | def rmtree(self, exclude_wildcard=""):
"""
Remove all files and directories in the working directory
Args:
exclude_wildcard: Optional string with regular expressions separated by `|`.
Files matching one of the regular expressions will be preserved.
ex... | def rmtree(self, exclude_wildcard=""):
"""
Remove all files and directories in the working directory
Args:
exclude_wildcard: Optional string with regular expressions separated by `|`.
Files matching one of the regular expressions will be preserved.
ex... | [
"Remove",
"all",
"files",
"and",
"directories",
"in",
"the",
"working",
"directory"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L758-L777 | [
"def",
"rmtree",
"(",
"self",
",",
"exclude_wildcard",
"=",
"\"\"",
")",
":",
"if",
"not",
"exclude_wildcard",
":",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"workdir",
")",
"else",
":",
"w",
"=",
"WildCard",
"(",
"exclude_wildcard",
")",
"for",
"dirpat... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.move | Recursively move self.workdir to another location. This is similar to the Unix "mv" command.
The destination path must not already exist. If the destination already exists
but is not a directory, it may be overwritten depending on os.rename() semantics.
Be default, dest is located in the parent... | pymatgen/io/abinit/works.py | def move(self, dest, isabspath=False):
"""
Recursively move self.workdir to another location. This is similar to the Unix "mv" command.
The destination path must not already exist. If the destination already exists
but is not a directory, it may be overwritten depending on os.rename() se... | def move(self, dest, isabspath=False):
"""
Recursively move self.workdir to another location. This is similar to the Unix "mv" command.
The destination path must not already exist. If the destination already exists
but is not a directory, it may be overwritten depending on os.rename() se... | [
"Recursively",
"move",
"self",
".",
"workdir",
"to",
"another",
"location",
".",
"This",
"is",
"similar",
"to",
"the",
"Unix",
"mv",
"command",
".",
"The",
"destination",
"path",
"must",
"not",
"already",
"exist",
".",
"If",
"the",
"destination",
"already",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L794-L806 | [
"def",
"move",
"(",
"self",
",",
"dest",
",",
"isabspath",
"=",
"False",
")",
":",
"if",
"not",
"isabspath",
":",
"dest",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"workdir",
")",
",",
"dest",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.submit_tasks | Submits the task in self and wait.
TODO: change name. | pymatgen/io/abinit/works.py | def submit_tasks(self, wait=False):
"""
Submits the task in self and wait.
TODO: change name.
"""
for task in self:
task.start()
if wait:
for task in self: task.wait() | def submit_tasks(self, wait=False):
"""
Submits the task in self and wait.
TODO: change name.
"""
for task in self:
task.start()
if wait:
for task in self: task.wait() | [
"Submits",
"the",
"task",
"in",
"self",
"and",
"wait",
".",
"TODO",
":",
"change",
"name",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L808-L817 | [
"def",
"submit_tasks",
"(",
"self",
",",
"wait",
"=",
"False",
")",
":",
"for",
"task",
"in",
"self",
":",
"task",
".",
"start",
"(",
")",
"if",
"wait",
":",
"for",
"task",
"in",
"self",
":",
"task",
".",
"wait",
"(",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.start | Start the work. Calls build and _setup first, then submit the tasks.
Non-blocking call unless wait is set to True | pymatgen/io/abinit/works.py | def start(self, *args, **kwargs):
"""
Start the work. Calls build and _setup first, then submit the tasks.
Non-blocking call unless wait is set to True
"""
wait = kwargs.pop("wait", False)
# Initial setup
self._setup(*args, **kwargs)
# Build dirs and fil... | def start(self, *args, **kwargs):
"""
Start the work. Calls build and _setup first, then submit the tasks.
Non-blocking call unless wait is set to True
"""
wait = kwargs.pop("wait", False)
# Initial setup
self._setup(*args, **kwargs)
# Build dirs and fil... | [
"Start",
"the",
"work",
".",
"Calls",
"build",
"and",
"_setup",
"first",
"then",
"submit",
"the",
"tasks",
".",
"Non",
"-",
"blocking",
"call",
"unless",
"wait",
"is",
"set",
"to",
"True"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L819-L833 | [
"def",
"start",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"wait",
"=",
"kwargs",
".",
"pop",
"(",
"\"wait\"",
",",
"False",
")",
"# Initial setup",
"self",
".",
"_setup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.read_etotals | Reads the total energy from the GSR file produced by the task.
Return a numpy array with the total energies in Hartree
The array element is set to np.inf if an exception is raised while reading the GSR file. | pymatgen/io/abinit/works.py | def read_etotals(self, unit="Ha"):
"""
Reads the total energy from the GSR file produced by the task.
Return a numpy array with the total energies in Hartree
The array element is set to np.inf if an exception is raised while reading the GSR file.
"""
if not self.all_done... | def read_etotals(self, unit="Ha"):
"""
Reads the total energy from the GSR file produced by the task.
Return a numpy array with the total energies in Hartree
The array element is set to np.inf if an exception is raised while reading the GSR file.
"""
if not self.all_done... | [
"Reads",
"the",
"total",
"energy",
"from",
"the",
"GSR",
"file",
"produced",
"by",
"the",
"task",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L835-L856 | [
"def",
"read_etotals",
"(",
"self",
",",
"unit",
"=",
"\"Ha\"",
")",
":",
"if",
"not",
"self",
".",
"all_done",
":",
"raise",
"self",
".",
"Error",
"(",
"\"Some task is still in running/submitted state\"",
")",
"etotals",
"=",
"[",
"]",
"for",
"task",
"in",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Work.parse_timers | Parse the TIMER section reported in the ABINIT output files.
Returns:
:class:`AbinitTimerParser` object | pymatgen/io/abinit/works.py | def parse_timers(self):
"""
Parse the TIMER section reported in the ABINIT output files.
Returns:
:class:`AbinitTimerParser` object
"""
filenames = list(filter(os.path.exists, [task.output_file.path for task in self]))
parser = AbinitTimerParser()
pa... | def parse_timers(self):
"""
Parse the TIMER section reported in the ABINIT output files.
Returns:
:class:`AbinitTimerParser` object
"""
filenames = list(filter(os.path.exists, [task.output_file.path for task in self]))
parser = AbinitTimerParser()
pa... | [
"Parse",
"the",
"TIMER",
"section",
"reported",
"in",
"the",
"ABINIT",
"output",
"files",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L858-L870 | [
"def",
"parse_timers",
"(",
"self",
")",
":",
"filenames",
"=",
"list",
"(",
"filter",
"(",
"os",
".",
"path",
".",
"exists",
",",
"[",
"task",
".",
"output_file",
".",
"path",
"for",
"task",
"in",
"self",
"]",
")",
")",
"parser",
"=",
"AbinitTimerPa... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureWork.plot_ebands | Plot the band structure. kwargs are passed to the plot method of :class:`ElectronBands`.
Returns:
`matplotlib` figure | pymatgen/io/abinit/works.py | def plot_ebands(self, **kwargs):
"""
Plot the band structure. kwargs are passed to the plot method of :class:`ElectronBands`.
Returns:
`matplotlib` figure
"""
with self.nscf_task.open_gsr() as gsr:
return gsr.ebands.plot(**kwargs) | def plot_ebands(self, **kwargs):
"""
Plot the band structure. kwargs are passed to the plot method of :class:`ElectronBands`.
Returns:
`matplotlib` figure
"""
with self.nscf_task.open_gsr() as gsr:
return gsr.ebands.plot(**kwargs) | [
"Plot",
"the",
"band",
"structure",
".",
"kwargs",
"are",
"passed",
"to",
"the",
"plot",
"method",
"of",
":",
"class",
":",
"ElectronBands",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L903-L911 | [
"def",
"plot_ebands",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"nscf_task",
".",
"open_gsr",
"(",
")",
"as",
"gsr",
":",
"return",
"gsr",
".",
"ebands",
".",
"plot",
"(",
"*",
"*",
"kwargs",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureWork.plot_ebands_with_edos | Plot the band structure and the DOS.
Args:
dos_pos: Index of the task from which the DOS should be obtained (note: 0 refers to the first DOS task).
method: String defining the method for the computation of the DOS.
step: Energy step (eV) of the linear mesh.
width... | pymatgen/io/abinit/works.py | def plot_ebands_with_edos(self, dos_pos=0, method="gaussian", step=0.01, width=0.1, **kwargs):
"""
Plot the band structure and the DOS.
Args:
dos_pos: Index of the task from which the DOS should be obtained (note: 0 refers to the first DOS task).
method: String defining ... | def plot_ebands_with_edos(self, dos_pos=0, method="gaussian", step=0.01, width=0.1, **kwargs):
"""
Plot the band structure and the DOS.
Args:
dos_pos: Index of the task from which the DOS should be obtained (note: 0 refers to the first DOS task).
method: String defining ... | [
"Plot",
"the",
"band",
"structure",
"and",
"the",
"DOS",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L913-L934 | [
"def",
"plot_ebands_with_edos",
"(",
"self",
",",
"dos_pos",
"=",
"0",
",",
"method",
"=",
"\"gaussian\"",
",",
"step",
"=",
"0.01",
",",
"width",
"=",
"0.1",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"nscf_task",
".",
"open_gsr",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BandStructureWork.plot_edoses | Plot the band structure and the DOS.
Args:
dos_pos: Index of the task from which the DOS should be obtained.
None is all DOSes should be displayed. Accepts integer or list of integers.
method: String defining the method for the computation of the DOS.
st... | pymatgen/io/abinit/works.py | def plot_edoses(self, dos_pos=None, method="gaussian", step=0.01, width=0.1, **kwargs):
"""
Plot the band structure and the DOS.
Args:
dos_pos: Index of the task from which the DOS should be obtained.
None is all DOSes should be displayed. Accepts integer or lis... | def plot_edoses(self, dos_pos=None, method="gaussian", step=0.01, width=0.1, **kwargs):
"""
Plot the band structure and the DOS.
Args:
dos_pos: Index of the task from which the DOS should be obtained.
None is all DOSes should be displayed. Accepts integer or lis... | [
"Plot",
"the",
"band",
"structure",
"and",
"the",
"DOS",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L936-L962 | [
"def",
"plot_edoses",
"(",
"self",
",",
"dos_pos",
"=",
"None",
",",
"method",
"=",
"\"gaussian\"",
",",
"step",
"=",
"0.01",
",",
"width",
"=",
"0.1",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dos_pos",
"is",
"not",
"None",
"and",
"not",
"isinstance... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | RelaxWork.on_ok | This callback is called when one task reaches status S_OK.
If sender == self.ion_task, we update the initial structure
used by self.ioncell_task and we unlock it so that the job can be submitted. | pymatgen/io/abinit/works.py | def on_ok(self, sender):
"""
This callback is called when one task reaches status S_OK.
If sender == self.ion_task, we update the initial structure
used by self.ioncell_task and we unlock it so that the job can be submitted.
"""
logger.debug("in on_ok with sender %s" % se... | def on_ok(self, sender):
"""
This callback is called when one task reaches status S_OK.
If sender == self.ion_task, we update the initial structure
used by self.ioncell_task and we unlock it so that the job can be submitted.
"""
logger.debug("in on_ok with sender %s" % se... | [
"This",
"callback",
"is",
"called",
"when",
"one",
"task",
"reaches",
"status",
"S_OK",
".",
"If",
"sender",
"==",
"self",
".",
"ion_task",
"we",
"update",
"the",
"initial",
"structure",
"used",
"by",
"self",
".",
"ioncell_task",
"and",
"we",
"unlock",
"it... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1004-L1031 | [
"def",
"on_ok",
"(",
"self",
",",
"sender",
")",
":",
"logger",
".",
"debug",
"(",
"\"in on_ok with sender %s\"",
"%",
"sender",
")",
"if",
"sender",
"==",
"self",
".",
"ion_task",
"and",
"not",
"self",
".",
"transfer_done",
":",
"# Get the relaxed structure f... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | RelaxWork.plot_ion_relaxation | Plot the history of the ion-cell relaxation.
kwargs are passed to the plot method of :class:`HistFile`
Return `matplotlib` figure or None if hist file is not found. | pymatgen/io/abinit/works.py | def plot_ion_relaxation(self, **kwargs):
"""
Plot the history of the ion-cell relaxation.
kwargs are passed to the plot method of :class:`HistFile`
Return `matplotlib` figure or None if hist file is not found.
"""
with self.ion_task.open_hist() as hist:
retur... | def plot_ion_relaxation(self, **kwargs):
"""
Plot the history of the ion-cell relaxation.
kwargs are passed to the plot method of :class:`HistFile`
Return `matplotlib` figure or None if hist file is not found.
"""
with self.ion_task.open_hist() as hist:
retur... | [
"Plot",
"the",
"history",
"of",
"the",
"ion",
"-",
"cell",
"relaxation",
".",
"kwargs",
"are",
"passed",
"to",
"the",
"plot",
"method",
"of",
":",
"class",
":",
"HistFile"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1033-L1041 | [
"def",
"plot_ion_relaxation",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"ion_task",
".",
"open_hist",
"(",
")",
"as",
"hist",
":",
"return",
"hist",
".",
"plot",
"(",
"*",
"*",
"kwargs",
")",
"if",
"hist",
"else",
"None"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | RelaxWork.plot_ioncell_relaxation | Plot the history of the ion-cell relaxation.
kwargs are passed to the plot method of :class:`HistFile`
Return `matplotlib` figure or None if hist file is not found. | pymatgen/io/abinit/works.py | def plot_ioncell_relaxation(self, **kwargs):
"""
Plot the history of the ion-cell relaxation.
kwargs are passed to the plot method of :class:`HistFile`
Return `matplotlib` figure or None if hist file is not found.
"""
with self.ioncell_task.open_hist() as hist:
... | def plot_ioncell_relaxation(self, **kwargs):
"""
Plot the history of the ion-cell relaxation.
kwargs are passed to the plot method of :class:`HistFile`
Return `matplotlib` figure or None if hist file is not found.
"""
with self.ioncell_task.open_hist() as hist:
... | [
"Plot",
"the",
"history",
"of",
"the",
"ion",
"-",
"cell",
"relaxation",
".",
"kwargs",
"are",
"passed",
"to",
"the",
"plot",
"method",
"of",
":",
"class",
":",
"HistFile"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1043-L1051 | [
"def",
"plot_ioncell_relaxation",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"ioncell_task",
".",
"open_hist",
"(",
")",
"as",
"hist",
":",
"return",
"hist",
".",
"plot",
"(",
"*",
"*",
"kwargs",
")",
"if",
"hist",
"else",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BseMdfWork.get_mdf_robot | Builds and returns a :class:`MdfRobot` for analyzing the results in the MDF files. | pymatgen/io/abinit/works.py | def get_mdf_robot(self):
"""Builds and returns a :class:`MdfRobot` for analyzing the results in the MDF files."""
from abilab.robots import MdfRobot
robot = MdfRobot()
for task in self[2:]:
mdf_path = task.outdir.has_abiext(robot.EXT)
if mdf_path:
... | def get_mdf_robot(self):
"""Builds and returns a :class:`MdfRobot` for analyzing the results in the MDF files."""
from abilab.robots import MdfRobot
robot = MdfRobot()
for task in self[2:]:
mdf_path = task.outdir.has_abiext(robot.EXT)
if mdf_path:
... | [
"Builds",
"and",
"returns",
"a",
":",
"class",
":",
"MdfRobot",
"for",
"analyzing",
"the",
"results",
"in",
"the",
"MDF",
"files",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1173-L1181 | [
"def",
"get_mdf_robot",
"(",
"self",
")",
":",
"from",
"abilab",
".",
"robots",
"import",
"MdfRobot",
"robot",
"=",
"MdfRobot",
"(",
")",
"for",
"task",
"in",
"self",
"[",
"2",
":",
"]",
":",
"mdf_path",
"=",
"task",
".",
"outdir",
".",
"has_abiext",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QptdmWork.create_tasks | Create the SCR tasks and register them in self.
Args:
wfk_file: Path to the ABINIT WFK file to use for the computation of the screening.
scr_input: Input for the screening calculation. | pymatgen/io/abinit/works.py | def create_tasks(self, wfk_file, scr_input):
"""
Create the SCR tasks and register them in self.
Args:
wfk_file: Path to the ABINIT WFK file to use for the computation of the screening.
scr_input: Input for the screening calculation.
"""
assert len(self) ... | def create_tasks(self, wfk_file, scr_input):
"""
Create the SCR tasks and register them in self.
Args:
wfk_file: Path to the ABINIT WFK file to use for the computation of the screening.
scr_input: Input for the screening calculation.
"""
assert len(self) ... | [
"Create",
"the",
"SCR",
"tasks",
"and",
"register",
"them",
"in",
"self",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1190-L1232 | [
"def",
"create_tasks",
"(",
"self",
",",
"wfk_file",
",",
"scr_input",
")",
":",
"assert",
"len",
"(",
"self",
")",
"==",
"0",
"wfk_file",
"=",
"self",
".",
"wfk_file",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"wfk_file",
")",
"# Build a temporary wo... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QptdmWork.merge_scrfiles | This method is called when all the q-points have been computed.
It runs `mrgscr` in sequential on the local machine to produce
the final SCR file in the outdir of the `Work`.
If remove_scrfiles is True, the partial SCR files are removed after the merge. | pymatgen/io/abinit/works.py | def merge_scrfiles(self, remove_scrfiles=True):
"""
This method is called when all the q-points have been computed.
It runs `mrgscr` in sequential on the local machine to produce
the final SCR file in the outdir of the `Work`.
If remove_scrfiles is True, the partial SCR files are... | def merge_scrfiles(self, remove_scrfiles=True):
"""
This method is called when all the q-points have been computed.
It runs `mrgscr` in sequential on the local machine to produce
the final SCR file in the outdir of the `Work`.
If remove_scrfiles is True, the partial SCR files are... | [
"This",
"method",
"is",
"called",
"when",
"all",
"the",
"q",
"-",
"points",
"have",
"been",
"computed",
".",
"It",
"runs",
"mrgscr",
"in",
"sequential",
"on",
"the",
"local",
"machine",
"to",
"produce",
"the",
"final",
"SCR",
"file",
"in",
"the",
"outdir... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1234-L1256 | [
"def",
"merge_scrfiles",
"(",
"self",
",",
"remove_scrfiles",
"=",
"True",
")",
":",
"scr_files",
"=",
"list",
"(",
"filter",
"(",
"None",
",",
"[",
"task",
".",
"outdir",
".",
"has_abiext",
"(",
"\"SCR\"",
")",
"for",
"task",
"in",
"self",
"]",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QptdmWork.on_all_ok | This method is called when all the q-points have been computed.
It runs `mrgscr` in sequential on the local machine to produce
the final SCR file in the outdir of the `Work`. | pymatgen/io/abinit/works.py | def on_all_ok(self):
"""
This method is called when all the q-points have been computed.
It runs `mrgscr` in sequential on the local machine to produce
the final SCR file in the outdir of the `Work`.
"""
final_scr = self.merge_scrfiles()
return self.Results(node=s... | def on_all_ok(self):
"""
This method is called when all the q-points have been computed.
It runs `mrgscr` in sequential on the local machine to produce
the final SCR file in the outdir of the `Work`.
"""
final_scr = self.merge_scrfiles()
return self.Results(node=s... | [
"This",
"method",
"is",
"called",
"when",
"all",
"the",
"q",
"-",
"points",
"have",
"been",
"computed",
".",
"It",
"runs",
"mrgscr",
"in",
"sequential",
"on",
"the",
"local",
"machine",
"to",
"produce",
"the",
"final",
"SCR",
"file",
"in",
"the",
"outdir... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1259-L1266 | [
"def",
"on_all_ok",
"(",
"self",
")",
":",
"final_scr",
"=",
"self",
".",
"merge_scrfiles",
"(",
")",
"return",
"self",
".",
"Results",
"(",
"node",
"=",
"self",
",",
"returncode",
"=",
"0",
",",
"message",
"=",
"\"mrgscr done\"",
",",
"final_scr",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MergeDdb.add_becs_from_scf_task | Build tasks for the computation of Born effective charges and add them to the work.
Args:
scf_task: ScfTask object.
ddk_tolerance: dict {"varname": value} with the tolerance used in the DDK run.
None to use AbiPy default.
ph_tolerance: dict {"varname": value}... | pymatgen/io/abinit/works.py | def add_becs_from_scf_task(self, scf_task, ddk_tolerance, ph_tolerance):
"""
Build tasks for the computation of Born effective charges and add them to the work.
Args:
scf_task: ScfTask object.
ddk_tolerance: dict {"varname": value} with the tolerance used in the DDK run.... | def add_becs_from_scf_task(self, scf_task, ddk_tolerance, ph_tolerance):
"""
Build tasks for the computation of Born effective charges and add them to the work.
Args:
scf_task: ScfTask object.
ddk_tolerance: dict {"varname": value} with the tolerance used in the DDK run.... | [
"Build",
"tasks",
"for",
"the",
"computation",
"of",
"Born",
"effective",
"charges",
"and",
"add",
"them",
"to",
"the",
"work",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1273-L1309 | [
"def",
"add_becs_from_scf_task",
"(",
"self",
",",
"scf_task",
",",
"ddk_tolerance",
",",
"ph_tolerance",
")",
":",
"if",
"not",
"isinstance",
"(",
"scf_task",
",",
"ScfTask",
")",
":",
"raise",
"TypeError",
"(",
"\"task `%s` does not inherit from ScfTask\"",
"%",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MergeDdb.merge_ddb_files | This method is called when all the q-points have been computed.
It runs `mrgddb` in sequential on the local machine to produce
the final DDB file in the outdir of the `Work`.
Args:
delete_source_ddbs: True if input DDB should be removed once final DDB is created.
only_df... | pymatgen/io/abinit/works.py | def merge_ddb_files(self, delete_source_ddbs=True, only_dfpt_tasks=True,
exclude_tasks=None, include_tasks=None):
"""
This method is called when all the q-points have been computed.
It runs `mrgddb` in sequential on the local machine to produce
the final DDB file ... | def merge_ddb_files(self, delete_source_ddbs=True, only_dfpt_tasks=True,
exclude_tasks=None, include_tasks=None):
"""
This method is called when all the q-points have been computed.
It runs `mrgddb` in sequential on the local machine to produce
the final DDB file ... | [
"This",
"method",
"is",
"called",
"when",
"all",
"the",
"q",
"-",
"points",
"have",
"been",
"computed",
".",
"It",
"runs",
"mrgddb",
"in",
"sequential",
"on",
"the",
"local",
"machine",
"to",
"produce",
"the",
"final",
"DDB",
"file",
"in",
"the",
"outdir... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1311-L1361 | [
"def",
"merge_ddb_files",
"(",
"self",
",",
"delete_source_ddbs",
"=",
"True",
",",
"only_dfpt_tasks",
"=",
"True",
",",
"exclude_tasks",
"=",
"None",
",",
"include_tasks",
"=",
"None",
")",
":",
"if",
"exclude_tasks",
":",
"my_tasks",
"=",
"[",
"task",
"for... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MergeDdb.merge_pot1_files | This method is called when all the q-points have been computed.
It runs `mrgdvdb` in sequential on the local machine to produce
the final DVDB file in the outdir of the `Work`.
Args:
delete_source: True if POT1 files should be removed after (successful) merge.
Returns:
... | pymatgen/io/abinit/works.py | def merge_pot1_files(self, delete_source=True):
"""
This method is called when all the q-points have been computed.
It runs `mrgdvdb` in sequential on the local machine to produce
the final DVDB file in the outdir of the `Work`.
Args:
delete_source: True if POT1 file... | def merge_pot1_files(self, delete_source=True):
"""
This method is called when all the q-points have been computed.
It runs `mrgdvdb` in sequential on the local machine to produce
the final DVDB file in the outdir of the `Work`.
Args:
delete_source: True if POT1 file... | [
"This",
"method",
"is",
"called",
"when",
"all",
"the",
"q",
"-",
"points",
"have",
"been",
"computed",
".",
"It",
"runs",
"mrgdvdb",
"in",
"sequential",
"on",
"the",
"local",
"machine",
"to",
"produce",
"the",
"final",
"DVDB",
"file",
"in",
"the",
"outd... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1363-L1407 | [
"def",
"merge_pot1_files",
"(",
"self",
",",
"delete_source",
"=",
"True",
")",
":",
"natom",
"=",
"len",
"(",
"self",
"[",
"0",
"]",
".",
"input",
".",
"structure",
")",
"max_pertcase",
"=",
"3",
"*",
"natom",
"pot1_files",
"=",
"[",
"]",
"for",
"ta... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononWork.from_scf_task | Construct a `PhononWork` from a :class:`ScfTask` object.
The input file for phonons is automatically generated from the input of the ScfTask.
Each phonon task depends on the WFK file produced by the `scf_task`.
Args:
scf_task: ScfTask object.
qpoints: q-points in reduced... | pymatgen/io/abinit/works.py | def from_scf_task(cls, scf_task, qpoints, is_ngqpt=False, tolerance=None, with_becs=False,
ddk_tolerance=None, manager=None):
"""
Construct a `PhononWork` from a :class:`ScfTask` object.
The input file for phonons is automatically generated from the input of the ScfTask.
... | def from_scf_task(cls, scf_task, qpoints, is_ngqpt=False, tolerance=None, with_becs=False,
ddk_tolerance=None, manager=None):
"""
Construct a `PhononWork` from a :class:`ScfTask` object.
The input file for phonons is automatically generated from the input of the ScfTask.
... | [
"Construct",
"a",
"PhononWork",
"from",
"a",
":",
"class",
":",
"ScfTask",
"object",
".",
"The",
"input",
"file",
"for",
"phonons",
"is",
"automatically",
"generated",
"from",
"the",
"input",
"of",
"the",
"ScfTask",
".",
"Each",
"phonon",
"task",
"depends",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1420-L1456 | [
"def",
"from_scf_task",
"(",
"cls",
",",
"scf_task",
",",
"qpoints",
",",
"is_ngqpt",
"=",
"False",
",",
"tolerance",
"=",
"None",
",",
"with_becs",
"=",
"False",
",",
"ddk_tolerance",
"=",
"None",
",",
"manager",
"=",
"None",
")",
":",
"if",
"not",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononWork.from_scf_input | Similar to `from_scf_task`, the difference is that this method requires
an input for SCF calculation. A new ScfTask is created and added to the Work.
This API should be used if the DDB of the GS task should be merged. | pymatgen/io/abinit/works.py | def from_scf_input(cls, scf_input, qpoints, is_ngqpt=False, tolerance=None,
with_becs=False, ddk_tolerance=None, manager=None):
"""
Similar to `from_scf_task`, the difference is that this method requires
an input for SCF calculation. A new ScfTask is created and added to t... | def from_scf_input(cls, scf_input, qpoints, is_ngqpt=False, tolerance=None,
with_becs=False, ddk_tolerance=None, manager=None):
"""
Similar to `from_scf_task`, the difference is that this method requires
an input for SCF calculation. A new ScfTask is created and added to t... | [
"Similar",
"to",
"from_scf_task",
"the",
"difference",
"is",
"that",
"this",
"method",
"requires",
"an",
"input",
"for",
"SCF",
"calculation",
".",
"A",
"new",
"ScfTask",
"is",
"created",
"and",
"added",
"to",
"the",
"Work",
".",
"This",
"API",
"should",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1459-L1484 | [
"def",
"from_scf_input",
"(",
"cls",
",",
"scf_input",
",",
"qpoints",
",",
"is_ngqpt",
"=",
"False",
",",
"tolerance",
"=",
"None",
",",
"with_becs",
"=",
"False",
",",
"ddk_tolerance",
"=",
"None",
",",
"manager",
"=",
"None",
")",
":",
"if",
"is_ngqpt... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononWfkqWork.from_scf_task | Construct a `PhononWfkqWork` from a :class:`ScfTask` object.
The input files for WFQ and phonons are automatically generated from the input of the ScfTask.
Each phonon task depends on the WFK file produced by scf_task and the associated WFQ file.
Args:
scf_task: ScfTask object.
... | pymatgen/io/abinit/works.py | def from_scf_task(cls, scf_task, ngqpt, ph_tolerance=None, tolwfr=1.0e-22, nband=None,
with_becs=False, ddk_tolerance=None, shiftq=(0, 0, 0), is_ngqpt=True, remove_wfkq=True,
manager=None):
"""
Construct a `PhononWfkqWork` from a :class:`ScfTask` object.
... | def from_scf_task(cls, scf_task, ngqpt, ph_tolerance=None, tolwfr=1.0e-22, nband=None,
with_becs=False, ddk_tolerance=None, shiftq=(0, 0, 0), is_ngqpt=True, remove_wfkq=True,
manager=None):
"""
Construct a `PhononWfkqWork` from a :class:`ScfTask` object.
... | [
"Construct",
"a",
"PhononWfkqWork",
"from",
"a",
":",
"class",
":",
"ScfTask",
"object",
".",
"The",
"input",
"files",
"for",
"WFQ",
"and",
"phonons",
"are",
"automatically",
"generated",
"from",
"the",
"input",
"of",
"the",
"ScfTask",
".",
"Each",
"phonon",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1513-L1598 | [
"def",
"from_scf_task",
"(",
"cls",
",",
"scf_task",
",",
"ngqpt",
",",
"ph_tolerance",
"=",
"None",
",",
"tolwfr",
"=",
"1.0e-22",
",",
"nband",
"=",
"None",
",",
"with_becs",
"=",
"False",
",",
"ddk_tolerance",
"=",
"None",
",",
"shiftq",
"=",
"(",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononWfkqWork.on_ok | This callback is called when one task reaches status `S_OK`.
It removes the WFKQ file if all its children have reached `S_OK`. | pymatgen/io/abinit/works.py | def on_ok(self, sender):
"""
This callback is called when one task reaches status `S_OK`.
It removes the WFKQ file if all its children have reached `S_OK`.
"""
if self.remove_wfkq:
for task in self.wfkq_tasks:
if task.status != task.S_OK: continue
... | def on_ok(self, sender):
"""
This callback is called when one task reaches status `S_OK`.
It removes the WFKQ file if all its children have reached `S_OK`.
"""
if self.remove_wfkq:
for task in self.wfkq_tasks:
if task.status != task.S_OK: continue
... | [
"This",
"callback",
"is",
"called",
"when",
"one",
"task",
"reaches",
"status",
"S_OK",
".",
"It",
"removes",
"the",
"WFKQ",
"file",
"if",
"all",
"its",
"children",
"have",
"reached",
"S_OK",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1600-L1615 | [
"def",
"on_ok",
"(",
"self",
",",
"sender",
")",
":",
"if",
"self",
".",
"remove_wfkq",
":",
"for",
"task",
"in",
"self",
".",
"wfkq_tasks",
":",
"if",
"task",
".",
"status",
"!=",
"task",
".",
"S_OK",
":",
"continue",
"children",
"=",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GKKPWork.from_den_ddb_dvdb | Construct a `PhononWfkqWork` from a DDB and DVDB file.
For each q found, a WFQ task and an EPH task computing the matrix elements are created. | pymatgen/io/abinit/works.py | def from_den_ddb_dvdb(cls, inp, den_path, ddb_path, dvdb_path, mpiprocs=1, remove_wfkq=True,
qpath=None, with_ddk=True, expand=True, manager=None):
"""
Construct a `PhononWfkqWork` from a DDB and DVDB file.
For each q found, a WFQ task and an EPH task computing the matr... | def from_den_ddb_dvdb(cls, inp, den_path, ddb_path, dvdb_path, mpiprocs=1, remove_wfkq=True,
qpath=None, with_ddk=True, expand=True, manager=None):
"""
Construct a `PhononWfkqWork` from a DDB and DVDB file.
For each q found, a WFQ task and an EPH task computing the matr... | [
"Construct",
"a",
"PhononWfkqWork",
"from",
"a",
"DDB",
"and",
"DVDB",
"file",
".",
"For",
"each",
"q",
"found",
"a",
"WFQ",
"task",
"and",
"an",
"EPH",
"task",
"computing",
"the",
"matrix",
"elements",
"are",
"created",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1638-L1721 | [
"def",
"from_den_ddb_dvdb",
"(",
"cls",
",",
"inp",
",",
"den_path",
",",
"ddb_path",
",",
"dvdb_path",
",",
"mpiprocs",
"=",
"1",
",",
"remove_wfkq",
"=",
"True",
",",
"qpath",
"=",
"None",
",",
"with_ddk",
"=",
"True",
",",
"expand",
"=",
"True",
","... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GKKPWork.from_phononwfkq_work | Construct a `GKKPWork` from a `PhononWfkqWork` object.
The WFQ are the ones used for PhononWfkqWork so in principle have only valence bands | pymatgen/io/abinit/works.py | def from_phononwfkq_work(cls, phononwfkq_work, nscf_vars={}, remove_wfkq=True, with_ddk=True, manager=None):
"""
Construct a `GKKPWork` from a `PhononWfkqWork` object.
The WFQ are the ones used for PhononWfkqWork so in principle have only valence bands
"""
# Get list of qpoints f... | def from_phononwfkq_work(cls, phononwfkq_work, nscf_vars={}, remove_wfkq=True, with_ddk=True, manager=None):
"""
Construct a `GKKPWork` from a `PhononWfkqWork` object.
The WFQ are the ones used for PhononWfkqWork so in principle have only valence bands
"""
# Get list of qpoints f... | [
"Construct",
"a",
"GKKPWork",
"from",
"a",
"PhononWfkqWork",
"object",
".",
"The",
"WFQ",
"are",
"the",
"ones",
"used",
"for",
"PhononWfkqWork",
"so",
"in",
"principle",
"have",
"only",
"valence",
"bands"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1724-L1778 | [
"def",
"from_phononwfkq_work",
"(",
"cls",
",",
"phononwfkq_work",
",",
"nscf_vars",
"=",
"{",
"}",
",",
"remove_wfkq",
"=",
"True",
",",
"with_ddk",
"=",
"True",
",",
"manager",
"=",
"None",
")",
":",
"# Get list of qpoints from the the phonon tasks in this work",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | GKKPWork.on_ok | This callback is called when one task reaches status `S_OK`.
It removes the WFKQ file if all its children have reached `S_OK`. | pymatgen/io/abinit/works.py | def on_ok(self, sender):
"""
This callback is called when one task reaches status `S_OK`.
It removes the WFKQ file if all its children have reached `S_OK`.
"""
if self.remove_wfkq:
for task in self.wfkq_tasks:
if task.status != task.S_OK: continue
... | def on_ok(self, sender):
"""
This callback is called when one task reaches status `S_OK`.
It removes the WFKQ file if all its children have reached `S_OK`.
"""
if self.remove_wfkq:
for task in self.wfkq_tasks:
if task.status != task.S_OK: continue
... | [
"This",
"callback",
"is",
"called",
"when",
"one",
"task",
"reaches",
"status",
"S_OK",
".",
"It",
"removes",
"the",
"WFKQ",
"file",
"if",
"all",
"its",
"children",
"have",
"reached",
"S_OK",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1780-L1804 | [
"def",
"on_ok",
"(",
"self",
",",
"sender",
")",
":",
"if",
"self",
".",
"remove_wfkq",
":",
"for",
"task",
"in",
"self",
".",
"wfkq_tasks",
":",
"if",
"task",
".",
"status",
"!=",
"task",
".",
"S_OK",
":",
"continue",
"children",
"=",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BecWork.from_scf_task | Build tasks for the computation of Born effective charges from a ground-state task.
Args:
scf_task: ScfTask object.
ddk_tolerance: tolerance used in the DDK run if with_becs. None to use AbiPy default.
ph_tolerance: dict {"varname": value} with the tolerance used in the phon... | pymatgen/io/abinit/works.py | def from_scf_task(cls, scf_task, ddk_tolerance=None, ph_tolerance=None, manager=None):
"""
Build tasks for the computation of Born effective charges from a ground-state task.
Args:
scf_task: ScfTask object.
ddk_tolerance: tolerance used in the DDK run if with_becs. None ... | def from_scf_task(cls, scf_task, ddk_tolerance=None, ph_tolerance=None, manager=None):
"""
Build tasks for the computation of Born effective charges from a ground-state task.
Args:
scf_task: ScfTask object.
ddk_tolerance: tolerance used in the DDK run if with_becs. None ... | [
"Build",
"tasks",
"for",
"the",
"computation",
"of",
"Born",
"effective",
"charges",
"from",
"a",
"ground",
"-",
"state",
"task",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1817-L1830 | [
"def",
"from_scf_task",
"(",
"cls",
",",
"scf_task",
",",
"ddk_tolerance",
"=",
"None",
",",
"ph_tolerance",
"=",
"None",
",",
"manager",
"=",
"None",
")",
":",
"new",
"=",
"cls",
"(",
"manager",
"=",
"manager",
")",
"new",
".",
"add_becs_from_scf_task",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BecWork.on_all_ok | This method is called when all tasks reach S_OK
Ir runs `mrgddb` in sequential on the local machine to produce
the final DDB file in the outdir of the `Work`. | pymatgen/io/abinit/works.py | def on_all_ok(self):
"""
This method is called when all tasks reach S_OK
Ir runs `mrgddb` in sequential on the local machine to produce
the final DDB file in the outdir of the `Work`.
"""
# Merge DDB files.
out_ddb = self.merge_ddb_files()
return self.Resu... | def on_all_ok(self):
"""
This method is called when all tasks reach S_OK
Ir runs `mrgddb` in sequential on the local machine to produce
the final DDB file in the outdir of the `Work`.
"""
# Merge DDB files.
out_ddb = self.merge_ddb_files()
return self.Resu... | [
"This",
"method",
"is",
"called",
"when",
"all",
"tasks",
"reach",
"S_OK",
"Ir",
"runs",
"mrgddb",
"in",
"sequential",
"on",
"the",
"local",
"machine",
"to",
"produce",
"the",
"final",
"DDB",
"file",
"in",
"the",
"outdir",
"of",
"the",
"Work",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1832-L1840 | [
"def",
"on_all_ok",
"(",
"self",
")",
":",
"# Merge DDB files.",
"out_ddb",
"=",
"self",
".",
"merge_ddb_files",
"(",
")",
"return",
"self",
".",
"Results",
"(",
"node",
"=",
"self",
",",
"returncode",
"=",
"0",
",",
"message",
"=",
"\"DDB merge done\"",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DteWork.from_scf_task | Build a DteWork from a ground-state task.
Args:
scf_task: ScfTask object.
ddk_tolerance: tolerance used in the DDK run if with_becs. None to use AbiPy default.
manager: :class:`TaskManager` object. | pymatgen/io/abinit/works.py | def from_scf_task(cls, scf_task, ddk_tolerance=None, manager=None):
"""
Build a DteWork from a ground-state task.
Args:
scf_task: ScfTask object.
ddk_tolerance: tolerance used in the DDK run if with_becs. None to use AbiPy default.
manager: :class:`TaskManager` obje... | def from_scf_task(cls, scf_task, ddk_tolerance=None, manager=None):
"""
Build a DteWork from a ground-state task.
Args:
scf_task: ScfTask object.
ddk_tolerance: tolerance used in the DDK run if with_becs. None to use AbiPy default.
manager: :class:`TaskManager` obje... | [
"Build",
"a",
"DteWork",
"from",
"a",
"ground",
"-",
"state",
"task",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L1851-L1897 | [
"def",
"from_scf_task",
"(",
"cls",
",",
"scf_task",
",",
"ddk_tolerance",
"=",
"None",
",",
"manager",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"scf_task",
",",
"ScfTask",
")",
":",
"raise",
"TypeError",
"(",
"\"task `%s` does not inherit from S... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | create_saturated_interstitial_structure | this takes a Interstitial defect object and generates the
sublattice for it based on the structure's space group.
Useful for understanding multiplicity of an interstitial
defect in thermodynamic analysis.
NOTE: if large relaxation happens to interstitial or
defect involves a complex then there ... | pymatgen/analysis/defects/core.py | def create_saturated_interstitial_structure( interstitial_def, dist_tol=0.1):
"""
this takes a Interstitial defect object and generates the
sublattice for it based on the structure's space group.
Useful for understanding multiplicity of an interstitial
defect in thermodynamic analysis.
NOTE: if... | def create_saturated_interstitial_structure( interstitial_def, dist_tol=0.1):
"""
this takes a Interstitial defect object and generates the
sublattice for it based on the structure's space group.
Useful for understanding multiplicity of an interstitial
defect in thermodynamic analysis.
NOTE: if... | [
"this",
"takes",
"a",
"Interstitial",
"defect",
"object",
"and",
"generates",
"the",
"sublattice",
"for",
"it",
"based",
"on",
"the",
"structure",
"s",
"space",
"group",
".",
"Useful",
"for",
"understanding",
"multiplicity",
"of",
"an",
"interstitial",
"defect",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L382-L435 | [
"def",
"create_saturated_interstitial_structure",
"(",
"interstitial_def",
",",
"dist_tol",
"=",
"0.1",
")",
":",
"sga",
"=",
"SpacegroupAnalyzer",
"(",
"interstitial_def",
".",
"bulk_structure",
".",
"copy",
"(",
")",
")",
"sg_ops",
"=",
"sga",
".",
"get_symmetry... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Vacancy.generate_defect_structure | Returns Defective Vacancy structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix | pymatgen/analysis/defects/core.py | def generate_defect_structure(self, supercell=(1, 1, 1)):
"""
Returns Defective Vacancy structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
"""
defect_structure = self.bulk_structure.copy()
... | def generate_defect_structure(self, supercell=(1, 1, 1)):
"""
Returns Defective Vacancy structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
"""
defect_structure = self.bulk_structure.copy()
... | [
"Returns",
"Defective",
"Vacancy",
"structure",
"decorated",
"with",
"charge",
"Args",
":",
"supercell",
"(",
"int",
"[",
"3x1",
"]",
"or",
"[[",
"]]",
"(",
"3x3",
"))",
":",
"supercell",
"integer",
"vector",
"or",
"scaling",
"matrix"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L134-L156 | [
"def",
"generate_defect_structure",
"(",
"self",
",",
"supercell",
"=",
"(",
"1",
",",
"1",
",",
"1",
")",
")",
":",
"defect_structure",
"=",
"self",
".",
"bulk_structure",
".",
"copy",
"(",
")",
"defect_structure",
".",
"make_supercell",
"(",
"supercell",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Vacancy.multiplicity | Returns the multiplicity of a defect site within the structure (needed for concentration analysis) | pymatgen/analysis/defects/core.py | def multiplicity(self):
"""
Returns the multiplicity of a defect site within the structure (needed for concentration analysis)
"""
sga = SpacegroupAnalyzer(self.bulk_structure)
periodic_struc = sga.get_symmetrized_structure()
poss_deflist = sorted(
periodic_st... | def multiplicity(self):
"""
Returns the multiplicity of a defect site within the structure (needed for concentration analysis)
"""
sga = SpacegroupAnalyzer(self.bulk_structure)
periodic_struc = sga.get_symmetrized_structure()
poss_deflist = sorted(
periodic_st... | [
"Returns",
"the",
"multiplicity",
"of",
"a",
"defect",
"site",
"within",
"the",
"structure",
"(",
"needed",
"for",
"concentration",
"analysis",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L159-L170 | [
"def",
"multiplicity",
"(",
"self",
")",
":",
"sga",
"=",
"SpacegroupAnalyzer",
"(",
"self",
".",
"bulk_structure",
")",
"periodic_struc",
"=",
"sga",
".",
"get_symmetrized_structure",
"(",
")",
"poss_deflist",
"=",
"sorted",
"(",
"periodic_struc",
".",
"get_sit... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitution.generate_defect_structure | Returns Defective Substitution structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix | pymatgen/analysis/defects/core.py | def generate_defect_structure(self, supercell=(1, 1, 1)):
"""
Returns Defective Substitution structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
"""
defect_structure = self.bulk_structure.copy()
... | def generate_defect_structure(self, supercell=(1, 1, 1)):
"""
Returns Defective Substitution structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
"""
defect_structure = self.bulk_structure.copy()
... | [
"Returns",
"Defective",
"Substitution",
"structure",
"decorated",
"with",
"charge",
"Args",
":",
"supercell",
"(",
"int",
"[",
"3x1",
"]",
"or",
"[[",
"]]",
"(",
"3x3",
"))",
":",
"supercell",
"integer",
"vector",
"or",
"scaling",
"matrix"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L197-L237 | [
"def",
"generate_defect_structure",
"(",
"self",
",",
"supercell",
"=",
"(",
"1",
",",
"1",
",",
"1",
")",
")",
":",
"defect_structure",
"=",
"self",
".",
"bulk_structure",
".",
"copy",
"(",
")",
"defect_structure",
".",
"make_supercell",
"(",
"supercell",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Substitution.name | Returns a name for this defect | pymatgen/analysis/defects/core.py | def name(self):
"""
Returns a name for this defect
"""
poss_deflist = sorted(
self.bulk_structure.get_sites_in_sphere(self.site.coords, 2, include_index=True), key=lambda x: x[1])
defindex = poss_deflist[0][2]
return "Sub_{}_on_{}_mult{}".format(self.site.spec... | def name(self):
"""
Returns a name for this defect
"""
poss_deflist = sorted(
self.bulk_structure.get_sites_in_sphere(self.site.coords, 2, include_index=True), key=lambda x: x[1])
defindex = poss_deflist[0][2]
return "Sub_{}_on_{}_mult{}".format(self.site.spec... | [
"Returns",
"a",
"name",
"for",
"this",
"defect"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L255-L262 | [
"def",
"name",
"(",
"self",
")",
":",
"poss_deflist",
"=",
"sorted",
"(",
"self",
".",
"bulk_structure",
".",
"get_sites_in_sphere",
"(",
"self",
".",
"site",
".",
"coords",
",",
"2",
",",
"include_index",
"=",
"True",
")",
",",
"key",
"=",
"lambda",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Interstitial.generate_defect_structure | Returns Defective Interstitial structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix | pymatgen/analysis/defects/core.py | def generate_defect_structure(self, supercell=(1, 1, 1)):
"""
Returns Defective Interstitial structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
"""
defect_structure = self.bulk_structure.copy()
... | def generate_defect_structure(self, supercell=(1, 1, 1)):
"""
Returns Defective Interstitial structure, decorated with charge
Args:
supercell (int, [3x1], or [[]] (3x3)): supercell integer, vector, or scaling matrix
"""
defect_structure = self.bulk_structure.copy()
... | [
"Returns",
"Defective",
"Interstitial",
"structure",
"decorated",
"with",
"charge",
"Args",
":",
"supercell",
"(",
"int",
"[",
"3x1",
"]",
"or",
"[[",
"]]",
"(",
"3x3",
"))",
":",
"supercell",
"integer",
"vector",
"or",
"scaling",
"matrix"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L307-L342 | [
"def",
"generate_defect_structure",
"(",
"self",
",",
"supercell",
"=",
"(",
"1",
",",
"1",
",",
"1",
")",
")",
":",
"defect_structure",
"=",
"self",
".",
"bulk_structure",
".",
"copy",
"(",
")",
"defect_structure",
".",
"make_supercell",
"(",
"supercell",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Interstitial.multiplicity | Returns the multiplicity of a defect site within the structure (needed for concentration analysis) | pymatgen/analysis/defects/core.py | def multiplicity(self):
"""
Returns the multiplicity of a defect site within the structure (needed for concentration analysis)
"""
if self._multiplicity is None:
# generate multiplicity based on space group symmetry operations performed on defect coordinates
try:
... | def multiplicity(self):
"""
Returns the multiplicity of a defect site within the structure (needed for concentration analysis)
"""
if self._multiplicity is None:
# generate multiplicity based on space group symmetry operations performed on defect coordinates
try:
... | [
"Returns",
"the",
"multiplicity",
"of",
"a",
"defect",
"site",
"within",
"the",
"structure",
"(",
"needed",
"for",
"concentration",
"analysis",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L345-L369 | [
"def",
"multiplicity",
"(",
"self",
")",
":",
"if",
"self",
".",
"_multiplicity",
"is",
"None",
":",
"# generate multiplicity based on space group symmetry operations performed on defect coordinates",
"try",
":",
"d_structure",
"=",
"create_saturated_interstitial_structure",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Interstitial.name | Returns a name for this defect | pymatgen/analysis/defects/core.py | def name(self):
"""
Returns a name for this defect
"""
if self.site_name:
return "Int_{}_{}_mult{}".format(self.site.specie, self.site_name, self.multiplicity)
else:
return "Int_{}_mult{}".format(self.site.specie, self.multiplicity) | def name(self):
"""
Returns a name for this defect
"""
if self.site_name:
return "Int_{}_{}_mult{}".format(self.site.specie, self.site_name, self.multiplicity)
else:
return "Int_{}_mult{}".format(self.site.specie, self.multiplicity) | [
"Returns",
"a",
"name",
"for",
"this",
"defect"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L372-L379 | [
"def",
"name",
"(",
"self",
")",
":",
"if",
"self",
".",
"site_name",
":",
"return",
"\"Int_{}_{}_mult{}\"",
".",
"format",
"(",
"self",
".",
"site",
".",
"specie",
",",
"self",
".",
"site_name",
",",
"self",
".",
"multiplicity",
")",
"else",
":",
"ret... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DefectEntry.as_dict | Json-serializable dict representation of DefectEntry | pymatgen/analysis/defects/core.py | def as_dict(self):
"""
Json-serializable dict representation of DefectEntry
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"defect": self.defect.as_dict(),
"uncorrected_energy": self.uncorrected_energy,
... | def as_dict(self):
"""
Json-serializable dict representation of DefectEntry
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"defect": self.defect.as_dict(),
"uncorrected_energy": self.uncorrected_energy,
... | [
"Json",
"-",
"serializable",
"dict",
"representation",
"of",
"DefectEntry"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L479-L490 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"defect\"",
":",
"self",
".",
"defect",
".",
"as_dict",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DefectEntry.from_dict | Reconstitute a DefectEntry object from a dict representation created using
as_dict().
Args:
d (dict): dict representation of DefectEntry.
Returns:
DefectEntry object | pymatgen/analysis/defects/core.py | def from_dict(cls, d):
"""
Reconstitute a DefectEntry object from a dict representation created using
as_dict().
Args:
d (dict): dict representation of DefectEntry.
Returns:
DefectEntry object
"""
defect = MontyDecoder().process_decoded( ... | def from_dict(cls, d):
"""
Reconstitute a DefectEntry object from a dict representation created using
as_dict().
Args:
d (dict): dict representation of DefectEntry.
Returns:
DefectEntry object
"""
defect = MontyDecoder().process_decoded( ... | [
"Reconstitute",
"a",
"DefectEntry",
"object",
"from",
"a",
"dict",
"representation",
"created",
"using",
"as_dict",
"()",
".",
"Args",
":",
"d",
"(",
"dict",
")",
":",
"dict",
"representation",
"of",
"DefectEntry",
".",
"Returns",
":",
"DefectEntry",
"object"
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L493-L509 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"defect",
"=",
"MontyDecoder",
"(",
")",
".",
"process_decoded",
"(",
"d",
"[",
"\"defect\"",
"]",
")",
"uncorrected_energy",
"=",
"d",
"[",
"\"uncorrected_energy\"",
"]",
"corrections",
"=",
"d",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DefectEntry.energy | Returns the *corrected* energy of the entry | pymatgen/analysis/defects/core.py | def energy(self):
"""
Returns the *corrected* energy of the entry
"""
return self.uncorrected_energy + np.sum(list(self.corrections.values())) | def energy(self):
"""
Returns the *corrected* energy of the entry
"""
return self.uncorrected_energy + np.sum(list(self.corrections.values())) | [
"Returns",
"the",
"*",
"corrected",
"*",
"energy",
"of",
"the",
"entry"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L524-L528 | [
"def",
"energy",
"(",
"self",
")",
":",
"return",
"self",
".",
"uncorrected_energy",
"+",
"np",
".",
"sum",
"(",
"list",
"(",
"self",
".",
"corrections",
".",
"values",
"(",
")",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DefectEntry.formation_energy | Computes the formation energy for a defect taking into account a given chemical potential and fermi_level | pymatgen/analysis/defects/core.py | def formation_energy(self, chemical_potentials=None, fermi_level=0):
"""
Computes the formation energy for a defect taking into account a given chemical potential and fermi_level
"""
chemical_potentials = chemical_potentials if chemical_potentials else {}
chempot_correction = su... | def formation_energy(self, chemical_potentials=None, fermi_level=0):
"""
Computes the formation energy for a defect taking into account a given chemical potential and fermi_level
"""
chemical_potentials = chemical_potentials if chemical_potentials else {}
chempot_correction = su... | [
"Computes",
"the",
"formation",
"energy",
"for",
"a",
"defect",
"taking",
"into",
"account",
"a",
"given",
"chemical",
"potential",
"and",
"fermi_level"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L547-L565 | [
"def",
"formation_energy",
"(",
"self",
",",
"chemical_potentials",
"=",
"None",
",",
"fermi_level",
"=",
"0",
")",
":",
"chemical_potentials",
"=",
"chemical_potentials",
"if",
"chemical_potentials",
"else",
"{",
"}",
"chempot_correction",
"=",
"sum",
"(",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DefectEntry.defect_concentration | Get the defect concentration for a temperature and Fermi level.
Args:
temperature:
the temperature in K
fermi_level:
the fermi level in eV (with respect to the VBM)
Returns:
defects concentration in cm^-3 | pymatgen/analysis/defects/core.py | def defect_concentration(self, chemical_potentials, temperature=300, fermi_level=0.0):
"""
Get the defect concentration for a temperature and Fermi level.
Args:
temperature:
the temperature in K
fermi_level:
the fermi level in eV (with resp... | def defect_concentration(self, chemical_potentials, temperature=300, fermi_level=0.0):
"""
Get the defect concentration for a temperature and Fermi level.
Args:
temperature:
the temperature in K
fermi_level:
the fermi level in eV (with resp... | [
"Get",
"the",
"defect",
"concentration",
"for",
"a",
"temperature",
"and",
"Fermi",
"level",
".",
"Args",
":",
"temperature",
":",
"the",
"temperature",
"in",
"K",
"fermi_level",
":",
"the",
"fermi",
"level",
"in",
"eV",
"(",
"with",
"respect",
"to",
"the"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L567-L582 | [
"def",
"defect_concentration",
"(",
"self",
",",
"chemical_potentials",
",",
"temperature",
"=",
"300",
",",
"fermi_level",
"=",
"0.0",
")",
":",
"n",
"=",
"self",
".",
"multiplicity",
"*",
"1e24",
"/",
"self",
".",
"defect",
".",
"bulk_structure",
".",
"v... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | DefectCorrection.correct_entry | Corrects a single entry.
Args:
entry: A DefectEntry object.
Returns:
An processed entry.
Raises:
CompatibilityError if entry is not compatible. | pymatgen/analysis/defects/core.py | def correct_entry(self, entry):
"""
Corrects a single entry.
Args:
entry: A DefectEntry object.
Returns:
An processed entry.
Raises:
CompatibilityError if entry is not compatible.
"""
entry.correction.update(self.get_correcti... | def correct_entry(self, entry):
"""
Corrects a single entry.
Args:
entry: A DefectEntry object.
Returns:
An processed entry.
Raises:
CompatibilityError if entry is not compatible.
"""
entry.correction.update(self.get_correcti... | [
"Corrects",
"a",
"single",
"entry",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/core.py#L625-L639 | [
"def",
"correct_entry",
"(",
"self",
",",
"entry",
")",
":",
"entry",
".",
"correction",
".",
"update",
"(",
"self",
".",
"get_correction",
"(",
"entry",
")",
")",
"return",
"entry"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | bader_analysis_from_path | Convenience method to run Bader analysis on a folder containing
typical VASP output files.
This method will:
1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped
counterparts.
2. If AECCAR* files are present, constructs a temporary reference
file as AECCAR0 + AECCAR2
3. Runs B... | pymatgen/command_line/bader_caller.py | def bader_analysis_from_path(path, suffix=''):
"""
Convenience method to run Bader analysis on a folder containing
typical VASP output files.
This method will:
1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped
counterparts.
2. If AECCAR* files are present, constructs a temp... | def bader_analysis_from_path(path, suffix=''):
"""
Convenience method to run Bader analysis on a folder containing
typical VASP output files.
This method will:
1. Look for files CHGCAR, AECAR0, AECAR2, POTCAR or their gzipped
counterparts.
2. If AECCAR* files are present, constructs a temp... | [
"Convenience",
"method",
"to",
"run",
"Bader",
"analysis",
"on",
"a",
"folder",
"containing",
"typical",
"VASP",
"output",
"files",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/bader_caller.py#L369-L415 | [
"def",
"bader_analysis_from_path",
"(",
"path",
",",
"suffix",
"=",
"''",
")",
":",
"def",
"_get_filepath",
"(",
"filename",
",",
"warning",
",",
"path",
"=",
"path",
",",
"suffix",
"=",
"suffix",
")",
":",
"paths",
"=",
"glob",
".",
"glob",
"(",
"os",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | bader_analysis_from_objects | Convenience method to run Bader analysis from a set
of pymatgen Chgcar and Potcar objects.
This method will:
1. If aeccar objects are present, constructs a temporary reference
file as AECCAR0 + AECCAR2
2. Runs Bader analysis twice: once for charge, and a second time
for the charge difference (... | pymatgen/command_line/bader_caller.py | def bader_analysis_from_objects(chgcar, potcar=None, aeccar0=None, aeccar2=None):
"""
Convenience method to run Bader analysis from a set
of pymatgen Chgcar and Potcar objects.
This method will:
1. If aeccar objects are present, constructs a temporary reference
file as AECCAR0 + AECCAR2
2.... | def bader_analysis_from_objects(chgcar, potcar=None, aeccar0=None, aeccar2=None):
"""
Convenience method to run Bader analysis from a set
of pymatgen Chgcar and Potcar objects.
This method will:
1. If aeccar objects are present, constructs a temporary reference
file as AECCAR0 + AECCAR2
2.... | [
"Convenience",
"method",
"to",
"run",
"Bader",
"analysis",
"from",
"a",
"set",
"of",
"pymatgen",
"Chgcar",
"and",
"Potcar",
"objects",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/bader_caller.py#L418-L482 | [
"def",
"bader_analysis_from_objects",
"(",
"chgcar",
",",
"potcar",
"=",
"None",
",",
"aeccar0",
"=",
"None",
",",
"aeccar2",
"=",
"None",
")",
":",
"with",
"ScratchDir",
"(",
"\".\"",
")",
"as",
"temp_dir",
":",
"if",
"aeccar0",
"and",
"aeccar2",
":",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BaderAnalysis.get_charge_transfer | Returns the charge transferred for a particular atom. Requires POTCAR
to be supplied.
Args:
atom_index:
Index of atom.
Returns:
Charge transfer associated with atom from the Bader analysis.
Given by final charge on atom - nelectrons in POTCAR... | pymatgen/command_line/bader_caller.py | def get_charge_transfer(self, atom_index):
"""
Returns the charge transferred for a particular atom. Requires POTCAR
to be supplied.
Args:
atom_index:
Index of atom.
Returns:
Charge transfer associated with atom from the Bader analysis.
... | def get_charge_transfer(self, atom_index):
"""
Returns the charge transferred for a particular atom. Requires POTCAR
to be supplied.
Args:
atom_index:
Index of atom.
Returns:
Charge transfer associated with atom from the Bader analysis.
... | [
"Returns",
"the",
"charge",
"transferred",
"for",
"a",
"particular",
"atom",
".",
"Requires",
"POTCAR",
"to",
"be",
"supplied",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/bader_caller.py#L254-L275 | [
"def",
"get_charge_transfer",
"(",
"self",
",",
"atom_index",
")",
":",
"if",
"self",
".",
"potcar",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"POTCAR must be supplied in order to calculate \"",
"\"charge transfer!\"",
")",
"potcar_indices",
"=",
"[",
"]",
"f... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BaderAnalysis.get_oxidation_state_decorated_structure | Returns an oxidation state decorated structure.
Returns:
Returns an oxidation state decorated structure. Requires POTCAR
to be supplied. | pymatgen/command_line/bader_caller.py | def get_oxidation_state_decorated_structure(self):
"""
Returns an oxidation state decorated structure.
Returns:
Returns an oxidation state decorated structure. Requires POTCAR
to be supplied.
"""
structure = self.chgcar.structure
charges = [-self.... | def get_oxidation_state_decorated_structure(self):
"""
Returns an oxidation state decorated structure.
Returns:
Returns an oxidation state decorated structure. Requires POTCAR
to be supplied.
"""
structure = self.chgcar.structure
charges = [-self.... | [
"Returns",
"an",
"oxidation",
"state",
"decorated",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/bader_caller.py#L277-L289 | [
"def",
"get_oxidation_state_decorated_structure",
"(",
"self",
")",
":",
"structure",
"=",
"self",
".",
"chgcar",
".",
"structure",
"charges",
"=",
"[",
"-",
"self",
".",
"get_charge_transfer",
"(",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"st... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BaderAnalysis.from_path | Convenient constructor that takes in the path name of VASP run
to perform Bader analysis.
Args:
path (str): Name of directory where VASP output files are
stored.
suffix (str): specific suffix to look for (e.g. '.relax1'
for 'CHGCAR.relax1.gz'). | pymatgen/command_line/bader_caller.py | def from_path(cls, path, suffix=""):
"""
Convenient constructor that takes in the path name of VASP run
to perform Bader analysis.
Args:
path (str): Name of directory where VASP output files are
stored.
suffix (str): specific suffix to look for (e... | def from_path(cls, path, suffix=""):
"""
Convenient constructor that takes in the path name of VASP run
to perform Bader analysis.
Args:
path (str): Name of directory where VASP output files are
stored.
suffix (str): specific suffix to look for (e... | [
"Convenient",
"constructor",
"that",
"takes",
"in",
"the",
"path",
"name",
"of",
"VASP",
"run",
"to",
"perform",
"Bader",
"analysis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/bader_caller.py#L314-L366 | [
"def",
"from_path",
"(",
"cls",
",",
"path",
",",
"suffix",
"=",
"\"\"",
")",
":",
"def",
"_get_filepath",
"(",
"filename",
")",
":",
"name_pattern",
"=",
"filename",
"+",
"suffix",
"+",
"'*'",
"if",
"filename",
"!=",
"'POTCAR'",
"else",
"filename",
"+",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_derivatives | return the derivatives of y(x) at the points x
if scipy is available a spline is generated to calculate the derivatives
if scipy is not available the left and right slopes are calculated, if both exist the average is returned
putting fd to zero always returns the finite difference slopes | pymatgen/util/convergence.py | def get_derivatives(xs, ys, fd=False):
"""
return the derivatives of y(x) at the points x
if scipy is available a spline is generated to calculate the derivatives
if scipy is not available the left and right slopes are calculated, if both exist the average is returned
putting fd to zero always retur... | def get_derivatives(xs, ys, fd=False):
"""
return the derivatives of y(x) at the points x
if scipy is available a spline is generated to calculate the derivatives
if scipy is not available the left and right slopes are calculated, if both exist the average is returned
putting fd to zero always retur... | [
"return",
"the",
"derivatives",
"of",
"y",
"(",
"x",
")",
"at",
"the",
"points",
"x",
"if",
"scipy",
"is",
"available",
"a",
"spline",
"is",
"generated",
"to",
"calculate",
"the",
"derivatives",
"if",
"scipy",
"is",
"not",
"available",
"the",
"left",
"an... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L43-L74 | [
"def",
"get_derivatives",
"(",
"xs",
",",
"ys",
",",
"fd",
"=",
"False",
")",
":",
"try",
":",
"if",
"fd",
":",
"raise",
"SplineInputError",
"(",
"'no spline wanted'",
")",
"if",
"len",
"(",
"xs",
")",
"<",
"4",
":",
"er",
"=",
"SplineInputError",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | reciprocal | reciprocal function to the power n to fit convergence data | pymatgen/util/convergence.py | def reciprocal(x, a, b, n):
"""
reciprocal function to the power n to fit convergence data
"""
if n < 1:
n = 1
elif n > 5:
n = 5
if isinstance(x, list):
y_l = []
for x_v in x:
y_l.append(a + b / x_v ** n)
y = np.array(y_l)
else:
y =... | def reciprocal(x, a, b, n):
"""
reciprocal function to the power n to fit convergence data
"""
if n < 1:
n = 1
elif n > 5:
n = 5
if isinstance(x, list):
y_l = []
for x_v in x:
y_l.append(a + b / x_v ** n)
y = np.array(y_l)
else:
y =... | [
"reciprocal",
"function",
"to",
"the",
"power",
"n",
"to",
"fit",
"convergence",
"data"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L89-L104 | [
"def",
"reciprocal",
"(",
"x",
",",
"a",
",",
"b",
",",
"n",
")",
":",
"if",
"n",
"<",
"1",
":",
"n",
"=",
"1",
"elif",
"n",
">",
"5",
":",
"n",
"=",
"5",
"if",
"isinstance",
"(",
"x",
",",
"list",
")",
":",
"y_l",
"=",
"[",
"]",
"for",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | p0_reciprocal | predictor for first guess for reciprocal | pymatgen/util/convergence.py | def p0_reciprocal(xs, ys):
"""
predictor for first guess for reciprocal
"""
a0 = ys[len(ys) - 1]
b0 = ys[0]*xs[0] - a0*xs[0]
return [a0, b0, 1] | def p0_reciprocal(xs, ys):
"""
predictor for first guess for reciprocal
"""
a0 = ys[len(ys) - 1]
b0 = ys[0]*xs[0] - a0*xs[0]
return [a0, b0, 1] | [
"predictor",
"for",
"first",
"guess",
"for",
"reciprocal"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L107-L113 | [
"def",
"p0_reciprocal",
"(",
"xs",
",",
"ys",
")",
":",
"a0",
"=",
"ys",
"[",
"len",
"(",
"ys",
")",
"-",
"1",
"]",
"b0",
"=",
"ys",
"[",
"0",
"]",
"*",
"xs",
"[",
"0",
"]",
"-",
"a0",
"*",
"xs",
"[",
"0",
"]",
"return",
"[",
"a0",
",",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | single_reciprocal | reciprocal function to fit convergence data | pymatgen/util/convergence.py | def single_reciprocal(x, a, b, c):
"""
reciprocal function to fit convergence data
"""
if isinstance(x, list):
y_l = []
for x_v in x:
y_l.append(a + b / (x_v - c))
y = np.array(y_l)
else:
y = a + b / (x - c)
return y | def single_reciprocal(x, a, b, c):
"""
reciprocal function to fit convergence data
"""
if isinstance(x, list):
y_l = []
for x_v in x:
y_l.append(a + b / (x_v - c))
y = np.array(y_l)
else:
y = a + b / (x - c)
return y | [
"reciprocal",
"function",
"to",
"fit",
"convergence",
"data"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L147-L158 | [
"def",
"single_reciprocal",
"(",
"x",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"list",
")",
":",
"y_l",
"=",
"[",
"]",
"for",
"x_v",
"in",
"x",
":",
"y_l",
".",
"append",
"(",
"a",
"+",
"b",
"/",
"(",
"x_v"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | simple_reciprocal | reciprocal function to fit convergence data | pymatgen/util/convergence.py | def simple_reciprocal(x, a, b):
"""
reciprocal function to fit convergence data
"""
if isinstance(x, list):
y_l = []
for x_v in x:
y_l.append(a + b / x_v)
y = np.array(y_l)
else:
y = a + b / x
return y | def simple_reciprocal(x, a, b):
"""
reciprocal function to fit convergence data
"""
if isinstance(x, list):
y_l = []
for x_v in x:
y_l.append(a + b / x_v)
y = np.array(y_l)
else:
y = a + b / x
return y | [
"reciprocal",
"function",
"to",
"fit",
"convergence",
"data"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L168-L179 | [
"def",
"simple_reciprocal",
"(",
"x",
",",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"list",
")",
":",
"y_l",
"=",
"[",
"]",
"for",
"x_v",
"in",
"x",
":",
"y_l",
".",
"append",
"(",
"a",
"+",
"b",
"/",
"x_v",
")",
"y",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | extrapolate_reciprocal | return the parameters such that a + b / x^n hits the last two data points | pymatgen/util/convergence.py | def extrapolate_reciprocal(xs, ys, n, noise):
"""
return the parameters such that a + b / x^n hits the last two data points
"""
if len(xs) > 4 and noise:
y1 = (ys[-3] + ys[-4]) / 2
y2 = (ys[-1] + ys[-2]) / 2
x1 = (xs[-3] + xs[-4]) / 2
x2 = (xs[-1] + xs[-2]) / 2
tr... | def extrapolate_reciprocal(xs, ys, n, noise):
"""
return the parameters such that a + b / x^n hits the last two data points
"""
if len(xs) > 4 and noise:
y1 = (ys[-3] + ys[-4]) / 2
y2 = (ys[-1] + ys[-2]) / 2
x1 = (xs[-3] + xs[-4]) / 2
x2 = (xs[-1] + xs[-2]) / 2
tr... | [
"return",
"the",
"parameters",
"such",
"that",
"a",
"+",
"b",
"/",
"x^n",
"hits",
"the",
"last",
"two",
"data",
"points"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L262-L282 | [
"def",
"extrapolate_reciprocal",
"(",
"xs",
",",
"ys",
",",
"n",
",",
"noise",
")",
":",
"if",
"len",
"(",
"xs",
")",
">",
"4",
"and",
"noise",
":",
"y1",
"=",
"(",
"ys",
"[",
"-",
"3",
"]",
"+",
"ys",
"[",
"-",
"4",
"]",
")",
"/",
"2",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | measure | measure the quality of a fit | pymatgen/util/convergence.py | def measure(function, xs, ys, popt, weights):
"""
measure the quality of a fit
"""
m = 0
n = 0
for x in xs:
try:
if len(popt) == 2:
m += (ys[n] - function(x, popt[0], popt[1]))**2 * weights[n]
elif len(popt) == 3:
m += (ys[n] - func... | def measure(function, xs, ys, popt, weights):
"""
measure the quality of a fit
"""
m = 0
n = 0
for x in xs:
try:
if len(popt) == 2:
m += (ys[n] - function(x, popt[0], popt[1]))**2 * weights[n]
elif len(popt) == 3:
m += (ys[n] - func... | [
"measure",
"the",
"quality",
"of",
"a",
"fit"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L285-L303 | [
"def",
"measure",
"(",
"function",
",",
"xs",
",",
"ys",
",",
"popt",
",",
"weights",
")",
":",
"m",
"=",
"0",
"n",
"=",
"0",
"for",
"x",
"in",
"xs",
":",
"try",
":",
"if",
"len",
"(",
"popt",
")",
"==",
"2",
":",
"m",
"+=",
"(",
"ys",
"[... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | multi_curve_fit | fit multiple functions to the x, y data, return the best fit | pymatgen/util/convergence.py | def multi_curve_fit(xs, ys, verbose):
"""
fit multiple functions to the x, y data, return the best fit
"""
#functions = {exponential: p0_exponential, reciprocal: p0_reciprocal, single_reciprocal: p0_single_reciprocal}
functions = {
exponential: p0_exponential,
reciprocal: p0_reciproc... | def multi_curve_fit(xs, ys, verbose):
"""
fit multiple functions to the x, y data, return the best fit
"""
#functions = {exponential: p0_exponential, reciprocal: p0_reciprocal, single_reciprocal: p0_single_reciprocal}
functions = {
exponential: p0_exponential,
reciprocal: p0_reciproc... | [
"fit",
"multiple",
"functions",
"to",
"the",
"x",
"y",
"data",
"return",
"the",
"best",
"fit"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L325-L357 | [
"def",
"multi_curve_fit",
"(",
"xs",
",",
"ys",
",",
"verbose",
")",
":",
"#functions = {exponential: p0_exponential, reciprocal: p0_reciprocal, single_reciprocal: p0_single_reciprocal}",
"functions",
"=",
"{",
"exponential",
":",
"p0_exponential",
",",
"reciprocal",
":",
"p0... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | multi_reciprocal_extra | Calculates for a series of powers ns the parameters for which the last two points are at the curve.
With these parameters measure how well the other data points fit.
return the best fit. | pymatgen/util/convergence.py | def multi_reciprocal_extra(xs, ys, noise=False):
"""
Calculates for a series of powers ns the parameters for which the last two points are at the curve.
With these parameters measure how well the other data points fit.
return the best fit.
"""
ns = np.linspace(0.5, 6.0, num=56)
best = ['', n... | def multi_reciprocal_extra(xs, ys, noise=False):
"""
Calculates for a series of powers ns the parameters for which the last two points are at the curve.
With these parameters measure how well the other data points fit.
return the best fit.
"""
ns = np.linspace(0.5, 6.0, num=56)
best = ['', n... | [
"Calculates",
"for",
"a",
"series",
"of",
"powers",
"ns",
"the",
"parameters",
"for",
"which",
"the",
"last",
"two",
"points",
"are",
"at",
"the",
"curve",
".",
"With",
"these",
"parameters",
"measure",
"how",
"well",
"the",
"other",
"data",
"points",
"fit... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L360-L378 | [
"def",
"multi_reciprocal_extra",
"(",
"xs",
",",
"ys",
",",
"noise",
"=",
"False",
")",
":",
"ns",
"=",
"np",
".",
"linspace",
"(",
"0.5",
",",
"6.0",
",",
"num",
"=",
"56",
")",
"best",
"=",
"[",
"''",
",",
"np",
".",
"inf",
"]",
"fit_results",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | print_plot_line | print the gnuplot command line to plot the x, y data with the fitted function using the popt parameters | pymatgen/util/convergence.py | def print_plot_line(function, popt, xs, ys, name, tol=0.05, extra=''):
"""
print the gnuplot command line to plot the x, y data with the fitted function using the popt parameters
"""
idp = id_generator()
f = open('convdat.'+str(idp), mode='w')
for n in range(0, len(ys), 1):
f.write(str(x... | def print_plot_line(function, popt, xs, ys, name, tol=0.05, extra=''):
"""
print the gnuplot command line to plot the x, y data with the fitted function using the popt parameters
"""
idp = id_generator()
f = open('convdat.'+str(idp), mode='w')
for n in range(0, len(ys), 1):
f.write(str(x... | [
"print",
"the",
"gnuplot",
"command",
"line",
"to",
"plot",
"the",
"x",
"y",
"data",
"with",
"the",
"fitted",
"function",
"using",
"the",
"popt",
"parameters"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L381-L415 | [
"def",
"print_plot_line",
"(",
"function",
",",
"popt",
",",
"xs",
",",
"ys",
",",
"name",
",",
"tol",
"=",
"0.05",
",",
"extra",
"=",
"''",
")",
":",
"idp",
"=",
"id_generator",
"(",
")",
"f",
"=",
"open",
"(",
"'convdat.'",
"+",
"str",
"(",
"id... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | determine_convergence | test it and at which x_value dy(x)/dx < tol for all x >= x_value, conv is true is such a x_value exists. | pymatgen/util/convergence.py | def determine_convergence(xs, ys, name, tol=0.0001, extra='', verbose=False, mode='extra', plots=True):
"""
test it and at which x_value dy(x)/dx < tol for all x >= x_value, conv is true is such a x_value exists.
"""
if len(xs) != len(ys):
raise RuntimeError('the range of x and y are not equal')... | def determine_convergence(xs, ys, name, tol=0.0001, extra='', verbose=False, mode='extra', plots=True):
"""
test it and at which x_value dy(x)/dx < tol for all x >= x_value, conv is true is such a x_value exists.
"""
if len(xs) != len(ys):
raise RuntimeError('the range of x and y are not equal')... | [
"test",
"it",
"and",
"at",
"which",
"x_value",
"dy",
"(",
"x",
")",
"/",
"dx",
"<",
"tol",
"for",
"all",
"x",
">",
"=",
"x_value",
"conv",
"is",
"true",
"is",
"such",
"a",
"x_value",
"exists",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/convergence.py#L418-L494 | [
"def",
"determine_convergence",
"(",
"xs",
",",
"ys",
",",
"name",
",",
"tol",
"=",
"0.0001",
",",
"extra",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"mode",
"=",
"'extra'",
",",
"plots",
"=",
"True",
")",
":",
"if",
"len",
"(",
"xs",
")",
"!... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | prime_factors | Lists prime factors of a given natural integer, from greatest to smallest
:param n: Natural integer
:rtype : list of all prime factors of the given natural n | pymatgen/analysis/chemenv/utils/math_utils.py | def prime_factors(n):
"""Lists prime factors of a given natural integer, from greatest to smallest
:param n: Natural integer
:rtype : list of all prime factors of the given natural n
"""
i = 2
while i <= sqrt(n):
if n % i == 0:
l = prime_factors(n/i)
l.append(i)
... | def prime_factors(n):
"""Lists prime factors of a given natural integer, from greatest to smallest
:param n: Natural integer
:rtype : list of all prime factors of the given natural n
"""
i = 2
while i <= sqrt(n):
if n % i == 0:
l = prime_factors(n/i)
l.append(i)
... | [
"Lists",
"prime",
"factors",
"of",
"a",
"given",
"natural",
"integer",
"from",
"greatest",
"to",
"smallest",
":",
"param",
"n",
":",
"Natural",
"integer",
":",
"rtype",
":",
"list",
"of",
"all",
"prime",
"factors",
"of",
"the",
"given",
"natural",
"n"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/math_utils.py#L50-L62 | [
"def",
"prime_factors",
"(",
"n",
")",
":",
"i",
"=",
"2",
"while",
"i",
"<=",
"sqrt",
"(",
"n",
")",
":",
"if",
"n",
"%",
"i",
"==",
"0",
":",
"l",
"=",
"prime_factors",
"(",
"n",
"/",
"i",
")",
"l",
".",
"append",
"(",
"i",
")",
"return",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | _factor_generator | From a given natural integer, returns the prime factors and their multiplicity
:param n: Natural integer
:return: | pymatgen/analysis/chemenv/utils/math_utils.py | def _factor_generator(n):
"""
From a given natural integer, returns the prime factors and their multiplicity
:param n: Natural integer
:return:
"""
p = prime_factors(n)
factors = {}
for p1 in p:
try:
factors[p1] += 1
except KeyError:
factors[p1] = ... | def _factor_generator(n):
"""
From a given natural integer, returns the prime factors and their multiplicity
:param n: Natural integer
:return:
"""
p = prime_factors(n)
factors = {}
for p1 in p:
try:
factors[p1] += 1
except KeyError:
factors[p1] = ... | [
"From",
"a",
"given",
"natural",
"integer",
"returns",
"the",
"prime",
"factors",
"and",
"their",
"multiplicity",
":",
"param",
"n",
":",
"Natural",
"integer",
":",
"return",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/math_utils.py#L65-L78 | [
"def",
"_factor_generator",
"(",
"n",
")",
":",
"p",
"=",
"prime_factors",
"(",
"n",
")",
"factors",
"=",
"{",
"}",
"for",
"p1",
"in",
"p",
":",
"try",
":",
"factors",
"[",
"p1",
"]",
"+=",
"1",
"except",
"KeyError",
":",
"factors",
"[",
"p1",
"]... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | divisors | From a given natural integer, returns the list of divisors in ascending order
:param n: Natural integer
:return: List of divisors of n in ascending order | pymatgen/analysis/chemenv/utils/math_utils.py | def divisors(n):
"""
From a given natural integer, returns the list of divisors in ascending order
:param n: Natural integer
:return: List of divisors of n in ascending order
"""
factors = _factor_generator(n)
_divisors = []
listexponents = [[k**x for x in range(0, factors[k]+1)] for k i... | def divisors(n):
"""
From a given natural integer, returns the list of divisors in ascending order
:param n: Natural integer
:return: List of divisors of n in ascending order
"""
factors = _factor_generator(n)
_divisors = []
listexponents = [[k**x for x in range(0, factors[k]+1)] for k i... | [
"From",
"a",
"given",
"natural",
"integer",
"returns",
"the",
"list",
"of",
"divisors",
"in",
"ascending",
"order",
":",
"param",
"n",
":",
"Natural",
"integer",
":",
"return",
":",
"List",
"of",
"divisors",
"of",
"n",
"in",
"ascending",
"order"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/utils/math_utils.py#L81-L94 | [
"def",
"divisors",
"(",
"n",
")",
":",
"factors",
"=",
"_factor_generator",
"(",
"n",
")",
"_divisors",
"=",
"[",
"]",
"listexponents",
"=",
"[",
"[",
"k",
"**",
"x",
"for",
"x",
"in",
"range",
"(",
"0",
",",
"factors",
"[",
"k",
"]",
"+",
"1",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | str_delimited | Given a tuple of tuples, generate a delimited string form.
>>> results = [["a","b","c"],["d","e","f"],[1,2,3]]
>>> print(str_delimited(results,delimiter=","))
a,b,c
d,e,f
1,2,3
Args:
result: 2d sequence of arbitrary types.
header: optional header
Returns:
Aligned st... | pymatgen/util/string.py | def str_delimited(results, header=None, delimiter="\t"):
"""
Given a tuple of tuples, generate a delimited string form.
>>> results = [["a","b","c"],["d","e","f"],[1,2,3]]
>>> print(str_delimited(results,delimiter=","))
a,b,c
d,e,f
1,2,3
Args:
result: 2d sequence of arbitrary ty... | def str_delimited(results, header=None, delimiter="\t"):
"""
Given a tuple of tuples, generate a delimited string form.
>>> results = [["a","b","c"],["d","e","f"],[1,2,3]]
>>> print(str_delimited(results,delimiter=","))
a,b,c
d,e,f
1,2,3
Args:
result: 2d sequence of arbitrary ty... | [
"Given",
"a",
"tuple",
"of",
"tuples",
"generate",
"a",
"delimited",
"string",
"form",
".",
">>>",
"results",
"=",
"[[",
"a",
"b",
"c",
"]",
"[",
"d",
"e",
"f",
"]",
"[",
"1",
"2",
"3",
"]]",
">>>",
"print",
"(",
"str_delimited",
"(",
"results",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L19-L39 | [
"def",
"str_delimited",
"(",
"results",
",",
"header",
"=",
"None",
",",
"delimiter",
"=",
"\"\\t\"",
")",
":",
"returnstr",
"=",
"\"\"",
"if",
"header",
"is",
"not",
"None",
":",
"returnstr",
"+=",
"delimiter",
".",
"join",
"(",
"header",
")",
"+",
"\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | formula_double_format | This function is used to make pretty formulas by formatting the amounts.
Instead of Li1.0 Fe1.0 P1.0 O4.0, you get LiFePO4.
Args:
afloat (float): a float
ignore_ones (bool): if true, floats of 1 are ignored.
tol (float): Tolerance to round to nearest int. i.e. 2.0000000001 -> 2
Ret... | pymatgen/util/string.py | def formula_double_format(afloat, ignore_ones=True, tol=1e-8):
"""
This function is used to make pretty formulas by formatting the amounts.
Instead of Li1.0 Fe1.0 P1.0 O4.0, you get LiFePO4.
Args:
afloat (float): a float
ignore_ones (bool): if true, floats of 1 are ignored.
tol ... | def formula_double_format(afloat, ignore_ones=True, tol=1e-8):
"""
This function is used to make pretty formulas by formatting the amounts.
Instead of Li1.0 Fe1.0 P1.0 O4.0, you get LiFePO4.
Args:
afloat (float): a float
ignore_ones (bool): if true, floats of 1 are ignored.
tol ... | [
"This",
"function",
"is",
"used",
"to",
"make",
"pretty",
"formulas",
"by",
"formatting",
"the",
"amounts",
".",
"Instead",
"of",
"Li1",
".",
"0",
"Fe1",
".",
"0",
"P1",
".",
"0",
"O4",
".",
"0",
"you",
"get",
"LiFePO4",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L42-L60 | [
"def",
"formula_double_format",
"(",
"afloat",
",",
"ignore_ones",
"=",
"True",
",",
"tol",
"=",
"1e-8",
")",
":",
"if",
"ignore_ones",
"and",
"afloat",
"==",
"1",
":",
"return",
"\"\"",
"elif",
"abs",
"(",
"afloat",
"-",
"int",
"(",
"afloat",
")",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | unicodeify | Generates a formula with unicode subscripts, e.g. Fe2O3 is transformed
to Fe₂O₃. Does not support formulae with decimal points.
:param formula:
:return: | pymatgen/util/string.py | def unicodeify(formula):
"""
Generates a formula with unicode subscripts, e.g. Fe2O3 is transformed
to Fe₂O₃. Does not support formulae with decimal points.
:param formula:
:return:
"""
if '.' in formula:
raise ValueError('No unicode character exists for subscript period.')
su... | def unicodeify(formula):
"""
Generates a formula with unicode subscripts, e.g. Fe2O3 is transformed
to Fe₂O₃. Does not support formulae with decimal points.
:param formula:
:return:
"""
if '.' in formula:
raise ValueError('No unicode character exists for subscript period.')
su... | [
"Generates",
"a",
"formula",
"with",
"unicode",
"subscripts",
"e",
".",
"g",
".",
"Fe2O3",
"is",
"transformed",
"to",
"Fe₂O₃",
".",
"Does",
"not",
"support",
"formulae",
"with",
"decimal",
"points",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L88-L106 | [
"def",
"unicodeify",
"(",
"formula",
")",
":",
"if",
"'.'",
"in",
"formula",
":",
"raise",
"ValueError",
"(",
"'No unicode character exists for subscript period.'",
")",
"subscript_unicode_map",
"=",
"{",
"0",
":",
"'₀', ",
"1",
" ",
"'",
"', 2:",
" ",
"₂",
"'... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | latexify_spacegroup | Generates a latex formatted spacegroup. E.g., P2_1/c is converted to
P2$_{1}$/c and P-1 is converted to P$\\overline{1}$.
Args:
spacegroup_symbol (str): A spacegroup symbol
Returns:
A latex formatted spacegroup with proper subscripts and overlines. | pymatgen/util/string.py | def latexify_spacegroup(spacegroup_symbol):
"""
Generates a latex formatted spacegroup. E.g., P2_1/c is converted to
P2$_{1}$/c and P-1 is converted to P$\\overline{1}$.
Args:
spacegroup_symbol (str): A spacegroup symbol
Returns:
A latex formatted spacegroup with proper subscripts ... | def latexify_spacegroup(spacegroup_symbol):
"""
Generates a latex formatted spacegroup. E.g., P2_1/c is converted to
P2$_{1}$/c and P-1 is converted to P$\\overline{1}$.
Args:
spacegroup_symbol (str): A spacegroup symbol
Returns:
A latex formatted spacegroup with proper subscripts ... | [
"Generates",
"a",
"latex",
"formatted",
"spacegroup",
".",
"E",
".",
"g",
".",
"P2_1",
"/",
"c",
"is",
"converted",
"to",
"P2$_",
"{",
"1",
"}",
"$",
"/",
"c",
"and",
"P",
"-",
"1",
"is",
"converted",
"to",
"P$",
"\\\\",
"overline",
"{",
"1",
"}"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L109-L121 | [
"def",
"latexify_spacegroup",
"(",
"spacegroup_symbol",
")",
":",
"sym",
"=",
"re",
".",
"sub",
"(",
"r\"_(\\d+)\"",
",",
"r\"$_{\\1}$\"",
",",
"spacegroup_symbol",
")",
"return",
"re",
".",
"sub",
"(",
"r\"-(\\d)\"",
",",
"r\"$\\\\overline{\\1}$\"",
",",
"sym",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | stream_has_colours | True if stream supports colours. Python cookbook, #475186 | pymatgen/util/string.py | def stream_has_colours(stream):
"""
True if stream supports colours. Python cookbook, #475186
"""
if not hasattr(stream, "isatty"):
return False
if not stream.isatty():
return False # auto color only on TTYs
try:
import curses
curses.setupterm()
return c... | def stream_has_colours(stream):
"""
True if stream supports colours. Python cookbook, #475186
"""
if not hasattr(stream, "isatty"):
return False
if not stream.isatty():
return False # auto color only on TTYs
try:
import curses
curses.setupterm()
return c... | [
"True",
"if",
"stream",
"supports",
"colours",
".",
"Python",
"cookbook",
"#475186"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L124-L138 | [
"def",
"stream_has_colours",
"(",
"stream",
")",
":",
"if",
"not",
"hasattr",
"(",
"stream",
",",
"\"isatty\"",
")",
":",
"return",
"False",
"if",
"not",
"stream",
".",
"isatty",
"(",
")",
":",
"return",
"False",
"# auto color only on TTYs",
"try",
":",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | transformation_to_string | Convenience method. Given matrix returns string, e.g. x+2y+1/4
:param matrix
:param translation_vec
:param components: either ('x', 'y', 'z') or ('a', 'b', 'c')
:param c: optional additional character to print (used for magmoms)
:param delim: delimiter
:return: xyz string | pymatgen/util/string.py | def transformation_to_string(matrix, translation_vec=(0, 0, 0), components=('x', 'y', 'z'), c='', delim=','):
"""
Convenience method. Given matrix returns string, e.g. x+2y+1/4
:param matrix
:param translation_vec
:param components: either ('x', 'y', 'z') or ('a', 'b', 'c')
:param c: optional ad... | def transformation_to_string(matrix, translation_vec=(0, 0, 0), components=('x', 'y', 'z'), c='', delim=','):
"""
Convenience method. Given matrix returns string, e.g. x+2y+1/4
:param matrix
:param translation_vec
:param components: either ('x', 'y', 'z') or ('a', 'b', 'c')
:param c: optional ad... | [
"Convenience",
"method",
".",
"Given",
"matrix",
"returns",
"string",
"e",
".",
"g",
".",
"x",
"+",
"2y",
"+",
"1",
"/",
"4",
":",
"param",
"matrix",
":",
"param",
"translation_vec",
":",
"param",
"components",
":",
"either",
"(",
"x",
"y",
"z",
")",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L141-L173 | [
"def",
"transformation_to_string",
"(",
"matrix",
",",
"translation_vec",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
",",
"components",
"=",
"(",
"'x'",
",",
"'y'",
",",
"'z'",
")",
",",
"c",
"=",
"''",
",",
"delim",
"=",
"','",
")",
":",
"parts",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | disordered_formula | Returns a formula of a form like AxB1-x (x=0.5)
for disordered structures. Will only return a
formula for disordered structures with one
kind of disordered site at present.
Args:
disordered_struct: a disordered structure
symbols: a tuple of characters to use for
subscripts, by d... | pymatgen/util/string.py | def disordered_formula(disordered_struct, symbols=('x', 'y', 'z'), fmt='plain'):
"""
Returns a formula of a form like AxB1-x (x=0.5)
for disordered structures. Will only return a
formula for disordered structures with one
kind of disordered site at present.
Args:
disordered_struct: a di... | def disordered_formula(disordered_struct, symbols=('x', 'y', 'z'), fmt='plain'):
"""
Returns a formula of a form like AxB1-x (x=0.5)
for disordered structures. Will only return a
formula for disordered structures with one
kind of disordered site at present.
Args:
disordered_struct: a di... | [
"Returns",
"a",
"formula",
"of",
"a",
"form",
"like",
"AxB1",
"-",
"x",
"(",
"x",
"=",
"0",
".",
"5",
")",
"for",
"disordered",
"structures",
".",
"Will",
"only",
"return",
"a",
"formula",
"for",
"disordered",
"structures",
"with",
"one",
"kind",
"of",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/string.py#L176-L284 | [
"def",
"disordered_formula",
"(",
"disordered_struct",
",",
"symbols",
"=",
"(",
"'x'",
",",
"'y'",
",",
"'z'",
")",
",",
"fmt",
"=",
"'plain'",
")",
":",
"# this is in string utils and not in",
"# Composition because we need to have access",
"# to site occupancies to cal... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MoleculeStructureComparator.are_equal | Compare the bond table of the two molecules.
Args:
mol1: first molecule. pymatgen Molecule object.
mol2: second moleculs. pymatgen Molecule objec. | pymatgen/analysis/molecule_structure_comparator.py | def are_equal(self, mol1, mol2):
"""
Compare the bond table of the two molecules.
Args:
mol1: first molecule. pymatgen Molecule object.
mol2: second moleculs. pymatgen Molecule objec.
"""
b1 = set(self._get_bonds(mol1))
b2 = set(self._get_bonds(mo... | def are_equal(self, mol1, mol2):
"""
Compare the bond table of the two molecules.
Args:
mol1: first molecule. pymatgen Molecule object.
mol2: second moleculs. pymatgen Molecule objec.
"""
b1 = set(self._get_bonds(mol1))
b2 = set(self._get_bonds(mo... | [
"Compare",
"the",
"bond",
"table",
"of",
"the",
"two",
"molecules",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/molecule_structure_comparator.py#L103-L113 | [
"def",
"are_equal",
"(",
"self",
",",
"mol1",
",",
"mol2",
")",
":",
"b1",
"=",
"set",
"(",
"self",
".",
"_get_bonds",
"(",
"mol1",
")",
")",
"b2",
"=",
"set",
"(",
"self",
".",
"_get_bonds",
"(",
"mol2",
")",
")",
"return",
"b1",
"==",
"b2"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MoleculeStructureComparator._get_bonds | Find all the bond in a molcule
Args:
mol: the molecule. pymatgen Molecule object
Returns:
List of tuple. Each tuple correspond to a bond represented by the
id of the two end atoms. | pymatgen/analysis/molecule_structure_comparator.py | def _get_bonds(self, mol):
"""
Find all the bond in a molcule
Args:
mol: the molecule. pymatgen Molecule object
Returns:
List of tuple. Each tuple correspond to a bond represented by the
id of the two end atoms.
"""
num_atoms = len(mo... | def _get_bonds(self, mol):
"""
Find all the bond in a molcule
Args:
mol: the molecule. pymatgen Molecule object
Returns:
List of tuple. Each tuple correspond to a bond represented by the
id of the two end atoms.
"""
num_atoms = len(mo... | [
"Find",
"all",
"the",
"bond",
"in",
"a",
"molcule"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/molecule_structure_comparator.py#L127-L167 | [
"def",
"_get_bonds",
"(",
"self",
",",
"mol",
")",
":",
"num_atoms",
"=",
"len",
"(",
"mol",
")",
"# index starting from 0",
"if",
"self",
".",
"ignore_ionic_bond",
":",
"covalent_atoms",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"num_atoms",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | compare_sym_bands | Compute the mean of correlation between bzt and vasp bandstructure on
sym line, for all bands and locally (for each branches) the difference
squared (%) if nb is specified. | pymatgen/electronic_structure/boltztrap.py | def compare_sym_bands(bands_obj, bands_ref_obj, nb=None):
"""
Compute the mean of correlation between bzt and vasp bandstructure on
sym line, for all bands and locally (for each branches) the difference
squared (%) if nb is specified.
"""
nkpt = len(bands_obj.kpoints)
if bands_ref_obj.is_sp... | def compare_sym_bands(bands_obj, bands_ref_obj, nb=None):
"""
Compute the mean of correlation between bzt and vasp bandstructure on
sym line, for all bands and locally (for each branches) the difference
squared (%) if nb is specified.
"""
nkpt = len(bands_obj.kpoints)
if bands_ref_obj.is_sp... | [
"Compute",
"the",
"mean",
"of",
"correlation",
"between",
"bzt",
"and",
"vasp",
"bandstructure",
"on",
"sym",
"line",
"for",
"all",
"bands",
"and",
"locally",
"(",
"for",
"each",
"branches",
")",
"the",
"difference",
"squared",
"(",
"%",
")",
"if",
"nb",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L2237-L2309 | [
"def",
"compare_sym_bands",
"(",
"bands_obj",
",",
"bands_ref_obj",
",",
"nb",
"=",
"None",
")",
":",
"nkpt",
"=",
"len",
"(",
"bands_obj",
".",
"kpoints",
")",
"if",
"bands_ref_obj",
".",
"is_spin_polarized",
":",
"nbands",
"=",
"min",
"(",
"bands_obj",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | seebeck_spb | Seebeck analytic formula in the single parabolic model | pymatgen/electronic_structure/boltztrap.py | def seebeck_spb(eta,Lambda=0.5):
"""
Seebeck analytic formula in the single parabolic model
"""
from fdint import fdk
return constants.k/constants.e * ((2. + Lambda) * fdk( 1.+ Lambda, eta)/
((1.+Lambda)*fdk(Lambda, eta))- eta) * 1e+6 | def seebeck_spb(eta,Lambda=0.5):
"""
Seebeck analytic formula in the single parabolic model
"""
from fdint import fdk
return constants.k/constants.e * ((2. + Lambda) * fdk( 1.+ Lambda, eta)/
((1.+Lambda)*fdk(Lambda, eta))- eta) * 1e+6 | [
"Seebeck",
"analytic",
"formula",
"in",
"the",
"single",
"parabolic",
"model"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L2312-L2319 | [
"def",
"seebeck_spb",
"(",
"eta",
",",
"Lambda",
"=",
"0.5",
")",
":",
"from",
"fdint",
"import",
"fdk",
"return",
"constants",
".",
"k",
"/",
"constants",
".",
"e",
"*",
"(",
"(",
"2.",
"+",
"Lambda",
")",
"*",
"fdk",
"(",
"1.",
"+",
"Lambda",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | eta_from_seebeck | It takes a value of seebeck and adjusts the analytic seebeck until it's equal
Returns: eta where the two seebeck coefficients are equal
(reduced chemical potential) | pymatgen/electronic_structure/boltztrap.py | def eta_from_seebeck(seeb,Lambda):
"""
It takes a value of seebeck and adjusts the analytic seebeck until it's equal
Returns: eta where the two seebeck coefficients are equal
(reduced chemical potential)
"""
from scipy.optimize import fsolve
out = fsolve(lambda x: (seebeck_spb(... | def eta_from_seebeck(seeb,Lambda):
"""
It takes a value of seebeck and adjusts the analytic seebeck until it's equal
Returns: eta where the two seebeck coefficients are equal
(reduced chemical potential)
"""
from scipy.optimize import fsolve
out = fsolve(lambda x: (seebeck_spb(... | [
"It",
"takes",
"a",
"value",
"of",
"seebeck",
"and",
"adjusts",
"the",
"analytic",
"seebeck",
"until",
"it",
"s",
"equal",
"Returns",
":",
"eta",
"where",
"the",
"two",
"seebeck",
"coefficients",
"are",
"equal",
"(",
"reduced",
"chemical",
"potential",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L2321-L2329 | [
"def",
"eta_from_seebeck",
"(",
"seeb",
",",
"Lambda",
")",
":",
"from",
"scipy",
".",
"optimize",
"import",
"fsolve",
"out",
"=",
"fsolve",
"(",
"lambda",
"x",
":",
"(",
"seebeck_spb",
"(",
"x",
",",
"Lambda",
")",
"-",
"abs",
"(",
"seeb",
")",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | seebeck_eff_mass_from_carr | Calculate seebeck effective mass at a certain carrier concentration
eta in kB*T units, n in cm-3, T in K, returns mass in m0 units | pymatgen/electronic_structure/boltztrap.py | def seebeck_eff_mass_from_carr(eta, n, T, Lambda):
"""
Calculate seebeck effective mass at a certain carrier concentration
eta in kB*T units, n in cm-3, T in K, returns mass in m0 units
"""
from fdint import fdk
return (2 * np.pi**2 * abs(n) * 10 ** 6 / (fdk(0.5,eta))) ** (2. / 3)\
... | def seebeck_eff_mass_from_carr(eta, n, T, Lambda):
"""
Calculate seebeck effective mass at a certain carrier concentration
eta in kB*T units, n in cm-3, T in K, returns mass in m0 units
"""
from fdint import fdk
return (2 * np.pi**2 * abs(n) * 10 ** 6 / (fdk(0.5,eta))) ** (2. / 3)\
... | [
"Calculate",
"seebeck",
"effective",
"mass",
"at",
"a",
"certain",
"carrier",
"concentration",
"eta",
"in",
"kB",
"*",
"T",
"units",
"n",
"in",
"cm",
"-",
"3",
"T",
"in",
"K",
"returns",
"mass",
"in",
"m0",
"units"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L2332-L2340 | [
"def",
"seebeck_eff_mass_from_carr",
"(",
"eta",
",",
"n",
",",
"T",
",",
"Lambda",
")",
":",
"from",
"fdint",
"import",
"fdk",
"return",
"(",
"2",
"*",
"np",
".",
"pi",
"**",
"2",
"*",
"abs",
"(",
"n",
")",
"*",
"10",
"**",
"6",
"/",
"(",
"fdk... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | seebeck_eff_mass_from_seebeck_carr | Find the chemical potential where analytic and calculated seebeck are identical
and then calculate the seebeck effective mass at that chemical potential and
a certain carrier concentration n | pymatgen/electronic_structure/boltztrap.py | def seebeck_eff_mass_from_seebeck_carr(seeb, n, T, Lambda):
"""
Find the chemical potential where analytic and calculated seebeck are identical
and then calculate the seebeck effective mass at that chemical potential and
a certain carrier concentration n
"""
try:
from fdint ... | def seebeck_eff_mass_from_seebeck_carr(seeb, n, T, Lambda):
"""
Find the chemical potential where analytic and calculated seebeck are identical
and then calculate the seebeck effective mass at that chemical potential and
a certain carrier concentration n
"""
try:
from fdint ... | [
"Find",
"the",
"chemical",
"potential",
"where",
"analytic",
"and",
"calculated",
"seebeck",
"are",
"identical",
"and",
"then",
"calculate",
"the",
"seebeck",
"effective",
"mass",
"at",
"that",
"chemical",
"potential",
"and",
"a",
"certain",
"carrier",
"concentrat... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L2343-L2357 | [
"def",
"seebeck_eff_mass_from_seebeck_carr",
"(",
"seeb",
",",
"n",
",",
"T",
",",
"Lambda",
")",
":",
"try",
":",
"from",
"fdint",
"import",
"fdk",
"except",
"ImportError",
":",
"raise",
"BoltztrapError",
"(",
"\"fdint module not found. Please, install it.\\n\"",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapRunner._auto_set_energy_range | automatically determine the energy range as min/max eigenvalue
minus/plus the buffer_in_ev | pymatgen/electronic_structure/boltztrap.py | def _auto_set_energy_range(self):
"""
automatically determine the energy range as min/max eigenvalue
minus/plus the buffer_in_ev
"""
emins = [min([e_k[0] for e_k in self._bs.bands[Spin.up]])]
emaxs = [max([e_k[0] for e_k in self._bs.bands[Spin.up]])]
if self._bs.... | def _auto_set_energy_range(self):
"""
automatically determine the energy range as min/max eigenvalue
minus/plus the buffer_in_ev
"""
emins = [min([e_k[0] for e_k in self._bs.bands[Spin.up]])]
emaxs = [max([e_k[0] for e_k in self._bs.bands[Spin.up]])]
if self._bs.... | [
"automatically",
"determine",
"the",
"energy",
"range",
"as",
"min",
"/",
"max",
"eigenvalue",
"minus",
"/",
"plus",
"the",
"buffer_in_ev"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L191-L223 | [
"def",
"_auto_set_energy_range",
"(",
"self",
")",
":",
"emins",
"=",
"[",
"min",
"(",
"[",
"e_k",
"[",
"0",
"]",
"for",
"e_k",
"in",
"self",
".",
"_bs",
".",
"bands",
"[",
"Spin",
".",
"up",
"]",
"]",
")",
"]",
"emaxs",
"=",
"[",
"max",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapRunner.run | Write inputs (optional), run BoltzTraP, and ensure
convergence (optional)
Args:
path_dir (str): directory in which to run BoltzTraP
convergence (bool): whether to check convergence and make
corrections if needed
write_input: (bool) whether to write inp... | pymatgen/electronic_structure/boltztrap.py | def run(self, path_dir=None, convergence=True, write_input=True,
clear_dir=False, max_lpfac=150, min_egrid=0.00005):
"""
Write inputs (optional), run BoltzTraP, and ensure
convergence (optional)
Args:
path_dir (str): directory in which to run BoltzTraP
... | def run(self, path_dir=None, convergence=True, write_input=True,
clear_dir=False, max_lpfac=150, min_egrid=0.00005):
"""
Write inputs (optional), run BoltzTraP, and ensure
convergence (optional)
Args:
path_dir (str): directory in which to run BoltzTraP
... | [
"Write",
"inputs",
"(",
"optional",
")",
"run",
"BoltzTraP",
"and",
"ensure",
"convergence",
"(",
"optional",
")",
"Args",
":",
"path_dir",
"(",
"str",
")",
":",
"directory",
"in",
"which",
"to",
"run",
"BoltzTraP",
"convergence",
"(",
"bool",
")",
":",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L532-L694 | [
"def",
"run",
"(",
"self",
",",
"path_dir",
"=",
"None",
",",
"convergence",
"=",
"True",
",",
"write_input",
"=",
"True",
",",
"clear_dir",
"=",
"False",
",",
"max_lpfac",
"=",
"150",
",",
"min_egrid",
"=",
"0.00005",
")",
":",
"# TODO: consider making th... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_symm_bands | Function useful to read bands from Boltztrap output and get a
BandStructureSymmLine object comparable with that one from a DFT
calculation (if the same kpt_line is provided). Default kpt_line
and labels_dict is the standard path of high symmetry k-point for
the specified ... | pymatgen/electronic_structure/boltztrap.py | def get_symm_bands(self, structure, efermi, kpt_line=None,
labels_dict=None):
"""
Function useful to read bands from Boltztrap output and get a
BandStructureSymmLine object comparable with that one from a DFT
calculation (if the same kpt_line is provide... | def get_symm_bands(self, structure, efermi, kpt_line=None,
labels_dict=None):
"""
Function useful to read bands from Boltztrap output and get a
BandStructureSymmLine object comparable with that one from a DFT
calculation (if the same kpt_line is provide... | [
"Function",
"useful",
"to",
"read",
"bands",
"from",
"Boltztrap",
"output",
"and",
"get",
"a",
"BandStructureSymmLine",
"object",
"comparable",
"with",
"that",
"one",
"from",
"a",
"DFT",
"calculation",
"(",
"if",
"the",
"same",
"kpt_line",
"is",
"provided",
")... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L851-L915 | [
"def",
"get_symm_bands",
"(",
"self",
",",
"structure",
",",
"efermi",
",",
"kpt_line",
"=",
"None",
",",
"labels_dict",
"=",
"None",
")",
":",
"try",
":",
"if",
"kpt_line",
"is",
"None",
":",
"kpath",
"=",
"HighSymmKpath",
"(",
"structure",
")",
"kpt_li... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.check_acc_bzt_bands | Compare sbs_bz BandStructureSymmLine calculated with boltztrap with
the sbs_ref BandStructureSymmLine as reference (from MP for
instance), computing correlation and energy difference for eight bands
around the gap (semiconductors) or fermi level (metals).
warn_thr is a th... | pymatgen/electronic_structure/boltztrap.py | def check_acc_bzt_bands(sbs_bz, sbs_ref, warn_thr=(0.03, 0.03)):
"""
Compare sbs_bz BandStructureSymmLine calculated with boltztrap with
the sbs_ref BandStructureSymmLine as reference (from MP for
instance), computing correlation and energy difference for eight bands
... | def check_acc_bzt_bands(sbs_bz, sbs_ref, warn_thr=(0.03, 0.03)):
"""
Compare sbs_bz BandStructureSymmLine calculated with boltztrap with
the sbs_ref BandStructureSymmLine as reference (from MP for
instance), computing correlation and energy difference for eight bands
... | [
"Compare",
"sbs_bz",
"BandStructureSymmLine",
"calculated",
"with",
"boltztrap",
"with",
"the",
"sbs_ref",
"BandStructureSymmLine",
"as",
"reference",
"(",
"from",
"MP",
"for",
"instance",
")",
"computing",
"correlation",
"and",
"energy",
"difference",
"for",
"eight",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L918-L985 | [
"def",
"check_acc_bzt_bands",
"(",
"sbs_bz",
",",
"sbs_ref",
",",
"warn_thr",
"=",
"(",
"0.03",
",",
"0.03",
")",
")",
":",
"if",
"not",
"sbs_ref",
".",
"is_metal",
"(",
")",
"and",
"not",
"sbs_bz",
".",
"is_metal",
"(",
")",
":",
"vbm_idx",
"=",
"sb... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_seebeck | Gives the seebeck coefficient (microV/K) in either a
full 3x3 tensor form, as 3 eigenvalues, or as the average value
(trace/3.0) If doping_levels=True, the results are given at
different p and n doping
levels (given by self.doping), otherwise it is given as a series
... | pymatgen/electronic_structure/boltztrap.py | def get_seebeck(self, output='eigs', doping_levels=True):
"""
Gives the seebeck coefficient (microV/K) in either a
full 3x3 tensor form, as 3 eigenvalues, or as the average value
(trace/3.0) If doping_levels=True, the results are given at
different p and n doping
... | def get_seebeck(self, output='eigs', doping_levels=True):
"""
Gives the seebeck coefficient (microV/K) in either a
full 3x3 tensor form, as 3 eigenvalues, or as the average value
(trace/3.0) If doping_levels=True, the results are given at
different p and n doping
... | [
"Gives",
"the",
"seebeck",
"coefficient",
"(",
"microV",
"/",
"K",
")",
"in",
"either",
"a",
"full",
"3x3",
"tensor",
"form",
"as",
"3",
"eigenvalues",
"or",
"as",
"the",
"average",
"value",
"(",
"trace",
"/",
"3",
".",
"0",
")",
"If",
"doping_levels",... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L987-L1020 | [
"def",
"get_seebeck",
"(",
"self",
",",
"output",
"=",
"'eigs'",
",",
"doping_levels",
"=",
"True",
")",
":",
"return",
"BoltztrapAnalyzer",
".",
"_format_to_output",
"(",
"self",
".",
"_seebeck",
",",
"self",
".",
"_seebeck_doping",
",",
"output",
",",
"dop... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_conductivity | Gives the conductivity (1/Ohm*m) in either a full 3x3 tensor
form, as 3 eigenvalues, or as the average value
(trace/3.0) If doping_levels=True, the results are given at
different p and n doping
levels (given by self.doping), otherwise it is given as a series
o... | pymatgen/electronic_structure/boltztrap.py | def get_conductivity(self, output='eigs', doping_levels=True,
relaxation_time=1e-14):
"""
Gives the conductivity (1/Ohm*m) in either a full 3x3 tensor
form, as 3 eigenvalues, or as the average value
(trace/3.0) If doping_levels=True, the results are g... | def get_conductivity(self, output='eigs', doping_levels=True,
relaxation_time=1e-14):
"""
Gives the conductivity (1/Ohm*m) in either a full 3x3 tensor
form, as 3 eigenvalues, or as the average value
(trace/3.0) If doping_levels=True, the results are g... | [
"Gives",
"the",
"conductivity",
"(",
"1",
"/",
"Ohm",
"*",
"m",
")",
"in",
"either",
"a",
"full",
"3x3",
"tensor",
"form",
"as",
"3",
"eigenvalues",
"or",
"as",
"the",
"average",
"value",
"(",
"trace",
"/",
"3",
".",
"0",
")",
"If",
"doping_levels",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1022-L1058 | [
"def",
"get_conductivity",
"(",
"self",
",",
"output",
"=",
"'eigs'",
",",
"doping_levels",
"=",
"True",
",",
"relaxation_time",
"=",
"1e-14",
")",
":",
"return",
"BoltztrapAnalyzer",
".",
"_format_to_output",
"(",
"self",
".",
"_cond",
",",
"self",
".",
"_c... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_power_factor | Gives the power factor (Seebeck^2 * conductivity) in units
microW/(m*K^2) in either a full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=True, the results are given at
different p and n doping levels (given by self.doping), otherwise it
i... | pymatgen/electronic_structure/boltztrap.py | def get_power_factor(self, output='eigs', doping_levels=True,
relaxation_time=1e-14):
"""
Gives the power factor (Seebeck^2 * conductivity) in units
microW/(m*K^2) in either a full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
... | def get_power_factor(self, output='eigs', doping_levels=True,
relaxation_time=1e-14):
"""
Gives the power factor (Seebeck^2 * conductivity) in units
microW/(m*K^2) in either a full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
... | [
"Gives",
"the",
"power",
"factor",
"(",
"Seebeck^2",
"*",
"conductivity",
")",
"in",
"units",
"microW",
"/",
"(",
"m",
"*",
"K^2",
")",
"in",
"either",
"a",
"full",
"3x3",
"tensor",
"form",
"as",
"3",
"eigenvalues",
"or",
"as",
"the",
"average",
"value... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1060-L1123 | [
"def",
"get_power_factor",
"(",
"self",
",",
"output",
"=",
"'eigs'",
",",
"doping_levels",
"=",
"True",
",",
"relaxation_time",
"=",
"1e-14",
")",
":",
"result",
"=",
"None",
"result_doping",
"=",
"None",
"if",
"doping_levels",
":",
"result_doping",
"=",
"{... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_thermal_conductivity | Gives the electronic part of the thermal conductivity in either a
full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=True, the results are given at
different p and n doping levels (given by self.doping), otherwise it
is given as a series ... | pymatgen/electronic_structure/boltztrap.py | def get_thermal_conductivity(self, output='eigs', doping_levels=True,
k_el=True, relaxation_time=1e-14):
"""
Gives the electronic part of the thermal conductivity in either a
full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
... | def get_thermal_conductivity(self, output='eigs', doping_levels=True,
k_el=True, relaxation_time=1e-14):
"""
Gives the electronic part of the thermal conductivity in either a
full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
... | [
"Gives",
"the",
"electronic",
"part",
"of",
"the",
"thermal",
"conductivity",
"in",
"either",
"a",
"full",
"3x3",
"tensor",
"form",
"as",
"3",
"eigenvalues",
"or",
"as",
"the",
"average",
"value",
"(",
"trace",
"/",
"3",
".",
"0",
")",
"If",
"doping_leve... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1125-L1196 | [
"def",
"get_thermal_conductivity",
"(",
"self",
",",
"output",
"=",
"'eigs'",
",",
"doping_levels",
"=",
"True",
",",
"k_el",
"=",
"True",
",",
"relaxation_time",
"=",
"1e-14",
")",
":",
"result",
"=",
"None",
"result_doping",
"=",
"None",
"if",
"doping_leve... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_zt | Gives the ZT coefficient (S^2*cond*T/thermal cond) in either a full
3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=True, the results are given at
different p and n doping levels (given by self.doping), otherwise it
is given as a series of
... | pymatgen/electronic_structure/boltztrap.py | def get_zt(self, output='eigs', doping_levels=True, relaxation_time=1e-14,
kl=1.0):
"""
Gives the ZT coefficient (S^2*cond*T/thermal cond) in either a full
3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=True, the results are... | def get_zt(self, output='eigs', doping_levels=True, relaxation_time=1e-14,
kl=1.0):
"""
Gives the ZT coefficient (S^2*cond*T/thermal cond) in either a full
3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=True, the results are... | [
"Gives",
"the",
"ZT",
"coefficient",
"(",
"S^2",
"*",
"cond",
"*",
"T",
"/",
"thermal",
"cond",
")",
"in",
"either",
"a",
"full",
"3x3",
"tensor",
"form",
"as",
"3",
"eigenvalues",
"or",
"as",
"the",
"average",
"value",
"(",
"trace",
"/",
"3",
".",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1198-L1270 | [
"def",
"get_zt",
"(",
"self",
",",
"output",
"=",
"'eigs'",
",",
"doping_levels",
"=",
"True",
",",
"relaxation_time",
"=",
"1e-14",
",",
"kl",
"=",
"1.0",
")",
":",
"result",
"=",
"None",
"result_doping",
"=",
"None",
"if",
"doping_levels",
":",
"result... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_average_eff_mass | Gives the average effective mass tensor. We call it average because
it takes into account all the bands
and regions in the Brillouin zone. This is different than the standard
textbook effective mass which relates
often to only one (parabolic) band.
The average effective mass tens... | pymatgen/electronic_structure/boltztrap.py | def get_average_eff_mass(self, output='eigs', doping_levels=True):
"""
Gives the average effective mass tensor. We call it average because
it takes into account all the bands
and regions in the Brillouin zone. This is different than the standard
textbook effective mass which rela... | def get_average_eff_mass(self, output='eigs', doping_levels=True):
"""
Gives the average effective mass tensor. We call it average because
it takes into account all the bands
and regions in the Brillouin zone. This is different than the standard
textbook effective mass which rela... | [
"Gives",
"the",
"average",
"effective",
"mass",
"tensor",
".",
"We",
"call",
"it",
"average",
"because",
"it",
"takes",
"into",
"account",
"all",
"the",
"bands",
"and",
"regions",
"in",
"the",
"Brillouin",
"zone",
".",
"This",
"is",
"different",
"than",
"t... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1272-L1353 | [
"def",
"get_average_eff_mass",
"(",
"self",
",",
"output",
"=",
"'eigs'",
",",
"doping_levels",
"=",
"True",
")",
":",
"result",
"=",
"None",
"result_doping",
"=",
"None",
"conc",
"=",
"self",
".",
"get_carrier_concentration",
"(",
")",
"if",
"doping_levels",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_seebeck_eff_mass | Seebeck effective mass calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab initio band structure calculations.
npj Computational Materials 3, 8 (2017).
Args:
output: 'average' returns the seebeck effective mass ca... | pymatgen/electronic_structure/boltztrap.py | def get_seebeck_eff_mass(self, output='average', temp=300, doping_levels=False,
Lambda=0.5):
"""
Seebeck effective mass calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab initio band structure c... | def get_seebeck_eff_mass(self, output='average', temp=300, doping_levels=False,
Lambda=0.5):
"""
Seebeck effective mass calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab initio band structure c... | [
"Seebeck",
"effective",
"mass",
"calculated",
"as",
"explained",
"in",
"Ref",
".",
"Gibbs",
"Z",
".",
"M",
".",
"et",
"al",
".",
"Effective",
"mass",
"and",
"fermi",
"surface",
"complexity",
"factor",
"from",
"ab",
"initio",
"band",
"structure",
"calculation... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1355-L1417 | [
"def",
"get_seebeck_eff_mass",
"(",
"self",
",",
"output",
"=",
"'average'",
",",
"temp",
"=",
"300",
",",
"doping_levels",
"=",
"False",
",",
"Lambda",
"=",
"0.5",
")",
":",
"if",
"doping_levels",
":",
"sbk_mass",
"=",
"{",
"}",
"for",
"dt",
"in",
"("... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_complexity_factor | Fermi surface complexity factor respect to calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab initio band structure calculations.
npj Computational Materials 3, 8 (2017).
Args:
output: 'average' returns t... | pymatgen/electronic_structure/boltztrap.py | def get_complexity_factor(self, output='average', temp=300, doping_levels=False,
Lambda=0.5):
"""
Fermi surface complexity factor respect to calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab init... | def get_complexity_factor(self, output='average', temp=300, doping_levels=False,
Lambda=0.5):
"""
Fermi surface complexity factor respect to calculated as explained in Ref.
Gibbs, Z. M. et al., Effective mass and fermi surface complexity factor
from ab init... | [
"Fermi",
"surface",
"complexity",
"factor",
"respect",
"to",
"calculated",
"as",
"explained",
"in",
"Ref",
".",
"Gibbs",
"Z",
".",
"M",
".",
"et",
"al",
".",
"Effective",
"mass",
"and",
"fermi",
"surface",
"complexity",
"factor",
"from",
"ab",
"initio",
"b... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1419-L1476 | [
"def",
"get_complexity_factor",
"(",
"self",
",",
"output",
"=",
"'average'",
",",
"temp",
"=",
"300",
",",
"doping_levels",
"=",
"False",
",",
"Lambda",
"=",
"0.5",
")",
":",
"if",
"doping_levels",
":",
"cmplx_fact",
"=",
"{",
"}",
"for",
"dt",
"in",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_extreme | This method takes in eigenvalues over a range of carriers,
temperatures, and doping levels, and tells you what is the "best"
value that can be achieved for the given target_property. Note that
this method searches the doping dict only, not the full mu dict.
Args:
target_prop... | pymatgen/electronic_structure/boltztrap.py | def get_extreme(self, target_prop, maximize=True, min_temp=None,
max_temp=None, min_doping=None, max_doping=None,
isotropy_tolerance=0.05, use_average=True):
"""
This method takes in eigenvalues over a range of carriers,
temperatures, and doping levels, a... | def get_extreme(self, target_prop, maximize=True, min_temp=None,
max_temp=None, min_doping=None, max_doping=None,
isotropy_tolerance=0.05, use_average=True):
"""
This method takes in eigenvalues over a range of carriers,
temperatures, and doping levels, a... | [
"This",
"method",
"takes",
"in",
"eigenvalues",
"over",
"a",
"range",
"of",
"carriers",
"temperatures",
"and",
"doping",
"levels",
"and",
"tells",
"you",
"what",
"is",
"the",
"best",
"value",
"that",
"can",
"be",
"achieved",
"for",
"the",
"given",
"target_pr... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1478-L1588 | [
"def",
"get_extreme",
"(",
"self",
",",
"target_prop",
",",
"maximize",
"=",
"True",
",",
"min_temp",
"=",
"None",
",",
"max_temp",
"=",
"None",
",",
"min_doping",
"=",
"None",
",",
"max_doping",
"=",
"None",
",",
"isotropy_tolerance",
"=",
"0.05",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_complete_dos | Gives a CompleteDos object with the DOS from the interpolated
projected band structure
Args:
the structure (necessary to identify sites for projection)
analyzer_for_second_spin must be specified to have a
CompleteDos with both Spin components
... | pymatgen/electronic_structure/boltztrap.py | def get_complete_dos(self, structure, analyzer_for_second_spin=None):
"""
Gives a CompleteDos object with the DOS from the interpolated
projected band structure
Args:
the structure (necessary to identify sites for projection)
analyzer_for_secon... | def get_complete_dos(self, structure, analyzer_for_second_spin=None):
"""
Gives a CompleteDos object with the DOS from the interpolated
projected band structure
Args:
the structure (necessary to identify sites for projection)
analyzer_for_secon... | [
"Gives",
"a",
"CompleteDos",
"object",
"with",
"the",
"DOS",
"from",
"the",
"interpolated",
"projected",
"band",
"structure",
"Args",
":",
"the",
"structure",
"(",
"necessary",
"to",
"identify",
"sites",
"for",
"projection",
")",
"analyzer_for_second_spin",
"must"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1637-L1691 | [
"def",
"get_complete_dos",
"(",
"self",
",",
"structure",
",",
"analyzer_for_second_spin",
"=",
"None",
")",
":",
"pdoss",
"=",
"{",
"}",
"spin_1",
"=",
"list",
"(",
"self",
".",
"dos",
".",
"densities",
".",
"keys",
"(",
")",
")",
"[",
"0",
"]",
"if... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_carrier_concentration | gives the carrier concentration (in cm^-3)
Returns
a dictionary {temp:[]} with an array of carrier concentration
(in cm^-3) at each temperature
The array relates to each step of electron chemical potential | pymatgen/electronic_structure/boltztrap.py | def get_carrier_concentration(self):
"""
gives the carrier concentration (in cm^-3)
Returns
a dictionary {temp:[]} with an array of carrier concentration
(in cm^-3) at each temperature
The array relates to each step of electron chemical potential
"""
... | def get_carrier_concentration(self):
"""
gives the carrier concentration (in cm^-3)
Returns
a dictionary {temp:[]} with an array of carrier concentration
(in cm^-3) at each temperature
The array relates to each step of electron chemical potential
"""
... | [
"gives",
"the",
"carrier",
"concentration",
"(",
"in",
"cm^",
"-",
"3",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1696-L1707 | [
"def",
"get_carrier_concentration",
"(",
"self",
")",
":",
"return",
"{",
"temp",
":",
"[",
"1e24",
"*",
"i",
"/",
"self",
".",
"vol",
"for",
"i",
"in",
"self",
".",
"_carrier_conc",
"[",
"temp",
"]",
"]",
"for",
"temp",
"in",
"self",
".",
"_carrier_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.get_hall_carrier_concentration | gives the Hall carrier concentration (in cm^-3). This is the trace of
the Hall tensor (see Boltztrap source code) Hall carrier concentration
are not always exactly the same than carrier concentration.
Returns
a dictionary {temp:[]} with an array of Hall carrier concentration
... | pymatgen/electronic_structure/boltztrap.py | def get_hall_carrier_concentration(self):
"""
gives the Hall carrier concentration (in cm^-3). This is the trace of
the Hall tensor (see Boltztrap source code) Hall carrier concentration
are not always exactly the same than carrier concentration.
Returns
a dictionary... | def get_hall_carrier_concentration(self):
"""
gives the Hall carrier concentration (in cm^-3). This is the trace of
the Hall tensor (see Boltztrap source code) Hall carrier concentration
are not always exactly the same than carrier concentration.
Returns
a dictionary... | [
"gives",
"the",
"Hall",
"carrier",
"concentration",
"(",
"in",
"cm^",
"-",
"3",
")",
".",
"This",
"is",
"the",
"trace",
"of",
"the",
"Hall",
"tensor",
"(",
"see",
"Boltztrap",
"source",
"code",
")",
"Hall",
"carrier",
"concentration",
"are",
"not",
"alwa... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1709-L1728 | [
"def",
"get_hall_carrier_concentration",
"(",
"self",
")",
":",
"result",
"=",
"{",
"temp",
":",
"[",
"]",
"for",
"temp",
"in",
"self",
".",
"_hall",
"}",
"for",
"temp",
"in",
"self",
".",
"_hall",
":",
"for",
"i",
"in",
"self",
".",
"_hall",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BoltztrapAnalyzer.parse_outputtrans | Parses .outputtrans file
Args:
path_dir: dir containing boltztrap.outputtrans
Returns:
tuple - (run_type, warning, efermi, gap, doping_levels) | pymatgen/electronic_structure/boltztrap.py | def parse_outputtrans(path_dir):
"""
Parses .outputtrans file
Args:
path_dir: dir containing boltztrap.outputtrans
Returns:
tuple - (run_type, warning, efermi, gap, doping_levels)
"""
run_type = None
warning = None
efermi = None
... | def parse_outputtrans(path_dir):
"""
Parses .outputtrans file
Args:
path_dir: dir containing boltztrap.outputtrans
Returns:
tuple - (run_type, warning, efermi, gap, doping_levels)
"""
run_type = None
warning = None
efermi = None
... | [
"Parses",
".",
"outputtrans",
"file"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/boltztrap.py#L1731-L1762 | [
"def",
"parse_outputtrans",
"(",
"path_dir",
")",
":",
"run_type",
"=",
"None",
"warning",
"=",
"None",
"efermi",
"=",
"None",
"gap",
"=",
"None",
"doping_levels",
"=",
"[",
"]",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path_dir",
","... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.