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 | PhononDosPlotter.add_dos | Adds a dos for plotting.
Args:
label:
label for the DOS. Must be unique.
dos:
PhononDos object | pymatgen/phonon/plotter.py | def add_dos(self, label, dos):
"""
Adds a dos for plotting.
Args:
label:
label for the DOS. Must be unique.
dos:
PhononDos object
"""
densities = dos.get_smeared_densities(self.sigma) if self.sigma \
else dos.d... | def add_dos(self, label, dos):
"""
Adds a dos for plotting.
Args:
label:
label for the DOS. Must be unique.
dos:
PhononDos object
"""
densities = dos.get_smeared_densities(self.sigma) if self.sigma \
else dos.d... | [
"Adds",
"a",
"dos",
"for",
"plotting",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L73-L86 | [
"def",
"add_dos",
"(",
"self",
",",
"label",
",",
"dos",
")",
":",
"densities",
"=",
"dos",
".",
"get_smeared_densities",
"(",
"self",
".",
"sigma",
")",
"if",
"self",
".",
"sigma",
"else",
"dos",
".",
"densities",
"self",
".",
"_doses",
"[",
"label",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDosPlotter.add_dos_dict | Add a dictionary of doses, with an optional sorting function for the
keys.
Args:
dos_dict: dict of {label: Dos}
key_sort_func: function used to sort the dos_dict keys. | pymatgen/phonon/plotter.py | def add_dos_dict(self, dos_dict, key_sort_func=None):
"""
Add a dictionary of doses, with an optional sorting function for the
keys.
Args:
dos_dict: dict of {label: Dos}
key_sort_func: function used to sort the dos_dict keys.
"""
if key_sort_func:... | def add_dos_dict(self, dos_dict, key_sort_func=None):
"""
Add a dictionary of doses, with an optional sorting function for the
keys.
Args:
dos_dict: dict of {label: Dos}
key_sort_func: function used to sort the dos_dict keys.
"""
if key_sort_func:... | [
"Add",
"a",
"dictionary",
"of",
"doses",
"with",
"an",
"optional",
"sorting",
"function",
"for",
"the",
"keys",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L88-L102 | [
"def",
"add_dos_dict",
"(",
"self",
",",
"dos_dict",
",",
"key_sort_func",
"=",
"None",
")",
":",
"if",
"key_sort_func",
":",
"keys",
"=",
"sorted",
"(",
"dos_dict",
".",
"keys",
"(",
")",
",",
"key",
"=",
"key_sort_func",
")",
"else",
":",
"keys",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDosPlotter.get_plot | Get a matplotlib plot showing the DOS.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
units: units for the frequencies. Accepted values thz, ev, mev, ha, cm-1, cm^-1. | pymatgen/phonon/plotter.py | def get_plot(self, xlim=None, ylim=None, units="thz"):
"""
Get a matplotlib plot showing the DOS.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
units: units for the frequen... | def get_plot(self, xlim=None, ylim=None, units="thz"):
"""
Get a matplotlib plot showing the DOS.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
units: units for the frequen... | [
"Get",
"a",
"matplotlib",
"plot",
"showing",
"the",
"DOS",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L116-L191 | [
"def",
"get_plot",
"(",
"self",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
",",
"units",
"=",
"\"thz\"",
")",
":",
"u",
"=",
"freq_units",
"(",
"units",
")",
"ncolors",
"=",
"max",
"(",
"3",
",",
"len",
"(",
"self",
".",
"_doses",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDosPlotter.show | Show the plot using matplotlib.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
units: units for the frequencies. Accepted values thz, ev, mev, ha, cm-1, cm^-1. | pymatgen/phonon/plotter.py | def show(self, xlim=None, ylim=None, units="thz"):
"""
Show the plot using matplotlib.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
units: units for the frequencies. Accep... | def show(self, xlim=None, ylim=None, units="thz"):
"""
Show the plot using matplotlib.
Args:
xlim: Specifies the x-axis limits. Set to None for automatic
determination.
ylim: Specifies the y-axis limits.
units: units for the frequencies. Accep... | [
"Show",
"the",
"plot",
"using",
"matplotlib",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L208-L219 | [
"def",
"show",
"(",
"self",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
",",
"units",
"=",
"\"thz\"",
")",
":",
"plt",
"=",
"self",
".",
"get_plot",
"(",
"xlim",
",",
"ylim",
",",
"units",
"=",
"units",
")",
"plt",
".",
"show",
"(",
")"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter._maketicks | utility private method to add ticks to a band structure | pymatgen/phonon/plotter.py | def _maketicks(self, plt):
"""
utility private method to add ticks to a band structure
"""
ticks = self.get_ticks()
# Sanitize only plot the uniq values
uniq_d = []
uniq_l = []
temp_ticks = list(zip(ticks['distance'], ticks['label']))
for i in rang... | def _maketicks(self, plt):
"""
utility private method to add ticks to a band structure
"""
ticks = self.get_ticks()
# Sanitize only plot the uniq values
uniq_d = []
uniq_l = []
temp_ticks = list(zip(ticks['distance'], ticks['label']))
for i in rang... | [
"utility",
"private",
"method",
"to",
"add",
"ticks",
"to",
"a",
"band",
"structure"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L239-L285 | [
"def",
"_maketicks",
"(",
"self",
",",
"plt",
")",
":",
"ticks",
"=",
"self",
".",
"get_ticks",
"(",
")",
"# Sanitize only plot the uniq values",
"uniq_d",
"=",
"[",
"]",
"uniq_l",
"=",
"[",
"]",
"temp_ticks",
"=",
"list",
"(",
"zip",
"(",
"ticks",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter.bs_plot_data | Get the data nicely formatted for a plot
Returns:
A dict of the following format:
ticks: A dict with the 'distances' at which there is a qpoint (the
x axis) and the labels (None if no label)
frequencies: A list (one element for each branch) of frequencies for
... | pymatgen/phonon/plotter.py | def bs_plot_data(self):
"""
Get the data nicely formatted for a plot
Returns:
A dict of the following format:
ticks: A dict with the 'distances' at which there is a qpoint (the
x axis) and the labels (None if no label)
frequencies: A list (one el... | def bs_plot_data(self):
"""
Get the data nicely formatted for a plot
Returns:
A dict of the following format:
ticks: A dict with the 'distances' at which there is a qpoint (the
x axis) and the labels (None if no label)
frequencies: A list (one el... | [
"Get",
"the",
"data",
"nicely",
"formatted",
"for",
"a",
"plot"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L287-L319 | [
"def",
"bs_plot_data",
"(",
"self",
")",
":",
"distance",
"=",
"[",
"]",
"frequency",
"=",
"[",
"]",
"ticks",
"=",
"self",
".",
"get_ticks",
"(",
")",
"for",
"b",
"in",
"self",
".",
"_bs",
".",
"branches",
":",
"frequency",
".",
"append",
"(",
"[",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter.get_plot | Get a matplotlib object for the bandstructure plot.
Args:
ylim: Specify the y-axis (frequency) limits; by default None let
the code choose.
units: units for the frequencies. Accepted values thz, ev, mev, ha, cm-1, cm^-1. | pymatgen/phonon/plotter.py | def get_plot(self, ylim=None, units="thz"):
"""
Get a matplotlib object for the bandstructure plot.
Args:
ylim: Specify the y-axis (frequency) limits; by default None let
the code choose.
units: units for the frequencies. Accepted values thz, ev, mev, ha,... | def get_plot(self, ylim=None, units="thz"):
"""
Get a matplotlib object for the bandstructure plot.
Args:
ylim: Specify the y-axis (frequency) limits; by default None let
the code choose.
units: units for the frequencies. Accepted values thz, ev, mev, ha,... | [
"Get",
"a",
"matplotlib",
"object",
"for",
"the",
"bandstructure",
"plot",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L321-L365 | [
"def",
"get_plot",
"(",
"self",
",",
"ylim",
"=",
"None",
",",
"units",
"=",
"\"thz\"",
")",
":",
"u",
"=",
"freq_units",
"(",
"units",
")",
"plt",
"=",
"pretty_plot",
"(",
"12",
",",
"8",
")",
"band_linewidth",
"=",
"1",
"data",
"=",
"self",
".",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter.save_plot | Save matplotlib plot to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
ylim: Specifies the y-axis limits.
units: units for the frequencies. Accepted values thz, ev, mev, ha, cm-1, cm^-1. | pymatgen/phonon/plotter.py | def save_plot(self, filename, img_format="eps", ylim=None, units="thz"):
"""
Save matplotlib plot to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
ylim: Specifies the y-axis limits.
units: units fo... | def save_plot(self, filename, img_format="eps", ylim=None, units="thz"):
"""
Save matplotlib plot to a file.
Args:
filename: Filename to write to.
img_format: Image format to use. Defaults to EPS.
ylim: Specifies the y-axis limits.
units: units fo... | [
"Save",
"matplotlib",
"plot",
"to",
"a",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L379-L391 | [
"def",
"save_plot",
"(",
"self",
",",
"filename",
",",
"img_format",
"=",
"\"eps\"",
",",
"ylim",
"=",
"None",
",",
"units",
"=",
"\"thz\"",
")",
":",
"plt",
"=",
"self",
".",
"get_plot",
"(",
"ylim",
"=",
"ylim",
",",
"units",
"=",
"units",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter.get_ticks | Get all ticks and labels for a band structure plot.
Returns:
A dict with 'distance': a list of distance at which ticks should
be set and 'label': a list of label for each of those ticks. | pymatgen/phonon/plotter.py | def get_ticks(self):
"""
Get all ticks and labels for a band structure plot.
Returns:
A dict with 'distance': a list of distance at which ticks should
be set and 'label': a list of label for each of those ticks.
"""
tick_distance = []
tick_labels ... | def get_ticks(self):
"""
Get all ticks and labels for a band structure plot.
Returns:
A dict with 'distance': a list of distance at which ticks should
be set and 'label': a list of label for each of those ticks.
"""
tick_distance = []
tick_labels ... | [
"Get",
"all",
"ticks",
"and",
"labels",
"for",
"a",
"band",
"structure",
"plot",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L393-L431 | [
"def",
"get_ticks",
"(",
"self",
")",
":",
"tick_distance",
"=",
"[",
"]",
"tick_labels",
"=",
"[",
"]",
"previous_label",
"=",
"self",
".",
"_bs",
".",
"qpoints",
"[",
"0",
"]",
".",
"label",
"previous_branch",
"=",
"self",
".",
"_bs",
".",
"branches"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter.plot_compare | plot two band structure for comparison. One is in red the other in blue.
The two band structures need to be defined on the same symmetry lines!
and the distance between symmetry lines is
the one of the band structure used to build the PhononBSPlotter
Args:
another PhononBSPl... | pymatgen/phonon/plotter.py | def plot_compare(self, other_plotter):
"""
plot two band structure for comparison. One is in red the other in blue.
The two band structures need to be defined on the same symmetry lines!
and the distance between symmetry lines is
the one of the band structure used to build the Ph... | def plot_compare(self, other_plotter):
"""
plot two band structure for comparison. One is in red the other in blue.
The two band structures need to be defined on the same symmetry lines!
and the distance between symmetry lines is
the one of the band structure used to build the Ph... | [
"plot",
"two",
"band",
"structure",
"for",
"comparison",
".",
"One",
"is",
"in",
"red",
"the",
"other",
"in",
"blue",
".",
"The",
"two",
"band",
"structures",
"need",
"to",
"be",
"defined",
"on",
"the",
"same",
"symmetry",
"lines!",
"and",
"the",
"distan... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L433-L462 | [
"def",
"plot_compare",
"(",
"self",
",",
"other_plotter",
")",
":",
"data_orig",
"=",
"self",
".",
"bs_plot_data",
"(",
")",
"data",
"=",
"other_plotter",
".",
"bs_plot_data",
"(",
")",
"if",
"len",
"(",
"data_orig",
"[",
"'distances'",
"]",
")",
"!=",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononBSPlotter.plot_brillouin | plot the Brillouin zone | pymatgen/phonon/plotter.py | def plot_brillouin(self):
"""
plot the Brillouin zone
"""
# get labels and lines
labels = {}
for q in self._bs.qpoints:
if q.label:
labels[q.label] = q.frac_coords
lines = []
for b in self._bs.branches:
lines.appen... | def plot_brillouin(self):
"""
plot the Brillouin zone
"""
# get labels and lines
labels = {}
for q in self._bs.qpoints:
if q.label:
labels[q.label] = q.frac_coords
lines = []
for b in self._bs.branches:
lines.appen... | [
"plot",
"the",
"Brillouin",
"zone"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L464-L480 | [
"def",
"plot_brillouin",
"(",
"self",
")",
":",
"# get labels and lines",
"labels",
"=",
"{",
"}",
"for",
"q",
"in",
"self",
".",
"_bs",
".",
"qpoints",
":",
"if",
"q",
".",
"label",
":",
"labels",
"[",
"q",
".",
"label",
"]",
"=",
"q",
".",
"frac_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ThermoPlotter._plot_thermo | Plots a thermodynamic property for a generic function from a PhononDos instance.
Args:
func: the thermodynamic function to be used to calculate the property
temperatures: a list of temperatures
factor: a multiplicative factor applied to the thermodynamic property calculated.... | pymatgen/phonon/plotter.py | def _plot_thermo(self, func, temperatures, factor=1, ax=None, ylabel=None, label=None, ylim=None, **kwargs):
"""
Plots a thermodynamic property for a generic function from a PhononDos instance.
Args:
func: the thermodynamic function to be used to calculate the property
t... | def _plot_thermo(self, func, temperatures, factor=1, ax=None, ylabel=None, label=None, ylim=None, **kwargs):
"""
Plots a thermodynamic property for a generic function from a PhononDos instance.
Args:
func: the thermodynamic function to be used to calculate the property
t... | [
"Plots",
"a",
"thermodynamic",
"property",
"for",
"a",
"generic",
"function",
"from",
"a",
"PhononDos",
"instance",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L499-L538 | [
"def",
"_plot_thermo",
"(",
"self",
",",
"func",
",",
"temperatures",
",",
"factor",
"=",
"1",
",",
"ax",
"=",
"None",
",",
"ylabel",
"=",
"None",
",",
"label",
"=",
"None",
",",
"ylim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ThermoPlotter.plot_cv | Plots the constant volume specific heat C_v in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
kwargs: kwargs passed to the matplotlib function 'plot'.
... | pymatgen/phonon/plotter.py | def plot_cv(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the constant volume specific heat C_v in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis l... | def plot_cv(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the constant volume specific heat C_v in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis l... | [
"Plots",
"the",
"constant",
"volume",
"specific",
"heat",
"C_v",
"in",
"a",
"temperature",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L541-L563 | [
"def",
"plot_cv",
"(",
"self",
",",
"tmin",
",",
"tmax",
",",
"ntemp",
",",
"ylim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"temperatures",
"=",
"np",
".",
"linspace",
"(",
"tmin",
",",
"tmax",
",",
"ntemp",
")",
"if",
"self",
".",
"struc... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ThermoPlotter.plot_entropy | Plots the vibrational entrpy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
kwargs: kwargs passed to the matplotlib function 'plot'.
Returns:
... | pymatgen/phonon/plotter.py | def plot_entropy(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the vibrational entrpy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
... | def plot_entropy(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the vibrational entrpy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
... | [
"Plots",
"the",
"vibrational",
"entrpy",
"in",
"a",
"temperature",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L566-L588 | [
"def",
"plot_entropy",
"(",
"self",
",",
"tmin",
",",
"tmax",
",",
"ntemp",
",",
"ylim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"temperatures",
"=",
"np",
".",
"linspace",
"(",
"tmin",
",",
"tmax",
",",
"ntemp",
")",
"if",
"self",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ThermoPlotter.plot_internal_energy | Plots the vibrational internal energy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
kwargs: kwargs passed to the matplotlib function 'plot'.
R... | pymatgen/phonon/plotter.py | def plot_internal_energy(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the vibrational internal energy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y... | def plot_internal_energy(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the vibrational internal energy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y... | [
"Plots",
"the",
"vibrational",
"internal",
"energy",
"in",
"a",
"temperature",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L591-L614 | [
"def",
"plot_internal_energy",
"(",
"self",
",",
"tmin",
",",
"tmax",
",",
"ntemp",
",",
"ylim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"temperatures",
"=",
"np",
".",
"linspace",
"(",
"tmin",
",",
"tmax",
",",
"ntemp",
")",
"if",
"self",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ThermoPlotter.plot_helmholtz_free_energy | Plots the vibrational contribution to the Helmoltz free energy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
kwargs: kwargs passed to the matplotlib f... | pymatgen/phonon/plotter.py | def plot_helmholtz_free_energy(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the vibrational contribution to the Helmoltz free energy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
... | def plot_helmholtz_free_energy(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots the vibrational contribution to the Helmoltz free energy in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
... | [
"Plots",
"the",
"vibrational",
"contribution",
"to",
"the",
"Helmoltz",
"free",
"energy",
"in",
"a",
"temperature",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L617-L640 | [
"def",
"plot_helmholtz_free_energy",
"(",
"self",
",",
"tmin",
",",
"tmax",
",",
"ntemp",
",",
"ylim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"temperatures",
"=",
"np",
".",
"linspace",
"(",
"tmin",
",",
"tmax",
",",
"ntemp",
")",
"if",
"sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | ThermoPlotter.plot_thermodynamic_properties | Plots all the thermodynamic properties in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specifying the y-axis limits.
kwargs: kwargs passed to the matplotlib function 'plot'.
... | pymatgen/phonon/plotter.py | def plot_thermodynamic_properties(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots all the thermodynamic properties in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specif... | def plot_thermodynamic_properties(self, tmin, tmax, ntemp, ylim=None, **kwargs):
"""
Plots all the thermodynamic properties in a temperature range.
Args:
tmin: minimum temperature
tmax: maximum temperature
ntemp: number of steps
ylim: tuple specif... | [
"Plots",
"all",
"the",
"thermodynamic",
"properties",
"in",
"a",
"temperature",
"range",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/plotter.py#L643-L671 | [
"def",
"plot_thermodynamic_properties",
"(",
"self",
",",
"tmin",
",",
"tmax",
",",
"ntemp",
",",
"ylim",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"temperatures",
"=",
"np",
".",
"linspace",
"(",
"tmin",
",",
"tmax",
",",
"ntemp",
")",
"mol",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PWInput.as_dict | Create a dictionary representation of a PWInput object
Returns:
dict | pymatgen/io/pwscf.py | def as_dict(self):
"""
Create a dictionary representation of a PWInput object
Returns:
dict
"""
pwinput_dict = {'structure': self.structure.as_dict(),
'pseudo': self.pseudo,
'sections': self.sections,
... | def as_dict(self):
"""
Create a dictionary representation of a PWInput object
Returns:
dict
"""
pwinput_dict = {'structure': self.structure.as_dict(),
'pseudo': self.pseudo,
'sections': self.sections,
... | [
"Create",
"a",
"dictionary",
"representation",
"of",
"a",
"PWInput",
"object",
"Returns",
":",
"dict"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/pwscf.py#L173-L186 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"pwinput_dict",
"=",
"{",
"'structure'",
":",
"self",
".",
"structure",
".",
"as_dict",
"(",
")",
",",
"'pseudo'",
":",
"self",
".",
"pseudo",
",",
"'sections'",
":",
"self",
".",
"sections",
",",
"'kpoints_mode'"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PWInput.from_dict | Load a PWInput object from a dictionary.
Args:
pwinput_dict (dict): dictionary with PWInput data
Returns:
PWInput object | pymatgen/io/pwscf.py | def from_dict(cls, pwinput_dict):
"""
Load a PWInput object from a dictionary.
Args:
pwinput_dict (dict): dictionary with PWInput data
Returns:
PWInput object
"""
pwinput = cls(structure=Structure.from_dict(pwinput_dict['struc... | def from_dict(cls, pwinput_dict):
"""
Load a PWInput object from a dictionary.
Args:
pwinput_dict (dict): dictionary with PWInput data
Returns:
PWInput object
"""
pwinput = cls(structure=Structure.from_dict(pwinput_dict['struc... | [
"Load",
"a",
"PWInput",
"object",
"from",
"a",
"dictionary",
".",
"Args",
":",
"pwinput_dict",
"(",
"dict",
")",
":",
"dictionary",
"with",
"PWInput",
"data",
"Returns",
":",
"PWInput",
"object"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/pwscf.py#L189-L209 | [
"def",
"from_dict",
"(",
"cls",
",",
"pwinput_dict",
")",
":",
"pwinput",
"=",
"cls",
"(",
"structure",
"=",
"Structure",
".",
"from_dict",
"(",
"pwinput_dict",
"[",
"'structure'",
"]",
")",
",",
"pseudo",
"=",
"pwinput_dict",
"[",
"'pseudo'",
"]",
",",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PWInput.write_file | Write the PWSCF input file.
Args:
filename (str): The string filename to output to. | pymatgen/io/pwscf.py | def write_file(self, filename):
"""
Write the PWSCF input file.
Args:
filename (str): The string filename to output to.
"""
with open(filename, "w") as f:
f.write(self.__str__()) | def write_file(self, filename):
"""
Write the PWSCF input file.
Args:
filename (str): The string filename to output to.
"""
with open(filename, "w") as f:
f.write(self.__str__()) | [
"Write",
"the",
"PWSCF",
"input",
"file",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/pwscf.py#L211-L219 | [
"def",
"write_file",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"self",
".",
"__str__",
"(",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PWInput.from_string | Reads an PWInput object from a string.
Args:
string (str): PWInput string
Returns:
PWInput object | pymatgen/io/pwscf.py | def from_string(string):
"""
Reads an PWInput object from a string.
Args:
string (str): PWInput string
Returns:
PWInput object
"""
lines = list(clean_lines(string.splitlines()))
def input_mode(line):
if line[0] == "&":
... | def from_string(string):
"""
Reads an PWInput object from a string.
Args:
string (str): PWInput string
Returns:
PWInput object
"""
lines = list(clean_lines(string.splitlines()))
def input_mode(line):
if line[0] == "&":
... | [
"Reads",
"an",
"PWInput",
"object",
"from",
"a",
"string",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/pwscf.py#L236-L333 | [
"def",
"from_string",
"(",
"string",
")",
":",
"lines",
"=",
"list",
"(",
"clean_lines",
"(",
"string",
".",
"splitlines",
"(",
")",
")",
")",
"def",
"input_mode",
"(",
"line",
")",
":",
"if",
"line",
"[",
"0",
"]",
"==",
"\"&\"",
":",
"return",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PWInput.proc_val | Static helper method to convert PWINPUT parameters to proper type, e.g.,
integers, floats, etc.
Args:
key: PWINPUT parameter key
val: Actual value of PWINPUT parameter. | pymatgen/io/pwscf.py | def proc_val(key, val):
"""
Static helper method to convert PWINPUT parameters to proper type, e.g.,
integers, floats, etc.
Args:
key: PWINPUT parameter key
val: Actual value of PWINPUT parameter.
"""
float_keys = ('etot_conv_thr','forc_conv_thr',... | def proc_val(key, val):
"""
Static helper method to convert PWINPUT parameters to proper type, e.g.,
integers, floats, etc.
Args:
key: PWINPUT parameter key
val: Actual value of PWINPUT parameter.
"""
float_keys = ('etot_conv_thr','forc_conv_thr',... | [
"Static",
"helper",
"method",
"to",
"convert",
"PWINPUT",
"parameters",
"to",
"proper",
"type",
"e",
".",
"g",
".",
"integers",
"floats",
"etc",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/pwscf.py#L335-L398 | [
"def",
"proc_val",
"(",
"key",
",",
"val",
")",
":",
"float_keys",
"=",
"(",
"'etot_conv_thr'",
",",
"'forc_conv_thr'",
",",
"'conv_thr'",
",",
"'Hubbard_U'",
",",
"'Hubbard_J0'",
",",
"'defauss'",
",",
"'starting_magnetization'",
",",
")",
"int_keys",
"=",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PWOutput.read_pattern | General pattern reading. Uses monty's regrep method. Takes the same
arguments.
Args:
patterns (dict): A dict of patterns, e.g.,
{"energy": r"energy\\(sigma->0\\)\\s+=\\s+([\\d\\-.]+)"}.
reverse (bool): Read files in reverse. Defaults to false. Useful for
... | pymatgen/io/pwscf.py | def read_pattern(self, patterns, reverse=False,
terminate_on_match=False, postprocess=str):
"""
General pattern reading. Uses monty's regrep method. Takes the same
arguments.
Args:
patterns (dict): A dict of patterns, e.g.,
{"energy": r"e... | def read_pattern(self, patterns, reverse=False,
terminate_on_match=False, postprocess=str):
"""
General pattern reading. Uses monty's regrep method. Takes the same
arguments.
Args:
patterns (dict): A dict of patterns, e.g.,
{"energy": r"e... | [
"General",
"pattern",
"reading",
".",
"Uses",
"monty",
"s",
"regrep",
"method",
".",
"Takes",
"the",
"same",
"arguments",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/pwscf.py#L433-L461 | [
"def",
"read_pattern",
"(",
"self",
",",
"patterns",
",",
"reverse",
"=",
"False",
",",
"terminate_on_match",
"=",
"False",
",",
"postprocess",
"=",
"str",
")",
":",
"matches",
"=",
"regrep",
"(",
"self",
".",
"filename",
",",
"patterns",
",",
"reverse",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | show_qparams | Print to the given stream the template of the :class:`QueueAdapter` of type `qtype`. | pymatgen/io/abinit/qadapters.py | def show_qparams(qtype, stream=sys.stdout):
"""Print to the given stream the template of the :class:`QueueAdapter` of type `qtype`."""
for cls in all_subclasses(QueueAdapter):
if cls.QTYPE == qtype: return stream.write(cls.QTEMPLATE)
raise ValueError("Cannot find class associated to qtype %s" % qty... | def show_qparams(qtype, stream=sys.stdout):
"""Print to the given stream the template of the :class:`QueueAdapter` of type `qtype`."""
for cls in all_subclasses(QueueAdapter):
if cls.QTYPE == qtype: return stream.write(cls.QTEMPLATE)
raise ValueError("Cannot find class associated to qtype %s" % qty... | [
"Print",
"to",
"the",
"given",
"stream",
"the",
"template",
"of",
"the",
":",
"class",
":",
"QueueAdapter",
"of",
"type",
"qtype",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L296-L301 | [
"def",
"show_qparams",
"(",
"qtype",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"for",
"cls",
"in",
"all_subclasses",
"(",
"QueueAdapter",
")",
":",
"if",
"cls",
".",
"QTYPE",
"==",
"qtype",
":",
"return",
"stream",
".",
"write",
"(",
"cls",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | make_qadapter | Return the concrete :class:`QueueAdapter` class from a string.
Note that one can register a customized version with:
.. example::
from qadapters import SlurmAdapter
class MyAdapter(SlurmAdapter):
QTYPE = "myslurm"
# Add your customized code here
# Register you... | pymatgen/io/abinit/qadapters.py | def make_qadapter(**kwargs):
"""
Return the concrete :class:`QueueAdapter` class from a string.
Note that one can register a customized version with:
.. example::
from qadapters import SlurmAdapter
class MyAdapter(SlurmAdapter):
QTYPE = "myslurm"
# Add your cus... | def make_qadapter(**kwargs):
"""
Return the concrete :class:`QueueAdapter` class from a string.
Note that one can register a customized version with:
.. example::
from qadapters import SlurmAdapter
class MyAdapter(SlurmAdapter):
QTYPE = "myslurm"
# Add your cus... | [
"Return",
"the",
"concrete",
":",
"class",
":",
"QueueAdapter",
"class",
"from",
"a",
"string",
".",
"Note",
"that",
"one",
"can",
"register",
"a",
"customized",
"version",
"with",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L309-L339 | [
"def",
"make_qadapter",
"(",
"*",
"*",
"kwargs",
")",
":",
"# Get all known subclasses of QueueAdapter.",
"d",
"=",
"{",
"c",
".",
"QTYPE",
":",
"c",
"for",
"c",
"in",
"all_subclasses",
"(",
"QueueAdapter",
")",
"}",
"# Preventive copy before pop",
"kwargs",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | MpiRunner.string_to_run | Build and return a string with the command required to launch `executable` with the qadapter `qad`.
Args
qad: Qadapter instance.
executable (str): Executable name or path
stdin (str): Name of the file to be used as standard input. None means no redirection.
stdou... | pymatgen/io/abinit/qadapters.py | def string_to_run(self, qad, executable, stdin=None, stdout=None, stderr=None, exec_args=None):
"""
Build and return a string with the command required to launch `executable` with the qadapter `qad`.
Args
qad: Qadapter instance.
executable (str): Executable name or path
... | def string_to_run(self, qad, executable, stdin=None, stdout=None, stderr=None, exec_args=None):
"""
Build and return a string with the command required to launch `executable` with the qadapter `qad`.
Args
qad: Qadapter instance.
executable (str): Executable name or path
... | [
"Build",
"and",
"return",
"a",
"string",
"with",
"the",
"command",
"required",
"to",
"launch",
"executable",
"with",
"the",
"qadapter",
"qad",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L83-L128 | [
"def",
"string_to_run",
"(",
"self",
",",
"qad",
",",
"executable",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
",",
"exec_args",
"=",
"None",
")",
":",
"stdin",
"=",
"\"< \"",
"+",
"stdin",
"if",
"stdin",
"is",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | OmpEnv.as_ompenv | Convert an object into a OmpEnv | pymatgen/io/abinit/qadapters.py | def as_ompenv(cls, obj):
"""Convert an object into a OmpEnv"""
if isinstance(obj, cls): return obj
if obj is None: return cls()
return cls(**obj) | def as_ompenv(cls, obj):
"""Convert an object into a OmpEnv"""
if isinstance(obj, cls): return obj
if obj is None: return cls()
return cls(**obj) | [
"Convert",
"an",
"object",
"into",
"a",
"OmpEnv"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L156-L160 | [
"def",
"as_ompenv",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"cls",
")",
":",
"return",
"obj",
"if",
"obj",
"is",
"None",
":",
"return",
"cls",
"(",
")",
"return",
"cls",
"(",
"*",
"*",
"obj",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.as_dict | Provides a simple though not complete dict serialization of the object (OMP missing, not all limits are
kept in the dictionary, ... other things to be checked)
Raise:
`ValueError` if errors. | pymatgen/io/abinit/qadapters.py | def as_dict(self):
"""
Provides a simple though not complete dict serialization of the object (OMP missing, not all limits are
kept in the dictionary, ... other things to be checked)
Raise:
`ValueError` if errors.
"""
if self.has_omp:
raise NotImp... | def as_dict(self):
"""
Provides a simple though not complete dict serialization of the object (OMP missing, not all limits are
kept in the dictionary, ... other things to be checked)
Raise:
`ValueError` if errors.
"""
if self.has_omp:
raise NotImp... | [
"Provides",
"a",
"simple",
"though",
"not",
"complete",
"dict",
"serialization",
"of",
"the",
"object",
"(",
"OMP",
"missing",
"not",
"all",
"limits",
"are",
"kept",
"in",
"the",
"dictionary",
"...",
"other",
"things",
"to",
"be",
"checked",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L503-L533 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_omp",
":",
"raise",
"NotImplementedError",
"(",
"'as_dict method of QueueAdapter not yet implemented when OpenMP is activated'",
")",
"return",
"{",
"'@module'",
":",
"self",
".",
"__class__",
".",
"__mo... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.validate_qparams | Check if the keys specified by the user in qparams are supported.
Raise:
`ValueError` if errors. | pymatgen/io/abinit/qadapters.py | def validate_qparams(self):
"""
Check if the keys specified by the user in qparams are supported.
Raise:
`ValueError` if errors.
"""
# No validation for ShellAdapter.
if isinstance(self, ShellAdapter): return
# Parse the template so that we know the ... | def validate_qparams(self):
"""
Check if the keys specified by the user in qparams are supported.
Raise:
`ValueError` if errors.
"""
# No validation for ShellAdapter.
if isinstance(self, ShellAdapter): return
# Parse the template so that we know the ... | [
"Check",
"if",
"the",
"keys",
"specified",
"by",
"the",
"user",
"in",
"qparams",
"are",
"supported",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L555-L575 | [
"def",
"validate_qparams",
"(",
"self",
")",
":",
"# No validation for ShellAdapter.",
"if",
"isinstance",
"(",
"self",
",",
"ShellAdapter",
")",
":",
"return",
"# Parse the template so that we know the list of supported options.",
"err_msg",
"=",
"\"\"",
"for",
"param",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.record_launch | Save submission | pymatgen/io/abinit/qadapters.py | def record_launch(self, queue_id): # retcode):
"""Save submission"""
self.launches.append(
AttrDict(queue_id=queue_id, mpi_procs=self.mpi_procs, omp_threads=self.omp_threads,
mem_per_proc=self.mem_per_proc, timelimit=self.timelimit))
return len(self.launches) | def record_launch(self, queue_id): # retcode):
"""Save submission"""
self.launches.append(
AttrDict(queue_id=queue_id, mpi_procs=self.mpi_procs, omp_threads=self.omp_threads,
mem_per_proc=self.mem_per_proc, timelimit=self.timelimit))
return len(self.launches) | [
"Save",
"submission"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L726-L731 | [
"def",
"record_launch",
"(",
"self",
",",
"queue_id",
")",
":",
"# retcode):",
"self",
".",
"launches",
".",
"append",
"(",
"AttrDict",
"(",
"queue_id",
"=",
"queue_id",
",",
"mpi_procs",
"=",
"self",
".",
"mpi_procs",
",",
"omp_threads",
"=",
"self",
".",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.validate | Validate the parameters of the run. Raises self.Error if invalid parameters. | pymatgen/io/abinit/qadapters.py | def validate(self):
"""Validate the parameters of the run. Raises self.Error if invalid parameters."""
errors = []
app = errors.append
if not self.hint_cores >= self.mpi_procs * self.omp_threads >= self.min_cores:
app("self.hint_cores >= mpi_procs * omp_threads >= self.min_c... | def validate(self):
"""Validate the parameters of the run. Raises self.Error if invalid parameters."""
errors = []
app = errors.append
if not self.hint_cores >= self.mpi_procs * self.omp_threads >= self.min_cores:
app("self.hint_cores >= mpi_procs * omp_threads >= self.min_c... | [
"Validate",
"the",
"parameters",
"of",
"the",
"run",
".",
"Raises",
"self",
".",
"Error",
"if",
"invalid",
"parameters",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L750-L774 | [
"def",
"validate",
"(",
"self",
")",
":",
"errors",
"=",
"[",
"]",
"app",
"=",
"errors",
".",
"append",
"if",
"not",
"self",
".",
"hint_cores",
">=",
"self",
".",
"mpi_procs",
"*",
"self",
".",
"omp_threads",
">=",
"self",
".",
"min_cores",
":",
"app... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.can_run_pconf | True if the qadapter in principle is able to run the :class:`ParalConf` pconf | pymatgen/io/abinit/qadapters.py | def can_run_pconf(self, pconf):
"""True if the qadapter in principle is able to run the :class:`ParalConf` pconf"""
if not self.hint_cores >= pconf.num_cores >= self.min_cores: return False
if not self.hw.can_use_omp_threads(self.omp_threads): return False
if pconf.mem_per_proc > self.hw... | def can_run_pconf(self, pconf):
"""True if the qadapter in principle is able to run the :class:`ParalConf` pconf"""
if not self.hint_cores >= pconf.num_cores >= self.min_cores: return False
if not self.hw.can_use_omp_threads(self.omp_threads): return False
if pconf.mem_per_proc > self.hw... | [
"True",
"if",
"the",
"qadapter",
"in",
"principle",
"is",
"able",
"to",
"run",
"the",
":",
"class",
":",
"ParalConf",
"pconf"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L867-L875 | [
"def",
"can_run_pconf",
"(",
"self",
",",
"pconf",
")",
":",
"if",
"not",
"self",
".",
"hint_cores",
">=",
"pconf",
".",
"num_cores",
">=",
"self",
".",
"min_cores",
":",
"return",
"False",
"if",
"not",
"self",
".",
"hw",
".",
"can_use_omp_threads",
"(",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.distribute | Returns (num_nodes, mpi_per_node)
Aggressive: When Open MPI thinks that it is in an exactly- or under-subscribed mode
(i.e., the number of running processes is equal to or less than the number of available processors),
MPI processes will automatically run in aggressive mode, meaning that they w... | pymatgen/io/abinit/qadapters.py | def distribute(self, mpi_procs, omp_threads, mem_per_proc):
"""
Returns (num_nodes, mpi_per_node)
Aggressive: When Open MPI thinks that it is in an exactly- or under-subscribed mode
(i.e., the number of running processes is equal to or less than the number of available processors),
... | def distribute(self, mpi_procs, omp_threads, mem_per_proc):
"""
Returns (num_nodes, mpi_per_node)
Aggressive: When Open MPI thinks that it is in an exactly- or under-subscribed mode
(i.e., the number of running processes is equal to or less than the number of available processors),
... | [
"Returns",
"(",
"num_nodes",
"mpi_per_node",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L877-L940 | [
"def",
"distribute",
"(",
"self",
",",
"mpi_procs",
",",
"omp_threads",
",",
"mem_per_proc",
")",
":",
"class",
"Distrib",
"(",
"namedtuple",
"(",
"\"Distrib\"",
",",
"\"num_nodes mpi_per_node exact\"",
")",
")",
":",
"pass",
"#@property",
"#def mem_per_node",
"# ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.get_subs_dict | Return substitution dict for replacements into the template
Subclasses may want to customize this method. | pymatgen/io/abinit/qadapters.py | def get_subs_dict(self, qnodes=None):
"""
Return substitution dict for replacements into the template
Subclasses may want to customize this method.
"""
#d = self.qparams.copy()
d = self.qparams
d.update(self.optimize_params(qnodes=qnodes))
# clean null val... | def get_subs_dict(self, qnodes=None):
"""
Return substitution dict for replacements into the template
Subclasses may want to customize this method.
"""
#d = self.qparams.copy()
d = self.qparams
d.update(self.optimize_params(qnodes=qnodes))
# clean null val... | [
"Return",
"substitution",
"dict",
"for",
"replacements",
"into",
"the",
"template",
"Subclasses",
"may",
"want",
"to",
"customize",
"this",
"method",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L950-L961 | [
"def",
"get_subs_dict",
"(",
"self",
",",
"qnodes",
"=",
"None",
")",
":",
"#d = self.qparams.copy()",
"d",
"=",
"self",
".",
"qparams",
"d",
".",
"update",
"(",
"self",
".",
"optimize_params",
"(",
"qnodes",
"=",
"qnodes",
")",
")",
"# clean null values",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter._make_qheader | Return a string with the options that are passed to the resource manager. | pymatgen/io/abinit/qadapters.py | def _make_qheader(self, job_name, qout_path, qerr_path):
"""Return a string with the options that are passed to the resource manager."""
# get substitution dict for replacements into the template
subs_dict = self.get_subs_dict()
# Set job_name and the names for the stderr and stdout of ... | def _make_qheader(self, job_name, qout_path, qerr_path):
"""Return a string with the options that are passed to the resource manager."""
# get substitution dict for replacements into the template
subs_dict = self.get_subs_dict()
# Set job_name and the names for the stderr and stdout of ... | [
"Return",
"a",
"string",
"with",
"the",
"options",
"that",
"are",
"passed",
"to",
"the",
"resource",
"manager",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L963-L985 | [
"def",
"_make_qheader",
"(",
"self",
",",
"job_name",
",",
"qout_path",
",",
"qerr_path",
")",
":",
"# get substitution dict for replacements into the template",
"subs_dict",
"=",
"self",
".",
"get_subs_dict",
"(",
")",
"# Set job_name and the names for the stderr and stdout ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.get_script_str | Returns a (multi-line) String representing the queue script, e.g. PBS script.
Uses the template_file along with internal parameters to create the script.
Args:
job_name: Name of the job.
launch_dir: (str) The directory the job will be launched in.
executable: String ... | pymatgen/io/abinit/qadapters.py | def get_script_str(self, job_name, launch_dir, executable, qout_path, qerr_path,
stdin=None, stdout=None, stderr=None, exec_args=None):
"""
Returns a (multi-line) String representing the queue script, e.g. PBS script.
Uses the template_file along with internal parameters t... | def get_script_str(self, job_name, launch_dir, executable, qout_path, qerr_path,
stdin=None, stdout=None, stderr=None, exec_args=None):
"""
Returns a (multi-line) String representing the queue script, e.g. PBS script.
Uses the template_file along with internal parameters t... | [
"Returns",
"a",
"(",
"multi",
"-",
"line",
")",
"String",
"representing",
"the",
"queue",
"script",
"e",
".",
"g",
".",
"PBS",
"script",
".",
"Uses",
"the",
"template_file",
"along",
"with",
"internal",
"parameters",
"to",
"create",
"the",
"script",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L987-L1058 | [
"def",
"get_script_str",
"(",
"self",
",",
"job_name",
",",
"launch_dir",
",",
"executable",
",",
"qout_path",
",",
"qerr_path",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
",",
"exec_args",
"=",
"None",
")",
":",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.submit_to_queue | Public API: wraps the concrete implementation _submit_to_queue
Raises:
`self.MaxNumLaunchesError` if we have already tried to submit the job max_num_launches
`self.Error` if generic error | pymatgen/io/abinit/qadapters.py | def submit_to_queue(self, script_file):
"""
Public API: wraps the concrete implementation _submit_to_queue
Raises:
`self.MaxNumLaunchesError` if we have already tried to submit the job max_num_launches
`self.Error` if generic error
"""
if not os.path.exis... | def submit_to_queue(self, script_file):
"""
Public API: wraps the concrete implementation _submit_to_queue
Raises:
`self.MaxNumLaunchesError` if we have already tried to submit the job max_num_launches
`self.Error` if generic error
"""
if not os.path.exis... | [
"Public",
"API",
":",
"wraps",
"the",
"concrete",
"implementation",
"_submit_to_queue"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1060-L1085 | [
"def",
"submit_to_queue",
"(",
"self",
",",
"script_file",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"script_file",
")",
":",
"raise",
"self",
".",
"Error",
"(",
"'Cannot find script file located at: {}'",
".",
"format",
"(",
"script_file",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.get_njobs_in_queue | returns the number of jobs in the queue, probably using subprocess or shutil to
call a command like 'qstat'. returns None when the number of jobs cannot be determined.
Args:
username: (str) the username of the jobs to count (default is to autodetect) | pymatgen/io/abinit/qadapters.py | def get_njobs_in_queue(self, username=None):
"""
returns the number of jobs in the queue, probably using subprocess or shutil to
call a command like 'qstat'. returns None when the number of jobs cannot be determined.
Args:
username: (str) the username of the jobs to count (d... | def get_njobs_in_queue(self, username=None):
"""
returns the number of jobs in the queue, probably using subprocess or shutil to
call a command like 'qstat'. returns None when the number of jobs cannot be determined.
Args:
username: (str) the username of the jobs to count (d... | [
"returns",
"the",
"number",
"of",
"jobs",
"in",
"the",
"queue",
"probably",
"using",
"subprocess",
"or",
"shutil",
"to",
"call",
"a",
"command",
"like",
"qstat",
".",
"returns",
"None",
"when",
"the",
"number",
"of",
"jobs",
"cannot",
"be",
"determined",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1100-L1120 | [
"def",
"get_njobs_in_queue",
"(",
"self",
",",
"username",
"=",
"None",
")",
":",
"if",
"username",
"is",
"None",
":",
"username",
"=",
"getpass",
".",
"getuser",
"(",
")",
"njobs",
",",
"process",
"=",
"self",
".",
"_get_njobs_in_queue",
"(",
"username",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.more_mem_per_proc | Method to increase the amount of memory asked for, by factor.
Return: new memory if success, 0 if memory cannot be increased. | pymatgen/io/abinit/qadapters.py | def more_mem_per_proc(self, factor=1):
"""
Method to increase the amount of memory asked for, by factor.
Return: new memory if success, 0 if memory cannot be increased.
"""
base_increase = 2000
old_mem = self.mem_per_proc
new_mem = old_mem + factor*base_increase
... | def more_mem_per_proc(self, factor=1):
"""
Method to increase the amount of memory asked for, by factor.
Return: new memory if success, 0 if memory cannot be increased.
"""
base_increase = 2000
old_mem = self.mem_per_proc
new_mem = old_mem + factor*base_increase
... | [
"Method",
"to",
"increase",
"the",
"amount",
"of",
"memory",
"asked",
"for",
"by",
"factor",
".",
"Return",
":",
"new",
"memory",
"if",
"success",
"0",
"if",
"memory",
"cannot",
"be",
"increased",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1139-L1152 | [
"def",
"more_mem_per_proc",
"(",
"self",
",",
"factor",
"=",
"1",
")",
":",
"base_increase",
"=",
"2000",
"old_mem",
"=",
"self",
".",
"mem_per_proc",
"new_mem",
"=",
"old_mem",
"+",
"factor",
"*",
"base_increase",
"if",
"new_mem",
"<",
"self",
".",
"hw",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.more_master_mem_overhead | Method to increase the amount of memory overheaded asked for the master node.
Return: new master memory overhead if success, 0 if it cannot be increased. | pymatgen/io/abinit/qadapters.py | def more_master_mem_overhead(self, mem_increase_mb=1000):
"""
Method to increase the amount of memory overheaded asked for the master node.
Return: new master memory overhead if success, 0 if it cannot be increased.
"""
old_master_mem_overhead = self.master_mem_overhead
n... | def more_master_mem_overhead(self, mem_increase_mb=1000):
"""
Method to increase the amount of memory overheaded asked for the master node.
Return: new master memory overhead if success, 0 if it cannot be increased.
"""
old_master_mem_overhead = self.master_mem_overhead
n... | [
"Method",
"to",
"increase",
"the",
"amount",
"of",
"memory",
"overheaded",
"asked",
"for",
"the",
"master",
"node",
".",
"Return",
":",
"new",
"master",
"memory",
"overhead",
"if",
"success",
"0",
"if",
"it",
"cannot",
"be",
"increased",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1154-L1165 | [
"def",
"more_master_mem_overhead",
"(",
"self",
",",
"mem_increase_mb",
"=",
"1000",
")",
":",
"old_master_mem_overhead",
"=",
"self",
".",
"master_mem_overhead",
"new_master_mem_overhead",
"=",
"old_master_mem_overhead",
"+",
"mem_increase_mb",
"if",
"new_master_mem_overhe... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.more_cores | Method to increase the number of MPI procs.
Return: new number of processors if success, 0 if processors cannot be increased. | pymatgen/io/abinit/qadapters.py | def more_cores(self, factor=1):
"""
Method to increase the number of MPI procs.
Return: new number of processors if success, 0 if processors cannot be increased.
"""
# TODO : find a formula that works for all max_cores
if self.max_cores > 40:
base_increase = 4 *... | def more_cores(self, factor=1):
"""
Method to increase the number of MPI procs.
Return: new number of processors if success, 0 if processors cannot be increased.
"""
# TODO : find a formula that works for all max_cores
if self.max_cores > 40:
base_increase = 4 *... | [
"Method",
"to",
"increase",
"the",
"number",
"of",
"MPI",
"procs",
".",
"Return",
":",
"new",
"number",
"of",
"processors",
"if",
"success",
"0",
"if",
"processors",
"cannot",
"be",
"increased",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1167-L1184 | [
"def",
"more_cores",
"(",
"self",
",",
"factor",
"=",
"1",
")",
":",
"# TODO : find a formula that works for all max_cores",
"if",
"self",
".",
"max_cores",
">",
"40",
":",
"base_increase",
"=",
"4",
"*",
"int",
"(",
"self",
".",
"max_cores",
"/",
"40",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | QueueAdapter.more_time | Method to increase the wall time | pymatgen/io/abinit/qadapters.py | def more_time(self, factor=1):
"""
Method to increase the wall time
"""
base_increase = int(self.timelimit_hard / 10)
new_time = self.timelimit + base_increase*factor
print('qadapter: trying to increase time')
if new_time < self.timelimit_hard:
self.s... | def more_time(self, factor=1):
"""
Method to increase the wall time
"""
base_increase = int(self.timelimit_hard / 10)
new_time = self.timelimit + base_increase*factor
print('qadapter: trying to increase time')
if new_time < self.timelimit_hard:
self.s... | [
"Method",
"to",
"increase",
"the",
"wall",
"time"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1186-L1201 | [
"def",
"more_time",
"(",
"self",
",",
"factor",
"=",
"1",
")",
":",
"base_increase",
"=",
"int",
"(",
"self",
".",
"timelimit_hard",
"/",
"10",
")",
"new_time",
"=",
"self",
".",
"timelimit",
"+",
"base_increase",
"*",
"factor",
"print",
"(",
"'qadapter:... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SlurmAdapter.set_mem_per_proc | Set the memory per process in megabytes | pymatgen/io/abinit/qadapters.py | def set_mem_per_proc(self, mem_mb):
"""Set the memory per process in megabytes"""
super().set_mem_per_proc(mem_mb)
self.qparams["mem_per_cpu"] = self.mem_per_proc | def set_mem_per_proc(self, mem_mb):
"""Set the memory per process in megabytes"""
super().set_mem_per_proc(mem_mb)
self.qparams["mem_per_cpu"] = self.mem_per_proc | [
"Set",
"the",
"memory",
"per",
"process",
"in",
"megabytes"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1280-L1283 | [
"def",
"set_mem_per_proc",
"(",
"self",
",",
"mem_mb",
")",
":",
"super",
"(",
")",
".",
"set_mem_per_proc",
"(",
"mem_mb",
")",
"self",
".",
"qparams",
"[",
"\"mem_per_cpu\"",
"]",
"=",
"self",
".",
"mem_per_proc"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PbsProAdapter.get_select | Select is not the most intuitive command. For more info see:
* http://www.cardiff.ac.uk/arcca/services/equipment/User-Guide/pbs.html
* https://portal.ivec.org/docs/Supercomputers/PBS_Pro | pymatgen/io/abinit/qadapters.py | def get_select(self, ret_dict=False, qnodes=None, memory_policy=None):
"""
Select is not the most intuitive command. For more info see:
* http://www.cardiff.ac.uk/arcca/services/equipment/User-Guide/pbs.html
* https://portal.ivec.org/docs/Supercomputers/PBS_Pro
"""
... | def get_select(self, ret_dict=False, qnodes=None, memory_policy=None):
"""
Select is not the most intuitive command. For more info see:
* http://www.cardiff.ac.uk/arcca/services/equipment/User-Guide/pbs.html
* https://portal.ivec.org/docs/Supercomputers/PBS_Pro
"""
... | [
"Select",
"is",
"not",
"the",
"most",
"intuitive",
"command",
".",
"For",
"more",
"info",
"see",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1425-L1513 | [
"def",
"get_select",
"(",
"self",
",",
"ret_dict",
"=",
"False",
",",
"qnodes",
"=",
"None",
",",
"memory_policy",
"=",
"None",
")",
":",
"hw",
",",
"mem_per_proc",
"=",
"self",
".",
"hw",
",",
"int",
"(",
"self",
".",
"mem_per_proc",
")",
"#dist = sel... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PbsProAdapter._submit_to_queue | Submit a job script to the queue. | pymatgen/io/abinit/qadapters.py | def _submit_to_queue(self, script_file):
"""Submit a job script to the queue."""
if sys.version_info[0] < 3:
process = Popen(['qsub', script_file], stdout=PIPE, stderr=PIPE)
else:
# need string not bytes so must use universal_newlines
process = Popen(['qsub', ... | def _submit_to_queue(self, script_file):
"""Submit a job script to the queue."""
if sys.version_info[0] < 3:
process = Popen(['qsub', script_file], stdout=PIPE, stderr=PIPE)
else:
# need string not bytes so must use universal_newlines
process = Popen(['qsub', ... | [
"Submit",
"a",
"job",
"script",
"to",
"the",
"queue",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1686-L1704 | [
"def",
"_submit_to_queue",
"(",
"self",
",",
"script_file",
")",
":",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"<",
"3",
":",
"process",
"=",
"Popen",
"(",
"[",
"'qsub'",
",",
"script_file",
"]",
",",
"stdout",
"=",
"PIPE",
",",
"stderr",
"="... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | TorqueAdapter.set_mpi_procs | Set the number of CPUs used for MPI. | pymatgen/io/abinit/qadapters.py | def set_mpi_procs(self, mpi_procs):
"""Set the number of CPUs used for MPI."""
QueueAdapter.set_mpi_procs(self, mpi_procs)
num_nodes, rest_cores = self.hw.divmod_node(mpi_procs, omp_threads=1)
if num_nodes == 0:
self.qparams["nodes"] = 1
self.qparams["ppn"] = mpi... | def set_mpi_procs(self, mpi_procs):
"""Set the number of CPUs used for MPI."""
QueueAdapter.set_mpi_procs(self, mpi_procs)
num_nodes, rest_cores = self.hw.divmod_node(mpi_procs, omp_threads=1)
if num_nodes == 0:
self.qparams["nodes"] = 1
self.qparams["ppn"] = mpi... | [
"Set",
"the",
"number",
"of",
"CPUs",
"used",
"for",
"MPI",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1761-L1774 | [
"def",
"set_mpi_procs",
"(",
"self",
",",
"mpi_procs",
")",
":",
"QueueAdapter",
".",
"set_mpi_procs",
"(",
"self",
",",
"mpi_procs",
")",
"num_nodes",
",",
"rest_cores",
"=",
"self",
".",
"hw",
".",
"divmod_node",
"(",
"mpi_procs",
",",
"omp_threads",
"=",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | SGEAdapter.set_mem_per_proc | Set the memory per process in megabytes | pymatgen/io/abinit/qadapters.py | def set_mem_per_proc(self, mem_mb):
"""Set the memory per process in megabytes"""
super().set_mem_per_proc(mem_mb)
self.qparams["mem_per_slot"] = str(int(self.mem_per_proc)) + "M" | def set_mem_per_proc(self, mem_mb):
"""Set the memory per process in megabytes"""
super().set_mem_per_proc(mem_mb)
self.qparams["mem_per_slot"] = str(int(self.mem_per_proc)) + "M" | [
"Set",
"the",
"memory",
"per",
"process",
"in",
"megabytes"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L1827-L1830 | [
"def",
"set_mem_per_proc",
"(",
"self",
",",
"mem_mb",
")",
":",
"super",
"(",
")",
".",
"set_mem_per_proc",
"(",
"mem_mb",
")",
"self",
".",
"qparams",
"[",
"\"mem_per_slot\"",
"]",
"=",
"str",
"(",
"int",
"(",
"self",
".",
"mem_per_proc",
")",
")",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BlueGeneAdapter.set_timelimit | Limits are specified with the format hh:mm:ss (hours:minutes:seconds) | pymatgen/io/abinit/qadapters.py | def set_timelimit(self, timelimit):
"""Limits are specified with the format hh:mm:ss (hours:minutes:seconds)"""
super().set_timelimit(timelimit)
self.qparams["wall_clock_limit"] = qu.time2loadlever(timelimit) | def set_timelimit(self, timelimit):
"""Limits are specified with the format hh:mm:ss (hours:minutes:seconds)"""
super().set_timelimit(timelimit)
self.qparams["wall_clock_limit"] = qu.time2loadlever(timelimit) | [
"Limits",
"are",
"specified",
"with",
"the",
"format",
"hh",
":",
"mm",
":",
"ss",
"(",
"hours",
":",
"minutes",
":",
"seconds",
")"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L2027-L2030 | [
"def",
"set_timelimit",
"(",
"self",
",",
"timelimit",
")",
":",
"super",
"(",
")",
".",
"set_timelimit",
"(",
"timelimit",
")",
"self",
".",
"qparams",
"[",
"\"wall_clock_limit\"",
"]",
"=",
"qu",
".",
"time2loadlever",
"(",
"timelimit",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | BlueGeneAdapter.bgsize_rankspernode | Return (bg_size, ranks_per_node) from mpi_procs and omp_threads. | pymatgen/io/abinit/qadapters.py | def bgsize_rankspernode(self):
"""Return (bg_size, ranks_per_node) from mpi_procs and omp_threads."""
bg_size = int(math.ceil((self.mpi_procs * self.omp_threads)/ self.hw.cores_per_node))
bg_size = max(bg_size, 32) # TODO hardcoded
ranks_per_node = int(math.ceil(self.mpi_procs / bg_size))
retu... | def bgsize_rankspernode(self):
"""Return (bg_size, ranks_per_node) from mpi_procs and omp_threads."""
bg_size = int(math.ceil((self.mpi_procs * self.omp_threads)/ self.hw.cores_per_node))
bg_size = max(bg_size, 32) # TODO hardcoded
ranks_per_node = int(math.ceil(self.mpi_procs / bg_size))
retu... | [
"Return",
"(",
"bg_size",
"ranks_per_node",
")",
"from",
"mpi_procs",
"and",
"omp_threads",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/qadapters.py#L2035-L2041 | [
"def",
"bgsize_rankspernode",
"(",
"self",
")",
":",
"bg_size",
"=",
"int",
"(",
"math",
".",
"ceil",
"(",
"(",
"self",
".",
"mpi_procs",
"*",
"self",
".",
"omp_threads",
")",
"/",
"self",
".",
"hw",
".",
"cores_per_node",
")",
")",
"bg_size",
"=",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | alternate | [a[0], b[0], ... , a[1], b[1], ..., a[n], b[n] ...]
>>> alternate([1,4], [2,5], [3,6])
[1, 2, 3, 4, 5, 6] | pymatgen/io/abinit/abitimer.py | def alternate(*iterables):
"""
[a[0], b[0], ... , a[1], b[1], ..., a[n], b[n] ...]
>>> alternate([1,4], [2,5], [3,6])
[1, 2, 3, 4, 5, 6]
"""
items = []
for tup in zip(*iterables):
items.extend([item for item in tup])
return items | def alternate(*iterables):
"""
[a[0], b[0], ... , a[1], b[1], ..., a[n], b[n] ...]
>>> alternate([1,4], [2,5], [3,6])
[1, 2, 3, 4, 5, 6]
"""
items = []
for tup in zip(*iterables):
items.extend([item for item in tup])
return items | [
"[",
"a",
"[",
"0",
"]",
"b",
"[",
"0",
"]",
"...",
"a",
"[",
"1",
"]",
"b",
"[",
"1",
"]",
"...",
"a",
"[",
"n",
"]",
"b",
"[",
"n",
"]",
"...",
"]",
">>>",
"alternate",
"(",
"[",
"1",
"4",
"]",
"[",
"2",
"5",
"]",
"[",
"3",
"6",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L23-L32 | [
"def",
"alternate",
"(",
"*",
"iterables",
")",
":",
"items",
"=",
"[",
"]",
"for",
"tup",
"in",
"zip",
"(",
"*",
"iterables",
")",
":",
"items",
".",
"extend",
"(",
"[",
"item",
"for",
"item",
"in",
"tup",
"]",
")",
"return",
"items"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.walk | Scan directory tree starting from top, look for files with extension `ext` and
parse timing data.
Return: (parser, paths, okfiles)
where `parser` is the new object, `paths` is the list of files found and `okfiles`
is the list of files that have been parsed successfully.
... | pymatgen/io/abinit/abitimer.py | def walk(cls, top=".", ext=".abo"):
"""
Scan directory tree starting from top, look for files with extension `ext` and
parse timing data.
Return: (parser, paths, okfiles)
where `parser` is the new object, `paths` is the list of files found and `okfiles`
is the li... | def walk(cls, top=".", ext=".abo"):
"""
Scan directory tree starting from top, look for files with extension `ext` and
parse timing data.
Return: (parser, paths, okfiles)
where `parser` is the new object, `paths` is the list of files found and `okfiles`
is the li... | [
"Scan",
"directory",
"tree",
"starting",
"from",
"top",
"look",
"for",
"files",
"with",
"extension",
"ext",
"and",
"parse",
"timing",
"data",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L63-L81 | [
"def",
"walk",
"(",
"cls",
",",
"top",
"=",
"\".\"",
",",
"ext",
"=",
"\".abo\"",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"top",
")",
":",
"for",
"f",
"in",
"files",
":",
"if",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.parse | Read and parse a filename or a list of filenames.
Files that cannot be opened are ignored. A single filename may also be given.
Return: list of successfully read files. | pymatgen/io/abinit/abitimer.py | def parse(self, filenames):
"""
Read and parse a filename or a list of filenames.
Files that cannot be opened are ignored. A single filename may also be given.
Return: list of successfully read files.
"""
filenames = list_strings(filenames)
read_ok = []
... | def parse(self, filenames):
"""
Read and parse a filename or a list of filenames.
Files that cannot be opened are ignored. A single filename may also be given.
Return: list of successfully read files.
"""
filenames = list_strings(filenames)
read_ok = []
... | [
"Read",
"and",
"parse",
"a",
"filename",
"or",
"a",
"list",
"of",
"filenames",
".",
"Files",
"that",
"cannot",
"be",
"opened",
"are",
"ignored",
".",
"A",
"single",
"filename",
"may",
"also",
"be",
"given",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L102-L132 | [
"def",
"parse",
"(",
"self",
",",
"filenames",
")",
":",
"filenames",
"=",
"list_strings",
"(",
"filenames",
")",
"read_ok",
"=",
"[",
"]",
"for",
"fname",
"in",
"filenames",
":",
"try",
":",
"fh",
"=",
"open",
"(",
"fname",
")",
"except",
"IOError",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser._read | Parse the TIMER section | pymatgen/io/abinit/abitimer.py | def _read(self, fh, fname):
"""Parse the TIMER section"""
if fname in self._timers:
raise self.Error("Cannot overwrite timer associated to: %s " % fname)
def parse_line(line):
"""Parse single line."""
name, vals = line[:25], line[25:].split()
try:... | def _read(self, fh, fname):
"""Parse the TIMER section"""
if fname in self._timers:
raise self.Error("Cannot overwrite timer associated to: %s " % fname)
def parse_line(line):
"""Parse single line."""
name, vals = line[:25], line[25:].split()
try:... | [
"Parse",
"the",
"TIMER",
"section"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L134-L199 | [
"def",
"_read",
"(",
"self",
",",
"fh",
",",
"fname",
")",
":",
"if",
"fname",
"in",
"self",
".",
"_timers",
":",
"raise",
"self",
".",
"Error",
"(",
"\"Cannot overwrite timer associated to: %s \"",
"%",
"fname",
")",
"def",
"parse_line",
"(",
"line",
")",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.timers | Return the list of timers associated to the given `filename` and MPI rank mpi_rank. | pymatgen/io/abinit/abitimer.py | def timers(self, filename=None, mpi_rank="0"):
"""
Return the list of timers associated to the given `filename` and MPI rank mpi_rank.
"""
if filename is not None:
return [self._timers[filename][mpi_rank]]
else:
return [self._timers[filename][mpi_rank] for... | def timers(self, filename=None, mpi_rank="0"):
"""
Return the list of timers associated to the given `filename` and MPI rank mpi_rank.
"""
if filename is not None:
return [self._timers[filename][mpi_rank]]
else:
return [self._timers[filename][mpi_rank] for... | [
"Return",
"the",
"list",
"of",
"timers",
"associated",
"to",
"the",
"given",
"filename",
"and",
"MPI",
"rank",
"mpi_rank",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L201-L208 | [
"def",
"timers",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"mpi_rank",
"=",
"\"0\"",
")",
":",
"if",
"filename",
"is",
"not",
"None",
":",
"return",
"[",
"self",
".",
"_timers",
"[",
"filename",
"]",
"[",
"mpi_rank",
"]",
"]",
"else",
":",
"r... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.section_names | Return the names of sections ordered by ordkey.
For the time being, the values are taken from the first timer. | pymatgen/io/abinit/abitimer.py | def section_names(self, ordkey="wall_time"):
"""
Return the names of sections ordered by ordkey.
For the time being, the values are taken from the first timer.
"""
section_names = []
# FIXME this is not trivial
for idx, timer in enumerate(self.timers()):
... | def section_names(self, ordkey="wall_time"):
"""
Return the names of sections ordered by ordkey.
For the time being, the values are taken from the first timer.
"""
section_names = []
# FIXME this is not trivial
for idx, timer in enumerate(self.timers()):
... | [
"Return",
"the",
"names",
"of",
"sections",
"ordered",
"by",
"ordkey",
".",
"For",
"the",
"time",
"being",
"the",
"values",
"are",
"taken",
"from",
"the",
"first",
"timer",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L210-L231 | [
"def",
"section_names",
"(",
"self",
",",
"ordkey",
"=",
"\"wall_time\"",
")",
":",
"section_names",
"=",
"[",
"]",
"# FIXME this is not trivial",
"for",
"idx",
",",
"timer",
"in",
"enumerate",
"(",
"self",
".",
"timers",
"(",
")",
")",
":",
"if",
"idx",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.get_sections | Return the list of sections stored in self.timers() given `section_name`
A fake section is returned if the timer does not have section_name. | pymatgen/io/abinit/abitimer.py | def get_sections(self, section_name):
"""
Return the list of sections stored in self.timers() given `section_name`
A fake section is returned if the timer does not have section_name.
"""
sections = []
for timer in self.timers():
for sect in timer.sections:
... | def get_sections(self, section_name):
"""
Return the list of sections stored in self.timers() given `section_name`
A fake section is returned if the timer does not have section_name.
"""
sections = []
for timer in self.timers():
for sect in timer.sections:
... | [
"Return",
"the",
"list",
"of",
"sections",
"stored",
"in",
"self",
".",
"timers",
"()",
"given",
"section_name",
"A",
"fake",
"section",
"is",
"returned",
"if",
"the",
"timer",
"does",
"not",
"have",
"section_name",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L233-L247 | [
"def",
"get_sections",
"(",
"self",
",",
"section_name",
")",
":",
"sections",
"=",
"[",
"]",
"for",
"timer",
"in",
"self",
".",
"timers",
"(",
")",
":",
"for",
"sect",
"in",
"timer",
".",
"sections",
":",
"if",
"sect",
".",
"name",
"==",
"section_na... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.pefficiency | Analyze the parallel efficiency.
Return:
:class:`ParallelEfficiency` object. | pymatgen/io/abinit/abitimer.py | def pefficiency(self):
"""
Analyze the parallel efficiency.
Return:
:class:`ParallelEfficiency` object.
"""
timers = self.timers()
# Number of CPUs employed in each calculation.
ncpus = [timer.ncpus for timer in timers]
# Find the minimum nu... | def pefficiency(self):
"""
Analyze the parallel efficiency.
Return:
:class:`ParallelEfficiency` object.
"""
timers = self.timers()
# Number of CPUs employed in each calculation.
ncpus = [timer.ncpus for timer in timers]
# Find the minimum nu... | [
"Analyze",
"the",
"parallel",
"efficiency",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L249-L299 | [
"def",
"pefficiency",
"(",
"self",
")",
":",
"timers",
"=",
"self",
".",
"timers",
"(",
")",
"# Number of CPUs employed in each calculation.",
"ncpus",
"=",
"[",
"timer",
".",
"ncpus",
"for",
"timer",
"in",
"timers",
"]",
"# Find the minimum number of cpus used and ... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.summarize | Return pandas DataFrame with the most important results stored in the timers. | pymatgen/io/abinit/abitimer.py | def summarize(self, **kwargs):
"""
Return pandas DataFrame with the most important results stored in the timers.
"""
import pandas as pd
colnames = ["fname", "wall_time", "cpu_time", "mpi_nprocs", "omp_nthreads", "mpi_rank"]
frame = pd.DataFrame(columns=colnames)
... | def summarize(self, **kwargs):
"""
Return pandas DataFrame with the most important results stored in the timers.
"""
import pandas as pd
colnames = ["fname", "wall_time", "cpu_time", "mpi_nprocs", "omp_nthreads", "mpi_rank"]
frame = pd.DataFrame(columns=colnames)
... | [
"Return",
"pandas",
"DataFrame",
"with",
"the",
"most",
"important",
"results",
"stored",
"in",
"the",
"timers",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L301-L319 | [
"def",
"summarize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"pandas",
"as",
"pd",
"colnames",
"=",
"[",
"\"fname\"",
",",
"\"wall_time\"",
",",
"\"cpu_time\"",
",",
"\"mpi_nprocs\"",
",",
"\"omp_nthreads\"",
",",
"\"mpi_rank\"",
"]",
"frame... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.plot_efficiency | Plot the parallel efficiency
Args:
key: Parallel efficiency is computed using the wall_time.
what: Specifies what to plot: `good` for sections with good parallel efficiency.
`bad` for sections with bad efficiency. Options can be concatenated with `+`.
nmax: M... | pymatgen/io/abinit/abitimer.py | def plot_efficiency(self, key="wall_time", what="good+bad", nmax=5, ax=None, **kwargs):
"""
Plot the parallel efficiency
Args:
key: Parallel efficiency is computed using the wall_time.
what: Specifies what to plot: `good` for sections with good parallel efficiency.
... | def plot_efficiency(self, key="wall_time", what="good+bad", nmax=5, ax=None, **kwargs):
"""
Plot the parallel efficiency
Args:
key: Parallel efficiency is computed using the wall_time.
what: Specifies what to plot: `good` for sections with good parallel efficiency.
... | [
"Plot",
"the",
"parallel",
"efficiency"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L322-L396 | [
"def",
"plot_efficiency",
"(",
"self",
",",
"key",
"=",
"\"wall_time\"",
",",
"what",
"=",
"\"good+bad\"",
",",
"nmax",
"=",
"5",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
",",
"fig",
",",
"plt",
"=",
"get_ax_fig_plt",
"(",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.plot_pie | Plot pie charts of the different timers.
Args:
key: Keyword used to extract data from timers.
minfract: Don't show sections whose relative weight is less that minfract.
Returns:
`matplotlib` figure | pymatgen/io/abinit/abitimer.py | def plot_pie(self, key="wall_time", minfract=0.05, **kwargs):
"""
Plot pie charts of the different timers.
Args:
key: Keyword used to extract data from timers.
minfract: Don't show sections whose relative weight is less that minfract.
Returns:
`matpl... | def plot_pie(self, key="wall_time", minfract=0.05, **kwargs):
"""
Plot pie charts of the different timers.
Args:
key: Keyword used to extract data from timers.
minfract: Don't show sections whose relative weight is less that minfract.
Returns:
`matpl... | [
"Plot",
"pie",
"charts",
"of",
"the",
"different",
"timers",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L399-L423 | [
"def",
"plot_pie",
"(",
"self",
",",
"key",
"=",
"\"wall_time\"",
",",
"minfract",
"=",
"0.05",
",",
"*",
"*",
"kwargs",
")",
":",
"timers",
"=",
"self",
".",
"timers",
"(",
")",
"n",
"=",
"len",
"(",
"timers",
")",
"# Make square figures and axes",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.plot_stacked_hist | Plot stacked histogram of the different timers.
Args:
key: Keyword used to extract data from the timers. Only the first `nmax`
sections with largest value are show.
mmax: Maximum nuber of sections to show. Other entries are grouped together
in the `others... | pymatgen/io/abinit/abitimer.py | def plot_stacked_hist(self, key="wall_time", nmax=5, ax=None, **kwargs):
"""
Plot stacked histogram of the different timers.
Args:
key: Keyword used to extract data from the timers. Only the first `nmax`
sections with largest value are show.
mmax: Maximum... | def plot_stacked_hist(self, key="wall_time", nmax=5, ax=None, **kwargs):
"""
Plot stacked histogram of the different timers.
Args:
key: Keyword used to extract data from the timers. Only the first `nmax`
sections with largest value are show.
mmax: Maximum... | [
"Plot",
"stacked",
"histogram",
"of",
"the",
"different",
"timers",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L426-L485 | [
"def",
"plot_stacked_hist",
"(",
"self",
",",
"key",
"=",
"\"wall_time\"",
",",
"nmax",
"=",
"5",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
",",
"fig",
",",
"plt",
"=",
"get_ax_fig_plt",
"(",
"ax",
"=",
"ax",
")",
"mpi_rank",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerParser.plot_all | Call all plot methods provided by the parser. | pymatgen/io/abinit/abitimer.py | def plot_all(self, show=True, **kwargs):
"""
Call all plot methods provided by the parser.
"""
figs = []; app = figs.append
app(self.plot_stacked_hist(show=show))
app(self.plot_efficiency(show=show))
app(self.plot_pie(show=show))
return figs | def plot_all(self, show=True, **kwargs):
"""
Call all plot methods provided by the parser.
"""
figs = []; app = figs.append
app(self.plot_stacked_hist(show=show))
app(self.plot_efficiency(show=show))
app(self.plot_pie(show=show))
return figs | [
"Call",
"all",
"plot",
"methods",
"provided",
"by",
"the",
"parser",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L487-L495 | [
"def",
"plot_all",
"(",
"self",
",",
"show",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"figs",
"=",
"[",
"]",
"app",
"=",
"figs",
".",
"append",
"app",
"(",
"self",
".",
"plot_stacked_hist",
"(",
"show",
"=",
"show",
")",
")",
"app",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimerSection.to_csvline | Return a string with data in CSV format | pymatgen/io/abinit/abitimer.py | def to_csvline(self, with_header=False):
"""Return a string with data in CSV format"""
string = ""
if with_header:
string += "# " + " ".join(at for at in AbinitTimerSection.FIELDS) + "\n"
string += ", ".join(str(v) for v in self.to_tuple()) + "\n"
return string | def to_csvline(self, with_header=False):
"""Return a string with data in CSV format"""
string = ""
if with_header:
string += "# " + " ".join(at for at in AbinitTimerSection.FIELDS) + "\n"
string += ", ".join(str(v) for v in self.to_tuple()) + "\n"
return string | [
"Return",
"a",
"string",
"with",
"data",
"in",
"CSV",
"format"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L588-L596 | [
"def",
"to_csvline",
"(",
"self",
",",
"with_header",
"=",
"False",
")",
":",
"string",
"=",
"\"\"",
"if",
"with_header",
":",
"string",
"+=",
"\"# \"",
"+",
"\" \"",
".",
"join",
"(",
"at",
"for",
"at",
"in",
"AbinitTimerSection",
".",
"FIELDS",
")",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.to_csv | Write data on file fileobj using CSV format. | pymatgen/io/abinit/abitimer.py | def to_csv(self, fileobj=sys.stdout):
"""Write data on file fileobj using CSV format."""
openclose = is_string(fileobj)
if openclose:
fileobj = open(fileobj, "w")
for idx, section in enumerate(self.sections):
fileobj.write(section.to_csvline(with_header=(idx == ... | def to_csv(self, fileobj=sys.stdout):
"""Write data on file fileobj using CSV format."""
openclose = is_string(fileobj)
if openclose:
fileobj = open(fileobj, "w")
for idx, section in enumerate(self.sections):
fileobj.write(section.to_csvline(with_header=(idx == ... | [
"Write",
"data",
"on",
"file",
"fileobj",
"using",
"CSV",
"format",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L644-L656 | [
"def",
"to_csv",
"(",
"self",
",",
"fileobj",
"=",
"sys",
".",
"stdout",
")",
":",
"openclose",
"=",
"is_string",
"(",
"fileobj",
")",
"if",
"openclose",
":",
"fileobj",
"=",
"open",
"(",
"fileobj",
",",
"\"w\"",
")",
"for",
"idx",
",",
"section",
"i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.to_table | Return a table (list of lists) with timer data | pymatgen/io/abinit/abitimer.py | def to_table(self, sort_key="wall_time", stop=None):
"""Return a table (list of lists) with timer data"""
table = [list(AbinitTimerSection.FIELDS), ]
ord_sections = self.order_sections(sort_key)
if stop is not None:
ord_sections = ord_sections[:stop]
for osect in or... | def to_table(self, sort_key="wall_time", stop=None):
"""Return a table (list of lists) with timer data"""
table = [list(AbinitTimerSection.FIELDS), ]
ord_sections = self.order_sections(sort_key)
if stop is not None:
ord_sections = ord_sections[:stop]
for osect in or... | [
"Return",
"a",
"table",
"(",
"list",
"of",
"lists",
")",
"with",
"timer",
"data"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L658-L670 | [
"def",
"to_table",
"(",
"self",
",",
"sort_key",
"=",
"\"wall_time\"",
",",
"stop",
"=",
"None",
")",
":",
"table",
"=",
"[",
"list",
"(",
"AbinitTimerSection",
".",
"FIELDS",
")",
",",
"]",
"ord_sections",
"=",
"self",
".",
"order_sections",
"(",
"sort_... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.get_dataframe | Return a pandas DataFrame with entries sorted according to `sort_key`. | pymatgen/io/abinit/abitimer.py | def get_dataframe(self, sort_key="wall_time", **kwargs):
"""
Return a pandas DataFrame with entries sorted according to `sort_key`.
"""
import pandas as pd
frame = pd.DataFrame(columns=AbinitTimerSection.FIELDS)
for osect in self.order_sections(sort_key):
fra... | def get_dataframe(self, sort_key="wall_time", **kwargs):
"""
Return a pandas DataFrame with entries sorted according to `sort_key`.
"""
import pandas as pd
frame = pd.DataFrame(columns=AbinitTimerSection.FIELDS)
for osect in self.order_sections(sort_key):
fra... | [
"Return",
"a",
"pandas",
"DataFrame",
"with",
"entries",
"sorted",
"according",
"to",
"sort_key",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L675-L694 | [
"def",
"get_dataframe",
"(",
"self",
",",
"sort_key",
"=",
"\"wall_time\"",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"pandas",
"as",
"pd",
"frame",
"=",
"pd",
".",
"DataFrame",
"(",
"columns",
"=",
"AbinitTimerSection",
".",
"FIELDS",
")",
"for",
"os... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.get_values | Return a list of values associated to a particular list of keys. | pymatgen/io/abinit/abitimer.py | def get_values(self, keys):
"""
Return a list of values associated to a particular list of keys.
"""
if is_string(keys):
return [s.__dict__[keys] for s in self.sections]
else:
values = []
for k in keys:
values.append([s.__dict__... | def get_values(self, keys):
"""
Return a list of values associated to a particular list of keys.
"""
if is_string(keys):
return [s.__dict__[keys] for s in self.sections]
else:
values = []
for k in keys:
values.append([s.__dict__... | [
"Return",
"a",
"list",
"of",
"values",
"associated",
"to",
"a",
"particular",
"list",
"of",
"keys",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L696-L706 | [
"def",
"get_values",
"(",
"self",
",",
"keys",
")",
":",
"if",
"is_string",
"(",
"keys",
")",
":",
"return",
"[",
"s",
".",
"__dict__",
"[",
"keys",
"]",
"for",
"s",
"in",
"self",
".",
"sections",
"]",
"else",
":",
"values",
"=",
"[",
"]",
"for",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.names_and_values | Select the entries whose value[key] is >= minval or whose fraction[key] is >= minfract
Return the names of the sections and the corresponding values. | pymatgen/io/abinit/abitimer.py | def names_and_values(self, key, minval=None, minfract=None, sorted=True):
"""
Select the entries whose value[key] is >= minval or whose fraction[key] is >= minfract
Return the names of the sections and the corresponding values.
"""
values = self.get_values(key)
names = se... | def names_and_values(self, key, minval=None, minfract=None, sorted=True):
"""
Select the entries whose value[key] is >= minval or whose fraction[key] is >= minfract
Return the names of the sections and the corresponding values.
"""
values = self.get_values(key)
names = se... | [
"Select",
"the",
"entries",
"whose",
"value",
"[",
"key",
"]",
"is",
">",
"=",
"minval",
"or",
"whose",
"fraction",
"[",
"key",
"]",
"is",
">",
"=",
"minfract",
"Return",
"the",
"names",
"of",
"the",
"sections",
"and",
"the",
"corresponding",
"values",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L708-L758 | [
"def",
"names_and_values",
"(",
"self",
",",
"key",
",",
"minval",
"=",
"None",
",",
"minfract",
"=",
"None",
",",
"sorted",
"=",
"True",
")",
":",
"values",
"=",
"self",
".",
"get_values",
"(",
"key",
")",
"names",
"=",
"self",
".",
"get_values",
"(... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.order_sections | Sort sections according to the value of key. | pymatgen/io/abinit/abitimer.py | def order_sections(self, key, reverse=True):
"""Sort sections according to the value of key."""
fsort = lambda s: s.__dict__[key]
return sorted(self.sections, key=fsort, reverse=reverse) | def order_sections(self, key, reverse=True):
"""Sort sections according to the value of key."""
fsort = lambda s: s.__dict__[key]
return sorted(self.sections, key=fsort, reverse=reverse) | [
"Sort",
"sections",
"according",
"to",
"the",
"value",
"of",
"key",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L766-L769 | [
"def",
"order_sections",
"(",
"self",
",",
"key",
",",
"reverse",
"=",
"True",
")",
":",
"fsort",
"=",
"lambda",
"s",
":",
"s",
".",
"__dict__",
"[",
"key",
"]",
"return",
"sorted",
"(",
"self",
".",
"sections",
",",
"key",
"=",
"fsort",
",",
"reve... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AbinitTimer.pie | Plot pie chart for this timer.
Args:
key: Keyword used to extract data from the timer.
minfract: Don't show sections whose relative weight is less that minfract.
ax: matplotlib :class:`Axes` or None if a new figure should be created.
Returns:
`matplotlib... | pymatgen/io/abinit/abitimer.py | def pie(self, key="wall_time", minfract=0.05, ax=None, **kwargs):
"""
Plot pie chart for this timer.
Args:
key: Keyword used to extract data from the timer.
minfract: Don't show sections whose relative weight is less that minfract.
ax: matplotlib :class:`Axes... | def pie(self, key="wall_time", minfract=0.05, ax=None, **kwargs):
"""
Plot pie chart for this timer.
Args:
key: Keyword used to extract data from the timer.
minfract: Don't show sections whose relative weight is less that minfract.
ax: matplotlib :class:`Axes... | [
"Plot",
"pie",
"chart",
"for",
"this",
"timer",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/abitimer.py#L817-L835 | [
"def",
"pie",
"(",
"self",
",",
"key",
"=",
"\"wall_time\"",
",",
"minfract",
"=",
"0.05",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
",",
"fig",
",",
"plt",
"=",
"get_ax_fig_plt",
"(",
"ax",
"=",
"ax",
")",
"# Set aspect rati... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AseAtomsAdaptor.get_atoms | Returns ASE Atoms object from pymatgen structure.
Args:
structure: pymatgen.core.structure.Structure
**kwargs: other keyword args to pass into the ASE Atoms constructor
Returns:
ASE Atoms object | pymatgen/io/ase.py | def get_atoms(structure, **kwargs):
"""
Returns ASE Atoms object from pymatgen structure.
Args:
structure: pymatgen.core.structure.Structure
**kwargs: other keyword args to pass into the ASE Atoms constructor
Returns:
ASE Atoms object
"""
... | def get_atoms(structure, **kwargs):
"""
Returns ASE Atoms object from pymatgen structure.
Args:
structure: pymatgen.core.structure.Structure
**kwargs: other keyword args to pass into the ASE Atoms constructor
Returns:
ASE Atoms object
"""
... | [
"Returns",
"ASE",
"Atoms",
"object",
"from",
"pymatgen",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/ase.py#L34-L51 | [
"def",
"get_atoms",
"(",
"structure",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"structure",
".",
"is_ordered",
":",
"raise",
"ValueError",
"(",
"\"ASE Atoms only supports ordered structures\"",
")",
"symbols",
"=",
"[",
"str",
"(",
"site",
".",
"specie"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | AseAtomsAdaptor.get_structure | Returns pymatgen structure from ASE Atoms.
Args:
atoms: ASE Atoms object
cls: The Structure class to instantiate (defaults to pymatgen structure)
Returns:
Equivalent pymatgen.core.structure.Structure | pymatgen/io/ase.py | def get_structure(atoms, cls=None):
"""
Returns pymatgen structure from ASE Atoms.
Args:
atoms: ASE Atoms object
cls: The Structure class to instantiate (defaults to pymatgen structure)
Returns:
Equivalent pymatgen.core.structure.Structure
""... | def get_structure(atoms, cls=None):
"""
Returns pymatgen structure from ASE Atoms.
Args:
atoms: ASE Atoms object
cls: The Structure class to instantiate (defaults to pymatgen structure)
Returns:
Equivalent pymatgen.core.structure.Structure
""... | [
"Returns",
"pymatgen",
"structure",
"from",
"ASE",
"Atoms",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/ase.py#L54-L71 | [
"def",
"get_structure",
"(",
"atoms",
",",
"cls",
"=",
"None",
")",
":",
"symbols",
"=",
"atoms",
".",
"get_chemical_symbols",
"(",
")",
"positions",
"=",
"atoms",
".",
"get_positions",
"(",
")",
"lattice",
"=",
"atoms",
".",
"get_cell",
"(",
")",
"cls",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.get_smeared_densities | Returns the densities, but with a Gaussian smearing of
std dev sigma applied.
Args:
sigma: Std dev of Gaussian smearing function.
Returns:
Gaussian-smeared densities. | pymatgen/phonon/dos.py | def get_smeared_densities(self, sigma):
"""
Returns the densities, but with a Gaussian smearing of
std dev sigma applied.
Args:
sigma: Std dev of Gaussian smearing function.
Returns:
Gaussian-smeared densities.
"""
from scipy.ndimage.fil... | def get_smeared_densities(self, sigma):
"""
Returns the densities, but with a Gaussian smearing of
std dev sigma applied.
Args:
sigma: Std dev of Gaussian smearing function.
Returns:
Gaussian-smeared densities.
"""
from scipy.ndimage.fil... | [
"Returns",
"the",
"densities",
"but",
"with",
"a",
"Gaussian",
"smearing",
"of",
"std",
"dev",
"sigma",
"applied",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L36-L54 | [
"def",
"get_smeared_densities",
"(",
"self",
",",
"sigma",
")",
":",
"from",
"scipy",
".",
"ndimage",
".",
"filters",
"import",
"gaussian_filter1d",
"diff",
"=",
"[",
"self",
".",
"frequencies",
"[",
"i",
"+",
"1",
"]",
"-",
"self",
".",
"frequencies",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.as_dict | Json-serializable dict representation of PhononDos. | pymatgen/phonon/dos.py | def as_dict(self):
"""
Json-serializable dict representation of PhononDos.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"frequencies": list(self.frequencies),
"densities": list(self.densities)} | def as_dict(self):
"""
Json-serializable dict representation of PhononDos.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"frequencies": list(self.frequencies),
"densities": list(self.densities)} | [
"Json",
"-",
"serializable",
"dict",
"representation",
"of",
"PhononDos",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L112-L119 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"return",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"frequencies\"",
":",
"list",
"(",
"self",
".",
"frequencies"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.ind_zero_freq | Index of the first point for which the freqencies are equal or greater than zero. | pymatgen/phonon/dos.py | def ind_zero_freq(self):
"""
Index of the first point for which the freqencies are equal or greater than zero.
"""
ind = np.searchsorted(self.frequencies, 0)
if ind >= len(self.frequencies):
raise ValueError("No positive frequencies found")
return ind | def ind_zero_freq(self):
"""
Index of the first point for which the freqencies are equal or greater than zero.
"""
ind = np.searchsorted(self.frequencies, 0)
if ind >= len(self.frequencies):
raise ValueError("No positive frequencies found")
return ind | [
"Index",
"of",
"the",
"first",
"point",
"for",
"which",
"the",
"freqencies",
"are",
"equal",
"or",
"greater",
"than",
"zero",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L122-L129 | [
"def",
"ind_zero_freq",
"(",
"self",
")",
":",
"ind",
"=",
"np",
".",
"searchsorted",
"(",
"self",
".",
"frequencies",
",",
"0",
")",
"if",
"ind",
">=",
"len",
"(",
"self",
".",
"frequencies",
")",
":",
"raise",
"ValueError",
"(",
"\"No positive frequenc... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.cv | Constant volume specific heat C_v at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/(K*mol-c). A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with experimental dat... | pymatgen/phonon/dos.py | def cv(self, t, structure=None):
"""
Constant volume specific heat C_v at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/(K*mol-c). A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the a... | def cv(self, t, structure=None):
"""
Constant volume specific heat C_v at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/(K*mol-c). A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the a... | [
"Constant",
"volume",
"specific",
"heat",
"C_v",
"at",
"temperature",
"T",
"obtained",
"from",
"the",
"integration",
"of",
"the",
"DOS",
".",
"Only",
"positive",
"frequencies",
"will",
"be",
"used",
".",
"Result",
"in",
"J",
"/",
"(",
"K",
"*",
"mol",
"-... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L145-L178 | [
"def",
"cv",
"(",
"self",
",",
"t",
",",
"structure",
"=",
"None",
")",
":",
"if",
"t",
"==",
"0",
":",
"return",
"0",
"freqs",
"=",
"self",
".",
"_positive_frequencies",
"dens",
"=",
"self",
".",
"_positive_densities",
"csch2",
"=",
"lambda",
"x",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.entropy | Vibrational entropy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/(K*mol-c). A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with experimental data the result
... | pymatgen/phonon/dos.py | def entropy(self, t, structure=None):
"""
Vibrational entropy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/(K*mol-c). A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a... | def entropy(self, t, structure=None):
"""
Vibrational entropy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/(K*mol-c). A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a... | [
"Vibrational",
"entropy",
"at",
"temperature",
"T",
"obtained",
"from",
"the",
"integration",
"of",
"the",
"DOS",
".",
"Only",
"positive",
"frequencies",
"will",
"be",
"used",
".",
"Result",
"in",
"J",
"/",
"(",
"K",
"*",
"mol",
"-",
"c",
")",
".",
"A"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L180-L214 | [
"def",
"entropy",
"(",
"self",
",",
"t",
",",
"structure",
"=",
"None",
")",
":",
"if",
"t",
"==",
"0",
":",
"return",
"0",
"freqs",
"=",
"self",
".",
"_positive_frequencies",
"dens",
"=",
"self",
".",
"_positive_densities",
"coth",
"=",
"lambda",
"x",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.internal_energy | Phonon contribution to the internal energy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with experimenta... | pymatgen/phonon/dos.py | def internal_energy(self, t, structure=None):
"""
Phonon contribution to the internal energy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Av... | def internal_energy(self, t, structure=None):
"""
Phonon contribution to the internal energy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Av... | [
"Phonon",
"contribution",
"to",
"the",
"internal",
"energy",
"at",
"temperature",
"T",
"obtained",
"from",
"the",
"integration",
"of",
"the",
"DOS",
".",
"Only",
"positive",
"frequencies",
"will",
"be",
"used",
".",
"Result",
"in",
"J",
"/",
"mol",
"-",
"c... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L216-L250 | [
"def",
"internal_energy",
"(",
"self",
",",
"t",
",",
"structure",
"=",
"None",
")",
":",
"if",
"t",
"==",
"0",
":",
"return",
"self",
".",
"zero_point_energy",
"(",
"structure",
"=",
"structure",
")",
"freqs",
"=",
"self",
".",
"_positive_frequencies",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.helmholtz_free_energy | Phonon contribution to the Helmholtz free energy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with exper... | pymatgen/phonon/dos.py | def helmholtz_free_energy(self, t, structure=None):
"""
Phonon contribution to the Helmholtz free energy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
... | def helmholtz_free_energy(self, t, structure=None):
"""
Phonon contribution to the Helmholtz free energy at temperature T obtained from the integration of the DOS.
Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
... | [
"Phonon",
"contribution",
"to",
"the",
"Helmholtz",
"free",
"energy",
"at",
"temperature",
"T",
"obtained",
"from",
"the",
"integration",
"of",
"the",
"DOS",
".",
"Only",
"positive",
"frequencies",
"will",
"be",
"used",
".",
"Result",
"in",
"J",
"/",
"mol",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L252-L284 | [
"def",
"helmholtz_free_energy",
"(",
"self",
",",
"t",
",",
"structure",
"=",
"None",
")",
":",
"if",
"t",
"==",
"0",
":",
"return",
"self",
".",
"zero_point_energy",
"(",
"structure",
"=",
"structure",
")",
"freqs",
"=",
"self",
".",
"_positive_frequencie... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | PhononDos.zero_point_energy | Zero point energy energy of the system. Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with experimental data the result
should be divided by the number of unit form... | pymatgen/phonon/dos.py | def zero_point_energy(self, structure=None):
"""
Zero point energy energy of the system. Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with experimental dat... | def zero_point_energy(self, structure=None):
"""
Zero point energy energy of the system. Only positive frequencies will be used.
Result in J/mol-c. A mol-c is the abbreviation of a mole-cell, that is, the number
of Avogadro times the atoms in a unit cell. To compare with experimental dat... | [
"Zero",
"point",
"energy",
"energy",
"of",
"the",
"system",
".",
"Only",
"positive",
"frequencies",
"will",
"be",
"used",
".",
"Result",
"in",
"J",
"/",
"mol",
"-",
"c",
".",
"A",
"mol",
"-",
"c",
"is",
"the",
"abbreviation",
"of",
"a",
"mole",
"-",
... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L286-L312 | [
"def",
"zero_point_energy",
"(",
"self",
",",
"structure",
"=",
"None",
")",
":",
"freqs",
"=",
"self",
".",
"_positive_frequencies",
"dens",
"=",
"self",
".",
"_positive_densities",
"zpe",
"=",
"0.5",
"*",
"np",
".",
"trapz",
"(",
"freqs",
"*",
"dens",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CompletePhononDos.get_element_dos | Get element projected Dos.
Returns:
dict of {Element: Dos} | pymatgen/phonon/dos.py | def get_element_dos(self):
"""
Get element projected Dos.
Returns:
dict of {Element: Dos}
"""
el_dos = {}
for site, atom_dos in self.pdos.items():
el = site.specie
if el not in el_dos:
el_dos[el] = np.array(atom_dos)
... | def get_element_dos(self):
"""
Get element projected Dos.
Returns:
dict of {Element: Dos}
"""
el_dos = {}
for site, atom_dos in self.pdos.items():
el = site.specie
if el not in el_dos:
el_dos[el] = np.array(atom_dos)
... | [
"Get",
"element",
"projected",
"Dos",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L346-L362 | [
"def",
"get_element_dos",
"(",
"self",
")",
":",
"el_dos",
"=",
"{",
"}",
"for",
"site",
",",
"atom_dos",
"in",
"self",
".",
"pdos",
".",
"items",
"(",
")",
":",
"el",
"=",
"site",
".",
"specie",
"if",
"el",
"not",
"in",
"el_dos",
":",
"el_dos",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CompletePhononDos.from_dict | Returns CompleteDos object from dict representation. | pymatgen/phonon/dos.py | def from_dict(cls, d):
"""
Returns CompleteDos object from dict representation.
"""
tdos = PhononDos.from_dict(d)
struct = Structure.from_dict(d["structure"])
pdoss = {}
for at, pdos in zip(struct, d["pdos"]):
pdoss[at] = pdos
return cls(struc... | def from_dict(cls, d):
"""
Returns CompleteDos object from dict representation.
"""
tdos = PhononDos.from_dict(d)
struct = Structure.from_dict(d["structure"])
pdoss = {}
for at, pdos in zip(struct, d["pdos"]):
pdoss[at] = pdos
return cls(struc... | [
"Returns",
"CompleteDos",
"object",
"from",
"dict",
"representation",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L365-L375 | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"tdos",
"=",
"PhononDos",
".",
"from_dict",
"(",
"d",
")",
"struct",
"=",
"Structure",
".",
"from_dict",
"(",
"d",
"[",
"\"structure\"",
"]",
")",
"pdoss",
"=",
"{",
"}",
"for",
"at",
",",
"pdos",... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | CompletePhononDos.as_dict | Json-serializable dict representation of CompletePhononDos. | pymatgen/phonon/dos.py | def as_dict(self):
"""
Json-serializable dict representation of CompletePhononDos.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"structure": self.structure.as_dict(),
"frequencies": list(self.frequencies),
... | def as_dict(self):
"""
Json-serializable dict representation of CompletePhononDos.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"structure": self.structure.as_dict(),
"frequencies": list(self.frequencies),
... | [
"Json",
"-",
"serializable",
"dict",
"representation",
"of",
"CompletePhononDos",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/phonon/dos.py#L377-L390 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"\"@module\"",
":",
"self",
".",
"__class__",
".",
"__module__",
",",
"\"@class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"structure\"",
":",
"self",
".",
"structure",
".",
"as_dict... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | sort_dict | Sorts a dict by value.
Args:
d: Input dictionary
key: Function which takes an tuple (key, object) and returns a value to
compare and sort by. By default, the function compares the values
of the dict i.e. key = lambda t : t[1]
reverse: Allows to reverse sort order.
... | pymatgen/util/num.py | def sort_dict(d, key=None, reverse=False):
"""
Sorts a dict by value.
Args:
d: Input dictionary
key: Function which takes an tuple (key, object) and returns a value to
compare and sort by. By default, the function compares the values
of the dict i.e. key = lambda t :... | def sort_dict(d, key=None, reverse=False):
"""
Sorts a dict by value.
Args:
d: Input dictionary
key: Function which takes an tuple (key, object) and returns a value to
compare and sort by. By default, the function compares the values
of the dict i.e. key = lambda t :... | [
"Sorts",
"a",
"dict",
"by",
"value",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L31-L54 | [
"def",
"sort_dict",
"(",
"d",
",",
"key",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"kv_items",
"=",
"[",
"kv",
"for",
"kv",
"in",
"d",
".",
"items",
"(",
")",
"]",
"# Sort kv_items according to key.",
"if",
"key",
"is",
"None",
":",
"kv_i... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | min_max_indexes | Uses enumerate, max, and min to return the indices of the values
in a list with the maximum and minimum value: | pymatgen/util/num.py | def min_max_indexes(seq):
"""
Uses enumerate, max, and min to return the indices of the values
in a list with the maximum and minimum value:
"""
l = sorted(enumerate(seq), key=lambda s: s[1])
return l[0][0], l[-1][0] | def min_max_indexes(seq):
"""
Uses enumerate, max, and min to return the indices of the values
in a list with the maximum and minimum value:
"""
l = sorted(enumerate(seq), key=lambda s: s[1])
return l[0][0], l[-1][0] | [
"Uses",
"enumerate",
"max",
"and",
"min",
"to",
"return",
"the",
"indices",
"of",
"the",
"values",
"in",
"a",
"list",
"with",
"the",
"maximum",
"and",
"minimum",
"value",
":"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L75-L81 | [
"def",
"min_max_indexes",
"(",
"seq",
")",
":",
"l",
"=",
"sorted",
"(",
"enumerate",
"(",
"seq",
")",
",",
"key",
"=",
"lambda",
"s",
":",
"s",
"[",
"1",
"]",
")",
"return",
"l",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"l",
"[",
"-",
"1",
"]",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | strictly_increasing | True if values are stricly increasing. | pymatgen/util/num.py | def strictly_increasing(values):
"""True if values are stricly increasing."""
return all(x < y for x, y in zip(values, values[1:])) | def strictly_increasing(values):
"""True if values are stricly increasing."""
return all(x < y for x, y in zip(values, values[1:])) | [
"True",
"if",
"values",
"are",
"stricly",
"increasing",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L84-L86 | [
"def",
"strictly_increasing",
"(",
"values",
")",
":",
"return",
"all",
"(",
"x",
"<",
"y",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"values",
",",
"values",
"[",
"1",
":",
"]",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | strictly_decreasing | True if values are stricly decreasing. | pymatgen/util/num.py | def strictly_decreasing(values):
"""True if values are stricly decreasing."""
return all(x > y for x, y in zip(values, values[1:])) | def strictly_decreasing(values):
"""True if values are stricly decreasing."""
return all(x > y for x, y in zip(values, values[1:])) | [
"True",
"if",
"values",
"are",
"stricly",
"decreasing",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L89-L91 | [
"def",
"strictly_decreasing",
"(",
"values",
")",
":",
"return",
"all",
"(",
"x",
">",
"y",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"values",
",",
"values",
"[",
"1",
":",
"]",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | non_increasing | True if values are not increasing. | pymatgen/util/num.py | def non_increasing(values):
"""True if values are not increasing."""
return all(x >= y for x, y in zip(values, values[1:])) | def non_increasing(values):
"""True if values are not increasing."""
return all(x >= y for x, y in zip(values, values[1:])) | [
"True",
"if",
"values",
"are",
"not",
"increasing",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L94-L96 | [
"def",
"non_increasing",
"(",
"values",
")",
":",
"return",
"all",
"(",
"x",
">=",
"y",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"values",
",",
"values",
"[",
"1",
":",
"]",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | non_decreasing | True if values are not decreasing. | pymatgen/util/num.py | def non_decreasing(values):
"""True if values are not decreasing."""
return all(x <= y for x, y in zip(values, values[1:])) | def non_decreasing(values):
"""True if values are not decreasing."""
return all(x <= y for x, y in zip(values, values[1:])) | [
"True",
"if",
"values",
"are",
"not",
"decreasing",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L99-L101 | [
"def",
"non_decreasing",
"(",
"values",
")",
":",
"return",
"all",
"(",
"x",
"<=",
"y",
"for",
"x",
",",
"y",
"in",
"zip",
"(",
"values",
",",
"values",
"[",
"1",
":",
"]",
")",
")"
] | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | monotonic | Returns False if values are not monotonic (decreasing|increasing).
mode is "<" for a decreasing sequence, ">" for an increasing sequence.
Two numbers are considered equal if they differ less that atol.
.. warning:
Not very efficient for large data sets.
>>> values = [1.2, 1.3, 1.4]
>>> mon... | pymatgen/util/num.py | def monotonic(values, mode="<", atol=1.e-8):
"""
Returns False if values are not monotonic (decreasing|increasing).
mode is "<" for a decreasing sequence, ">" for an increasing sequence.
Two numbers are considered equal if they differ less that atol.
.. warning:
Not very efficient for large... | def monotonic(values, mode="<", atol=1.e-8):
"""
Returns False if values are not monotonic (decreasing|increasing).
mode is "<" for a decreasing sequence, ">" for an increasing sequence.
Two numbers are considered equal if they differ less that atol.
.. warning:
Not very efficient for large... | [
"Returns",
"False",
"if",
"values",
"are",
"not",
"monotonic",
"(",
"decreasing|increasing",
")",
".",
"mode",
"is",
"<",
"for",
"a",
"decreasing",
"sequence",
">",
"for",
"an",
"increasing",
"sequence",
".",
"Two",
"numbers",
"are",
"considered",
"equal",
"... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L104-L137 | [
"def",
"monotonic",
"(",
"values",
",",
"mode",
"=",
"\"<\"",
",",
"atol",
"=",
"1.e-8",
")",
":",
"if",
"len",
"(",
"values",
")",
"==",
"1",
":",
"return",
"True",
"if",
"mode",
"==",
"\">\"",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | round_to_sigfigs | Rounds a number rounded to a specific number of significant
figures instead of to a specific precision. | pymatgen/util/num.py | def round_to_sigfigs(num, sigfigs):
"""
Rounds a number rounded to a specific number of significant
figures instead of to a specific precision.
"""
if type(sigfigs) != int:
raise TypeError("Number of significant figures must be integer.")
elif sigfigs < 1:
raise ValueError("Numbe... | def round_to_sigfigs(num, sigfigs):
"""
Rounds a number rounded to a specific number of significant
figures instead of to a specific precision.
"""
if type(sigfigs) != int:
raise TypeError("Number of significant figures must be integer.")
elif sigfigs < 1:
raise ValueError("Numbe... | [
"Rounds",
"a",
"number",
"rounded",
"to",
"a",
"specific",
"number",
"of",
"significant",
"figures",
"instead",
"of",
"to",
"a",
"specific",
"precision",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L140-L154 | [
"def",
"round_to_sigfigs",
"(",
"num",
",",
"sigfigs",
")",
":",
"if",
"type",
"(",
"sigfigs",
")",
"!=",
"int",
":",
"raise",
"TypeError",
"(",
"\"Number of significant figures must be integer.\"",
")",
"elif",
"sigfigs",
"<",
"1",
":",
"raise",
"ValueError",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | make_symmetric_matrix_from_upper_tri | Given a symmetric matrix in upper triangular matrix form as flat array indexes as:
[A_xx,A_yy,A_zz,A_xy,A_xz,A_yz]
This will generate the full matrix:
[[A_xx,A_xy,A_xz],[A_xy,A_yy,A_yz],[A_xz,A_yz,A_zz] | pymatgen/util/num.py | def make_symmetric_matrix_from_upper_tri(val):
"""
Given a symmetric matrix in upper triangular matrix form as flat array indexes as:
[A_xx,A_yy,A_zz,A_xy,A_xz,A_yz]
This will generate the full matrix:
[[A_xx,A_xy,A_xz],[A_xy,A_yy,A_yz],[A_xz,A_yz,A_zz]
"""
idx = [0,3,4,1,5,2]
val = np.a... | def make_symmetric_matrix_from_upper_tri(val):
"""
Given a symmetric matrix in upper triangular matrix form as flat array indexes as:
[A_xx,A_yy,A_zz,A_xy,A_xz,A_yz]
This will generate the full matrix:
[[A_xx,A_xy,A_xz],[A_xy,A_yy,A_yz],[A_xz,A_yz,A_zz]
"""
idx = [0,3,4,1,5,2]
val = np.a... | [
"Given",
"a",
"symmetric",
"matrix",
"in",
"upper",
"triangular",
"matrix",
"form",
"as",
"flat",
"array",
"indexes",
"as",
":",
"[",
"A_xx",
"A_yy",
"A_zz",
"A_xy",
"A_xz",
"A_yz",
"]",
"This",
"will",
"generate",
"the",
"full",
"matrix",
":",
"[[",
"A_... | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/num.py#L156-L169 | [
"def",
"make_symmetric_matrix_from_upper_tri",
"(",
"val",
")",
":",
"idx",
"=",
"[",
"0",
",",
"3",
",",
"4",
",",
"1",
",",
"5",
",",
"2",
"]",
"val",
"=",
"np",
".",
"array",
"(",
"val",
")",
"[",
"idx",
"]",
"mask",
"=",
"~",
"np",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | g0w0_extended_work | Returns a :class:`Work` object that performs G0W0 calculations for the given the material.
Args:
structure: Pymatgen structure.
pseudos: List of `Pseudo` objects.
scf_ Defines the sampling used for the SCF run.
nscf_nband: Number of bands included in the NSCF run.
ecuteps: C... | pymatgen/io/abinit/calculations.py | def g0w0_extended_work(structure, pseudos, kppa, nscf_nband, ecuteps, ecutsigx, scf_nband, accuracy="normal",
spin_mode="polarized", smearing="fermi_dirac:0.1 eV", response_models=["godby"], charge=0.0,
inclvkb=2, scr_nband=None, sigma_nband=None, workdir=None, manager=None... | def g0w0_extended_work(structure, pseudos, kppa, nscf_nband, ecuteps, ecutsigx, scf_nband, accuracy="normal",
spin_mode="polarized", smearing="fermi_dirac:0.1 eV", response_models=["godby"], charge=0.0,
inclvkb=2, scr_nband=None, sigma_nband=None, workdir=None, manager=None... | [
"Returns",
"a",
":",
"class",
":",
"Work",
"object",
"that",
"performs",
"G0W0",
"calculations",
"for",
"the",
"given",
"the",
"material",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/calculations.py#L24-L160 | [
"def",
"g0w0_extended_work",
"(",
"structure",
",",
"pseudos",
",",
"kppa",
",",
"nscf_nband",
",",
"ecuteps",
",",
"ecutsigx",
",",
"scf_nband",
",",
"accuracy",
"=",
"\"normal\"",
",",
"spin_mode",
"=",
"\"polarized\"",
",",
"smearing",
"=",
"\"fermi_dirac:0.1... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | get_structure_components | Gets information on the components in a bonded structure.
Correctly determines the dimensionality of all structures, regardless of
structure type or improper connections due to periodic boundary conditions.
Requires a StructureGraph object as input. This can be generated using one
of the NearNeighbor ... | pymatgen/analysis/dimensionality.py | def get_structure_components(bonded_structure, inc_orientation=False,
inc_site_ids=False, inc_molecule_graph=False):
"""
Gets information on the components in a bonded structure.
Correctly determines the dimensionality of all structures, regardless of
structure type or impr... | def get_structure_components(bonded_structure, inc_orientation=False,
inc_site_ids=False, inc_molecule_graph=False):
"""
Gets information on the components in a bonded structure.
Correctly determines the dimensionality of all structures, regardless of
structure type or impr... | [
"Gets",
"information",
"on",
"the",
"components",
"in",
"a",
"bonded",
"structure",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/dimensionality.py#L73-L165 | [
"def",
"get_structure_components",
"(",
"bonded_structure",
",",
"inc_orientation",
"=",
"False",
",",
"inc_site_ids",
"=",
"False",
",",
"inc_molecule_graph",
"=",
"False",
")",
":",
"import",
"networkx",
"as",
"nx",
"# optional dependency therefore not top level import"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | calculate_dimensionality_of_site | Calculates the dimensionality of the component containing the given site.
Implements directly the modified breadth-first-search algorithm described in
Algorithm 1 of:
P. Larsem, M. Pandey, M. Strange, K. W. Jacobsen, 2018, arXiv:1808.02114
Args:
bonded_structure (StructureGraph): A structure ... | pymatgen/analysis/dimensionality.py | def calculate_dimensionality_of_site(bonded_structure, site_index,
inc_vertices=False):
"""
Calculates the dimensionality of the component containing the given site.
Implements directly the modified breadth-first-search algorithm described in
Algorithm 1 of:
P.... | def calculate_dimensionality_of_site(bonded_structure, site_index,
inc_vertices=False):
"""
Calculates the dimensionality of the component containing the given site.
Implements directly the modified breadth-first-search algorithm described in
Algorithm 1 of:
P.... | [
"Calculates",
"the",
"dimensionality",
"of",
"the",
"component",
"containing",
"the",
"given",
"site",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/dimensionality.py#L168-L238 | [
"def",
"calculate_dimensionality_of_site",
"(",
"bonded_structure",
",",
"site_index",
",",
"inc_vertices",
"=",
"False",
")",
":",
"def",
"neighbours",
"(",
"comp_index",
")",
":",
"return",
"[",
"(",
"s",
".",
"index",
",",
"s",
".",
"jimage",
")",
"for",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | zero_d_graph_to_molecule_graph | Converts a zero-dimensional networkx Graph object into a MoleculeGraph.
Implements a similar breadth-first search to that in
calculate_dimensionality_of_site().
Args:
bonded_structure (StructureGraph): A structure with bonds, represented
as a pymatgen structure graph. For example, gene... | pymatgen/analysis/dimensionality.py | def zero_d_graph_to_molecule_graph(bonded_structure, graph):
"""
Converts a zero-dimensional networkx Graph object into a MoleculeGraph.
Implements a similar breadth-first search to that in
calculate_dimensionality_of_site().
Args:
bonded_structure (StructureGraph): A structure with bonds,... | def zero_d_graph_to_molecule_graph(bonded_structure, graph):
"""
Converts a zero-dimensional networkx Graph object into a MoleculeGraph.
Implements a similar breadth-first search to that in
calculate_dimensionality_of_site().
Args:
bonded_structure (StructureGraph): A structure with bonds,... | [
"Converts",
"a",
"zero",
"-",
"dimensional",
"networkx",
"Graph",
"object",
"into",
"a",
"MoleculeGraph",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/dimensionality.py#L241-L289 | [
"def",
"zero_d_graph_to_molecule_graph",
"(",
"bonded_structure",
",",
"graph",
")",
":",
"import",
"networkx",
"as",
"nx",
"seen_indices",
"=",
"[",
"]",
"sites",
"=",
"[",
"]",
"start_index",
"=",
"list",
"(",
"graph",
".",
"nodes",
"(",
")",
")",
"[",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | find_connected_atoms | Finds bonded atoms and returns a adjacency matrix of bonded atoms.
Author: "Gowoon Cheon"
Email: "gcheon@stanford.edu"
Args:
struct (Structure): Input structure
tolerance: length in angstroms used in finding bonded atoms. Two atoms
are considered bonded if (radius of atom 1) + ... | pymatgen/analysis/dimensionality.py | def find_connected_atoms(struct, tolerance=0.45, ldict=JmolNN().el_radius):
"""
Finds bonded atoms and returns a adjacency matrix of bonded atoms.
Author: "Gowoon Cheon"
Email: "gcheon@stanford.edu"
Args:
struct (Structure): Input structure
tolerance: length in angstroms used in fi... | def find_connected_atoms(struct, tolerance=0.45, ldict=JmolNN().el_radius):
"""
Finds bonded atoms and returns a adjacency matrix of bonded atoms.
Author: "Gowoon Cheon"
Email: "gcheon@stanford.edu"
Args:
struct (Structure): Input structure
tolerance: length in angstroms used in fi... | [
"Finds",
"bonded",
"atoms",
"and",
"returns",
"a",
"adjacency",
"matrix",
"of",
"bonded",
"atoms",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/dimensionality.py#L383-L427 | [
"def",
"find_connected_atoms",
"(",
"struct",
",",
"tolerance",
"=",
"0.45",
",",
"ldict",
"=",
"JmolNN",
"(",
")",
".",
"el_radius",
")",
":",
"n_atoms",
"=",
"len",
"(",
"struct",
".",
"species",
")",
"fc",
"=",
"np",
".",
"array",
"(",
"struct",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | find_clusters | Finds bonded clusters of atoms in the structure with periodic boundary
conditions.
If there are atoms that are not bonded to anything, returns [0,1,0]. (For
faster computation time)
Author: "Gowoon Cheon"
Email: "gcheon@stanford.edu"
Args:
struct (Structure): Input structure
c... | pymatgen/analysis/dimensionality.py | def find_clusters(struct, connected_matrix):
"""
Finds bonded clusters of atoms in the structure with periodic boundary
conditions.
If there are atoms that are not bonded to anything, returns [0,1,0]. (For
faster computation time)
Author: "Gowoon Cheon"
Email: "gcheon@stanford.edu"
Ar... | def find_clusters(struct, connected_matrix):
"""
Finds bonded clusters of atoms in the structure with periodic boundary
conditions.
If there are atoms that are not bonded to anything, returns [0,1,0]. (For
faster computation time)
Author: "Gowoon Cheon"
Email: "gcheon@stanford.edu"
Ar... | [
"Finds",
"bonded",
"clusters",
"of",
"atoms",
"in",
"the",
"structure",
"with",
"periodic",
"boundary",
"conditions",
"."
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/dimensionality.py#L430-L482 | [
"def",
"find_clusters",
"(",
"struct",
",",
"connected_matrix",
")",
":",
"n_atoms",
"=",
"len",
"(",
"struct",
".",
"species",
")",
"if",
"n_atoms",
"==",
"0",
":",
"return",
"[",
"0",
",",
"0",
",",
"0",
"]",
"if",
"0",
"in",
"np",
".",
"sum",
... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Stress.deviator_stress | returns the deviatoric component of the stress | pymatgen/analysis/elasticity/stress.py | def deviator_stress(self):
"""
returns the deviatoric component of the stress
"""
if not self.is_symmetric:
raise warnings.warn("The stress tensor is not symmetric, "
"so deviator stress will not be either")
return self - self.mean_stre... | def deviator_stress(self):
"""
returns the deviatoric component of the stress
"""
if not self.is_symmetric:
raise warnings.warn("The stress tensor is not symmetric, "
"so deviator stress will not be either")
return self - self.mean_stre... | [
"returns",
"the",
"deviatoric",
"component",
"of",
"the",
"stress"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/stress.py#L74-L81 | [
"def",
"deviator_stress",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_symmetric",
":",
"raise",
"warnings",
".",
"warn",
"(",
"\"The stress tensor is not symmetric, \"",
"\"so deviator stress will not be either\"",
")",
"return",
"self",
"-",
"self",
".",
"... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
train | Stress.piola_kirchoff_1 | calculates the first Piola-Kirchoff stress
Args:
def_grad (3x3 array-like): deformation gradient tensor | pymatgen/analysis/elasticity/stress.py | def piola_kirchoff_1(self, def_grad):
"""
calculates the first Piola-Kirchoff stress
Args:
def_grad (3x3 array-like): deformation gradient tensor
"""
if not self.is_symmetric:
raise ValueError("The stress tensor is not symmetric, \
... | def piola_kirchoff_1(self, def_grad):
"""
calculates the first Piola-Kirchoff stress
Args:
def_grad (3x3 array-like): deformation gradient tensor
"""
if not self.is_symmetric:
raise ValueError("The stress tensor is not symmetric, \
... | [
"calculates",
"the",
"first",
"Piola",
"-",
"Kirchoff",
"stress"
] | materialsproject/pymatgen | python | https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/stress.py#L83-L94 | [
"def",
"piola_kirchoff_1",
"(",
"self",
",",
"def_grad",
")",
":",
"if",
"not",
"self",
".",
"is_symmetric",
":",
"raise",
"ValueError",
"(",
"\"The stress tensor is not symmetric, \\\n PK stress is based on a symmetric stress tensor.\"",
")",
"def_g... | 4ca558cf72f8d5f8a1f21dfdfc0181a971c186da |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.