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 | NEBAnalysis.as_dict | Dict representation of NEBAnalysis.
Returns:
JSON serializable dict representation. | pymatgen/analysis/transition_state.py | def as_dict(self):
"""
Dict representation of NEBAnalysis.
Returns:
JSON serializable dict representation.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
'r': jsanitize(self.r),
'en... | def as_dict(self):
"""
Dict representation of NEBAnalysis.
Returns:
JSON serializable dict representation.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
'r': jsanitize(self.r),
'en... | [
"Dict",
"representation",
"of",
"NEBAnalysis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L294-L306 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"'r'",
":",
"jsanitize",
"(",
"self",
".",
"r",
")",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | bandstructure_flow | Build a :class:`Flow` for band structure calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
nscf_input: Input for the NSCF run (band structure run).
dos_inputs: Input(s) for the NSCF run (dos run).
manager: :class:`TaskManager` object used t... | pymatgen/io/abinit/flows.py | def bandstructure_flow(workdir, scf_input, nscf_input, dos_inputs=None, manager=None, flow_class=Flow, allocate=True):
"""
Build a :class:`Flow` for band structure calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
nscf_input: Input for the NSCF run... | def bandstructure_flow(workdir, scf_input, nscf_input, dos_inputs=None, manager=None, flow_class=Flow, allocate=True):
"""
Build a :class:`Flow` for band structure calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
nscf_input: Input for the NSCF run... | [
"Build",
"a",
":",
"class",
":",
"Flow",
"for",
"band",
"structure",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2644-L2669 | [
"def",
"bandstructure_flow",
"(",
"workdir",
",",
"scf_input",
",",
"nscf_input",
",",
"dos_inputs",
"=",
"None",
",",
"manager",
"=",
"None",
",",
"flow_class",
"=",
"Flow",
",",
"allocate",
"=",
"True",
")",
":",
"flow",
"=",
"flow_class",
"(",
"workdir"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | g0w0_flow | Build a :class:`Flow` for one-shot $G_0W_0$ calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
nscf_input: Input for the NSCF run (band structure run).
scr_input: Input for the SCR run.
sigma_inputs: List of inputs for the SIGMA run.
... | pymatgen/io/abinit/flows.py | def g0w0_flow(workdir, scf_input, nscf_input, scr_input, sigma_inputs, manager=None, flow_class=Flow, allocate=True):
"""
Build a :class:`Flow` for one-shot $G_0W_0$ calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
nscf_input: Input for the NSCF r... | def g0w0_flow(workdir, scf_input, nscf_input, scr_input, sigma_inputs, manager=None, flow_class=Flow, allocate=True):
"""
Build a :class:`Flow` for one-shot $G_0W_0$ calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
nscf_input: Input for the NSCF r... | [
"Build",
"a",
":",
"class",
":",
"Flow",
"for",
"one",
"-",
"shot",
"$G_0W_0$",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2672-L2694 | [
"def",
"g0w0_flow",
"(",
"workdir",
",",
"scf_input",
",",
"nscf_input",
",",
"scr_input",
",",
"sigma_inputs",
",",
"manager",
"=",
"None",
",",
"flow_class",
"=",
"Flow",
",",
"allocate",
"=",
"True",
")",
":",
"flow",
"=",
"flow_class",
"(",
"workdir",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | phonon_flow | Build a :class:`PhononFlow` for phonon calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run.
ph_inputs: List of Inputs for the phonon runs.
with_nscf: add an nscf task in front of al phonon tasks to make sure the q point is covered
with_ddk: ad... | pymatgen/io/abinit/flows.py | def phonon_flow(workdir, scf_input, ph_inputs, with_nscf=False, with_ddk=False, with_dde=False,
manager=None, flow_class=PhononFlow, allocate=True):
"""
Build a :class:`PhononFlow` for phonon calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run... | def phonon_flow(workdir, scf_input, ph_inputs, with_nscf=False, with_ddk=False, with_dde=False,
manager=None, flow_class=PhononFlow, allocate=True):
"""
Build a :class:`PhononFlow` for phonon calculations.
Args:
workdir: Working directory.
scf_input: Input for the GS SCF run... | [
"Build",
"a",
":",
"class",
":",
"PhononFlow",
"for",
"phonon",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2875-L3012 | [
"def",
"phonon_flow",
"(",
"workdir",
",",
"scf_input",
",",
"ph_inputs",
",",
"with_nscf",
"=",
"False",
",",
"with_ddk",
"=",
"False",
",",
"with_dde",
"=",
"False",
",",
"manager",
"=",
"None",
",",
"flow_class",
"=",
"PhononFlow",
",",
"allocate",
"=",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | phonon_conv_flow | Create a :class:`Flow` to perform convergence studies for phonon calculations.
Args:
workdir: Working directory of the flow.
scf_input: :class:`AbinitInput` object defining a GS-SCF calculation.
qpoints: List of list of lists with the reduced coordinates of the q-point(s).
params:
... | pymatgen/io/abinit/flows.py | def phonon_conv_flow(workdir, scf_input, qpoints, params, manager=None, allocate=True):
"""
Create a :class:`Flow` to perform convergence studies for phonon calculations.
Args:
workdir: Working directory of the flow.
scf_input: :class:`AbinitInput` object defining a GS-SCF calculation.
... | def phonon_conv_flow(workdir, scf_input, qpoints, params, manager=None, allocate=True):
"""
Create a :class:`Flow` to perform convergence studies for phonon calculations.
Args:
workdir: Working directory of the flow.
scf_input: :class:`AbinitInput` object defining a GS-SCF calculation.
... | [
"Create",
"a",
":",
"class",
":",
"Flow",
"to",
"perform",
"convergence",
"studies",
"for",
"phonon",
"calculations",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L3015-L3046 | [
"def",
"phonon_conv_flow",
"(",
"workdir",
",",
"scf_input",
",",
"qpoints",
",",
"params",
",",
"manager",
"=",
"None",
",",
"allocate",
"=",
"True",
")",
":",
"qpoints",
"=",
"np",
".",
"reshape",
"(",
"qpoints",
",",
"(",
"-",
"1",
",",
"3",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FlowResults.from_node | Initialize an instance from a Work instance. | pymatgen/io/abinit/flows.py | def from_node(cls, flow):
"""Initialize an instance from a Work instance."""
new = super().from_node(flow)
# Will put all files found in outdir in GridFs
d = {os.path.basename(f): f for f in flow.outdir.list_filepaths()}
# Add the pickle file.
d["pickle"] = flow.pickle_... | def from_node(cls, flow):
"""Initialize an instance from a Work instance."""
new = super().from_node(flow)
# Will put all files found in outdir in GridFs
d = {os.path.basename(f): f for f in flow.outdir.list_filepaths()}
# Add the pickle file.
d["pickle"] = flow.pickle_... | [
"Initialize",
"an",
"instance",
"from",
"a",
"Work",
"instance",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L73-L84 | [
"def",
"from_node",
"(",
"cls",
",",
"flow",
")",
":",
"new",
"=",
"super",
"(",
")",
".",
"from_node",
"(",
"flow",
")",
"# Will put all files found in outdir in GridFs",
"d",
"=",
"{",
"os",
".",
"path",
".",
"basename",
"(",
"f",
")",
":",
"f",
"for... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.from_inputs | Construct a simple flow from a list of inputs. The flow contains a single Work with
tasks whose class is given by task_class.
.. warning::
Don't use this interface if you have dependencies among the tasks.
Args:
workdir: String specifying the directory where the works ... | pymatgen/io/abinit/flows.py | def from_inputs(cls, workdir, inputs, manager=None, pickle_protocol=-1, task_class=ScfTask,
work_class=Work, remove=False):
"""
Construct a simple flow from a list of inputs. The flow contains a single Work with
tasks whose class is given by task_class.
.. warning::... | def from_inputs(cls, workdir, inputs, manager=None, pickle_protocol=-1, task_class=ScfTask,
work_class=Work, remove=False):
"""
Construct a simple flow from a list of inputs. The flow contains a single Work with
tasks whose class is given by task_class.
.. warning::... | [
"Construct",
"a",
"simple",
"flow",
"from",
"a",
"list",
"of",
"inputs",
".",
"The",
"flow",
"contains",
"a",
"single",
"Work",
"with",
"tasks",
"whose",
"class",
"is",
"given",
"by",
"task_class",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L120-L151 | [
"def",
"from_inputs",
"(",
"cls",
",",
"workdir",
",",
"inputs",
",",
"manager",
"=",
"None",
",",
"pickle_protocol",
"=",
"-",
"1",
",",
"task_class",
"=",
"ScfTask",
",",
"work_class",
"=",
"Work",
",",
"remove",
"=",
"False",
")",
":",
"if",
"not",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.as_flow | Convert obj into a Flow. Accepts filepath, dict, or Flow object. | pymatgen/io/abinit/flows.py | def as_flow(cls, obj):
"""Convert obj into a Flow. Accepts filepath, dict, or Flow object."""
if isinstance(obj, cls): return obj
if is_string(obj):
return cls.pickle_load(obj)
elif isinstance(obj, collections.Mapping):
return cls.from_dict(obj)
else:
... | def as_flow(cls, obj):
"""Convert obj into a Flow. Accepts filepath, dict, or Flow object."""
if isinstance(obj, cls): return obj
if is_string(obj):
return cls.pickle_load(obj)
elif isinstance(obj, collections.Mapping):
return cls.from_dict(obj)
else:
... | [
"Convert",
"obj",
"into",
"a",
"Flow",
".",
"Accepts",
"filepath",
"dict",
"or",
"Flow",
"object",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L154-L162 | [
"def",
"as_flow",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"cls",
")",
":",
"return",
"obj",
"if",
"is_string",
"(",
"obj",
")",
":",
"return",
"cls",
".",
"pickle_load",
"(",
"obj",
")",
"elif",
"isinstance",
"(",
"ob... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.set_workdir | Set the working directory. Cannot be set more than once unless chroot is True | pymatgen/io/abinit/flows.py | def set_workdir(self, workdir, chroot=False):
"""
Set the working directory. Cannot be set more than once unless chroot is True
"""
if not chroot and hasattr(self, "workdir") and self.workdir != workdir:
raise ValueError("self.workdir != workdir: %s, %s" % (self.workdir, wor... | def set_workdir(self, workdir, chroot=False):
"""
Set the working directory. Cannot be set more than once unless chroot is True
"""
if not chroot and hasattr(self, "workdir") and self.workdir != workdir:
raise ValueError("self.workdir != workdir: %s, %s" % (self.workdir, wor... | [
"Set",
"the",
"working",
"directory",
".",
"Cannot",
"be",
"set",
"more",
"than",
"once",
"unless",
"chroot",
"is",
"True"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L254-L266 | [
"def",
"set_workdir",
"(",
"self",
",",
"workdir",
",",
"chroot",
"=",
"False",
")",
":",
"if",
"not",
"chroot",
"and",
"hasattr",
"(",
"self",
",",
"\"workdir\"",
")",
"and",
"self",
".",
"workdir",
"!=",
"workdir",
":",
"raise",
"ValueError",
"(",
"\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.reload | Reload the flow from the pickle file. Used when we are monitoring the flow
executed by the scheduler. In this case, indeed, the flow might have been changed
by the scheduler and we have to reload the new flow in memory. | pymatgen/io/abinit/flows.py | def reload(self):
"""
Reload the flow from the pickle file. Used when we are monitoring the flow
executed by the scheduler. In this case, indeed, the flow might have been changed
by the scheduler and we have to reload the new flow in memory.
"""
new = self.__class__.pickl... | def reload(self):
"""
Reload the flow from the pickle file. Used when we are monitoring the flow
executed by the scheduler. In this case, indeed, the flow might have been changed
by the scheduler and we have to reload the new flow in memory.
"""
new = self.__class__.pickl... | [
"Reload",
"the",
"flow",
"from",
"the",
"pickle",
"file",
".",
"Used",
"when",
"we",
"are",
"monitoring",
"the",
"flow",
"executed",
"by",
"the",
"scheduler",
".",
"In",
"this",
"case",
"indeed",
"the",
"flow",
"might",
"have",
"been",
"changed",
"by",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L268-L275 | [
"def",
"reload",
"(",
"self",
")",
":",
"new",
"=",
"self",
".",
"__class__",
".",
"pickle_load",
"(",
"self",
".",
"workdir",
")",
"self",
"=",
"new"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.pickle_load | Loads the object from a pickle file and performs initial setup.
Args:
filepath: Filename or directory name. It filepath is a directory, we
scan the directory tree starting from filepath and we
read the first pickle database. Raise RuntimeError if multiple
... | pymatgen/io/abinit/flows.py | def pickle_load(cls, filepath, spectator_mode=True, remove_lock=False):
"""
Loads the object from a pickle file and performs initial setup.
Args:
filepath: Filename or directory name. It filepath is a directory, we
scan the directory tree starting from filepath and w... | def pickle_load(cls, filepath, spectator_mode=True, remove_lock=False):
"""
Loads the object from a pickle file and performs initial setup.
Args:
filepath: Filename or directory name. It filepath is a directory, we
scan the directory tree starting from filepath and w... | [
"Loads",
"the",
"object",
"from",
"a",
"pickle",
"file",
"and",
"performs",
"initial",
"setup",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L278-L329 | [
"def",
"pickle_load",
"(",
"cls",
",",
"filepath",
",",
"spectator_mode",
"=",
"True",
",",
"remove_lock",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"filepath",
")",
":",
"# Walk through each directory inside path and find the pickle data... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.pickle_loads | Reconstruct the flow from a string. | pymatgen/io/abinit/flows.py | def pickle_loads(cls, s):
"""Reconstruct the flow from a string."""
strio = StringIO()
strio.write(s)
strio.seek(0)
flow = pmg_pickle_load(strio)
return flow | def pickle_loads(cls, s):
"""Reconstruct the flow from a string."""
strio = StringIO()
strio.write(s)
strio.seek(0)
flow = pmg_pickle_load(strio)
return flow | [
"Reconstruct",
"the",
"flow",
"from",
"a",
"string",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L332-L338 | [
"def",
"pickle_loads",
"(",
"cls",
",",
"s",
")",
":",
"strio",
"=",
"StringIO",
"(",
")",
"strio",
".",
"write",
"(",
"s",
")",
"strio",
".",
"seek",
"(",
"0",
")",
"flow",
"=",
"pmg_pickle_load",
"(",
"strio",
")",
"return",
"flow"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.check_pid_file | This function checks if we are already running the :class:`Flow` with a :class:`PyFlowScheduler`.
Raises: Flow.Error if the pid file of the scheduler exists. | pymatgen/io/abinit/flows.py | def check_pid_file(self):
"""
This function checks if we are already running the :class:`Flow` with a :class:`PyFlowScheduler`.
Raises: Flow.Error if the pid file of the scheduler exists.
"""
if not os.path.exists(self.pid_file):
return 0
self.show_status()
... | def check_pid_file(self):
"""
This function checks if we are already running the :class:`Flow` with a :class:`PyFlowScheduler`.
Raises: Flow.Error if the pid file of the scheduler exists.
"""
if not os.path.exists(self.pid_file):
return 0
self.show_status()
... | [
"This",
"function",
"checks",
"if",
"we",
"are",
"already",
"running",
"the",
":",
"class",
":",
"Flow",
"with",
"a",
":",
"class",
":",
"PyFlowScheduler",
".",
"Raises",
":",
"Flow",
".",
"Error",
"if",
"the",
"pid",
"file",
"of",
"the",
"scheduler",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L381-L405 | [
"def",
"check_pid_file",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"pid_file",
")",
":",
"return",
"0",
"self",
".",
"show_status",
"(",
")",
"raise",
"self",
".",
"Error",
"(",
"\"\"\"\\n\\\n pid_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.validate_json_schema | Validate the JSON schema. Return list of errors. | pymatgen/io/abinit/flows.py | def validate_json_schema(self):
"""Validate the JSON schema. Return list of errors."""
errors = []
for work in self:
for task in work:
if not task.get_results().validate_json_schema():
errors.append(task)
if not work.get_results().vali... | def validate_json_schema(self):
"""Validate the JSON schema. Return list of errors."""
errors = []
for work in self:
for task in work:
if not task.get_results().validate_json_schema():
errors.append(task)
if not work.get_results().vali... | [
"Validate",
"the",
"JSON",
"schema",
".",
"Return",
"list",
"of",
"errors",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L426-L439 | [
"def",
"validate_json_schema",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"work",
"in",
"self",
":",
"for",
"task",
"in",
"work",
":",
"if",
"not",
"task",
".",
"get_results",
"(",
")",
".",
"validate_json_schema",
"(",
")",
":",
"errors",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.errored_tasks | List of errored tasks. | pymatgen/io/abinit/flows.py | def errored_tasks(self):
"""List of errored tasks."""
etasks = []
for status in [self.S_ERROR, self.S_QCRITICAL, self.S_ABICRITICAL]:
etasks.extend(list(self.iflat_tasks(status=status)))
return set(etasks) | def errored_tasks(self):
"""List of errored tasks."""
etasks = []
for status in [self.S_ERROR, self.S_QCRITICAL, self.S_ABICRITICAL]:
etasks.extend(list(self.iflat_tasks(status=status)))
return set(etasks) | [
"List",
"of",
"errored",
"tasks",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L473-L479 | [
"def",
"errored_tasks",
"(",
"self",
")",
":",
"etasks",
"=",
"[",
"]",
"for",
"status",
"in",
"[",
"self",
".",
"S_ERROR",
",",
"self",
".",
"S_QCRITICAL",
",",
"self",
".",
"S_ABICRITICAL",
"]",
":",
"etasks",
".",
"extend",
"(",
"list",
"(",
"self... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.status_counter | Returns a :class:`Counter` object that counts the number of tasks with
given status (use the string representation of the status as key). | pymatgen/io/abinit/flows.py | def status_counter(self):
"""
Returns a :class:`Counter` object that counts the number of tasks with
given status (use the string representation of the status as key).
"""
# Count the number of tasks with given status in each work.
counter = self[0].status_counter
... | def status_counter(self):
"""
Returns a :class:`Counter` object that counts the number of tasks with
given status (use the string representation of the status as key).
"""
# Count the number of tasks with given status in each work.
counter = self[0].status_counter
... | [
"Returns",
"a",
":",
"class",
":",
"Counter",
"object",
"that",
"counts",
"the",
"number",
"of",
"tasks",
"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/flows.py#L497-L507 | [
"def",
"status_counter",
"(",
"self",
")",
":",
"# Count the number of tasks with given status in each work.",
"counter",
"=",
"self",
"[",
"0",
"]",
".",
"status_counter",
"for",
"work",
"in",
"self",
"[",
"1",
":",
"]",
":",
"counter",
"+=",
"work",
".",
"st... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.chroot | Change the workir of the :class:`Flow`. Mainly used for
allowing the user to open the GUI on the local host
and access the flow from remote via sshfs.
.. note::
Calling this method will make the flow go in read-only mode. | pymatgen/io/abinit/flows.py | def chroot(self, new_workdir):
"""
Change the workir of the :class:`Flow`. Mainly used for
allowing the user to open the GUI on the local host
and access the flow from remote via sshfs.
.. note::
Calling this method will make the flow go in read-only mode.
""... | def chroot(self, new_workdir):
"""
Change the workir of the :class:`Flow`. Mainly used for
allowing the user to open the GUI on the local host
and access the flow from remote via sshfs.
.. note::
Calling this method will make the flow go in read-only mode.
""... | [
"Change",
"the",
"workir",
"of",
"the",
":",
"class",
":",
"Flow",
".",
"Mainly",
"used",
"for",
"allowing",
"the",
"user",
"to",
"open",
"the",
"GUI",
"on",
"the",
"local",
"host",
"and",
"access",
"the",
"flow",
"from",
"remote",
"via",
"sshfs",
"."
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L548-L562 | [
"def",
"chroot",
"(",
"self",
",",
"new_workdir",
")",
":",
"self",
".",
"_chrooted_from",
"=",
"self",
".",
"workdir",
"self",
".",
"set_workdir",
"(",
"new_workdir",
",",
"chroot",
"=",
"True",
")",
"for",
"i",
",",
"work",
"in",
"enumerate",
"(",
"s... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.groupby_status | Returns a ordered dictionary mapping the task status to
the list of named tuples (task, work_index, task_index). | pymatgen/io/abinit/flows.py | def groupby_status(self):
"""
Returns a ordered dictionary mapping the task status to
the list of named tuples (task, work_index, task_index).
"""
Entry = collections.namedtuple("Entry", "task wi ti")
d = collections.defaultdict(list)
for task, wi, ti in self.ifl... | def groupby_status(self):
"""
Returns a ordered dictionary mapping the task status to
the list of named tuples (task, work_index, task_index).
"""
Entry = collections.namedtuple("Entry", "task wi ti")
d = collections.defaultdict(list)
for task, wi, ti in self.ifl... | [
"Returns",
"a",
"ordered",
"dictionary",
"mapping",
"the",
"task",
"status",
"to",
"the",
"list",
"of",
"named",
"tuples",
"(",
"task",
"work_index",
"task_index",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L564-L576 | [
"def",
"groupby_status",
"(",
"self",
")",
":",
"Entry",
"=",
"collections",
".",
"namedtuple",
"(",
"\"Entry\"",
",",
"\"task wi ti\"",
")",
"d",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"task",
",",
"wi",
",",
"ti",
"in",
"self"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.groupby_task_class | Returns a dictionary mapping the task class to the list of tasks in the flow | pymatgen/io/abinit/flows.py | def groupby_task_class(self):
"""
Returns a dictionary mapping the task class to the list of tasks in the flow
"""
# Find all Task classes
class2tasks = OrderedDict()
for task in self.iflat_tasks():
cls = task.__class__
if cls not in class2tasks: c... | def groupby_task_class(self):
"""
Returns a dictionary mapping the task class to the list of tasks in the flow
"""
# Find all Task classes
class2tasks = OrderedDict()
for task in self.iflat_tasks():
cls = task.__class__
if cls not in class2tasks: c... | [
"Returns",
"a",
"dictionary",
"mapping",
"the",
"task",
"class",
"to",
"the",
"list",
"of",
"tasks",
"in",
"the",
"flow"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L578-L589 | [
"def",
"groupby_task_class",
"(",
"self",
")",
":",
"# Find all Task classes",
"class2tasks",
"=",
"OrderedDict",
"(",
")",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
")",
":",
"cls",
"=",
"task",
".",
"__class__",
"if",
"cls",
"not",
"in",
"cla... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.iflat_nodes | Generators that produces a flat sequence of nodes.
if status is not None, only the tasks with the specified status are selected.
nids is an optional list of node identifiers used to filter the nodes. | pymatgen/io/abinit/flows.py | def iflat_nodes(self, status=None, op="==", nids=None):
"""
Generators that produces a flat sequence of nodes.
if status is not None, only the tasks with the specified status are selected.
nids is an optional list of node identifiers used to filter the nodes.
"""
nids = a... | def iflat_nodes(self, status=None, op="==", nids=None):
"""
Generators that produces a flat sequence of nodes.
if status is not None, only the tasks with the specified status are selected.
nids is an optional list of node identifiers used to filter the nodes.
"""
nids = a... | [
"Generators",
"that",
"produces",
"a",
"flat",
"sequence",
"of",
"nodes",
".",
"if",
"status",
"is",
"not",
"None",
"only",
"the",
"tasks",
"with",
"the",
"specified",
"status",
"are",
"selected",
".",
"nids",
"is",
"an",
"optional",
"list",
"of",
"node",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L591-L625 | [
"def",
"iflat_nodes",
"(",
"self",
",",
"status",
"=",
"None",
",",
"op",
"=",
"\"==\"",
",",
"nids",
"=",
"None",
")",
":",
"nids",
"=",
"as_set",
"(",
"nids",
")",
"if",
"status",
"is",
"None",
":",
"if",
"not",
"(",
"nids",
"and",
"self",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.node_from_nid | Return the node in the `Flow` with the given `nid` identifier | pymatgen/io/abinit/flows.py | def node_from_nid(self, nid):
"""Return the node in the `Flow` with the given `nid` identifier"""
for node in self.iflat_nodes():
if node.node_id == nid: return node
raise ValueError("Cannot find node with node id: %s" % nid) | def node_from_nid(self, nid):
"""Return the node in the `Flow` with the given `nid` identifier"""
for node in self.iflat_nodes():
if node.node_id == nid: return node
raise ValueError("Cannot find node with node id: %s" % nid) | [
"Return",
"the",
"node",
"in",
"the",
"Flow",
"with",
"the",
"given",
"nid",
"identifier"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L627-L631 | [
"def",
"node_from_nid",
"(",
"self",
",",
"nid",
")",
":",
"for",
"node",
"in",
"self",
".",
"iflat_nodes",
"(",
")",
":",
"if",
"node",
".",
"node_id",
"==",
"nid",
":",
"return",
"node",
"raise",
"ValueError",
"(",
"\"Cannot find node with node id: %s\"",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.iflat_tasks_wti | Generator to iterate over all the tasks of the `Flow`.
Yields:
(task, work_index, task_index)
If status is not None, only the tasks whose status satisfies
the condition (task.status op status) are selected
status can be either one of the flags defined in the :class:`Task` c... | pymatgen/io/abinit/flows.py | def iflat_tasks_wti(self, status=None, op="==", nids=None):
"""
Generator to iterate over all the tasks of the `Flow`.
Yields:
(task, work_index, task_index)
If status is not None, only the tasks whose status satisfies
the condition (task.status op status) are selec... | def iflat_tasks_wti(self, status=None, op="==", nids=None):
"""
Generator to iterate over all the tasks of the `Flow`.
Yields:
(task, work_index, task_index)
If status is not None, only the tasks whose status satisfies
the condition (task.status op status) are selec... | [
"Generator",
"to",
"iterate",
"over",
"all",
"the",
"tasks",
"of",
"the",
"Flow",
".",
"Yields",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L633-L646 | [
"def",
"iflat_tasks_wti",
"(",
"self",
",",
"status",
"=",
"None",
",",
"op",
"=",
"\"==\"",
",",
"nids",
"=",
"None",
")",
":",
"return",
"self",
".",
"_iflat_tasks_wti",
"(",
"status",
"=",
"status",
",",
"op",
"=",
"op",
",",
"nids",
"=",
"nids",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.iflat_tasks | Generator to iterate over all the tasks of the :class:`Flow`.
If status is not None, only the tasks whose status satisfies
the condition (task.status op status) are selected
status can be either one of the flags defined in the :class:`Task` class
(e.g Task.S_OK) or a string e.g "S_OK"
... | pymatgen/io/abinit/flows.py | def iflat_tasks(self, status=None, op="==", nids=None):
"""
Generator to iterate over all the tasks of the :class:`Flow`.
If status is not None, only the tasks whose status satisfies
the condition (task.status op status) are selected
status can be either one of the flags defined... | def iflat_tasks(self, status=None, op="==", nids=None):
"""
Generator to iterate over all the tasks of the :class:`Flow`.
If status is not None, only the tasks whose status satisfies
the condition (task.status op status) are selected
status can be either one of the flags defined... | [
"Generator",
"to",
"iterate",
"over",
"all",
"the",
"tasks",
"of",
"the",
":",
"class",
":",
"Flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L648-L658 | [
"def",
"iflat_tasks",
"(",
"self",
",",
"status",
"=",
"None",
",",
"op",
"=",
"\"==\"",
",",
"nids",
"=",
"None",
")",
":",
"return",
"self",
".",
"_iflat_tasks_wti",
"(",
"status",
"=",
"status",
",",
"op",
"=",
"op",
",",
"nids",
"=",
"nids",
",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow._iflat_tasks_wti | Generators that produces a flat sequence of task.
if status is not None, only the tasks with the specified status are selected.
nids is an optional list of node identifiers used to filter the tasks.
Returns:
(task, work_index, task_index) if with_wti is True else task | pymatgen/io/abinit/flows.py | def _iflat_tasks_wti(self, status=None, op="==", nids=None, with_wti=True):
"""
Generators that produces a flat sequence of task.
if status is not None, only the tasks with the specified status are selected.
nids is an optional list of node identifiers used to filter the tasks.
... | def _iflat_tasks_wti(self, status=None, op="==", nids=None, with_wti=True):
"""
Generators that produces a flat sequence of task.
if status is not None, only the tasks with the specified status are selected.
nids is an optional list of node identifiers used to filter the tasks.
... | [
"Generators",
"that",
"produces",
"a",
"flat",
"sequence",
"of",
"task",
".",
"if",
"status",
"is",
"not",
"None",
"only",
"the",
"tasks",
"with",
"the",
"specified",
"status",
"are",
"selected",
".",
"nids",
"is",
"an",
"optional",
"list",
"of",
"node",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L660-L694 | [
"def",
"_iflat_tasks_wti",
"(",
"self",
",",
"status",
"=",
"None",
",",
"op",
"=",
"\"==\"",
",",
"nids",
"=",
"None",
",",
"with_wti",
"=",
"True",
")",
":",
"nids",
"=",
"as_set",
"(",
"nids",
")",
"if",
"status",
"is",
"None",
":",
"for",
"wi",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.abivalidate_inputs | Run ABINIT in dry mode to validate all the inputs of the flow.
Return:
(isok, tuples)
isok is True if all inputs are ok.
tuples is List of `namedtuple` objects, one for each task in the flow.
Each namedtuple has the following attributes:
retcode... | pymatgen/io/abinit/flows.py | def abivalidate_inputs(self):
"""
Run ABINIT in dry mode to validate all the inputs of the flow.
Return:
(isok, tuples)
isok is True if all inputs are ok.
tuples is List of `namedtuple` objects, one for each task in the flow.
Each namedtuple has ... | def abivalidate_inputs(self):
"""
Run ABINIT in dry mode to validate all the inputs of the flow.
Return:
(isok, tuples)
isok is True if all inputs are ok.
tuples is List of `namedtuple` objects, one for each task in the flow.
Each namedtuple has ... | [
"Run",
"ABINIT",
"in",
"dry",
"mode",
"to",
"validate",
"all",
"the",
"inputs",
"of",
"the",
"flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L696-L723 | [
"def",
"abivalidate_inputs",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"allocated",
":",
"self",
".",
"allocate",
"(",
")",
"isok",
",",
"tuples",
"=",
"True",
",",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
")",
":",
"t... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.check_dependencies | Test the dependencies of the nodes for possible deadlocks. | pymatgen/io/abinit/flows.py | def check_dependencies(self):
"""Test the dependencies of the nodes for possible deadlocks."""
deadlocks = []
for task in self.iflat_tasks():
for dep in task.deps:
if dep.node.depends_on(task):
deadlocks.append((task, dep.node))
if deadlo... | def check_dependencies(self):
"""Test the dependencies of the nodes for possible deadlocks."""
deadlocks = []
for task in self.iflat_tasks():
for dep in task.deps:
if dep.node.depends_on(task):
deadlocks.append((task, dep.node))
if deadlo... | [
"Test",
"the",
"dependencies",
"of",
"the",
"nodes",
"for",
"possible",
"deadlocks",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L725-L737 | [
"def",
"check_dependencies",
"(",
"self",
")",
":",
"deadlocks",
"=",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
")",
":",
"for",
"dep",
"in",
"task",
".",
"deps",
":",
"if",
"dep",
".",
"node",
".",
"depends_on",
"(",
"task",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.find_deadlocks | This function detects deadlocks
Return:
named tuple with the tasks grouped in: deadlocks, runnables, running | pymatgen/io/abinit/flows.py | def find_deadlocks(self):
"""
This function detects deadlocks
Return:
named tuple with the tasks grouped in: deadlocks, runnables, running
"""
# Find jobs that can be submitted and and the jobs that are already in the queue.
runnables = []
for work in... | def find_deadlocks(self):
"""
This function detects deadlocks
Return:
named tuple with the tasks grouped in: deadlocks, runnables, running
"""
# Find jobs that can be submitted and and the jobs that are already in the queue.
runnables = []
for work in... | [
"This",
"function",
"detects",
"deadlocks"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L739-L763 | [
"def",
"find_deadlocks",
"(",
"self",
")",
":",
"# Find jobs that can be submitted and and the jobs that are already in the queue.",
"runnables",
"=",
"[",
"]",
"for",
"work",
"in",
"self",
":",
"runnables",
".",
"extend",
"(",
"work",
".",
"fetch_alltasks_to_run",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.check_status | Check the status of the works in self.
Args:
show: True to show the status of the flow.
kwargs: keyword arguments passed to show_status | pymatgen/io/abinit/flows.py | def check_status(self, **kwargs):
"""
Check the status of the works in self.
Args:
show: True to show the status of the flow.
kwargs: keyword arguments passed to show_status
"""
for work in self:
work.check_status()
if kwargs.pop("sho... | def check_status(self, **kwargs):
"""
Check the status of the works in self.
Args:
show: True to show the status of the flow.
kwargs: keyword arguments passed to show_status
"""
for work in self:
work.check_status()
if kwargs.pop("sho... | [
"Check",
"the",
"status",
"of",
"the",
"works",
"in",
"self",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L765-L777 | [
"def",
"check_status",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"work",
"in",
"self",
":",
"work",
".",
"check_status",
"(",
")",
"if",
"kwargs",
".",
"pop",
"(",
"\"show\"",
",",
"False",
")",
":",
"self",
".",
"show_status",
"(",
"*... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.fix_abicritical | This function tries to fix critical events originating from ABINIT.
Returns the number of tasks that have been fixed. | pymatgen/io/abinit/flows.py | def fix_abicritical(self):
"""
This function tries to fix critical events originating from ABINIT.
Returns the number of tasks that have been fixed.
"""
count = 0
for task in self.iflat_tasks(status=self.S_ABICRITICAL):
count += task.fix_abicritical()
... | def fix_abicritical(self):
"""
This function tries to fix critical events originating from ABINIT.
Returns the number of tasks that have been fixed.
"""
count = 0
for task in self.iflat_tasks(status=self.S_ABICRITICAL):
count += task.fix_abicritical()
... | [
"This",
"function",
"tries",
"to",
"fix",
"critical",
"events",
"originating",
"from",
"ABINIT",
".",
"Returns",
"the",
"number",
"of",
"tasks",
"that",
"have",
"been",
"fixed",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L804-L813 | [
"def",
"fix_abicritical",
"(",
"self",
")",
":",
"count",
"=",
"0",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"status",
"=",
"self",
".",
"S_ABICRITICAL",
")",
":",
"count",
"+=",
"task",
".",
"fix_abicritical",
"(",
")",
"return",
"count"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.fix_queue_critical | This function tries to fix critical events originating from the queue submission system.
Returns the number of tasks that have been fixed. | pymatgen/io/abinit/flows.py | def fix_queue_critical(self):
"""
This function tries to fix critical events originating from the queue submission system.
Returns the number of tasks that have been fixed.
"""
count = 0
for task in self.iflat_tasks(status=self.S_QCRITICAL):
logger.info("Will... | def fix_queue_critical(self):
"""
This function tries to fix critical events originating from the queue submission system.
Returns the number of tasks that have been fixed.
"""
count = 0
for task in self.iflat_tasks(status=self.S_QCRITICAL):
logger.info("Will... | [
"This",
"function",
"tries",
"to",
"fix",
"critical",
"events",
"originating",
"from",
"the",
"queue",
"submission",
"system",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L815-L830 | [
"def",
"fix_queue_critical",
"(",
"self",
")",
":",
"count",
"=",
"0",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"status",
"=",
"self",
".",
"S_QCRITICAL",
")",
":",
"logger",
".",
"info",
"(",
"\"Will try to fix task %s\"",
"%",
"str",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_info | Print info on the flow i.e. total number of tasks, works, tasks grouped by class.
Example:
Task Class Number
------------ --------
ScfTask 1
NscfTask 1
ScrTask 2
SigmaTask 6 | pymatgen/io/abinit/flows.py | def show_info(self, **kwargs):
"""
Print info on the flow i.e. total number of tasks, works, tasks grouped by class.
Example:
Task Class Number
------------ --------
ScfTask 1
NscfTask 1
ScrTask ... | def show_info(self, **kwargs):
"""
Print info on the flow i.e. total number of tasks, works, tasks grouped by class.
Example:
Task Class Number
------------ --------
ScfTask 1
NscfTask 1
ScrTask ... | [
"Print",
"info",
"on",
"the",
"flow",
"i",
".",
"e",
".",
"total",
"number",
"of",
"tasks",
"works",
"tasks",
"grouped",
"by",
"class",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L832-L858 | [
"def",
"show_info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"stream",
"=",
"kwargs",
".",
"pop",
"(",
"\"stream\"",
",",
"sys",
".",
"stdout",
")",
"lines",
"=",
"[",
"str",
"(",
"self",
")",
"]",
"app",
"=",
"lines",
".",
"append",
"app"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_summary | Print a short summary with the status of the flow and a counter task_status --> number_of_tasks
Args:
stream: File-like object, Default: sys.stdout
Example:
Status Count
--------- -------
Completed 10
<Flow, node_id=27163, work... | pymatgen/io/abinit/flows.py | def show_summary(self, **kwargs):
"""
Print a short summary with the status of the flow and a counter task_status --> number_of_tasks
Args:
stream: File-like object, Default: sys.stdout
Example:
Status Count
--------- -------
Comp... | def show_summary(self, **kwargs):
"""
Print a short summary with the status of the flow and a counter task_status --> number_of_tasks
Args:
stream: File-like object, Default: sys.stdout
Example:
Status Count
--------- -------
Comp... | [
"Print",
"a",
"short",
"summary",
"with",
"the",
"status",
"of",
"the",
"flow",
"and",
"a",
"counter",
"task_status",
"--",
">",
"number_of_tasks"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L860-L882 | [
"def",
"show_summary",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"stream",
"=",
"kwargs",
".",
"pop",
"(",
"\"stream\"",
",",
"sys",
".",
"stdout",
")",
"stream",
".",
"write",
"(",
"\"\\n\"",
")",
"table",
"=",
"list",
"(",
"self",
".",
"sta... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_status | Report the status of the works and the status of the different tasks on the specified stream.
Args:
stream: File-like object, Default: sys.stdout
nids: List of node identifiers. By defaults all nodes are shown
wslice: Slice object used to select works.
verbose:... | pymatgen/io/abinit/flows.py | def show_status(self, **kwargs):
"""
Report the status of the works and the status of the different tasks on the specified stream.
Args:
stream: File-like object, Default: sys.stdout
nids: List of node identifiers. By defaults all nodes are shown
wslice: Sl... | def show_status(self, **kwargs):
"""
Report the status of the works and the status of the different tasks on the specified stream.
Args:
stream: File-like object, Default: sys.stdout
nids: List of node identifiers. By defaults all nodes are shown
wslice: Sl... | [
"Report",
"the",
"status",
"of",
"the",
"works",
"and",
"the",
"status",
"of",
"the",
"different",
"tasks",
"on",
"the",
"specified",
"stream",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L884-L976 | [
"def",
"show_status",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"stream",
"=",
"kwargs",
".",
"pop",
"(",
"\"stream\"",
",",
"sys",
".",
"stdout",
")",
"nids",
"=",
"as_set",
"(",
"kwargs",
".",
"pop",
"(",
"\"nids\"",
",",
"None",
")",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_events | Print the Abinit events (ERRORS, WARNIING, COMMENTS) to stdout
Args:
status: if not None, only the tasks with this status are select
nids: optional list of node identifiers used to filter the tasks. | pymatgen/io/abinit/flows.py | def show_events(self, status=None, nids=None):
"""
Print the Abinit events (ERRORS, WARNIING, COMMENTS) to stdout
Args:
status: if not None, only the tasks with this status are select
nids: optional list of node identifiers used to filter the tasks.
"""
nrows, n... | def show_events(self, status=None, nids=None):
"""
Print the Abinit events (ERRORS, WARNIING, COMMENTS) to stdout
Args:
status: if not None, only the tasks with this status are select
nids: optional list of node identifiers used to filter the tasks.
"""
nrows, n... | [
"Print",
"the",
"Abinit",
"events",
"(",
"ERRORS",
"WARNIING",
"COMMENTS",
")",
"to",
"stdout"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L978-L992 | [
"def",
"show_events",
"(",
"self",
",",
"status",
"=",
"None",
",",
"nids",
"=",
"None",
")",
":",
"nrows",
",",
"ncols",
"=",
"get_terminal_size",
"(",
")",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"status",
"=",
"status",
",",
"nids",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_corrections | Show the corrections applied to the flow at run-time.
Args:
status: if not None, only the tasks with this status are select.
nids: optional list of node identifiers used to filter the tasks.
Return: The number of corrections found. | pymatgen/io/abinit/flows.py | def show_corrections(self, status=None, nids=None):
"""
Show the corrections applied to the flow at run-time.
Args:
status: if not None, only the tasks with this status are select.
nids: optional list of node identifiers used to filter the tasks.
Return: The num... | def show_corrections(self, status=None, nids=None):
"""
Show the corrections applied to the flow at run-time.
Args:
status: if not None, only the tasks with this status are select.
nids: optional list of node identifiers used to filter the tasks.
Return: The num... | [
"Show",
"the",
"corrections",
"applied",
"to",
"the",
"flow",
"at",
"run",
"-",
"time",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L995-L1015 | [
"def",
"show_corrections",
"(",
"self",
",",
"status",
"=",
"None",
",",
"nids",
"=",
"None",
")",
":",
"nrows",
",",
"ncols",
"=",
"get_terminal_size",
"(",
")",
"count",
"=",
"0",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"status",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_history | Print the history of the flow to stdout.
Args:
status: if not None, only the tasks with this status are select
full_history: Print full info set, including nodes with an empty history.
nids: optional list of node identifiers used to filter the tasks.
metadata: pr... | pymatgen/io/abinit/flows.py | def show_history(self, status=None, nids=None, full_history=False, metadata=False):
"""
Print the history of the flow to stdout.
Args:
status: if not None, only the tasks with this status are select
full_history: Print full info set, including nodes with an empty history... | def show_history(self, status=None, nids=None, full_history=False, metadata=False):
"""
Print the history of the flow to stdout.
Args:
status: if not None, only the tasks with this status are select
full_history: Print full info set, including nodes with an empty history... | [
"Print",
"the",
"history",
"of",
"the",
"flow",
"to",
"stdout",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1017-L1047 | [
"def",
"show_history",
"(",
"self",
",",
"status",
"=",
"None",
",",
"nids",
"=",
"None",
",",
"full_history",
"=",
"False",
",",
"metadata",
"=",
"False",
")",
":",
"nrows",
",",
"ncols",
"=",
"get_terminal_size",
"(",
")",
"works_done",
"=",
"[",
"]"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_inputs | Print the input of the tasks to the given stream.
Args:
varnames:
List of Abinit variables. If not None, only the variable in varnames
are selected and printed.
nids:
List of node identifiers. By defaults all nodes are shown
ws... | pymatgen/io/abinit/flows.py | def show_inputs(self, varnames=None, nids=None, wslice=None, stream=sys.stdout):
"""
Print the input of the tasks to the given stream.
Args:
varnames:
List of Abinit variables. If not None, only the variable in varnames
are selected and printed.
... | def show_inputs(self, varnames=None, nids=None, wslice=None, stream=sys.stdout):
"""
Print the input of the tasks to the given stream.
Args:
varnames:
List of Abinit variables. If not None, only the variable in varnames
are selected and printed.
... | [
"Print",
"the",
"input",
"of",
"the",
"tasks",
"to",
"the",
"given",
"stream",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1049-L1101 | [
"def",
"show_inputs",
"(",
"self",
",",
"varnames",
"=",
"None",
",",
"nids",
"=",
"None",
",",
"wslice",
"=",
"None",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"varnames",
"is",
"not",
"None",
":",
"# Build dictionary varname --> [(task1, ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.listext | Print to the given `stream` a table with the list of the output files
with the given `ext` produced by the flow. | pymatgen/io/abinit/flows.py | def listext(self, ext, stream=sys.stdout):
"""
Print to the given `stream` a table with the list of the output files
with the given `ext` produced by the flow.
"""
nodes_files = []
for node in self.iflat_nodes():
filepath = node.outdir.has_abiext(ext)
... | def listext(self, ext, stream=sys.stdout):
"""
Print to the given `stream` a table with the list of the output files
with the given `ext` produced by the flow.
"""
nodes_files = []
for node in self.iflat_nodes():
filepath = node.outdir.has_abiext(ext)
... | [
"Print",
"to",
"the",
"given",
"stream",
"a",
"table",
"with",
"the",
"list",
"of",
"the",
"output",
"files",
"with",
"the",
"given",
"ext",
"produced",
"by",
"the",
"flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1103-L1123 | [
"def",
"listext",
"(",
"self",
",",
"ext",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"nodes_files",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"iflat_nodes",
"(",
")",
":",
"filepath",
"=",
"node",
".",
"outdir",
".",
"has_abiext",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.select_tasks | Return a list with a subset of tasks.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
task_class: String or class used to select tasks. Ignored if None.
.. note::
nids and wslice are mutually exclusive.
If no... | pymatgen/io/abinit/flows.py | def select_tasks(self, nids=None, wslice=None, task_class=None):
"""
Return a list with a subset of tasks.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
task_class: String or class used to select tasks. Ignored if None.
... | def select_tasks(self, nids=None, wslice=None, task_class=None):
"""
Return a list with a subset of tasks.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
task_class: String or class used to select tasks. Ignored if None.
... | [
"Return",
"a",
"list",
"with",
"a",
"subset",
"of",
"tasks",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1125-L1155 | [
"def",
"select_tasks",
"(",
"self",
",",
"nids",
"=",
"None",
",",
"wslice",
"=",
"None",
",",
"task_class",
"=",
"None",
")",
":",
"if",
"nids",
"is",
"not",
"None",
":",
"assert",
"wslice",
"is",
"None",
"tasks",
"=",
"self",
".",
"tasks_from_nids",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.get_task_scfcycles | Return list of (taks, scfcycle) tuples for all the tasks in the flow with a SCF algorithm
e.g. electronic GS-SCF iteration, DFPT-SCF iterations etc.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
task_class: String or class used to s... | pymatgen/io/abinit/flows.py | def get_task_scfcycles(self, nids=None, wslice=None, task_class=None, exclude_ok_tasks=False):
"""
Return list of (taks, scfcycle) tuples for all the tasks in the flow with a SCF algorithm
e.g. electronic GS-SCF iteration, DFPT-SCF iterations etc.
Args:
nids: List of node id... | def get_task_scfcycles(self, nids=None, wslice=None, task_class=None, exclude_ok_tasks=False):
"""
Return list of (taks, scfcycle) tuples for all the tasks in the flow with a SCF algorithm
e.g. electronic GS-SCF iteration, DFPT-SCF iterations etc.
Args:
nids: List of node id... | [
"Return",
"list",
"of",
"(",
"taks",
"scfcycle",
")",
"tuples",
"for",
"all",
"the",
"tasks",
"in",
"the",
"flow",
"with",
"a",
"SCF",
"algorithm",
"e",
".",
"g",
".",
"electronic",
"GS",
"-",
"SCF",
"iteration",
"DFPT",
"-",
"SCF",
"iterations",
"etc"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1157-L1188 | [
"def",
"get_task_scfcycles",
"(",
"self",
",",
"nids",
"=",
"None",
",",
"wslice",
"=",
"None",
",",
"task_class",
"=",
"None",
",",
"exclude_ok_tasks",
"=",
"False",
")",
":",
"select_status",
"=",
"[",
"self",
".",
"S_RUN",
"]",
"if",
"exclude_ok_tasks",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_tricky_tasks | Print list of tricky tasks i.e. tasks that have been restarted or
launched more than once or tasks with corrections.
Args:
verbose: Verbosity level. If > 0, task history and corrections (if any) are printed. | pymatgen/io/abinit/flows.py | def show_tricky_tasks(self, verbose=0):
"""
Print list of tricky tasks i.e. tasks that have been restarted or
launched more than once or tasks with corrections.
Args:
verbose: Verbosity level. If > 0, task history and corrections (if any) are printed.
"""
nid... | def show_tricky_tasks(self, verbose=0):
"""
Print list of tricky tasks i.e. tasks that have been restarted or
launched more than once or tasks with corrections.
Args:
verbose: Verbosity level. If > 0, task history and corrections (if any) are printed.
"""
nid... | [
"Print",
"list",
"of",
"tricky",
"tasks",
"i",
".",
"e",
".",
"tasks",
"that",
"have",
"been",
"restarted",
"or",
"launched",
"more",
"than",
"once",
"or",
"tasks",
"with",
"corrections",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1190-L1218 | [
"def",
"show_tricky_tasks",
"(",
"self",
",",
"verbose",
"=",
"0",
")",
":",
"nids",
",",
"tasks",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
")",
":",
"if",
"task",
".",
"num_launches",
">",
"1",
"or",
"a... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.inspect | Inspect the tasks (SCF iterations, Structural relaxation ...) and
produces matplotlib plots.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
kwargs: keyword arguments passed to `task.inspect` method.
.. note::
ni... | pymatgen/io/abinit/flows.py | def inspect(self, nids=None, wslice=None, **kwargs):
"""
Inspect the tasks (SCF iterations, Structural relaxation ...) and
produces matplotlib plots.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
kwargs: keyword argu... | def inspect(self, nids=None, wslice=None, **kwargs):
"""
Inspect the tasks (SCF iterations, Structural relaxation ...) and
produces matplotlib plots.
Args:
nids: List of node identifiers.
wslice: Slice object used to select works.
kwargs: keyword argu... | [
"Inspect",
"the",
"tasks",
"(",
"SCF",
"iterations",
"Structural",
"relaxation",
"...",
")",
"and",
"produces",
"matplotlib",
"plots",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1220-L1249 | [
"def",
"inspect",
"(",
"self",
",",
"nids",
"=",
"None",
",",
"wslice",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"figs",
"=",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"select_tasks",
"(",
"nids",
"=",
"nids",
",",
"wslice",
"=",
"wslice... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.get_dict_for_mongodb_queries | This function returns a dictionary with the attributes that will be
put in the mongodb document to facilitate the query.
Subclasses may want to replace or extend the default behaviour. | pymatgen/io/abinit/flows.py | def get_dict_for_mongodb_queries(self):
"""
This function returns a dictionary with the attributes that will be
put in the mongodb document to facilitate the query.
Subclasses may want to replace or extend the default behaviour.
"""
d = {}
return d
# TODO
... | def get_dict_for_mongodb_queries(self):
"""
This function returns a dictionary with the attributes that will be
put in the mongodb document to facilitate the query.
Subclasses may want to replace or extend the default behaviour.
"""
d = {}
return d
# TODO
... | [
"This",
"function",
"returns",
"a",
"dictionary",
"with",
"the",
"attributes",
"that",
"will",
"be",
"put",
"in",
"the",
"mongodb",
"document",
"to",
"facilitate",
"the",
"query",
".",
"Subclasses",
"may",
"want",
"to",
"replace",
"or",
"extend",
"the",
"def... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1256-L1266 | [
"def",
"get_dict_for_mongodb_queries",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"return",
"d",
"# TODO",
"all_structures",
"=",
"[",
"task",
".",
"input",
".",
"structure",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
")",
"]",
"all_pseudos",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.look_before_you_leap | This method should be called before running the calculation to make
sure that the most important requirements are satisfied.
Return:
List of strings with inconsistencies/errors. | pymatgen/io/abinit/flows.py | def look_before_you_leap(self):
"""
This method should be called before running the calculation to make
sure that the most important requirements are satisfied.
Return:
List of strings with inconsistencies/errors.
"""
errors = []
try:
sel... | def look_before_you_leap(self):
"""
This method should be called before running the calculation to make
sure that the most important requirements are satisfied.
Return:
List of strings with inconsistencies/errors.
"""
errors = []
try:
sel... | [
"This",
"method",
"should",
"be",
"called",
"before",
"running",
"the",
"calculation",
"to",
"make",
"sure",
"that",
"the",
"most",
"important",
"requirements",
"are",
"satisfied",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1268-L1295 | [
"def",
"look_before_you_leap",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"try",
":",
"self",
".",
"check_dependencies",
"(",
")",
"except",
"self",
".",
"Error",
"as",
"exc",
":",
"errors",
".",
"append",
"(",
"str",
"(",
"exc",
")",
")",
"if",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.db_insert | Insert results in the `MongDB` database. | pymatgen/io/abinit/flows.py | def db_insert(self):
"""
Insert results in the `MongDB` database.
"""
assert self.has_db
# Connect to MongoDb and get the collection.
coll = self.manager.db_connector.get_collection()
print("Mongodb collection %s with count %d", coll, coll.count())
start ... | def db_insert(self):
"""
Insert results in the `MongDB` database.
"""
assert self.has_db
# Connect to MongoDb and get the collection.
coll = self.manager.db_connector.get_collection()
print("Mongodb collection %s with count %d", coll, coll.count())
start ... | [
"Insert",
"results",
"in",
"the",
"MongDB",
"database",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1302-L1330 | [
"def",
"db_insert",
"(",
"self",
")",
":",
"assert",
"self",
".",
"has_db",
"# Connect to MongoDb and get the collection.",
"coll",
"=",
"self",
".",
"manager",
".",
"db_connector",
".",
"get_collection",
"(",
")",
"print",
"(",
"\"Mongodb collection %s with count %d\... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.tasks_from_nids | Return the list of tasks associated to the given list of node identifiers (nids).
.. note::
Invalid ids are ignored | pymatgen/io/abinit/flows.py | def tasks_from_nids(self, nids):
"""
Return the list of tasks associated to the given list of node identifiers (nids).
.. note::
Invalid ids are ignored
"""
if not isinstance(nids, collections.abc.Iterable): nids = [nids]
n2task = {task.node_id: task for ta... | def tasks_from_nids(self, nids):
"""
Return the list of tasks associated to the given list of node identifiers (nids).
.. note::
Invalid ids are ignored
"""
if not isinstance(nids, collections.abc.Iterable): nids = [nids]
n2task = {task.node_id: task for ta... | [
"Return",
"the",
"list",
"of",
"tasks",
"associated",
"to",
"the",
"given",
"list",
"of",
"node",
"identifiers",
"(",
"nids",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1332-L1343 | [
"def",
"tasks_from_nids",
"(",
"self",
",",
"nids",
")",
":",
"if",
"not",
"isinstance",
"(",
"nids",
",",
"collections",
".",
"abc",
".",
"Iterable",
")",
":",
"nids",
"=",
"[",
"nids",
"]",
"n2task",
"=",
"{",
"task",
".",
"node_id",
":",
"task",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.open_files | Open the files of the flow inside an editor (command line interface).
Args:
what: string with the list of characters selecting the file type
Possible choices:
i ==> input_file,
o ==> output_file,
f ==> files_file,
... | pymatgen/io/abinit/flows.py | def open_files(self, what="o", status=None, op="==", nids=None, editor=None):
"""
Open the files of the flow inside an editor (command line interface).
Args:
what: string with the list of characters selecting the file type
Possible choices:
i ==... | def open_files(self, what="o", status=None, op="==", nids=None, editor=None):
"""
Open the files of the flow inside an editor (command line interface).
Args:
what: string with the list of characters selecting the file type
Possible choices:
i ==... | [
"Open",
"the",
"files",
"of",
"the",
"flow",
"inside",
"an",
"editor",
"(",
"command",
"line",
"interface",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1349-L1377 | [
"def",
"open_files",
"(",
"self",
",",
"what",
"=",
"\"o\"",
",",
"status",
"=",
"None",
",",
"op",
"=",
"\"==\"",
",",
"nids",
"=",
"None",
",",
"editor",
"=",
"None",
")",
":",
"# Build list of files to analyze.",
"files",
"=",
"[",
"]",
"for",
"task... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.parse_timing | Parse the timer data in the main output file(s) of Abinit.
Requires timopt /= 0 in the input file (usually timopt = -1)
Args:
nids: optional list of node identifiers used to filter the tasks.
Return: :class:`AbinitTimerParser` instance, None if error. | pymatgen/io/abinit/flows.py | def parse_timing(self, nids=None):
"""
Parse the timer data in the main output file(s) of Abinit.
Requires timopt /= 0 in the input file (usually timopt = -1)
Args:
nids: optional list of node identifiers used to filter the tasks.
Return: :class:`AbinitTimerParser` ... | def parse_timing(self, nids=None):
"""
Parse the timer data in the main output file(s) of Abinit.
Requires timopt /= 0 in the input file (usually timopt = -1)
Args:
nids: optional list of node identifiers used to filter the tasks.
Return: :class:`AbinitTimerParser` ... | [
"Parse",
"the",
"timer",
"data",
"in",
"the",
"main",
"output",
"file",
"(",
"s",
")",
"of",
"Abinit",
".",
"Requires",
"timopt",
"/",
"=",
"0",
"in",
"the",
"input",
"file",
"(",
"usually",
"timopt",
"=",
"-",
"1",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1379-L1398 | [
"def",
"parse_timing",
"(",
"self",
",",
"nids",
"=",
"None",
")",
":",
"# Get the list of output files according to nids.",
"paths",
"=",
"[",
"task",
".",
"output_file",
".",
"path",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"nids",
"=",
"nids",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_abierrors | Write to the given stream the list of ABINIT errors for all tasks whose status is S_ABICRITICAL.
Args:
nids: optional list of node identifiers used to filter the tasks.
stream: File-like object. Default: sys.stdout | pymatgen/io/abinit/flows.py | def show_abierrors(self, nids=None, stream=sys.stdout):
"""
Write to the given stream the list of ABINIT errors for all tasks whose status is S_ABICRITICAL.
Args:
nids: optional list of node identifiers used to filter the tasks.
stream: File-like object. Default: sys.std... | def show_abierrors(self, nids=None, stream=sys.stdout):
"""
Write to the given stream the list of ABINIT errors for all tasks whose status is S_ABICRITICAL.
Args:
nids: optional list of node identifiers used to filter the tasks.
stream: File-like object. Default: sys.std... | [
"Write",
"to",
"the",
"given",
"stream",
"the",
"list",
"of",
"ABINIT",
"errors",
"for",
"all",
"tasks",
"whose",
"status",
"is",
"S_ABICRITICAL",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1400-L1429 | [
"def",
"show_abierrors",
"(",
"self",
",",
"nids",
"=",
"None",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"lines",
"=",
"[",
"]",
"app",
"=",
"lines",
".",
"append",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"status",
"=",
"se... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_qouts | Write to the given stream the content of the queue output file for all tasks whose status is S_QCRITICAL.
Args:
nids: optional list of node identifiers used to filter the tasks.
stream: File-like object. Default: sys.stdout | pymatgen/io/abinit/flows.py | def show_qouts(self, nids=None, stream=sys.stdout):
"""
Write to the given stream the content of the queue output file for all tasks whose status is S_QCRITICAL.
Args:
nids: optional list of node identifiers used to filter the tasks.
stream: File-like object. Default: sy... | def show_qouts(self, nids=None, stream=sys.stdout):
"""
Write to the given stream the content of the queue output file for all tasks whose status is S_QCRITICAL.
Args:
nids: optional list of node identifiers used to filter the tasks.
stream: File-like object. Default: sy... | [
"Write",
"to",
"the",
"given",
"stream",
"the",
"content",
"of",
"the",
"queue",
"output",
"file",
"for",
"all",
"tasks",
"whose",
"status",
"is",
"S_QCRITICAL",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1431-L1452 | [
"def",
"show_qouts",
"(",
"self",
",",
"nids",
"=",
"None",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(",
"status",
"=",
"self",
".",
"S_QCRITICAL",
",",
"nids",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.debug | This method is usually used when the flow didn't completed succesfully
It analyzes the files produced the tasks to facilitate debugging.
Info are printed to stdout.
Args:
status: If not None, only the tasks with this status are selected
nids: optional list of node identi... | pymatgen/io/abinit/flows.py | def debug(self, status=None, nids=None):
"""
This method is usually used when the flow didn't completed succesfully
It analyzes the files produced the tasks to facilitate debugging.
Info are printed to stdout.
Args:
status: If not None, only the tasks with this statu... | def debug(self, status=None, nids=None):
"""
This method is usually used when the flow didn't completed succesfully
It analyzes the files produced the tasks to facilitate debugging.
Info are printed to stdout.
Args:
status: If not None, only the tasks with this statu... | [
"This",
"method",
"is",
"usually",
"used",
"when",
"the",
"flow",
"didn",
"t",
"completed",
"succesfully",
"It",
"analyzes",
"the",
"files",
"produced",
"the",
"tasks",
"to",
"facilitate",
"debugging",
".",
"Info",
"are",
"printed",
"to",
"stdout",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1454-L1541 | [
"def",
"debug",
"(",
"self",
",",
"status",
"=",
"None",
",",
"nids",
"=",
"None",
")",
":",
"nrows",
",",
"ncols",
"=",
"get_terminal_size",
"(",
")",
"# Test for scheduler exceptions first.",
"sched_excfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"se... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.cancel | Cancel all the tasks that are in the queue.
nids is an optional list of node identifiers used to filter the tasks.
Returns:
Number of jobs cancelled, negative value if error | pymatgen/io/abinit/flows.py | def cancel(self, nids=None):
"""
Cancel all the tasks that are in the queue.
nids is an optional list of node identifiers used to filter the tasks.
Returns:
Number of jobs cancelled, negative value if error
"""
if self.has_chrooted:
# TODO: Use pa... | def cancel(self, nids=None):
"""
Cancel all the tasks that are in the queue.
nids is an optional list of node identifiers used to filter the tasks.
Returns:
Number of jobs cancelled, negative value if error
"""
if self.has_chrooted:
# TODO: Use pa... | [
"Cancel",
"all",
"the",
"tasks",
"that",
"are",
"in",
"the",
"queue",
".",
"nids",
"is",
"an",
"optional",
"list",
"of",
"node",
"identifiers",
"used",
"to",
"filter",
"the",
"tasks",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1543-L1575 | [
"def",
"cancel",
"(",
"self",
",",
"nids",
"=",
"None",
")",
":",
"if",
"self",
".",
"has_chrooted",
":",
"# TODO: Use paramiko to kill the job?",
"warnings",
".",
"warn",
"(",
"\"Cannot cancel the flow via sshfs!\"",
")",
"return",
"-",
"1",
"# If we are running wi... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.rmtree | Remove workdir (same API as shutil.rmtree). | pymatgen/io/abinit/flows.py | def rmtree(self, ignore_errors=False, onerror=None):
"""Remove workdir (same API as shutil.rmtree)."""
if not os.path.exists(self.workdir): return
shutil.rmtree(self.workdir, ignore_errors=ignore_errors, onerror=onerror) | def rmtree(self, ignore_errors=False, onerror=None):
"""Remove workdir (same API as shutil.rmtree)."""
if not os.path.exists(self.workdir): return
shutil.rmtree(self.workdir, ignore_errors=ignore_errors, onerror=onerror) | [
"Remove",
"workdir",
"(",
"same",
"API",
"as",
"shutil",
".",
"rmtree",
")",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1586-L1589 | [
"def",
"rmtree",
"(",
"self",
",",
"ignore_errors",
"=",
"False",
",",
"onerror",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"workdir",
")",
":",
"return",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"wor... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.build | Make directories and files of the `Flow`. | pymatgen/io/abinit/flows.py | def build(self, *args, **kwargs):
"""Make directories and files of the `Flow`."""
# Allocate here if not done yet!
if not self.allocated: self.allocate()
self.indir.makedirs()
self.outdir.makedirs()
self.tmpdir.makedirs()
# Check the nodeid file in workdir
... | def build(self, *args, **kwargs):
"""Make directories and files of the `Flow`."""
# Allocate here if not done yet!
if not self.allocated: self.allocate()
self.indir.makedirs()
self.outdir.makedirs()
self.tmpdir.makedirs()
# Check the nodeid file in workdir
... | [
"Make",
"directories",
"and",
"files",
"of",
"the",
"Flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1596-L1629 | [
"def",
"build",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Allocate here if not done yet!",
"if",
"not",
"self",
".",
"allocated",
":",
"self",
".",
"allocate",
"(",
")",
"self",
".",
"indir",
".",
"makedirs",
"(",
")",
"self"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.build_and_pickle_dump | Build dirs and file of the `Flow` and save the object in pickle format.
Returns 0 if success
Args:
abivalidate: If True, all the input files are validate by calling
the abinit parser. If the validation fails, ValueError is raise. | pymatgen/io/abinit/flows.py | def build_and_pickle_dump(self, abivalidate=False):
"""
Build dirs and file of the `Flow` and save the object in pickle format.
Returns 0 if success
Args:
abivalidate: If True, all the input files are validate by calling
the abinit parser. If the validation f... | def build_and_pickle_dump(self, abivalidate=False):
"""
Build dirs and file of the `Flow` and save the object in pickle format.
Returns 0 if success
Args:
abivalidate: If True, all the input files are validate by calling
the abinit parser. If the validation f... | [
"Build",
"dirs",
"and",
"file",
"of",
"the",
"Flow",
"and",
"save",
"the",
"object",
"in",
"pickle",
"format",
".",
"Returns",
"0",
"if",
"success"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1631-L1649 | [
"def",
"build_and_pickle_dump",
"(",
"self",
",",
"abivalidate",
"=",
"False",
")",
":",
"self",
".",
"build",
"(",
")",
"if",
"not",
"abivalidate",
":",
"return",
"self",
".",
"pickle_dump",
"(",
")",
"# Validation with Abinit.",
"isok",
",",
"errors",
"=",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.pickle_dump | Save the status of the object in pickle format.
Returns 0 if success | pymatgen/io/abinit/flows.py | def pickle_dump(self):
"""
Save the status of the object in pickle format.
Returns 0 if success
"""
if self.has_chrooted:
warnings.warn("Cannot pickle_dump since we have chrooted from %s" % self.has_chrooted)
return -1
#if self.in_spectator_mode:
... | def pickle_dump(self):
"""
Save the status of the object in pickle format.
Returns 0 if success
"""
if self.has_chrooted:
warnings.warn("Cannot pickle_dump since we have chrooted from %s" % self.has_chrooted)
return -1
#if self.in_spectator_mode:
... | [
"Save",
"the",
"status",
"of",
"the",
"object",
"in",
"pickle",
"format",
".",
"Returns",
"0",
"if",
"success"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1652-L1672 | [
"def",
"pickle_dump",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_chrooted",
":",
"warnings",
".",
"warn",
"(",
"\"Cannot pickle_dump since we have chrooted from %s\"",
"%",
"self",
".",
"has_chrooted",
")",
"return",
"-",
"1",
"#if self.in_spectator_mode:",
"# ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.pickle_dumps | Return a string with the pickle representation.
`protocol` selects the pickle protocol. self.pickle_protocol is
used if `protocol` is None | pymatgen/io/abinit/flows.py | def pickle_dumps(self, protocol=None):
"""
Return a string with the pickle representation.
`protocol` selects the pickle protocol. self.pickle_protocol is
used if `protocol` is None
"""
strio = StringIO()
pmg_pickle_dump(self, strio,
proto... | def pickle_dumps(self, protocol=None):
"""
Return a string with the pickle representation.
`protocol` selects the pickle protocol. self.pickle_protocol is
used if `protocol` is None
"""
strio = StringIO()
pmg_pickle_dump(self, strio,
proto... | [
"Return",
"a",
"string",
"with",
"the",
"pickle",
"representation",
".",
"protocol",
"selects",
"the",
"pickle",
"protocol",
".",
"self",
".",
"pickle_protocol",
"is",
"used",
"if",
"protocol",
"is",
"None"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1674-L1684 | [
"def",
"pickle_dumps",
"(",
"self",
",",
"protocol",
"=",
"None",
")",
":",
"strio",
"=",
"StringIO",
"(",
")",
"pmg_pickle_dump",
"(",
"self",
",",
"strio",
",",
"protocol",
"=",
"self",
".",
"pickle_protocol",
"if",
"protocol",
"is",
"None",
"else",
"p... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.register_task | Utility function that generates a `Work` made of a single task
Args:
input: :class:`AbinitInput`
deps: List of :class:`Dependency` objects specifying the dependency of this node.
An empy list of deps implies that this node has no dependencies.
manager: The ... | pymatgen/io/abinit/flows.py | def register_task(self, input, deps=None, manager=None, task_class=None, append=False):
"""
Utility function that generates a `Work` made of a single task
Args:
input: :class:`AbinitInput`
deps: List of :class:`Dependency` objects specifying the dependency of this node.
... | def register_task(self, input, deps=None, manager=None, task_class=None, append=False):
"""
Utility function that generates a `Work` made of a single task
Args:
input: :class:`AbinitInput`
deps: List of :class:`Dependency` objects specifying the dependency of this node.
... | [
"Utility",
"function",
"that",
"generates",
"a",
"Work",
"made",
"of",
"a",
"single",
"task"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1686-L1716 | [
"def",
"register_task",
"(",
"self",
",",
"input",
",",
"deps",
"=",
"None",
",",
"manager",
"=",
"None",
",",
"task_class",
"=",
"None",
",",
"append",
"=",
"False",
")",
":",
"# append True is much easier to use. In principle should be the default behaviour",
"# b... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.register_work | Register a new :class:`Work` and add it to the internal list, taking into account possible dependencies.
Args:
work: :class:`Work` object.
deps: List of :class:`Dependency` objects specifying the dependency of this node.
An empy list of deps implies that this node has ... | pymatgen/io/abinit/flows.py | def register_work(self, work, deps=None, manager=None, workdir=None):
"""
Register a new :class:`Work` and add it to the internal list, taking into account possible dependencies.
Args:
work: :class:`Work` object.
deps: List of :class:`Dependency` objects specifying the d... | def register_work(self, work, deps=None, manager=None, workdir=None):
"""
Register a new :class:`Work` and add it to the internal list, taking into account possible dependencies.
Args:
work: :class:`Work` object.
deps: List of :class:`Dependency` objects specifying the d... | [
"Register",
"a",
"new",
":",
"class",
":",
"Work",
"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/flows.py#L1718-L1752 | [
"def",
"register_work",
"(",
"self",
",",
"work",
",",
"deps",
"=",
"None",
",",
"manager",
"=",
"None",
",",
"workdir",
"=",
"None",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"\"workdir\"",
",",
"None",
")",
"is",
"not",
"None",
":",
"# The flow ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.register_work_from_cbk | Registers a callback function that will generate the :class:`Task` of the :class:`Work`.
Args:
cbk_name: Name of the callback function (must be a bound method of self)
cbk_data: Additional data passed to the callback function.
deps: List of :class:`Dependency` objects specif... | pymatgen/io/abinit/flows.py | def register_work_from_cbk(self, cbk_name, cbk_data, deps, work_class, manager=None):
"""
Registers a callback function that will generate the :class:`Task` of the :class:`Work`.
Args:
cbk_name: Name of the callback function (must be a bound method of self)
cbk_data: Add... | def register_work_from_cbk(self, cbk_name, cbk_data, deps, work_class, manager=None):
"""
Registers a callback function that will generate the :class:`Task` of the :class:`Work`.
Args:
cbk_name: Name of the callback function (must be a bound method of self)
cbk_data: Add... | [
"Registers",
"a",
"callback",
"function",
"that",
"will",
"generate",
"the",
":",
"class",
":",
"Task",
"of",
"the",
":",
"class",
":",
"Work",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1754-L1789 | [
"def",
"register_work_from_cbk",
"(",
"self",
",",
"cbk_name",
",",
"cbk_data",
",",
"deps",
",",
"work_class",
",",
"manager",
"=",
"None",
")",
":",
"# TODO: pass a Work factory instead of a class",
"# Directory of the Work.",
"work_workdir",
"=",
"os",
".",
"path",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.allocate | Allocate the `Flow` i.e. assign the `workdir` and (optionally)
the :class:`TaskManager` to the different tasks in the Flow.
Args:
workdir: Working directory of the flow. Must be specified here
if we haven't initialized the workdir in the __init__.
Return:
... | pymatgen/io/abinit/flows.py | def allocate(self, workdir=None, use_smartio=False):
"""
Allocate the `Flow` i.e. assign the `workdir` and (optionally)
the :class:`TaskManager` to the different tasks in the Flow.
Args:
workdir: Working directory of the flow. Must be specified here
if we hav... | def allocate(self, workdir=None, use_smartio=False):
"""
Allocate the `Flow` i.e. assign the `workdir` and (optionally)
the :class:`TaskManager` to the different tasks in the Flow.
Args:
workdir: Working directory of the flow. Must be specified here
if we hav... | [
"Allocate",
"the",
"Flow",
"i",
".",
"e",
".",
"assign",
"the",
"workdir",
"and",
"(",
"optionally",
")",
"the",
":",
"class",
":",
"TaskManager",
"to",
"the",
"different",
"tasks",
"in",
"the",
"Flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1799-L1836 | [
"def",
"allocate",
"(",
"self",
",",
"workdir",
"=",
"None",
",",
"use_smartio",
"=",
"False",
")",
":",
"if",
"workdir",
"is",
"not",
"None",
":",
"# We set the workdir of the flow here",
"self",
".",
"set_workdir",
"(",
"workdir",
")",
"for",
"i",
",",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.use_smartio | This function should be called when the entire `Flow` has been built.
It tries to reduce the pressure on the hard disk by using Abinit smart-io
capabilities for those files that are not needed by other nodes.
Smart-io means that big files (e.g. WFK) are written only if the calculation
is... | pymatgen/io/abinit/flows.py | def use_smartio(self):
"""
This function should be called when the entire `Flow` has been built.
It tries to reduce the pressure on the hard disk by using Abinit smart-io
capabilities for those files that are not needed by other nodes.
Smart-io means that big files (e.g. WFK) are... | def use_smartio(self):
"""
This function should be called when the entire `Flow` has been built.
It tries to reduce the pressure on the hard disk by using Abinit smart-io
capabilities for those files that are not needed by other nodes.
Smart-io means that big files (e.g. WFK) are... | [
"This",
"function",
"should",
"be",
"called",
"when",
"the",
"entire",
"Flow",
"has",
"been",
"built",
".",
"It",
"tries",
"to",
"reduce",
"the",
"pressure",
"on",
"the",
"hard",
"disk",
"by",
"using",
"Abinit",
"smart",
"-",
"io",
"capabilities",
"for",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1838-L1882 | [
"def",
"use_smartio",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"allocated",
":",
"#raise RuntimeError(\"You must call flow.allocate() before invoking flow.use_smartio()\")",
"self",
".",
"allocate",
"(",
")",
"for",
"task",
"in",
"self",
".",
"iflat_tasks",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.show_dependencies | Writes to the given stream the ASCII representation of the dependency tree. | pymatgen/io/abinit/flows.py | def show_dependencies(self, stream=sys.stdout):
"""Writes to the given stream the ASCII representation of the dependency tree."""
def child_iter(node):
return [d.node for d in node.deps]
def text_str(node):
return colored(str(node), color=node.status.color_opts["color"])... | def show_dependencies(self, stream=sys.stdout):
"""Writes to the given stream the ASCII representation of the dependency tree."""
def child_iter(node):
return [d.node for d in node.deps]
def text_str(node):
return colored(str(node), color=node.status.color_opts["color"])... | [
"Writes",
"to",
"the",
"given",
"stream",
"the",
"ASCII",
"representation",
"of",
"the",
"dependency",
"tree",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1894-L1903 | [
"def",
"show_dependencies",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"def",
"child_iter",
"(",
"node",
")",
":",
"return",
"[",
"d",
".",
"node",
"for",
"d",
"in",
"node",
".",
"deps",
"]",
"def",
"text_str",
"(",
"node",
")... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.finalize | This method is called when the flow is completed.
Return 0 if success | pymatgen/io/abinit/flows.py | def finalize(self):
"""
This method is called when the flow is completed.
Return 0 if success
"""
if self.finalized:
self.history.warning("Calling finalize on an already finalized flow.")
return 1
self.history.info("Calling flow.finalize.")
... | def finalize(self):
"""
This method is called when the flow is completed.
Return 0 if success
"""
if self.finalized:
self.history.warning("Calling finalize on an already finalized flow.")
return 1
self.history.info("Calling flow.finalize.")
... | [
"This",
"method",
"is",
"called",
"when",
"the",
"flow",
"is",
"completed",
".",
"Return",
"0",
"if",
"success"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1930-L1958 | [
"def",
"finalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"finalized",
":",
"self",
".",
"history",
".",
"warning",
"(",
"\"Calling finalize on an already finalized flow.\"",
")",
"return",
"1",
"self",
".",
"history",
".",
"info",
"(",
"\"Calling flow.finali... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.set_garbage_collector | Enable the garbage collector that will remove the big output files that are not needed.
Args:
exts: string or list with the Abinit file extensions to be removed. A default is
provided if exts is None
policy: Either `flow` or `task`. If policy is set to 'task', we remove ... | pymatgen/io/abinit/flows.py | def set_garbage_collector(self, exts=None, policy="task"):
"""
Enable the garbage collector that will remove the big output files that are not needed.
Args:
exts: string or list with the Abinit file extensions to be removed. A default is
provided if exts is None
... | def set_garbage_collector(self, exts=None, policy="task"):
"""
Enable the garbage collector that will remove the big output files that are not needed.
Args:
exts: string or list with the Abinit file extensions to be removed. A default is
provided if exts is None
... | [
"Enable",
"the",
"garbage",
"collector",
"that",
"will",
"remove",
"the",
"big",
"output",
"files",
"that",
"are",
"not",
"needed",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1960-L1982 | [
"def",
"set_garbage_collector",
"(",
"self",
",",
"exts",
"=",
"None",
",",
"policy",
"=",
"\"task\"",
")",
":",
"assert",
"policy",
"in",
"(",
"\"task\"",
",",
"\"flow\"",
")",
"exts",
"=",
"list_strings",
"(",
"exts",
")",
"if",
"exts",
"is",
"not",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.connect_signals | Connect the signals within the `Flow`.
The `Flow` is responsible for catching the important signals raised from its works. | pymatgen/io/abinit/flows.py | def connect_signals(self):
"""
Connect the signals within the `Flow`.
The `Flow` is responsible for catching the important signals raised from its works.
"""
# Connect the signals inside each Work.
for work in self:
work.connect_signals()
# Observe th... | def connect_signals(self):
"""
Connect the signals within the `Flow`.
The `Flow` is responsible for catching the important signals raised from its works.
"""
# Connect the signals inside each Work.
for work in self:
work.connect_signals()
# Observe th... | [
"Connect",
"the",
"signals",
"within",
"the",
"Flow",
".",
"The",
"Flow",
"is",
"responsible",
"for",
"catching",
"the",
"important",
"signals",
"raised",
"from",
"its",
"works",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L1984-L1998 | [
"def",
"connect_signals",
"(",
"self",
")",
":",
"# Connect the signals inside each Work.",
"for",
"work",
"in",
"self",
":",
"work",
".",
"connect_signals",
"(",
")",
"# Observe the nodes that must reach S_OK in order to call the callbacks.",
"for",
"cbk",
"in",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.disconnect_signals | Disable the signals within the `Flow`. | pymatgen/io/abinit/flows.py | def disconnect_signals(self):
"""Disable the signals within the `Flow`."""
# Disconnect the signals inside each Work.
for work in self:
work.disconnect_signals()
# Disable callbacks.
for cbk in self._callbacks:
cbk.disable() | def disconnect_signals(self):
"""Disable the signals within the `Flow`."""
# Disconnect the signals inside each Work.
for work in self:
work.disconnect_signals()
# Disable callbacks.
for cbk in self._callbacks:
cbk.disable() | [
"Disable",
"the",
"signals",
"within",
"the",
"Flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2021-L2029 | [
"def",
"disconnect_signals",
"(",
"self",
")",
":",
"# Disconnect the signals inside each Work.",
"for",
"work",
"in",
"self",
":",
"work",
".",
"disconnect_signals",
"(",
")",
"# Disable callbacks.",
"for",
"cbk",
"in",
"self",
".",
"_callbacks",
":",
"cbk",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.set_spectator_mode | When the flow is in spectator_mode, we have to disable signals, pickle dump and possible callbacks
A spectator can still operate on the flow but the new status of the flow won't be saved in
the pickle file. Usually the flow is in spectator mode when we are already running it via
the scheduler or... | pymatgen/io/abinit/flows.py | def set_spectator_mode(self, mode=True):
"""
When the flow is in spectator_mode, we have to disable signals, pickle dump and possible callbacks
A spectator can still operate on the flow but the new status of the flow won't be saved in
the pickle file. Usually the flow is in spectator mod... | def set_spectator_mode(self, mode=True):
"""
When the flow is in spectator_mode, we have to disable signals, pickle dump and possible callbacks
A spectator can still operate on the flow but the new status of the flow won't be saved in
the pickle file. Usually the flow is in spectator mod... | [
"When",
"the",
"flow",
"is",
"in",
"spectator_mode",
"we",
"have",
"to",
"disable",
"signals",
"pickle",
"dump",
"and",
"possible",
"callbacks",
"A",
"spectator",
"can",
"still",
"operate",
"on",
"the",
"flow",
"but",
"the",
"new",
"status",
"of",
"the",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2039-L2060 | [
"def",
"set_spectator_mode",
"(",
"self",
",",
"mode",
"=",
"True",
")",
":",
"# Set the flags of all the nodes in the flow.",
"mode",
"=",
"bool",
"(",
"mode",
")",
"self",
".",
"in_spectator_mode",
"=",
"mode",
"for",
"node",
"in",
"self",
".",
"iflat_nodes",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.rapidfire | Use :class:`PyLauncher` to submits tasks in rapidfire mode.
kwargs contains the options passed to the launcher.
Args:
check_status:
max_nlaunch: Maximum number of launches. default: no limit.
max_loops: Maximum number of loops
sleep_time: seconds to sleep... | pymatgen/io/abinit/flows.py | def rapidfire(self, check_status=True, max_nlaunch=-1, max_loops=1, sleep_time=5, **kwargs):
"""
Use :class:`PyLauncher` to submits tasks in rapidfire mode.
kwargs contains the options passed to the launcher.
Args:
check_status:
max_nlaunch: Maximum number of lau... | def rapidfire(self, check_status=True, max_nlaunch=-1, max_loops=1, sleep_time=5, **kwargs):
"""
Use :class:`PyLauncher` to submits tasks in rapidfire mode.
kwargs contains the options passed to the launcher.
Args:
check_status:
max_nlaunch: Maximum number of lau... | [
"Use",
":",
"class",
":",
"PyLauncher",
"to",
"submits",
"tasks",
"in",
"rapidfire",
"mode",
".",
"kwargs",
"contains",
"the",
"options",
"passed",
"to",
"the",
"launcher",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2064-L2082 | [
"def",
"rapidfire",
"(",
"self",
",",
"check_status",
"=",
"True",
",",
"max_nlaunch",
"=",
"-",
"1",
",",
"max_loops",
"=",
"1",
",",
"sleep_time",
"=",
"5",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"check_pid_file",
"(",
")",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.single_shot | Use :class:`PyLauncher` to submits one task.
kwargs contains the options passed to the launcher.
Return:
number of tasks submitted. | pymatgen/io/abinit/flows.py | def single_shot(self, check_status=True, **kwargs):
"""
Use :class:`PyLauncher` to submits one task.
kwargs contains the options passed to the launcher.
Return:
number of tasks submitted.
"""
self.check_pid_file()
self.set_spectator_mode(False)
... | def single_shot(self, check_status=True, **kwargs):
"""
Use :class:`PyLauncher` to submits one task.
kwargs contains the options passed to the launcher.
Return:
number of tasks submitted.
"""
self.check_pid_file()
self.set_spectator_mode(False)
... | [
"Use",
":",
"class",
":",
"PyLauncher",
"to",
"submits",
"one",
"task",
".",
"kwargs",
"contains",
"the",
"options",
"passed",
"to",
"the",
"launcher",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2084-L2096 | [
"def",
"single_shot",
"(",
"self",
",",
"check_status",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"check_pid_file",
"(",
")",
"self",
".",
"set_spectator_mode",
"(",
"False",
")",
"if",
"check_status",
":",
"self",
".",
"check_status",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.make_scheduler | Build a return a :class:`PyFlowScheduler` to run the flow.
Args:
kwargs: if empty we use the user configuration file.
if `filepath` in kwargs we init the scheduler from filepath.
else pass **kwargs to :class:`PyFlowScheduler` __init__ method. | pymatgen/io/abinit/flows.py | def make_scheduler(self, **kwargs):
"""
Build a return a :class:`PyFlowScheduler` to run the flow.
Args:
kwargs: if empty we use the user configuration file.
if `filepath` in kwargs we init the scheduler from filepath.
else pass **kwargs to :c... | def make_scheduler(self, **kwargs):
"""
Build a return a :class:`PyFlowScheduler` to run the flow.
Args:
kwargs: if empty we use the user configuration file.
if `filepath` in kwargs we init the scheduler from filepath.
else pass **kwargs to :c... | [
"Build",
"a",
"return",
"a",
":",
"class",
":",
"PyFlowScheduler",
"to",
"run",
"the",
"flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2098-L2121 | [
"def",
"make_scheduler",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"launcher",
"import",
"PyFlowScheduler",
"if",
"not",
"kwargs",
":",
"# User config if kwargs is empty",
"sched",
"=",
"PyFlowScheduler",
".",
"from_user_config",
"(",
")",
"el... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.batch | Run the flow in batch mode, return exit status of the job script.
Requires a manager.yml file and a batch_adapter adapter.
Args:
timelimit: Time limit (int with seconds or string with time given with the slurm convention:
"days-hours:minutes:seconds"). If timelimit is None, the ... | pymatgen/io/abinit/flows.py | def batch(self, timelimit=None):
"""
Run the flow in batch mode, return exit status of the job script.
Requires a manager.yml file and a batch_adapter adapter.
Args:
timelimit: Time limit (int with seconds or string with time given with the slurm convention:
"day... | def batch(self, timelimit=None):
"""
Run the flow in batch mode, return exit status of the job script.
Requires a manager.yml file and a batch_adapter adapter.
Args:
timelimit: Time limit (int with seconds or string with time given with the slurm convention:
"day... | [
"Run",
"the",
"flow",
"in",
"batch",
"mode",
"return",
"exit",
"status",
"of",
"the",
"job",
"script",
".",
"Requires",
"a",
"manager",
".",
"yml",
"file",
"and",
"a",
"batch_adapter",
"adapter",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2123-L2139 | [
"def",
"batch",
"(",
"self",
",",
"timelimit",
"=",
"None",
")",
":",
"from",
".",
"launcher",
"import",
"BatchLauncher",
"# Create a batch dir from the flow.workdir.",
"prev_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"*",
"self",
".",
"workdir",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.make_light_tarfile | Lightweight tarball file. Mainly used for debugging. Return the name of the tarball file. | pymatgen/io/abinit/flows.py | def make_light_tarfile(self, name=None):
"""Lightweight tarball file. Mainly used for debugging. Return the name of the tarball file."""
name = os.path.basename(self.workdir) + "-light.tar.gz" if name is None else name
return self.make_tarfile(name=name, exclude_dirs=["outdata", "indata", "tmpda... | def make_light_tarfile(self, name=None):
"""Lightweight tarball file. Mainly used for debugging. Return the name of the tarball file."""
name = os.path.basename(self.workdir) + "-light.tar.gz" if name is None else name
return self.make_tarfile(name=name, exclude_dirs=["outdata", "indata", "tmpda... | [
"Lightweight",
"tarball",
"file",
".",
"Mainly",
"used",
"for",
"debugging",
".",
"Return",
"the",
"name",
"of",
"the",
"tarball",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2141-L2144 | [
"def",
"make_light_tarfile",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"self",
".",
"workdir",
")",
"+",
"\"-light.tar.gz\"",
"if",
"name",
"is",
"None",
"else",
"name",
"return",
"self",
"."... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.make_tarfile | Create a tarball file.
Args:
name: Name of the tarball file. Set to os.path.basename(`flow.workdir`) + "tar.gz"` if name is None.
max_filesize (int or string with unit): a file is included in the tar file if its size <= max_filesize
Can be specified in bytes e.g. `max_fi... | pymatgen/io/abinit/flows.py | def make_tarfile(self, name=None, max_filesize=None, exclude_exts=None, exclude_dirs=None, verbose=0, **kwargs):
"""
Create a tarball file.
Args:
name: Name of the tarball file. Set to os.path.basename(`flow.workdir`) + "tar.gz"` if name is None.
max_filesize (int or str... | def make_tarfile(self, name=None, max_filesize=None, exclude_exts=None, exclude_dirs=None, verbose=0, **kwargs):
"""
Create a tarball file.
Args:
name: Name of the tarball file. Set to os.path.basename(`flow.workdir`) + "tar.gz"` if name is None.
max_filesize (int or str... | [
"Create",
"a",
"tarball",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2146-L2225 | [
"def",
"make_tarfile",
"(",
"self",
",",
"name",
"=",
"None",
",",
"max_filesize",
"=",
"None",
",",
"exclude_exts",
"=",
"None",
",",
"exclude_dirs",
"=",
"None",
",",
"verbose",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"any2bytes",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.get_graphviz | Generate flow graph in the DOT language.
Args:
engine: Layout command used. ['dot', 'neato', 'twopi', 'circo', 'fdp', 'sfdp', 'patchwork', 'osage']
graph_attr: Mapping of (attribute, value) pairs for the graph.
node_attr: Mapping of (attribute, value) pairs set for all nodes... | pymatgen/io/abinit/flows.py | def get_graphviz(self, engine="automatic", graph_attr=None, node_attr=None, edge_attr=None):
"""
Generate flow graph in the DOT language.
Args:
engine: Layout command used. ['dot', 'neato', 'twopi', 'circo', 'fdp', 'sfdp', 'patchwork', 'osage']
graph_attr: Mapping of (at... | def get_graphviz(self, engine="automatic", graph_attr=None, node_attr=None, edge_attr=None):
"""
Generate flow graph in the DOT language.
Args:
engine: Layout command used. ['dot', 'neato', 'twopi', 'circo', 'fdp', 'sfdp', 'patchwork', 'osage']
graph_attr: Mapping of (at... | [
"Generate",
"flow",
"graph",
"in",
"the",
"DOT",
"language",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2236-L2337 | [
"def",
"get_graphviz",
"(",
"self",
",",
"engine",
"=",
"\"automatic\"",
",",
"graph_attr",
"=",
"None",
",",
"node_attr",
"=",
"None",
",",
"edge_attr",
"=",
"None",
")",
":",
"self",
".",
"allocate",
"(",
")",
"from",
"graphviz",
"import",
"Digraph",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.graphviz_imshow | Generate flow graph in the DOT language and plot it with matplotlib.
Args:
ax: matplotlib :class:`Axes` or None if a new figure should be created.
figsize: matplotlib figure size (None to use default)
dpi: DPI value.
fmt: Select format for output image
R... | pymatgen/io/abinit/flows.py | def graphviz_imshow(self, ax=None, figsize=None, dpi=300, fmt="png", **kwargs):
"""
Generate flow graph in the DOT language and plot it with matplotlib.
Args:
ax: matplotlib :class:`Axes` or None if a new figure should be created.
figsize: matplotlib figure size (None to... | def graphviz_imshow(self, ax=None, figsize=None, dpi=300, fmt="png", **kwargs):
"""
Generate flow graph in the DOT language and plot it with matplotlib.
Args:
ax: matplotlib :class:`Axes` or None if a new figure should be created.
figsize: matplotlib figure size (None to... | [
"Generate",
"flow",
"graph",
"in",
"the",
"DOT",
"language",
"and",
"plot",
"it",
"with",
"matplotlib",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2340-L2363 | [
"def",
"graphviz_imshow",
"(",
"self",
",",
"ax",
"=",
"None",
",",
"figsize",
"=",
"None",
",",
"dpi",
"=",
"300",
",",
"fmt",
"=",
"\"png\"",
",",
"*",
"*",
"kwargs",
")",
":",
"graph",
"=",
"self",
".",
"get_graphviz",
"(",
"*",
"*",
"kwargs",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Flow.plot_networkx | Use networkx to draw the flow with the connections among the nodes and
the status of the tasks.
Args:
mode: `networkx` to show connections, `status` to group tasks by status.
with_edge_labels: True to draw edge labels.
ax: matplotlib :class:`Axes` or None if a new fi... | pymatgen/io/abinit/flows.py | def plot_networkx(self, mode="network", with_edge_labels=False, ax=None, arrows=False,
node_size="num_cores", node_label="name_class", layout_type="spring", **kwargs):
"""
Use networkx to draw the flow with the connections among the nodes and
the status of the tasks.
... | def plot_networkx(self, mode="network", with_edge_labels=False, ax=None, arrows=False,
node_size="num_cores", node_label="name_class", layout_type="spring", **kwargs):
"""
Use networkx to draw the flow with the connections among the nodes and
the status of the tasks.
... | [
"Use",
"networkx",
"to",
"draw",
"the",
"flow",
"with",
"the",
"connections",
"among",
"the",
"nodes",
"and",
"the",
"status",
"of",
"the",
"tasks",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2366-L2490 | [
"def",
"plot_networkx",
"(",
"self",
",",
"mode",
"=",
"\"network\"",
",",
"with_edge_labels",
"=",
"False",
",",
"ax",
"=",
"None",
",",
"arrows",
"=",
"False",
",",
"node_size",
"=",
"\"num_cores\"",
",",
"node_label",
"=",
"\"name_class\"",
",",
"layout_t... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | G0W0WithQptdmFlow.cbk_qptdm_workflow | This callback is executed by the flow when bands_work.nscf_task reaches S_OK.
It computes the list of q-points for the W(q,G,G'), creates nqpt tasks
in the second work (QptdmWork), and connect the signals. | pymatgen/io/abinit/flows.py | def cbk_qptdm_workflow(self, cbk):
"""
This callback is executed by the flow when bands_work.nscf_task reaches S_OK.
It computes the list of q-points for the W(q,G,G'), creates nqpt tasks
in the second work (QptdmWork), and connect the signals.
"""
scr_input = cbk.data["... | def cbk_qptdm_workflow(self, cbk):
"""
This callback is executed by the flow when bands_work.nscf_task reaches S_OK.
It computes the list of q-points for the W(q,G,G'), creates nqpt tasks
in the second work (QptdmWork), and connect the signals.
"""
scr_input = cbk.data["... | [
"This",
"callback",
"is",
"executed",
"by",
"the",
"flow",
"when",
"bands_work",
".",
"nscf_task",
"reaches",
"S_OK",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2530-L2558 | [
"def",
"cbk_qptdm_workflow",
"(",
"self",
",",
"cbk",
")",
":",
"scr_input",
"=",
"cbk",
".",
"data",
"[",
"\"input\"",
"]",
"# Use the WFK file produced by the second",
"# Task in the first Work (NSCF step).",
"nscf_task",
"=",
"self",
"[",
"0",
"]",
"[",
"1",
"]... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | FlowCallback.can_execute | True if we can execute the callback. | pymatgen/io/abinit/flows.py | def can_execute(self):
"""True if we can execute the callback."""
return not self._disabled and all(dep.status == dep.node.S_OK for dep in self.deps) | def can_execute(self):
"""True if we can execute the callback."""
return not self._disabled and all(dep.status == dep.node.S_OK for dep in self.deps) | [
"True",
"if",
"we",
"can",
"execute",
"the",
"callback",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2620-L2622 | [
"def",
"can_execute",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"_disabled",
"and",
"all",
"(",
"dep",
".",
"status",
"==",
"dep",
".",
"node",
".",
"S_OK",
"for",
"dep",
"in",
"self",
".",
"deps",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononFlow.from_scf_input | Create a `PhononFlow` for phonon calculations from an `AbinitInput` defining a ground-state run.
Args:
workdir: Working directory of the flow.
scf_input: :class:`AbinitInput` object with the parameters for the GS-SCF run.
ph_ngqpt: q-mesh for phonons. Must be a sub-mesh of t... | pymatgen/io/abinit/flows.py | def from_scf_input(cls, workdir, scf_input, ph_ngqpt, with_becs=True, manager=None, allocate=True):
"""
Create a `PhononFlow` for phonon calculations from an `AbinitInput` defining a ground-state run.
Args:
workdir: Working directory of the flow.
scf_input: :class:`Abini... | def from_scf_input(cls, workdir, scf_input, ph_ngqpt, with_becs=True, manager=None, allocate=True):
"""
Create a `PhononFlow` for phonon calculations from an `AbinitInput` defining a ground-state run.
Args:
workdir: Working directory of the flow.
scf_input: :class:`Abini... | [
"Create",
"a",
"PhononFlow",
"for",
"phonon",
"calculations",
"from",
"an",
"AbinitInput",
"defining",
"a",
"ground",
"-",
"state",
"run",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2715-L2758 | [
"def",
"from_scf_input",
"(",
"cls",
",",
"workdir",
",",
"scf_input",
",",
"ph_ngqpt",
",",
"with_becs",
"=",
"True",
",",
"manager",
"=",
"None",
",",
"allocate",
"=",
"True",
")",
":",
"flow",
"=",
"cls",
"(",
"workdir",
",",
"manager",
"=",
"manage... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononFlow.open_final_ddb | Open the DDB file located in the output directory of the flow.
Return:
:class:`DdbFile` object, None if file could not be found or file is not readable. | pymatgen/io/abinit/flows.py | def open_final_ddb(self):
"""
Open the DDB file located in the output directory of the flow.
Return:
:class:`DdbFile` object, None if file could not be found or file is not readable.
"""
ddb_path = self.outdir.has_abiext("DDB")
if not ddb_path:
if... | def open_final_ddb(self):
"""
Open the DDB file located in the output directory of the flow.
Return:
:class:`DdbFile` object, None if file could not be found or file is not readable.
"""
ddb_path = self.outdir.has_abiext("DDB")
if not ddb_path:
if... | [
"Open",
"the",
"DDB",
"file",
"located",
"in",
"the",
"output",
"directory",
"of",
"the",
"flow",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2760-L2778 | [
"def",
"open_final_ddb",
"(",
"self",
")",
":",
"ddb_path",
"=",
"self",
".",
"outdir",
".",
"has_abiext",
"(",
"\"DDB\"",
")",
"if",
"not",
"ddb_path",
":",
"if",
"self",
".",
"status",
"==",
"self",
".",
"S_OK",
":",
"logger",
".",
"critical",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononFlow.finalize | This method is called when the flow is completed. | pymatgen/io/abinit/flows.py | def finalize(self):
"""This method is called when the flow is completed."""
# Merge all the out_DDB files found in work.outdir.
ddb_files = list(filter(None, [work.outdir.has_abiext("DDB") for work in self]))
# Final DDB file will be produced in the outdir of the work.
out_ddb =... | def finalize(self):
"""This method is called when the flow is completed."""
# Merge all the out_DDB files found in work.outdir.
ddb_files = list(filter(None, [work.outdir.has_abiext("DDB") for work in self]))
# Final DDB file will be produced in the outdir of the work.
out_ddb =... | [
"This",
"method",
"is",
"called",
"when",
"the",
"flow",
"is",
"completed",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2780-L2795 | [
"def",
"finalize",
"(",
"self",
")",
":",
"# Merge all the out_DDB files found in work.outdir.",
"ddb_files",
"=",
"list",
"(",
"filter",
"(",
"None",
",",
"[",
"work",
".",
"outdir",
".",
"has_abiext",
"(",
"\"DDB\"",
")",
"for",
"work",
"in",
"self",
"]",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | NonLinearCoeffFlow.from_scf_input | Create a `NonlinearFlow` for second order susceptibility calculations from
an `AbinitInput` defining a ground-state run.
Args:
workdir: Working directory of the flow.
scf_input: :class:`AbinitInput` object with the parameters for the GS-SCF run.
manager: :class:`Task... | pymatgen/io/abinit/flows.py | def from_scf_input(cls, workdir, scf_input, manager=None, allocate=True):
"""
Create a `NonlinearFlow` for second order susceptibility calculations from
an `AbinitInput` defining a ground-state run.
Args:
workdir: Working directory of the flow.
scf_input: :class:... | def from_scf_input(cls, workdir, scf_input, manager=None, allocate=True):
"""
Create a `NonlinearFlow` for second order susceptibility calculations from
an `AbinitInput` defining a ground-state run.
Args:
workdir: Working directory of the flow.
scf_input: :class:... | [
"Create",
"a",
"NonlinearFlow",
"for",
"second",
"order",
"susceptibility",
"calculations",
"from",
"an",
"AbinitInput",
"defining",
"a",
"ground",
"-",
"state",
"run",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L2807-L2832 | [
"def",
"from_scf_input",
"(",
"cls",
",",
"workdir",
",",
"scf_input",
",",
"manager",
"=",
"None",
",",
"allocate",
"=",
"True",
")",
":",
"flow",
"=",
"cls",
"(",
"workdir",
",",
"manager",
"=",
"manager",
")",
"flow",
".",
"register_scf_task",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.from_global_moment_and_saxis | Convenience method to initialize Magmom from a given global
magnetic moment, i.e. magnetic moment with saxis=(0,0,1), and
provided saxis.
Method is useful if you do not know the components of your
magnetic moment in frame of your desired saxis.
:param global_mom... | pymatgen/electronic_structure/core.py | def from_global_moment_and_saxis(cls, global_moment, saxis):
"""
Convenience method to initialize Magmom from a given global
magnetic moment, i.e. magnetic moment with saxis=(0,0,1), and
provided saxis.
Method is useful if you do not know the components of your
m... | def from_global_moment_and_saxis(cls, global_moment, saxis):
"""
Convenience method to initialize Magmom from a given global
magnetic moment, i.e. magnetic moment with saxis=(0,0,1), and
provided saxis.
Method is useful if you do not know the components of your
m... | [
"Convenience",
"method",
"to",
"initialize",
"Magmom",
"from",
"a",
"given",
"global",
"magnetic",
"moment",
"i",
".",
"e",
".",
"magnetic",
"moment",
"with",
"saxis",
"=",
"(",
"0",
"0",
"1",
")",
"and",
"provided",
"saxis",
".",
"Method",
"is",
"useful... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L163-L177 | [
"def",
"from_global_moment_and_saxis",
"(",
"cls",
",",
"global_moment",
",",
"saxis",
")",
":",
"magmom",
"=",
"Magmom",
"(",
"global_moment",
")",
"return",
"cls",
"(",
"magmom",
".",
"get_moment",
"(",
"saxis",
"=",
"saxis",
")",
",",
"saxis",
"=",
"sax... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.get_moment | Get magnetic moment relative to a given spin quantization axis.
If no axis is provided, moment will be given relative to the
Magmom's internal spin quantization axis, i.e. equivalent to
Magmom.moment
:param axis: (list/numpy array) spin quantization axis
:return: np.ndarray of l... | pymatgen/electronic_structure/core.py | def get_moment(self, saxis=(0, 0, 1)):
"""
Get magnetic moment relative to a given spin quantization axis.
If no axis is provided, moment will be given relative to the
Magmom's internal spin quantization axis, i.e. equivalent to
Magmom.moment
:param axis: (list/numpy arr... | def get_moment(self, saxis=(0, 0, 1)):
"""
Get magnetic moment relative to a given spin quantization axis.
If no axis is provided, moment will be given relative to the
Magmom's internal spin quantization axis, i.e. equivalent to
Magmom.moment
:param axis: (list/numpy arr... | [
"Get",
"magnetic",
"moment",
"relative",
"to",
"a",
"given",
"spin",
"quantization",
"axis",
".",
"If",
"no",
"axis",
"is",
"provided",
"moment",
"will",
"be",
"given",
"relative",
"to",
"the",
"Magmom",
"s",
"internal",
"spin",
"quantization",
"axis",
"i",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L215-L237 | [
"def",
"get_moment",
"(",
"self",
",",
"saxis",
"=",
"(",
"0",
",",
"0",
",",
"1",
")",
")",
":",
"# transform back to moment with spin axis [0, 0, 1]",
"m_inv",
"=",
"self",
".",
"_get_transformation_matrix_inv",
"(",
"self",
".",
"saxis",
")",
"moment",
"=",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.get_00t_magmom_with_xyz_saxis | For internal implementation reasons, in non-collinear calculations
VASP prefers:
MAGMOM = 0 0 total_magnetic_moment
SAXIS = x y z
to an equivalent:
MAGMOM = x y z
SAXIS = 0 0 1
This method returns a Magmom object with magnetic moment [0, 0, t],
where t... | pymatgen/electronic_structure/core.py | def get_00t_magmom_with_xyz_saxis(self):
"""
For internal implementation reasons, in non-collinear calculations
VASP prefers:
MAGMOM = 0 0 total_magnetic_moment
SAXIS = x y z
to an equivalent:
MAGMOM = x y z
SAXIS = 0 0 1
This method returns a ... | def get_00t_magmom_with_xyz_saxis(self):
"""
For internal implementation reasons, in non-collinear calculations
VASP prefers:
MAGMOM = 0 0 total_magnetic_moment
SAXIS = x y z
to an equivalent:
MAGMOM = x y z
SAXIS = 0 0 1
This method returns a ... | [
"For",
"internal",
"implementation",
"reasons",
"in",
"non",
"-",
"collinear",
"calculations",
"VASP",
"prefers",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L267-L304 | [
"def",
"get_00t_magmom_with_xyz_saxis",
"(",
"self",
")",
":",
"# reference direction gives sign of moment",
"# entirely arbitrary, there will always be a pathological case",
"# where a consistent sign is not possible if the magnetic moments",
"# are aligned along the reference direction, but in p... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.have_consistent_saxis | This method checks that all Magmom objects in a list have a
consistent spin quantization axis. To write MAGMOM tags to a
VASP INCAR, a global SAXIS value for all magmoms has to be used.
If saxis are inconsistent, can create consistent set with:
Magmom.get_consistent_set(magmoms)
... | pymatgen/electronic_structure/core.py | def have_consistent_saxis(magmoms):
"""
This method checks that all Magmom objects in a list have a
consistent spin quantization axis. To write MAGMOM tags to a
VASP INCAR, a global SAXIS value for all magmoms has to be used.
If saxis are inconsistent, can create consistent set w... | def have_consistent_saxis(magmoms):
"""
This method checks that all Magmom objects in a list have a
consistent spin quantization axis. To write MAGMOM tags to a
VASP INCAR, a global SAXIS value for all magmoms has to be used.
If saxis are inconsistent, can create consistent set w... | [
"This",
"method",
"checks",
"that",
"all",
"Magmom",
"objects",
"in",
"a",
"list",
"have",
"a",
"consistent",
"spin",
"quantization",
"axis",
".",
"To",
"write",
"MAGMOM",
"tags",
"to",
"a",
"VASP",
"INCAR",
"a",
"global",
"SAXIS",
"value",
"for",
"all",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L307-L324 | [
"def",
"have_consistent_saxis",
"(",
"magmoms",
")",
":",
"magmoms",
"=",
"[",
"Magmom",
"(",
"magmom",
")",
"for",
"magmom",
"in",
"magmoms",
"]",
"ref_saxis",
"=",
"magmoms",
"[",
"0",
"]",
".",
"saxis",
"match_ref",
"=",
"[",
"magmom",
".",
"saxis",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.get_consistent_set_and_saxis | Method to ensure a list of magmoms use the same spin axis.
Returns a tuple of a list of Magmoms and their global spin axis.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:param saxis: can provide a specific global spin axis
:return: (list of Magmoms, global spin axis) tu... | pymatgen/electronic_structure/core.py | def get_consistent_set_and_saxis(magmoms, saxis=None):
"""
Method to ensure a list of magmoms use the same spin axis.
Returns a tuple of a list of Magmoms and their global spin axis.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:param saxis: can provide a specif... | def get_consistent_set_and_saxis(magmoms, saxis=None):
"""
Method to ensure a list of magmoms use the same spin axis.
Returns a tuple of a list of Magmoms and their global spin axis.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:param saxis: can provide a specif... | [
"Method",
"to",
"ensure",
"a",
"list",
"of",
"magmoms",
"use",
"the",
"same",
"spin",
"axis",
".",
"Returns",
"a",
"tuple",
"of",
"a",
"list",
"of",
"Magmoms",
"and",
"their",
"global",
"spin",
"axis",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L327-L342 | [
"def",
"get_consistent_set_and_saxis",
"(",
"magmoms",
",",
"saxis",
"=",
"None",
")",
":",
"magmoms",
"=",
"[",
"Magmom",
"(",
"magmom",
")",
"for",
"magmom",
"in",
"magmoms",
"]",
"if",
"saxis",
"is",
"None",
":",
"saxis",
"=",
"Magmom",
".",
"get_sugg... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.get_suggested_saxis | This method returns a suggested spin axis for a set of magmoms,
taking the largest magnetic moment as the reference. For calculations
with collinear spins, this would give a sensible saxis for a ncl
calculation.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:retu... | pymatgen/electronic_structure/core.py | def get_suggested_saxis(magmoms):
"""
This method returns a suggested spin axis for a set of magmoms,
taking the largest magnetic moment as the reference. For calculations
with collinear spins, this would give a sensible saxis for a ncl
calculation.
:param magmoms: list ... | def get_suggested_saxis(magmoms):
"""
This method returns a suggested spin axis for a set of magmoms,
taking the largest magnetic moment as the reference. For calculations
with collinear spins, this would give a sensible saxis for a ncl
calculation.
:param magmoms: list ... | [
"This",
"method",
"returns",
"a",
"suggested",
"spin",
"axis",
"for",
"a",
"set",
"of",
"magmoms",
"taking",
"the",
"largest",
"magnetic",
"moment",
"as",
"the",
"reference",
".",
"For",
"calculations",
"with",
"collinear",
"spins",
"this",
"would",
"give",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L345-L368 | [
"def",
"get_suggested_saxis",
"(",
"magmoms",
")",
":",
"# heuristic, will pick largest magmom as reference",
"# useful for creating collinear approximations of",
"# e.g. slightly canted magnetic structures",
"# for fully collinear structures, will return expected",
"# result",
"magmoms",
"=... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.are_collinear | Method checks to see if a set of magnetic moments are collinear
with each other.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:return: bool | pymatgen/electronic_structure/core.py | def are_collinear(magmoms):
"""
Method checks to see if a set of magnetic moments are collinear
with each other.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:return: bool
"""
magmoms = [Magmom(magmom) for magmom in magmoms]
if not Magmom.... | def are_collinear(magmoms):
"""
Method checks to see if a set of magnetic moments are collinear
with each other.
:param magmoms: list of magmoms (Magmoms, scalars or vectors)
:return: bool
"""
magmoms = [Magmom(magmom) for magmom in magmoms]
if not Magmom.... | [
"Method",
"checks",
"to",
"see",
"if",
"a",
"set",
"of",
"magnetic",
"moments",
"are",
"collinear",
"with",
"each",
"other",
".",
":",
"param",
"magmoms",
":",
"list",
"of",
"magmoms",
"(",
"Magmoms",
"scalars",
"or",
"vectors",
")",
":",
"return",
":",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L371-L395 | [
"def",
"are_collinear",
"(",
"magmoms",
")",
":",
"magmoms",
"=",
"[",
"Magmom",
"(",
"magmom",
")",
"for",
"magmom",
"in",
"magmoms",
"]",
"if",
"not",
"Magmom",
".",
"have_consistent_saxis",
"(",
"magmoms",
")",
":",
"magmoms",
"=",
"Magmom",
".",
"get... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.from_moment_relative_to_crystal_axes | Obtaining a Magmom object from a magnetic moment provided
relative to crystal axes.
Used for obtaining moments from magCIF file.
:param magmom: list of floats specifying vector magmom
:param lattice: Lattice
:return: Magmom | pymatgen/electronic_structure/core.py | def from_moment_relative_to_crystal_axes(cls, moment, lattice):
"""
Obtaining a Magmom object from a magnetic moment provided
relative to crystal axes.
Used for obtaining moments from magCIF file.
:param magmom: list of floats specifying vector magmom
:param lattice: Lat... | def from_moment_relative_to_crystal_axes(cls, moment, lattice):
"""
Obtaining a Magmom object from a magnetic moment provided
relative to crystal axes.
Used for obtaining moments from magCIF file.
:param magmom: list of floats specifying vector magmom
:param lattice: Lat... | [
"Obtaining",
"a",
"Magmom",
"object",
"from",
"a",
"magnetic",
"moment",
"provided",
"relative",
"to",
"crystal",
"axes",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L398-L413 | [
"def",
"from_moment_relative_to_crystal_axes",
"(",
"cls",
",",
"moment",
",",
"lattice",
")",
":",
"# get matrix representing unit lattice vectors",
"unit_m",
"=",
"lattice",
".",
"matrix",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
"lattice",
".",
"matrix",
","... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Magmom.get_moment_relative_to_crystal_axes | If scalar magmoms, moments will be given arbitrarily along z.
Used for writing moments to magCIF file.
:param magmom: Magmom
:param lattice: Lattice
:return: vector as list of floats | pymatgen/electronic_structure/core.py | def get_moment_relative_to_crystal_axes(self, lattice):
"""
If scalar magmoms, moments will be given arbitrarily along z.
Used for writing moments to magCIF file.
:param magmom: Magmom
:param lattice: Lattice
:return: vector as list of floats
"""
# get ma... | def get_moment_relative_to_crystal_axes(self, lattice):
"""
If scalar magmoms, moments will be given arbitrarily along z.
Used for writing moments to magCIF file.
:param magmom: Magmom
:param lattice: Lattice
:return: vector as list of floats
"""
# get ma... | [
"If",
"scalar",
"magmoms",
"moments",
"will",
"be",
"given",
"arbitrarily",
"along",
"z",
".",
"Used",
"for",
"writing",
"moments",
"to",
"magCIF",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/electronic_structure/core.py#L415-L430 | [
"def",
"get_moment_relative_to_crystal_axes",
"(",
"self",
",",
"lattice",
")",
":",
"# get matrix representing unit lattice vectors",
"unit_m",
"=",
"lattice",
".",
"matrix",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
"lattice",
".",
"matrix",
",",
"axis",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_structure_from_mp | Convenience method to get a crystal from the Materials Project database via
the API. Requires PMG_MAPI_KEY to be set.
Args:
formula (str): A formula
Returns:
(Structure) The lowest energy structure in Materials Project with that
formula. | pymatgen/__init__.py | def get_structure_from_mp(formula):
"""
Convenience method to get a crystal from the Materials Project database via
the API. Requires PMG_MAPI_KEY to be set.
Args:
formula (str): A formula
Returns:
(Structure) The lowest energy structure in Materials Project with that
f... | def get_structure_from_mp(formula):
"""
Convenience method to get a crystal from the Materials Project database via
the API. Requires PMG_MAPI_KEY to be set.
Args:
formula (str): A formula
Returns:
(Structure) The lowest energy structure in Materials Project with that
f... | [
"Convenience",
"method",
"to",
"get",
"a",
"crystal",
"from",
"the",
"Materials",
"Project",
"database",
"via",
"the",
"API",
".",
"Requires",
"PMG_MAPI_KEY",
"to",
"be",
"set",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/__init__.py#L52-L73 | [
"def",
"get_structure_from_mp",
"(",
"formula",
")",
":",
"m",
"=",
"MPRester",
"(",
")",
"entries",
"=",
"m",
".",
"get_entries",
"(",
"formula",
",",
"inc_structure",
"=",
"\"final\"",
")",
"if",
"len",
"(",
"entries",
")",
"==",
"0",
":",
"raise",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | loadfn | Convenience method to perform quick loading of data from a filename. The
type of object returned depends the file type.
Args:
fname (string): A filename.
Returns:
Note that fname is matched using unix-style, i.e., fnmatch.
(Structure) if *POSCAR*/*CONTCAR*/*.cif
(Vasprun) *... | pymatgen/__init__.py | def loadfn(fname):
"""
Convenience method to perform quick loading of data from a filename. The
type of object returned depends the file type.
Args:
fname (string): A filename.
Returns:
Note that fname is matched using unix-style, i.e., fnmatch.
(Structure) if *POSCAR*/*CON... | def loadfn(fname):
"""
Convenience method to perform quick loading of data from a filename. The
type of object returned depends the file type.
Args:
fname (string): A filename.
Returns:
Note that fname is matched using unix-style, i.e., fnmatch.
(Structure) if *POSCAR*/*CON... | [
"Convenience",
"method",
"to",
"perform",
"quick",
"loading",
"of",
"data",
"from",
"a",
"filename",
".",
"The",
"type",
"of",
"object",
"returned",
"depends",
"the",
"file",
"type",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/__init__.py#L82-L104 | [
"def",
"loadfn",
"(",
"fname",
")",
":",
"if",
"(",
"fnmatch",
"(",
"fname",
",",
"\"*POSCAR*\"",
")",
"or",
"fnmatch",
"(",
"fname",
",",
"\"*CONTCAR*\"",
")",
"or",
"\".cif\"",
"in",
"fname",
".",
"lower",
"(",
")",
")",
"or",
"fnmatch",
"(",
"fnam... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | order_assimilation | Internal helper method for BorgQueen to process assimilation | pymatgen/apps/borg/queen.py | def order_assimilation(args):
"""
Internal helper method for BorgQueen to process assimilation
"""
(path, drone, data, status) = args
newdata = drone.assimilate(path)
if newdata:
data.append(json.dumps(newdata, cls=MontyEncoder))
status['count'] += 1
count = status['count']
t... | def order_assimilation(args):
"""
Internal helper method for BorgQueen to process assimilation
"""
(path, drone, data, status) = args
newdata = drone.assimilate(path)
if newdata:
data.append(json.dumps(newdata, cls=MontyEncoder))
status['count'] += 1
count = status['count']
t... | [
"Internal",
"helper",
"method",
"for",
"BorgQueen",
"to",
"process",
"assimilation"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L131-L143 | [
"def",
"order_assimilation",
"(",
"args",
")",
":",
"(",
"path",
",",
"drone",
",",
"data",
",",
"status",
")",
"=",
"args",
"newdata",
"=",
"drone",
".",
"assimilate",
"(",
"path",
")",
"if",
"newdata",
":",
"data",
".",
"append",
"(",
"json",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BorgQueen.parallel_assimilate | Assimilate the entire subdirectory structure in rootpath. | pymatgen/apps/borg/queen.py | def parallel_assimilate(self, rootpath):
"""
Assimilate the entire subdirectory structure in rootpath.
"""
logger.info('Scanning for valid paths...')
valid_paths = []
for (parent, subdirs, files) in os.walk(rootpath):
valid_paths.extend(self._drone.get_valid_p... | def parallel_assimilate(self, rootpath):
"""
Assimilate the entire subdirectory structure in rootpath.
"""
logger.info('Scanning for valid paths...')
valid_paths = []
for (parent, subdirs, files) in os.walk(rootpath):
valid_paths.extend(self._drone.get_valid_p... | [
"Assimilate",
"the",
"entire",
"subdirectory",
"structure",
"in",
"rootpath",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L64-L83 | [
"def",
"parallel_assimilate",
"(",
"self",
",",
"rootpath",
")",
":",
"logger",
".",
"info",
"(",
"'Scanning for valid paths...'",
")",
"valid_paths",
"=",
"[",
"]",
"for",
"(",
"parent",
",",
"subdirs",
",",
"files",
")",
"in",
"os",
".",
"walk",
"(",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BorgQueen.serial_assimilate | Assimilate the entire subdirectory structure in rootpath serially. | pymatgen/apps/borg/queen.py | def serial_assimilate(self, rootpath):
"""
Assimilate the entire subdirectory structure in rootpath serially.
"""
valid_paths = []
for (parent, subdirs, files) in os.walk(rootpath):
valid_paths.extend(self._drone.get_valid_paths((parent, subdirs,
... | def serial_assimilate(self, rootpath):
"""
Assimilate the entire subdirectory structure in rootpath serially.
"""
valid_paths = []
for (parent, subdirs, files) in os.walk(rootpath):
valid_paths.extend(self._drone.get_valid_paths((parent, subdirs,
... | [
"Assimilate",
"the",
"entire",
"subdirectory",
"structure",
"in",
"rootpath",
"serially",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L85-L103 | [
"def",
"serial_assimilate",
"(",
"self",
",",
"rootpath",
")",
":",
"valid_paths",
"=",
"[",
"]",
"for",
"(",
"parent",
",",
"subdirs",
",",
"files",
")",
"in",
"os",
".",
"walk",
"(",
"rootpath",
")",
":",
"valid_paths",
".",
"extend",
"(",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BorgQueen.save_data | Save the assimilated data to a file.
Args:
filename (str): filename to save the assimilated data to. Note
that if the filename ends with gz or bz2, the relevant gzip
or bz2 compression will be applied. | pymatgen/apps/borg/queen.py | def save_data(self, filename):
"""
Save the assimilated data to a file.
Args:
filename (str): filename to save the assimilated data to. Note
that if the filename ends with gz or bz2, the relevant gzip
or bz2 compression will be applied.
"""
... | def save_data(self, filename):
"""
Save the assimilated data to a file.
Args:
filename (str): filename to save the assimilated data to. Note
that if the filename ends with gz or bz2, the relevant gzip
or bz2 compression will be applied.
"""
... | [
"Save",
"the",
"assimilated",
"data",
"to",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L111-L121 | [
"def",
"save_data",
"(",
"self",
",",
"filename",
")",
":",
"with",
"zopen",
"(",
"filename",
",",
"\"wt\"",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"list",
"(",
"self",
".",
"_data",
")",
",",
"f",
",",
"cls",
"=",
"MontyEncoder",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BorgQueen.load_data | Load assimilated data from a file | pymatgen/apps/borg/queen.py | def load_data(self, filename):
"""
Load assimilated data from a file
"""
with zopen(filename, "rt") as f:
self._data = json.load(f, cls=MontyDecoder) | def load_data(self, filename):
"""
Load assimilated data from a file
"""
with zopen(filename, "rt") as f:
self._data = json.load(f, cls=MontyDecoder) | [
"Load",
"assimilated",
"data",
"from",
"a",
"file"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L123-L128 | [
"def",
"load_data",
"(",
"self",
",",
"filename",
")",
":",
"with",
"zopen",
"(",
"filename",
",",
"\"rt\"",
")",
"as",
"f",
":",
"self",
".",
"_data",
"=",
"json",
".",
"load",
"(",
"f",
",",
"cls",
"=",
"MontyDecoder",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | eigenvectors_from_displacements | Calculate the eigenvectors from the atomic displacements | pymatgen/phonon/bandstructure.py | def eigenvectors_from_displacements(disp,masses):
"""
Calculate the eigenvectors from the atomic displacements
"""
nphonons,natoms,ndirections = disp.shape
sqrt_masses = np.sqrt(masses)
return np.einsum("nax,a->nax",disp,sqrt_masses) | def eigenvectors_from_displacements(disp,masses):
"""
Calculate the eigenvectors from the atomic displacements
"""
nphonons,natoms,ndirections = disp.shape
sqrt_masses = np.sqrt(masses)
return np.einsum("nax,a->nax",disp,sqrt_masses) | [
"Calculate",
"the",
"eigenvectors",
"from",
"the",
"atomic",
"displacements"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/bandstructure.py#L28-L34 | [
"def",
"eigenvectors_from_displacements",
"(",
"disp",
",",
"masses",
")",
":",
"nphonons",
",",
"natoms",
",",
"ndirections",
"=",
"disp",
".",
"shape",
"sqrt_masses",
"=",
"np",
".",
"sqrt",
"(",
"masses",
")",
"return",
"np",
".",
"einsum",
"(",
"\"nax,... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.