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
XcFunc.from_abinit_ixc
Build the object from Abinit ixc (integer)
pymatgen/core/xcfunc.py
def from_abinit_ixc(cls, ixc): """Build the object from Abinit ixc (integer)""" ixc = int(ixc) if ixc >= 0: return cls(**cls.abinitixc_to_libxc[ixc]) else: # libxc notation employed in Abinit: a six-digit number in the form XXXCCC or CCCXXX #ixc = str(...
def from_abinit_ixc(cls, ixc): """Build the object from Abinit ixc (integer)""" ixc = int(ixc) if ixc >= 0: return cls(**cls.abinitixc_to_libxc[ixc]) else: # libxc notation employed in Abinit: a six-digit number in the form XXXCCC or CCCXXX #ixc = str(...
[ "Build", "the", "object", "from", "Abinit", "ixc", "(", "integer", ")" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L125-L141
[ "def", "from_abinit_ixc", "(", "cls", ",", "ixc", ")", ":", "ixc", "=", "int", "(", "ixc", ")", "if", "ixc", ">=", "0", ":", "return", "cls", "(", "*", "*", "cls", ".", "abinitixc_to_libxc", "[", "ixc", "]", ")", "else", ":", "# libxc notation employ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
XcFunc.from_type_name
Build the object from (type, name).
pymatgen/core/xcfunc.py
def from_type_name(cls, typ, name): """Build the object from (type, name).""" # Try aliases first. for k, nt in cls.defined_aliases.items(): if typ is not None and typ != nt.type: continue #print(name, nt.name) if name == nt.name: if len(k) == ...
def from_type_name(cls, typ, name): """Build the object from (type, name).""" # Try aliases first. for k, nt in cls.defined_aliases.items(): if typ is not None and typ != nt.type: continue #print(name, nt.name) if name == nt.name: if len(k) == ...
[ "Build", "the", "object", "from", "(", "type", "name", ")", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L149-L175
[ "def", "from_type_name", "(", "cls", ",", "typ", ",", "name", ")", ":", "# Try aliases first.", "for", "k", ",", "nt", "in", "cls", ".", "defined_aliases", ".", "items", "(", ")", ":", "if", "typ", "is", "not", "None", "and", "typ", "!=", "nt", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
XcFunc.from_dict
Makes XcFunc obey the general json interface used in pymatgen for easier serialization.
pymatgen/core/xcfunc.py
def from_dict(cls, d): """ Makes XcFunc obey the general json interface used in pymatgen for easier serialization. """ return cls(xc=d.get("xc"), x=d.get("x"), c=d.get("c"))
def from_dict(cls, d): """ Makes XcFunc obey the general json interface used in pymatgen for easier serialization. """ return cls(xc=d.get("xc"), x=d.get("x"), c=d.get("c"))
[ "Makes", "XcFunc", "obey", "the", "general", "json", "interface", "used", "in", "pymatgen", "for", "easier", "serialization", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L178-L182
[ "def", "from_dict", "(", "cls", ",", "d", ")", ":", "return", "cls", "(", "xc", "=", "d", ".", "get", "(", "\"xc\"", ")", ",", "x", "=", "d", ".", "get", "(", "\"x\"", ")", ",", "c", "=", "d", ".", "get", "(", "\"c\"", ")", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
XcFunc.as_dict
Makes XcFunc obey the general json interface used in pymatgen for easier serialization.
pymatgen/core/xcfunc.py
def as_dict(self): """ Makes XcFunc obey the general json interface used in pymatgen for easier serialization. """ d = {"@module": self.__class__.__module__, "@class": self.__class__.__name__} # print("in as_dict", type(self.x), type(self.c), type(self.xc)) i...
def as_dict(self): """ Makes XcFunc obey the general json interface used in pymatgen for easier serialization. """ d = {"@module": self.__class__.__module__, "@class": self.__class__.__name__} # print("in as_dict", type(self.x), type(self.c), type(self.xc)) i...
[ "Makes", "XcFunc", "obey", "the", "general", "json", "interface", "used", "in", "pymatgen", "for", "easier", "serialization", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L184-L194
[ "def", "as_dict", "(", "self", ")", ":", "d", "=", "{", "\"@module\"", ":", "self", ".", "__class__", ".", "__module__", ",", "\"@class\"", ":", "self", ".", "__class__", ".", "__name__", "}", "# print(\"in as_dict\", type(self.x), type(self.c), type(self.xc))", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
XcFunc.type
The type of the functional.
pymatgen/core/xcfunc.py
def type(self): """The type of the functional.""" if self.xc in self.defined_aliases: return self.defined_aliases[self.xc].type xc = (self.x, self.c) if xc in self.defined_aliases: return self.defined_aliases[xc].type # If self is not in defined_aliases, use LibxcFunc family ...
def type(self): """The type of the functional.""" if self.xc in self.defined_aliases: return self.defined_aliases[self.xc].type xc = (self.x, self.c) if xc in self.defined_aliases: return self.defined_aliases[xc].type # If self is not in defined_aliases, use LibxcFunc family ...
[ "The", "type", "of", "the", "functional", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L219-L227
[ "def", "type", "(", "self", ")", ":", "if", "self", ".", "xc", "in", "self", ".", "defined_aliases", ":", "return", "self", ".", "defined_aliases", "[", "self", ".", "xc", "]", ".", "type", "xc", "=", "(", "self", ".", "x", ",", "self", ".", "c",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
XcFunc.name
The name of the functional. If the functional is not found in the aliases, the string has the form X_NAME+C_NAME
pymatgen/core/xcfunc.py
def name(self): """ The name of the functional. If the functional is not found in the aliases, the string has the form X_NAME+C_NAME """ if self.xc in self.defined_aliases: return self.defined_aliases[self.xc].name xc = (self.x, self.c) if xc in self.defined_alias...
def name(self): """ The name of the functional. If the functional is not found in the aliases, the string has the form X_NAME+C_NAME """ if self.xc in self.defined_aliases: return self.defined_aliases[self.xc].name xc = (self.x, self.c) if xc in self.defined_alias...
[ "The", "name", "of", "the", "functional", ".", "If", "the", "functional", "is", "not", "found", "in", "the", "aliases", "the", "string", "has", "the", "form", "X_NAME", "+", "C_NAME" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/xcfunc.py#L230-L239
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "xc", "in", "self", ".", "defined_aliases", ":", "return", "self", ".", "defined_aliases", "[", "self", ".", "xc", "]", ".", "name", "xc", "=", "(", "self", ".", "x", ",", "self", ".", "c",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
from_bson_voronoi_list
Returns the voronoi_list needed for the VoronoiContainer object from a bson-encoded voronoi_list (composed of vlist and bson_nb_voro_list). :param vlist: List of voronoi objects :param bson_nb_voro_list: List of periodic sites involved in the Voronoi :return: The voronoi_list needed for the VoronoiConta...
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
def from_bson_voronoi_list(bson_nb_voro_list, structure): """ Returns the voronoi_list needed for the VoronoiContainer object from a bson-encoded voronoi_list (composed of vlist and bson_nb_voro_list). :param vlist: List of voronoi objects :param bson_nb_voro_list: List of periodic sites involved in...
def from_bson_voronoi_list(bson_nb_voro_list, structure): """ Returns the voronoi_list needed for the VoronoiContainer object from a bson-encoded voronoi_list (composed of vlist and bson_nb_voro_list). :param vlist: List of voronoi objects :param bson_nb_voro_list: List of periodic sites involved in...
[ "Returns", "the", "voronoi_list", "needed", "for", "the", "VoronoiContainer", "object", "from", "a", "bson", "-", "encoded", "voronoi_list", "(", "composed", "of", "vlist", "and", "bson_nb_voro_list", ")", ".", ":", "param", "vlist", ":", "List", "of", "vorono...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/voronoi.py#L33-L52
[ "def", "from_bson_voronoi_list", "(", "bson_nb_voro_list", ",", "structure", ")", ":", "voronoi_list", "=", "[", "None", "]", "*", "len", "(", "bson_nb_voro_list", ")", "for", "isite", ",", "voro", "in", "enumerate", "(", "bson_nb_voro_list", ")", ":", "if", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DetailedVoronoiContainer.setup_voronoi_list
Set up of the voronoi list of neighbours by calling qhull :param indices: indices of the sites for which the Voronoi is needed :param voronoi_cutoff: Voronoi cutoff for the search of neighbours :raise RuntimeError: If an infinite vertex is found in the voronoi construction
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
def setup_voronoi_list(self, indices, voronoi_cutoff): """ Set up of the voronoi list of neighbours by calling qhull :param indices: indices of the sites for which the Voronoi is needed :param voronoi_cutoff: Voronoi cutoff for the search of neighbours :raise RuntimeError: If an ...
def setup_voronoi_list(self, indices, voronoi_cutoff): """ Set up of the voronoi list of neighbours by calling qhull :param indices: indices of the sites for which the Voronoi is needed :param voronoi_cutoff: Voronoi cutoff for the search of neighbours :raise RuntimeError: If an ...
[ "Set", "up", "of", "the", "voronoi", "list", "of", "neighbours", "by", "calling", "qhull", ":", "param", "indices", ":", "indices", "of", "the", "sites", "for", "which", "the", "Voronoi", "is", "needed", ":", "param", "voronoi_cutoff", ":", "Voronoi", "cut...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/voronoi.py#L126-L182
[ "def", "setup_voronoi_list", "(", "self", ",", "indices", ",", "voronoi_cutoff", ")", ":", "self", ".", "voronoi_list2", "=", "[", "None", "]", "*", "len", "(", "self", ".", "structure", ")", "self", ".", "voronoi_list_coords", "=", "[", "None", "]", "*"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DetailedVoronoiContainer.setup_neighbors_distances_and_angles
Initializes the angle and distance separations :param indices: indices of the sites for which the Voronoi is needed
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
def setup_neighbors_distances_and_angles(self, indices): """ Initializes the angle and distance separations :param indices: indices of the sites for which the Voronoi is needed """ self.neighbors_distances = [None] * len(self.structure) self.neighbors_normalized_distances...
def setup_neighbors_distances_and_angles(self, indices): """ Initializes the angle and distance separations :param indices: indices of the sites for which the Voronoi is needed """ self.neighbors_distances = [None] * len(self.structure) self.neighbors_normalized_distances...
[ "Initializes", "the", "angle", "and", "distance", "separations", ":", "param", "indices", ":", "indices", "of", "the", "sites", "for", "which", "the", "Voronoi", "is", "needed" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/voronoi.py#L184-L308
[ "def", "setup_neighbors_distances_and_angles", "(", "self", ",", "indices", ")", ":", "self", ".", "neighbors_distances", "=", "[", "None", "]", "*", "len", "(", "self", ".", "structure", ")", "self", ".", "neighbors_normalized_distances", "=", "[", "None", "]...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DetailedVoronoiContainer.to_bson_voronoi_list2
Transforms the voronoi_list into a vlist + bson_nb_voro_list, that are BSON-encodable. :return: [vlist, bson_nb_voro_list], to be used in the as_dict method
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
def to_bson_voronoi_list2(self): """ Transforms the voronoi_list into a vlist + bson_nb_voro_list, that are BSON-encodable. :return: [vlist, bson_nb_voro_list], to be used in the as_dict method """ bson_nb_voro_list2 = [None] * len(self.voronoi_list2) for ivoro, voro in e...
def to_bson_voronoi_list2(self): """ Transforms the voronoi_list into a vlist + bson_nb_voro_list, that are BSON-encodable. :return: [vlist, bson_nb_voro_list], to be used in the as_dict method """ bson_nb_voro_list2 = [None] * len(self.voronoi_list2) for ivoro, voro in e...
[ "Transforms", "the", "voronoi_list", "into", "a", "vlist", "+", "bson_nb_voro_list", "that", "are", "BSON", "-", "encodable", ".", ":", "return", ":", "[", "vlist", "bson_nb_voro_list", "]", "to", "be", "used", "in", "the", "as_dict", "method" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/voronoi.py#L707-L729
[ "def", "to_bson_voronoi_list2", "(", "self", ")", ":", "bson_nb_voro_list2", "=", "[", "None", "]", "*", "len", "(", "self", ".", "voronoi_list2", ")", "for", "ivoro", ",", "voro", "in", "enumerate", "(", "self", ".", "voronoi_list2", ")", ":", "if", "vo...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DetailedVoronoiContainer.as_dict
Bson-serializable dict representation of the VoronoiContainer. :return: dictionary that is BSON-encodable
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
def as_dict(self): """ Bson-serializable dict representation of the VoronoiContainer. :return: dictionary that is BSON-encodable """ bson_nb_voro_list2 = self.to_bson_voronoi_list2() return {"@module": self.__class__.__module__, "@class": self.__class__.__...
def as_dict(self): """ Bson-serializable dict representation of the VoronoiContainer. :return: dictionary that is BSON-encodable """ bson_nb_voro_list2 = self.to_bson_voronoi_list2() return {"@module": self.__class__.__module__, "@class": self.__class__.__...
[ "Bson", "-", "serializable", "dict", "representation", "of", "the", "VoronoiContainer", ".", ":", "return", ":", "dictionary", "that", "is", "BSON", "-", "encodable" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/voronoi.py#L731-L747
[ "def", "as_dict", "(", "self", ")", ":", "bson_nb_voro_list2", "=", "self", ".", "to_bson_voronoi_list2", "(", ")", "return", "{", "\"@module\"", ":", "self", ".", "__class__", ".", "__module__", ",", "\"@class\"", ":", "self", ".", "__class__", ".", "__name...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DetailedVoronoiContainer.from_dict
Reconstructs the VoronoiContainer object from a dict representation of the VoronoiContainer created using the as_dict method. :param d: dict representation of the VoronoiContainer object :return: VoronoiContainer object
pymatgen/analysis/chemenv/coordination_environments/voronoi.py
def from_dict(cls, d): """ Reconstructs the VoronoiContainer object from a dict representation of the VoronoiContainer created using the as_dict method. :param d: dict representation of the VoronoiContainer object :return: VoronoiContainer object """ structure = S...
def from_dict(cls, d): """ Reconstructs the VoronoiContainer object from a dict representation of the VoronoiContainer created using the as_dict method. :param d: dict representation of the VoronoiContainer object :return: VoronoiContainer object """ structure = S...
[ "Reconstructs", "the", "VoronoiContainer", "object", "from", "a", "dict", "representation", "of", "the", "VoronoiContainer", "created", "using", "the", "as_dict", "method", ".", ":", "param", "d", ":", "dict", "representation", "of", "the", "VoronoiContainer", "ob...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/chemenv/coordination_environments/voronoi.py#L750-L768
[ "def", "from_dict", "(", "cls", ",", "d", ")", ":", "structure", "=", "Structure", ".", "from_dict", "(", "d", "[", "'structure'", "]", ")", "voronoi_list2", "=", "from_bson_voronoi_list2", "(", "d", "[", "'bson_nb_voro_list2'", "]", ",", "structure", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
check_spectator
Decorator for :class:`Node` methods. Raise `SpectatorNodeError`.
pymatgen/io/abinit/nodes.py
def check_spectator(node_method): """ Decorator for :class:`Node` methods. Raise `SpectatorNodeError`. """ from functools import wraps @wraps(node_method) def wrapper(*args, **kwargs): node = args[0] if node.in_spectator_mode: #raise node.SpectatorError("You should no...
def check_spectator(node_method): """ Decorator for :class:`Node` methods. Raise `SpectatorNodeError`. """ from functools import wraps @wraps(node_method) def wrapper(*args, **kwargs): node = args[0] if node.in_spectator_mode: #raise node.SpectatorError("You should no...
[ "Decorator", "for", ":", "class", ":", "Node", "methods", ".", "Raise", "SpectatorNodeError", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L411-L426
[ "def", "check_spectator", "(", "node_method", ")", ":", "from", "functools", "import", "wraps", "@", "wraps", "(", "node_method", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "node", "=", "args", "[", "0", "]", "if", "n...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
save_lastnode_id
Save the id of the last node created.
pymatgen/io/abinit/nodes.py
def save_lastnode_id(): """Save the id of the last node created.""" init_counter() with FileLock(_COUNTER_FILE): with AtomicFile(_COUNTER_FILE, mode="w") as fh: fh.write("%d\n" % _COUNTER)
def save_lastnode_id(): """Save the id of the last node created.""" init_counter() with FileLock(_COUNTER_FILE): with AtomicFile(_COUNTER_FILE, mode="w") as fh: fh.write("%d\n" % _COUNTER)
[ "Save", "the", "id", "of", "the", "last", "node", "created", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L1265-L1271
[ "def", "save_lastnode_id", "(", ")", ":", "init_counter", "(", ")", "with", "FileLock", "(", "_COUNTER_FILE", ")", ":", "with", "AtomicFile", "(", "_COUNTER_FILE", ",", "mode", "=", "\"w\"", ")", "as", "fh", ":", "fh", ".", "write", "(", "\"%d\\n\"", "%"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Status.as_status
Convert obj into Status.
pymatgen/io/abinit/nodes.py
def as_status(cls, obj): """Convert obj into Status.""" if obj is None: return None return obj if isinstance(obj, cls) else cls.from_string(obj)
def as_status(cls, obj): """Convert obj into Status.""" if obj is None: return None return obj if isinstance(obj, cls) else cls.from_string(obj)
[ "Convert", "obj", "into", "Status", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L70-L73
[ "def", "as_status", "(", "cls", ",", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "None", "return", "obj", "if", "isinstance", "(", "obj", ",", "cls", ")", "else", "cls", ".", "from_string", "(", "obj", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Status.from_string
Return a `Status` instance from its string representation.
pymatgen/io/abinit/nodes.py
def from_string(cls, s): """Return a `Status` instance from its string representation.""" for num, text in cls._STATUS2STR.items(): if text == s: return cls(num) else: raise ValueError("Wrong string %s" % s)
def from_string(cls, s): """Return a `Status` instance from its string representation.""" for num, text in cls._STATUS2STR.items(): if text == s: return cls(num) else: raise ValueError("Wrong string %s" % s)
[ "Return", "a", "Status", "instance", "from", "its", "string", "representation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L76-L82
[ "def", "from_string", "(", "cls", ",", "s", ")", ":", "for", "num", ",", "text", "in", "cls", ".", "_STATUS2STR", ".", "items", "(", ")", ":", "if", "text", "==", "s", ":", "return", "cls", "(", "num", ")", "else", ":", "raise", "ValueError", "("...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Dependency.products
List of output files produces by self.
pymatgen/io/abinit/nodes.py
def products(self): """List of output files produces by self.""" _products = [] for ext in self.exts: prod = Product(ext, self.node.opath_from_ext(ext)) _products.append(prod) return _products
def products(self): """List of output files produces by self.""" _products = [] for ext in self.exts: prod = Product(ext, self.node.opath_from_ext(ext)) _products.append(prod) return _products
[ "List", "of", "output", "files", "produces", "by", "self", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L161-L168
[ "def", "products", "(", "self", ")", ":", "_products", "=", "[", "]", "for", "ext", "in", "self", ".", "exts", ":", "prod", "=", "Product", "(", "ext", ",", "self", ".", "node", ".", "opath_from_ext", "(", "ext", ")", ")", "_products", ".", "append...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Dependency.apply_getters
This function is called when we specify the task dependencies with the syntax: deps={node: "@property"} In this case the task has to the get `property` from `node` before starting the calculation. At present, the following properties are supported: - @structure
pymatgen/io/abinit/nodes.py
def apply_getters(self, task): """ This function is called when we specify the task dependencies with the syntax: deps={node: "@property"} In this case the task has to the get `property` from `node` before starting the calculation. At present, the following properties are ...
def apply_getters(self, task): """ This function is called when we specify the task dependencies with the syntax: deps={node: "@property"} In this case the task has to the get `property` from `node` before starting the calculation. At present, the following properties are ...
[ "This", "function", "is", "called", "when", "we", "specify", "the", "task", "dependencies", "with", "the", "syntax", ":" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L170-L190
[ "def", "apply_getters", "(", "self", ",", "task", ")", ":", "if", "not", "self", ".", "getters", ":", "return", "for", "getter", "in", "self", ".", "getters", ":", "if", "getter", "==", "\"@structure\"", ":", "task", ".", "history", ".", "info", "(", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Dependency.connecting_vars
Returns a dictionary with the variables that must be added to the input file in order to connect this :class:`Node` to its dependencies.
pymatgen/io/abinit/nodes.py
def connecting_vars(self): """ Returns a dictionary with the variables that must be added to the input file in order to connect this :class:`Node` to its dependencies. """ vars = {} for prod in self.products: vars.update(prod.connecting_vars()) return...
def connecting_vars(self): """ Returns a dictionary with the variables that must be added to the input file in order to connect this :class:`Node` to its dependencies. """ vars = {} for prod in self.products: vars.update(prod.connecting_vars()) return...
[ "Returns", "a", "dictionary", "with", "the", "variables", "that", "must", "be", "added", "to", "the", "input", "file", "in", "order", "to", "connect", "this", ":", "class", ":", "Node", "to", "its", "dependencies", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L192-L201
[ "def", "connecting_vars", "(", "self", ")", ":", "vars", "=", "{", "}", "for", "prod", "in", "self", ".", "products", ":", "vars", ".", "update", "(", "prod", ".", "connecting_vars", "(", ")", ")", "return", "vars" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Dependency.get_filepaths_and_exts
Returns the paths of the output files produced by self and its extensions
pymatgen/io/abinit/nodes.py
def get_filepaths_and_exts(self): """Returns the paths of the output files produced by self and its extensions""" filepaths = [prod.filepath for prod in self.products] exts = [prod.ext for prod in self.products] return filepaths, exts
def get_filepaths_and_exts(self): """Returns the paths of the output files produced by self and its extensions""" filepaths = [prod.filepath for prod in self.products] exts = [prod.ext for prod in self.products] return filepaths, exts
[ "Returns", "the", "paths", "of", "the", "output", "files", "produced", "by", "self", "and", "its", "extensions" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L203-L208
[ "def", "get_filepaths_and_exts", "(", "self", ")", ":", "filepaths", "=", "[", "prod", ".", "filepath", "for", "prod", "in", "self", ".", "products", "]", "exts", "=", "[", "prod", ".", "ext", "for", "prod", "in", "self", ".", "products", "]", "return"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Product.from_file
Build a :class:`Product` instance from a filepath.
pymatgen/io/abinit/nodes.py
def from_file(cls, filepath): """Build a :class:`Product` instance from a filepath.""" # Find the abinit extension. for i in range(len(filepath)): if filepath[i:] in abi_extensions(): ext = filepath[i:] break else: raise ValueError(...
def from_file(cls, filepath): """Build a :class:`Product` instance from a filepath.""" # Find the abinit extension. for i in range(len(filepath)): if filepath[i:] in abi_extensions(): ext = filepath[i:] break else: raise ValueError(...
[ "Build", "a", ":", "class", ":", "Product", "instance", "from", "a", "filepath", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L229-L239
[ "def", "from_file", "(", "cls", ",", "filepath", ")", ":", "# Find the abinit extension.", "for", "i", "in", "range", "(", "len", "(", "filepath", ")", ")", ":", "if", "filepath", "[", "i", ":", "]", "in", "abi_extensions", "(", ")", ":", "ext", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeResults.from_node
Initialize an instance of `NodeResults` from a `Node` subclass.
pymatgen/io/abinit/nodes.py
def from_node(cls, node): """Initialize an instance of `NodeResults` from a `Node` subclass.""" kwargs = dict( node_id=node.node_id, node_finalized=node.finalized, node_history=list(node.history), node_name=node.name, node_class=node.__class__....
def from_node(cls, node): """Initialize an instance of `NodeResults` from a `Node` subclass.""" kwargs = dict( node_id=node.node_id, node_finalized=node.finalized, node_history=list(node.history), node_name=node.name, node_class=node.__class__....
[ "Initialize", "an", "instance", "of", "NodeResults", "from", "a", "Node", "subclass", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L282-L293
[ "def", "from_node", "(", "cls", ",", "node", ")", ":", "kwargs", "=", "dict", "(", "node_id", "=", "node", ".", "node_id", ",", "node_finalized", "=", "node", ".", "finalized", ",", "node_history", "=", "list", "(", "node", ".", "history", ")", ",", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeResults.register_gridfs_files
This function registers the files that will be saved in GridFS. kwargs is a dictionary mapping the key associated to the file (usually the extension) to the absolute path. By default, files are assumed to be in binary form, for formatted files one should pass a tuple ("filepath", "t"). ...
pymatgen/io/abinit/nodes.py
def register_gridfs_files(self, **kwargs): """ This function registers the files that will be saved in GridFS. kwargs is a dictionary mapping the key associated to the file (usually the extension) to the absolute path. By default, files are assumed to be in binary form, for formatted fil...
def register_gridfs_files(self, **kwargs): """ This function registers the files that will be saved in GridFS. kwargs is a dictionary mapping the key associated to the file (usually the extension) to the absolute path. By default, files are assumed to be in binary form, for formatted fil...
[ "This", "function", "registers", "the", "files", "that", "will", "be", "saved", "in", "GridFS", ".", "kwargs", "is", "a", "dictionary", "mapping", "the", "key", "associated", "to", "the", "file", "(", "usually", "the", "extension", ")", "to", "the", "absol...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L313-L333
[ "def", "register_gridfs_files", "(", "self", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "}", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "mode", "=", "\"b\"", "if", "isinstance", "(", "v", ",", "(", "list", ",", "t...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeResults.update_collection
Update a mongodb collection.
pymatgen/io/abinit/nodes.py
def update_collection(self, collection): """ Update a mongodb collection. """ node = self.node flow = node if node.is_flow else node.flow # Build the key used to store the entry in the document. key = node.name if node.is_task: key = "w" + str...
def update_collection(self, collection): """ Update a mongodb collection. """ node = self.node flow = node if node.is_flow else node.flow # Build the key used to store the entry in the document. key = node.name if node.is_task: key = "w" + str...
[ "Update", "a", "mongodb", "collection", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L367-L407
[ "def", "update_collection", "(", "self", ",", "collection", ")", ":", "node", "=", "self", ".", "node", "flow", "=", "node", "if", "node", ".", "is_flow", "else", "node", ".", "flow", "# Build the key used to store the entry in the document.", "key", "=", "node"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.color_hex
Node color as Hex Triplet https://en.wikipedia.org/wiki/Web_colors#Hex_triplet
pymatgen/io/abinit/nodes.py
def color_hex(self): """Node color as Hex Triplet https://en.wikipedia.org/wiki/Web_colors#Hex_triplet""" def clamp(x): return max(0, min(int(x), 255)) r, g, b = np.trunc(self.color_rgb * 255) return "#{0:02x}{1:02x}{2:02x}".format(clamp(r), clamp(g), clamp(b))
def color_hex(self): """Node color as Hex Triplet https://en.wikipedia.org/wiki/Web_colors#Hex_triplet""" def clamp(x): return max(0, min(int(x), 255)) r, g, b = np.trunc(self.color_rgb * 255) return "#{0:02x}{1:02x}{2:02x}".format(clamp(r), clamp(g), clamp(b))
[ "Node", "color", "as", "Hex", "Triplet", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Web_colors#Hex_triplet" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L529-L535
[ "def", "color_hex", "(", "self", ")", ":", "def", "clamp", "(", "x", ")", ":", "return", "max", "(", "0", ",", "min", "(", "int", "(", "x", ")", ",", "255", ")", ")", "r", ",", "g", ",", "b", "=", "np", ".", "trunc", "(", "self", ".", "co...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.isinstance
Check whether the node is a instance of `class_or_string`. Unlinke the standard isinstance builtin, the method accepts either a class or a string. In the later case, the string is compared with self.__class__.__name__ (case insensitive).
pymatgen/io/abinit/nodes.py
def isinstance(self, class_or_string): """ Check whether the node is a instance of `class_or_string`. Unlinke the standard isinstance builtin, the method accepts either a class or a string. In the later case, the string is compared with self.__class__.__name__ (case insensitive). ...
def isinstance(self, class_or_string): """ Check whether the node is a instance of `class_or_string`. Unlinke the standard isinstance builtin, the method accepts either a class or a string. In the later case, the string is compared with self.__class__.__name__ (case insensitive). ...
[ "Check", "whether", "the", "node", "is", "a", "instance", "of", "class_or_string", ".", "Unlinke", "the", "standard", "isinstance", "builtin", "the", "method", "accepts", "either", "a", "class", "or", "a", "string", ".", "In", "the", "later", "case", "the", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L537-L549
[ "def", "isinstance", "(", "self", ",", "class_or_string", ")", ":", "if", "class_or_string", "is", "None", ":", "return", "False", "import", "inspect", "if", "inspect", ".", "isclass", "(", "class_or_string", ")", ":", "return", "isinstance", "(", "self", ",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.as_node
Convert obj into a Node instance. Return: obj if obj is a Node instance, cast obj to :class:`FileNode` instance of obj is a string. None if obj is None
pymatgen/io/abinit/nodes.py
def as_node(cls, obj): """ Convert obj into a Node instance. Return: obj if obj is a Node instance, cast obj to :class:`FileNode` instance of obj is a string. None if obj is None """ if isinstance(obj, cls): return obj elif...
def as_node(cls, obj): """ Convert obj into a Node instance. Return: obj if obj is a Node instance, cast obj to :class:`FileNode` instance of obj is a string. None if obj is None """ if isinstance(obj, cls): return obj elif...
[ "Convert", "obj", "into", "a", "Node", "instance", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L552-L569
[ "def", "as_node", "(", "cls", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "cls", ")", ":", "return", "obj", "elif", "is_string", "(", "obj", ")", ":", "# Assume filepath.", "return", "FileNode", "(", "obj", ")", "elif", "obj", "is", "N...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.name
The name of the node (only used for facilitating its identification in the user interface).
pymatgen/io/abinit/nodes.py
def name(self): """ The name of the node (only used for facilitating its identification in the user interface). """ try: return self._name except AttributeError: if self.is_task: try: return self.pos_str ...
def name(self): """ The name of the node (only used for facilitating its identification in the user interface). """ try: return self._name except AttributeError: if self.is_task: try: return self.pos_str ...
[ "The", "name", "of", "the", "node", "(", "only", "used", "for", "facilitating", "its", "identification", "in", "the", "user", "interface", ")", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L572-L586
[ "def", "name", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_name", "except", "AttributeError", ":", "if", "self", ".", "is_task", ":", "try", ":", "return", "self", ".", "pos_str", "except", ":", "return", "os", ".", "path", ".", "base...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.relworkdir
Return a relative version of the workdir
pymatgen/io/abinit/nodes.py
def relworkdir(self): """Return a relative version of the workdir""" if getattr(self, "workdir", None) is None: return None try: return os.path.relpath(self.workdir) except OSError: # current working directory may not be defined! return sel...
def relworkdir(self): """Return a relative version of the workdir""" if getattr(self, "workdir", None) is None: return None try: return os.path.relpath(self.workdir) except OSError: # current working directory may not be defined! return sel...
[ "Return", "a", "relative", "version", "of", "the", "workdir" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L589-L597
[ "def", "relworkdir", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "\"workdir\"", ",", "None", ")", "is", "None", ":", "return", "None", "try", ":", "return", "os", ".", "path", ".", "relpath", "(", "self", ".", "workdir", ")", "except", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.log_correction
This method should be called once we have fixed the problem associated to this event. It adds a new entry in the correction history of the node. Args: event: :class:`AbinitEvent` that triggered the correction. action (str): Human-readable string with info on the action perfomed ...
pymatgen/io/abinit/nodes.py
def log_correction(self, event, action): """ This method should be called once we have fixed the problem associated to this event. It adds a new entry in the correction history of the node. Args: event: :class:`AbinitEvent` that triggered the correction. action (...
def log_correction(self, event, action): """ This method should be called once we have fixed the problem associated to this event. It adds a new entry in the correction history of the node. Args: event: :class:`AbinitEvent` that triggered the correction. action (...
[ "This", "method", "should", "be", "called", "once", "we", "have", "fixed", "the", "problem", "associated", "to", "this", "event", ".", "It", "adds", "a", "new", "entry", "in", "the", "correction", "history", "of", "the", "node", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L645-L661
[ "def", "log_correction", "(", "self", ",", "event", ",", "action", ")", ":", "# TODO: Create CorrectionObject", "action", "=", "str", "(", "action", ")", "self", ".", "history", ".", "info", "(", "action", ")", "self", ".", "_corrections", ".", "append", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.add_deps
Add a list of dependencies to the :class:`Node`. Args: deps: List of :class:`Dependency` objects specifying the dependencies of the node. or dictionary mapping nodes to file extensions e.g. {task: "DEN"}
pymatgen/io/abinit/nodes.py
def add_deps(self, deps): """ Add a list of dependencies to the :class:`Node`. Args: deps: List of :class:`Dependency` objects specifying the dependencies of the node. or dictionary mapping nodes to file extensions e.g. {task: "DEN"} """ if isinstan...
def add_deps(self, deps): """ Add a list of dependencies to the :class:`Node`. Args: deps: List of :class:`Dependency` objects specifying the dependencies of the node. or dictionary mapping nodes to file extensions e.g. {task: "DEN"} """ if isinstan...
[ "Add", "a", "list", "of", "dependencies", "to", "the", ":", "class", ":", "Node", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L695-L724
[ "def", "add_deps", "(", "self", ",", "deps", ")", ":", "if", "isinstance", "(", "deps", ",", "collections", ".", "Mapping", ")", ":", "# Convert dictionary into list of dependencies.", "deps", "=", "[", "Dependency", "(", "node", ",", "exts", ")", "for", "no...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.remove_deps
Remove a list of dependencies from the :class:`Node`. Args: deps: List of :class:`Dependency` objects specifying the dependencies of the node.
pymatgen/io/abinit/nodes.py
def remove_deps(self, deps): """ Remove a list of dependencies from the :class:`Node`. Args: deps: List of :class:`Dependency` objects specifying the dependencies of the node. """ if not isinstance(deps, (list, tuple)): deps = [deps] assert all(...
def remove_deps(self, deps): """ Remove a list of dependencies from the :class:`Node`. Args: deps: List of :class:`Dependency` objects specifying the dependencies of the node. """ if not isinstance(deps, (list, tuple)): deps = [deps] assert all(...
[ "Remove", "a", "list", "of", "dependencies", "from", "the", ":", "class", ":", "Node", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L727-L744
[ "def", "remove_deps", "(", "self", ",", "deps", ")", ":", "if", "not", "isinstance", "(", "deps", ",", "(", "list", ",", "tuple", ")", ")", ":", "deps", "=", "[", "deps", "]", "assert", "all", "(", "isinstance", "(", "d", ",", "Dependency", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.deps_status
Returns a list with the status of the dependencies.
pymatgen/io/abinit/nodes.py
def deps_status(self): """Returns a list with the status of the dependencies.""" if not self.deps: return [self.S_OK] return [d.status for d in self.deps]
def deps_status(self): """Returns a list with the status of the dependencies.""" if not self.deps: return [self.S_OK] return [d.status for d in self.deps]
[ "Returns", "a", "list", "with", "the", "status", "of", "the", "dependencies", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L746-L751
[ "def", "deps_status", "(", "self", ")", ":", "if", "not", "self", ".", "deps", ":", "return", "[", "self", ".", "S_OK", "]", "return", "[", "d", ".", "status", "for", "d", "in", "self", ".", "deps", "]" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.get_children
Return the list of nodes in the :class:`Flow` that depends on this :class:`Node` .. note:: This routine assumes the entire flow has been allocated.
pymatgen/io/abinit/nodes.py
def get_children(self): """ Return the list of nodes in the :class:`Flow` that depends on this :class:`Node` .. note:: This routine assumes the entire flow has been allocated. """ # Specialized branch for FileNode. if self.is_file: return self.fi...
def get_children(self): """ Return the list of nodes in the :class:`Flow` that depends on this :class:`Node` .. note:: This routine assumes the entire flow has been allocated. """ # Specialized branch for FileNode. if self.is_file: return self.fi...
[ "Return", "the", "list", "of", "nodes", "in", "the", ":", "class", ":", "Flow", "that", "depends", "on", "this", ":", "class", ":", "Node" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L767-L785
[ "def", "get_children", "(", "self", ")", ":", "# Specialized branch for FileNode.", "if", "self", ".", "is_file", ":", "return", "self", ".", "filechildren", "# Inspect the entire flow to get children.", "children", "=", "[", "]", "for", "work", "in", "self", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.str_deps
Return the string representation of the dependencies of the node.
pymatgen/io/abinit/nodes.py
def str_deps(self): """Return the string representation of the dependencies of the node.""" lines = [] app = lines.append app("Dependencies of node %s:" % str(self)) for i, dep in enumerate(self.deps): app("%d) %s, status=%s" % (i, dep.info, str(dep.status))) ...
def str_deps(self): """Return the string representation of the dependencies of the node.""" lines = [] app = lines.append app("Dependencies of node %s:" % str(self)) for i, dep in enumerate(self.deps): app("%d) %s, status=%s" % (i, dep.info, str(dep.status))) ...
[ "Return", "the", "string", "representation", "of", "the", "dependencies", "of", "the", "node", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L787-L796
[ "def", "str_deps", "(", "self", ")", ":", "lines", "=", "[", "]", "app", "=", "lines", ".", "append", "app", "(", "\"Dependencies of node %s:\"", "%", "str", "(", "self", ")", ")", "for", "i", ",", "dep", "in", "enumerate", "(", "self", ".", "deps", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.get_vars_dataframe
Return pandas DataFrame with the value of the variables specified in `varnames`. Can be used for task/works/flow. It's recursive! .. example: flow.get_vars_dataframe("ecut", "ngkpt") work.get_vars_dataframe("acell", "usepawu")
pymatgen/io/abinit/nodes.py
def get_vars_dataframe(self, *varnames): """ Return pandas DataFrame with the value of the variables specified in `varnames`. Can be used for task/works/flow. It's recursive! .. example: flow.get_vars_dataframe("ecut", "ngkpt") work.get_vars_dataframe("acell", "...
def get_vars_dataframe(self, *varnames): """ Return pandas DataFrame with the value of the variables specified in `varnames`. Can be used for task/works/flow. It's recursive! .. example: flow.get_vars_dataframe("ecut", "ngkpt") work.get_vars_dataframe("acell", "...
[ "Return", "pandas", "DataFrame", "with", "the", "value", "of", "the", "variables", "specified", "in", "varnames", ".", "Can", "be", "used", "for", "task", "/", "works", "/", "flow", ".", "It", "s", "recursive!" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L798-L824
[ "def", "get_vars_dataframe", "(", "self", ",", "*", "varnames", ")", ":", "import", "pandas", "as", "pd", "if", "self", ".", "is_task", ":", "df", "=", "pd", ".", "DataFrame", "(", "[", "{", "v", ":", "self", ".", "input", ".", "get", "(", "v", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.get_graphviz_dirtree
Generate directory graph in the DOT language. The graph show the files and directories in the node workdir. Returns: graphviz.Digraph <https://graphviz.readthedocs.io/en/stable/api.html#digraph>
pymatgen/io/abinit/nodes.py
def get_graphviz_dirtree(self, engine="automatic", **kwargs): """ Generate directory graph in the DOT language. The graph show the files and directories in the node workdir. Returns: graphviz.Digraph <https://graphviz.readthedocs.io/en/stable/api.html#digraph> """ if eng...
def get_graphviz_dirtree(self, engine="automatic", **kwargs): """ Generate directory graph in the DOT language. The graph show the files and directories in the node workdir. Returns: graphviz.Digraph <https://graphviz.readthedocs.io/en/stable/api.html#digraph> """ if eng...
[ "Generate", "directory", "graph", "in", "the", "DOT", "language", ".", "The", "graph", "show", "the", "files", "and", "directories", "in", "the", "node", "workdir", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L826-L836
[ "def", "get_graphviz_dirtree", "(", "self", ",", "engine", "=", "\"automatic\"", ",", "*", "*", "kwargs", ")", ":", "if", "engine", "==", "\"automatic\"", ":", "engine", "=", "\"fdp\"", "return", "Dirviz", "(", "self", ".", "workdir", ")", ".", "get_cluste...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.event_handlers
The list of handlers registered for this node. If the node is not a `Flow` and does not have its own list of `handlers` the handlers registered at the level of the flow are returned. This trick allows one to registered different handlers at the level of the Task for testing purposes. By...
pymatgen/io/abinit/nodes.py
def event_handlers(self): """ The list of handlers registered for this node. If the node is not a `Flow` and does not have its own list of `handlers` the handlers registered at the level of the flow are returned. This trick allows one to registered different handlers at the leve...
def event_handlers(self): """ The list of handlers registered for this node. If the node is not a `Flow` and does not have its own list of `handlers` the handlers registered at the level of the flow are returned. This trick allows one to registered different handlers at the leve...
[ "The", "list", "of", "handlers", "registered", "for", "this", "node", ".", "If", "the", "node", "is", "not", "a", "Flow", "and", "does", "not", "have", "its", "own", "list", "of", "handlers", "the", "handlers", "registered", "at", "the", "level", "of", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L858-L875
[ "def", "event_handlers", "(", "self", ")", ":", "if", "self", ".", "is_flow", ":", "return", "self", ".", "_event_handlers", "try", ":", "return", "self", ".", "_event_handlers", "except", "AttributeError", ":", "return", "self", ".", "flow", ".", "_event_ha...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.install_event_handlers
Install the `EventHandlers for this `Node`. If no argument is provided the default list of handlers is installed. Args: categories: List of categories to install e.g. base + can_change_physics handlers: explicit list of :class:`EventHandler` instances. This...
pymatgen/io/abinit/nodes.py
def install_event_handlers(self, categories=None, handlers=None): """ Install the `EventHandlers for this `Node`. If no argument is provided the default list of handlers is installed. Args: categories: List of categories to install e.g. base + can_change_physics ...
def install_event_handlers(self, categories=None, handlers=None): """ Install the `EventHandlers for this `Node`. If no argument is provided the default list of handlers is installed. Args: categories: List of categories to install e.g. base + can_change_physics ...
[ "Install", "the", "EventHandlers", "for", "this", "Node", ".", "If", "no", "argument", "is", "provided", "the", "default", "list", "of", "handlers", "is", "installed", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L878-L902
[ "def", "install_event_handlers", "(", "self", ",", "categories", "=", "None", ",", "handlers", "=", "None", ")", ":", "if", "categories", "is", "not", "None", "and", "handlers", "is", "not", "None", ":", "raise", "ValueError", "(", "\"categories and handlers a...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.show_event_handlers
Print to `stream` the event handlers installed for this flow.
pymatgen/io/abinit/nodes.py
def show_event_handlers(self, stream=sys.stdout, verbose=0): """Print to `stream` the event handlers installed for this flow.""" lines = ["List of event handlers installed:"] for handler in self.event_handlers: if verbose: lines.extend(handler.__class__.cls2str().spli...
def show_event_handlers(self, stream=sys.stdout, verbose=0): """Print to `stream` the event handlers installed for this flow.""" lines = ["List of event handlers installed:"] for handler in self.event_handlers: if verbose: lines.extend(handler.__class__.cls2str().spli...
[ "Print", "to", "stream", "the", "event", "handlers", "installed", "for", "this", "flow", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L904-L914
[ "def", "show_event_handlers", "(", "self", ",", "stream", "=", "sys", ".", "stdout", ",", "verbose", "=", "0", ")", ":", "lines", "=", "[", "\"List of event handlers installed:\"", "]", "for", "handler", "in", "self", ".", "event_handlers", ":", "if", "verbo...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Node.send_signal
Send signal from this node to all connected receivers unless the node is in spectator mode. signal -- (hashable) signal value, see `dispatcher` connect for details Return a list of tuple pairs [(receiver, response), ... ] or None if the node is in spectator mode. if any receiver raise...
pymatgen/io/abinit/nodes.py
def send_signal(self, signal): """ Send signal from this node to all connected receivers unless the node is in spectator mode. signal -- (hashable) signal value, see `dispatcher` connect for details Return a list of tuple pairs [(receiver, response), ... ] or None if the node i...
def send_signal(self, signal): """ Send signal from this node to all connected receivers unless the node is in spectator mode. signal -- (hashable) signal value, see `dispatcher` connect for details Return a list of tuple pairs [(receiver, response), ... ] or None if the node i...
[ "Send", "signal", "from", "this", "node", "to", "all", "connected", "receivers", "unless", "the", "node", "is", "in", "spectator", "mode", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L916-L931
[ "def", "send_signal", "(", "self", ",", "signal", ")", ":", "if", "self", ".", "in_spectator_mode", ":", "return", "None", "logger", ".", "debug", "(", "\"Node %s broadcasts signal %s\"", "%", "(", "self", ",", "signal", ")", ")", "dispatcher", ".", "send", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
HistoryRecord.get_message
Return the message after merging any user-supplied arguments with the message. Args: metadata: True if function and module name should be added. asctime: True if time string should be added.
pymatgen/io/abinit/nodes.py
def get_message(self, metadata=False, asctime=True): """ Return the message after merging any user-supplied arguments with the message. Args: metadata: True if function and module name should be added. asctime: True if time string should be added. """ msg...
def get_message(self, metadata=False, asctime=True): """ Return the message after merging any user-supplied arguments with the message. Args: metadata: True if function and module name should be added. asctime: True if time string should be added. """ msg...
[ "Return", "the", "message", "after", "merging", "any", "user", "-", "supplied", "arguments", "with", "the", "message", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L1137-L1158
[ "def", "get_message", "(", "self", ",", "metadata", "=", "False", ",", "asctime", "=", "True", ")", ":", "msg", "=", "self", ".", "msg", "if", "is_string", "(", "self", ".", "msg", ")", "else", "str", "(", "self", ".", "msg", ")", "if", "self", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeHistory.to_string
Returns a string with the history. Set metadata to True to have info on function and module.
pymatgen/io/abinit/nodes.py
def to_string(self, metadata=False): """Returns a string with the history. Set metadata to True to have info on function and module.""" return "\n".join(rec.get_message(metadata=metadata) for rec in self)
def to_string(self, metadata=False): """Returns a string with the history. Set metadata to True to have info on function and module.""" return "\n".join(rec.get_message(metadata=metadata) for rec in self)
[ "Returns", "a", "string", "with", "the", "history", ".", "Set", "metadata", "to", "True", "to", "have", "info", "on", "function", "and", "module", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L1177-L1179
[ "def", "to_string", "(", "self", ",", "metadata", "=", "False", ")", ":", "return", "\"\\n\"", ".", "join", "(", "rec", ".", "get_message", "(", "metadata", "=", "metadata", ")", "for", "rec", "in", "self", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeHistory.warning
Log 'msg % args' with the warning severity level
pymatgen/io/abinit/nodes.py
def warning(self, msg, *args, **kwargs): """Log 'msg % args' with the warning severity level""" self._log("WARNING", msg, args, kwargs)
def warning(self, msg, *args, **kwargs): """Log 'msg % args' with the warning severity level""" self._log("WARNING", msg, args, kwargs)
[ "Log", "msg", "%", "args", "with", "the", "warning", "severity", "level" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L1185-L1187
[ "def", "warning", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_log", "(", "\"WARNING\"", ",", "msg", ",", "args", ",", "kwargs", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeHistory.critical
Log 'msg % args' with the critical severity level
pymatgen/io/abinit/nodes.py
def critical(self, msg, *args, **kwargs): """Log 'msg % args' with the critical severity level""" self._log("CRITICAL", msg, args, kwargs)
def critical(self, msg, *args, **kwargs): """Log 'msg % args' with the critical severity level""" self._log("CRITICAL", msg, args, kwargs)
[ "Log", "msg", "%", "args", "with", "the", "critical", "severity", "level" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L1189-L1191
[ "def", "critical", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_log", "(", "\"CRITICAL\"", ",", "msg", ",", "args", ",", "kwargs", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
NodeHistory._log
Low-level logging routine which creates a :class:`HistoryRecord`.
pymatgen/io/abinit/nodes.py
def _log(self, level, msg, args, exc_info=None, extra=None): """Low-level logging routine which creates a :class:`HistoryRecord`.""" if exc_info and not isinstance(exc_info, tuple): exc_info = sys.exc_info() self.append(HistoryRecord(level, "unknown filename", 0, msg, args, exc_info...
def _log(self, level, msg, args, exc_info=None, extra=None): """Low-level logging routine which creates a :class:`HistoryRecord`.""" if exc_info and not isinstance(exc_info, tuple): exc_info = sys.exc_info() self.append(HistoryRecord(level, "unknown filename", 0, msg, args, exc_info...
[ "Low", "-", "level", "logging", "routine", "which", "creates", "a", ":", "class", ":", "HistoryRecord", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/nodes.py#L1193-L1198
[ "def", "_log", "(", "self", ",", "level", ",", "msg", ",", "args", ",", "exc_info", "=", "None", ",", "extra", "=", "None", ")", ":", "if", "exc_info", "and", "not", "isinstance", "(", "exc_info", ",", "tuple", ")", ":", "exc_info", "=", "sys", "."...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
parse_libxc_docs
Parse libxc_docs.txt file, return dictionary with mapping: libxc_id --> info_dict
dev_scripts/regen_libxcfunc.py
def parse_libxc_docs(path): """ Parse libxc_docs.txt file, return dictionary with mapping: libxc_id --> info_dict """ def parse_section(section): d = {} for l in section: key, value = l.split(":") key = key.strip() d[key] = value.strip() return int(d["Number"]), d d = Ordered...
def parse_libxc_docs(path): """ Parse libxc_docs.txt file, return dictionary with mapping: libxc_id --> info_dict """ def parse_section(section): d = {} for l in section: key, value = l.split(":") key = key.strip() d[key] = value.strip() return int(d["Number"]), d d = Ordered...
[ "Parse", "libxc_docs", ".", "txt", "file", "return", "dictionary", "with", "mapping", ":", "libxc_id", "--", ">", "info_dict" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/dev_scripts/regen_libxcfunc.py#L17-L44
[ "def", "parse_libxc_docs", "(", "path", ")", ":", "def", "parse_section", "(", "section", ")", ":", "d", "=", "{", "}", "for", "l", "in", "section", ":", "key", ",", "value", "=", "l", ".", "split", "(", "\":\"", ")", "key", "=", "key", ".", "str...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
write_libxc_docs_json
Write json file with libxc metadata to path jpath.
dev_scripts/regen_libxcfunc.py
def write_libxc_docs_json(xcfuncs, jpath): """Write json file with libxc metadata to path jpath.""" from copy import deepcopy xcfuncs = deepcopy(xcfuncs) # Remove XC_FAMILY from Family and XC_ from Kind to make strings more human-readable. for d in xcfuncs.values(): d["Family"] = d["Family"...
def write_libxc_docs_json(xcfuncs, jpath): """Write json file with libxc metadata to path jpath.""" from copy import deepcopy xcfuncs = deepcopy(xcfuncs) # Remove XC_FAMILY from Family and XC_ from Kind to make strings more human-readable. for d in xcfuncs.values(): d["Family"] = d["Family"...
[ "Write", "json", "file", "with", "libxc", "metadata", "to", "path", "jpath", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/dev_scripts/regen_libxcfunc.py#L47-L68
[ "def", "write_libxc_docs_json", "(", "xcfuncs", ",", "jpath", ")", ":", "from", "copy", "import", "deepcopy", "xcfuncs", "=", "deepcopy", "(", "xcfuncs", ")", "# Remove XC_FAMILY from Family and XC_ from Kind to make strings more human-readable.", "for", "d", "in", "xcfun...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
main
Main function.
dev_scripts/regen_libxcfunc.py
def main(): """Main function.""" if "-h" in sys.argv or "--help" in sys.argv: print(__doc__) print("Usage: regen_libxcfunc.py path_to_libxc_docs.txt") return 0 try: path = sys.argv[1] except IndexError: print(__doc__) print("Usage: regen_libxcfunc.py path...
def main(): """Main function.""" if "-h" in sys.argv or "--help" in sys.argv: print(__doc__) print("Usage: regen_libxcfunc.py path_to_libxc_docs.txt") return 0 try: path = sys.argv[1] except IndexError: print(__doc__) print("Usage: regen_libxcfunc.py path...
[ "Main", "function", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/dev_scripts/regen_libxcfunc.py#L70-L118
[ "def", "main", "(", ")", ":", "if", "\"-h\"", "in", "sys", ".", "argv", "or", "\"--help\"", "in", "sys", ".", "argv", ":", "print", "(", "__doc__", ")", "print", "(", "\"Usage: regen_libxcfunc.py path_to_libxc_docs.txt\"", ")", "return", "0", "try", ":", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
make_movie
Generate a movie from a sequence of structures using vtk and ffmpeg. Args: structures ([Structure]): sequence of structures output_filename (str): filename for structure output. defaults to movie.mp4 zoom (float): A zoom to be applied to the visualizer. Defaults to 1.0. ...
pymatgen/vis/structure_vtk.py
def make_movie(structures, output_filename="movie.mp4", zoom=1.0, fps=20, bitrate="10000k", quality=1, **kwargs): """ Generate a movie from a sequence of structures using vtk and ffmpeg. Args: structures ([Structure]): sequence of structures output_filename (str): filename fo...
def make_movie(structures, output_filename="movie.mp4", zoom=1.0, fps=20, bitrate="10000k", quality=1, **kwargs): """ Generate a movie from a sequence of structures using vtk and ffmpeg. Args: structures ([Structure]): sequence of structures output_filename (str): filename fo...
[ "Generate", "a", "movie", "from", "a", "sequence", "of", "structures", "using", "vtk", "and", "ffmpeg", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L869-L899
[ "def", "make_movie", "(", "structures", ",", "output_filename", "=", "\"movie.mp4\"", ",", "zoom", "=", "1.0", ",", "fps", "=", "20", ",", "bitrate", "=", "\"10000k\"", ",", "quality", "=", "1", ",", "*", "*", "kwargs", ")", ":", "vis", "=", "Structure...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.rotate_view
Rotate the camera view. Args: axis_ind: Index of axis to rotate. Defaults to 0, i.e., a-axis. angle: Angle to rotate by. Defaults to 0.
pymatgen/vis/structure_vtk.py
def rotate_view(self, axis_ind=0, angle=0): """ Rotate the camera view. Args: axis_ind: Index of axis to rotate. Defaults to 0, i.e., a-axis. angle: Angle to rotate by. Defaults to 0. """ camera = self.ren.GetActiveCamera() if axis_ind == 0: ...
def rotate_view(self, axis_ind=0, angle=0): """ Rotate the camera view. Args: axis_ind: Index of axis to rotate. Defaults to 0, i.e., a-axis. angle: Angle to rotate by. Defaults to 0. """ camera = self.ren.GetActiveCamera() if axis_ind == 0: ...
[ "Rotate", "the", "camera", "view", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L125-L140
[ "def", "rotate_view", "(", "self", ",", "axis_ind", "=", "0", ",", "angle", "=", "0", ")", ":", "camera", "=", "self", ".", "ren", ".", "GetActiveCamera", "(", ")", "if", "axis_ind", "==", "0", ":", "camera", ".", "Roll", "(", "angle", ")", "elif",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.write_image
Save render window to an image. Arguments: filename: filename to save to. Defaults to image.png. magnification: magnification. Use it to render high res images. image_format: choose between jpeg, png. Png is the default.
pymatgen/vis/structure_vtk.py
def write_image(self, filename="image.png", magnification=1, image_format="png"): """ Save render window to an image. Arguments: filename: filename to save to. Defaults to image.png. magnification: magnification. Use it...
def write_image(self, filename="image.png", magnification=1, image_format="png"): """ Save render window to an image. Arguments: filename: filename to save to. Defaults to image.png. magnification: magnification. Use it...
[ "Save", "render", "window", "to", "an", "image", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L142-L169
[ "def", "write_image", "(", "self", ",", "filename", "=", "\"image.png\"", ",", "magnification", "=", "1", ",", "image_format", "=", "\"png\"", ")", ":", "render_large", "=", "vtk", ".", "vtkRenderLargeImage", "(", ")", "render_large", ".", "SetInput", "(", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.redraw
Redraw the render window. Args: reset_camera: Set to True to reset the camera to a pre-determined default for each structure. Defaults to False.
pymatgen/vis/structure_vtk.py
def redraw(self, reset_camera=False): """ Redraw the render window. Args: reset_camera: Set to True to reset the camera to a pre-determined default for each structure. Defaults to False. """ self.ren.RemoveAllViewProps() self.picker = None ...
def redraw(self, reset_camera=False): """ Redraw the render window. Args: reset_camera: Set to True to reset the camera to a pre-determined default for each structure. Defaults to False. """ self.ren.RemoveAllViewProps() self.picker = None ...
[ "Redraw", "the", "render", "window", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L171-L191
[ "def", "redraw", "(", "self", ",", "reset_camera", "=", "False", ")", ":", "self", ".", "ren", ".", "RemoveAllViewProps", "(", ")", "self", ".", "picker", "=", "None", "self", ".", "add_picker_fixed", "(", ")", "self", ".", "helptxt_mapper", "=", "vtk", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.display_help
Display the help for various keyboard shortcuts.
pymatgen/vis/structure_vtk.py
def display_help(self): """ Display the help for various keyboard shortcuts. """ helptxt = ["h : Toggle help", "A/a, B/b or C/c : Increase/decrease cell by one a," " b or c unit vector", "# : Toggle showing of polyhedrons", "-: Tog...
def display_help(self): """ Display the help for various keyboard shortcuts. """ helptxt = ["h : Toggle help", "A/a, B/b or C/c : Increase/decrease cell by one a," " b or c unit vector", "# : Toggle showing of polyhedrons", "-: Tog...
[ "Display", "the", "help", "for", "various", "keyboard", "shortcuts", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L198-L215
[ "def", "display_help", "(", "self", ")", ":", "helptxt", "=", "[", "\"h : Toggle help\"", ",", "\"A/a, B/b or C/c : Increase/decrease cell by one a,\"", "\" b or c unit vector\"", ",", "\"# : Toggle showing of polyhedrons\"", ",", "\"-: Toggle showing of bonds\"", ",", "\"r : Res...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.set_structure
Add a structure to the visualizer. Args: structure: structure to visualize reset_camera: Set to True to reset the camera to a default determined based on the structure. to_unit_cell: Whether or not to fall back sites into the unit cell.
pymatgen/vis/structure_vtk.py
def set_structure(self, structure, reset_camera=True, to_unit_cell=True): """ Add a structure to the visualizer. Args: structure: structure to visualize reset_camera: Set to True to reset the camera to a default determined based on the structure. ...
def set_structure(self, structure, reset_camera=True, to_unit_cell=True): """ Add a structure to the visualizer. Args: structure: structure to visualize reset_camera: Set to True to reset the camera to a default determined based on the structure. ...
[ "Add", "a", "structure", "to", "the", "visualizer", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L217-L327
[ "def", "set_structure", "(", "self", ",", "structure", ",", "reset_camera", "=", "True", ",", "to_unit_cell", "=", "True", ")", ":", "self", ".", "ren", ".", "RemoveAllViewProps", "(", ")", "has_lattice", "=", "hasattr", "(", "structure", ",", "\"lattice\"",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.zoom
Zoom the camera view by a factor.
pymatgen/vis/structure_vtk.py
def zoom(self, factor): """ Zoom the camera view by a factor. """ camera = self.ren.GetActiveCamera() camera.Zoom(factor) self.ren_win.Render()
def zoom(self, factor): """ Zoom the camera view by a factor. """ camera = self.ren.GetActiveCamera() camera.Zoom(factor) self.ren_win.Render()
[ "Zoom", "the", "camera", "view", "by", "a", "factor", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L329-L335
[ "def", "zoom", "(", "self", ",", "factor", ")", ":", "camera", "=", "self", ".", "ren", ".", "GetActiveCamera", "(", ")", "camera", ".", "Zoom", "(", "factor", ")", "self", ".", "ren_win", ".", "Render", "(", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.show
Display the visualizer.
pymatgen/vis/structure_vtk.py
def show(self): """ Display the visualizer. """ self.iren.Initialize() self.ren_win.SetSize(800, 800) self.ren_win.SetWindowName(self.title) self.ren_win.Render() self.iren.Start()
def show(self): """ Display the visualizer. """ self.iren.Initialize() self.ren_win.SetSize(800, 800) self.ren_win.SetWindowName(self.title) self.ren_win.Render() self.iren.Start()
[ "Display", "the", "visualizer", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L337-L345
[ "def", "show", "(", "self", ")", ":", "self", ".", "iren", ".", "Initialize", "(", ")", "self", ".", "ren_win", ".", "SetSize", "(", "800", ",", "800", ")", "self", ".", "ren_win", ".", "SetWindowName", "(", "self", ".", "title", ")", "self", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.add_site
Add a site to the render window. The site is displayed as a sphere, the color of which is determined based on the element. Partially occupied sites are displayed as a single element color, though the site info still shows the partial occupancy. Args: site: Site to add.
pymatgen/vis/structure_vtk.py
def add_site(self, site): """ Add a site to the render window. The site is displayed as a sphere, the color of which is determined based on the element. Partially occupied sites are displayed as a single element color, though the site info still shows the partial occupancy. ...
def add_site(self, site): """ Add a site to the render window. The site is displayed as a sphere, the color of which is determined based on the element. Partially occupied sites are displayed as a single element color, though the site info still shows the partial occupancy. ...
[ "Add", "a", "site", "to", "the", "render", "window", ".", "The", "site", "is", "displayed", "as", "a", "sphere", "the", "color", "of", "which", "is", "determined", "based", "on", "the", "element", ".", "Partially", "occupied", "sites", "are", "displayed", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L347-L383
[ "def", "add_site", "(", "self", ",", "site", ")", ":", "start_angle", "=", "0", "radius", "=", "0", "total_occu", "=", "0", "for", "specie", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")", ":", "radius", "+=", "occu", "*", "(", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.add_text
Add text at a coordinate. Args: coords: Coordinates to add text at. text: Text to place. color: Color for text as RGB. Defaults to black.
pymatgen/vis/structure_vtk.py
def add_text(self, coords, text, color=(0, 0, 0)): """ Add text at a coordinate. Args: coords: Coordinates to add text at. text: Text to place. color: Color for text as RGB. Defaults to black. """ source = vtk.vtkVectorText() source.Se...
def add_text(self, coords, text, color=(0, 0, 0)): """ Add text at a coordinate. Args: coords: Coordinates to add text at. text: Text to place. color: Color for text as RGB. Defaults to black. """ source = vtk.vtkVectorText() source.Se...
[ "Add", "text", "at", "a", "coordinate", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L404-L423
[ "def", "add_text", "(", "self", ",", "coords", ",", "text", ",", "color", "=", "(", "0", ",", "0", ",", "0", ")", ")", ":", "source", "=", "vtk", ".", "vtkVectorText", "(", ")", "source", ".", "SetText", "(", "text", ")", "mapper", "=", "vtk", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.add_line
Adds a line. Args: start: Starting coordinates for line. end: Ending coordinates for line. color: Color for text as RGB. Defaults to grey. width: Width of line. Defaults to 1.
pymatgen/vis/structure_vtk.py
def add_line(self, start, end, color=(0.5, 0.5, 0.5), width=1): """ Adds a line. Args: start: Starting coordinates for line. end: Ending coordinates for line. color: Color for text as RGB. Defaults to grey. width: Width of line. Defaults to 1. ...
def add_line(self, start, end, color=(0.5, 0.5, 0.5), width=1): """ Adds a line. Args: start: Starting coordinates for line. end: Ending coordinates for line. color: Color for text as RGB. Defaults to grey. width: Width of line. Defaults to 1. ...
[ "Adds", "a", "line", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L425-L453
[ "def", "add_line", "(", "self", ",", "start", ",", "end", ",", "color", "=", "(", "0.5", ",", "0.5", ",", "0.5", ")", ",", "width", "=", "1", ")", ":", "source", "=", "vtk", ".", "vtkLineSource", "(", ")", "source", ".", "SetPoint1", "(", "start"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.add_polyhedron
Adds a polyhedron. Args: neighbors: Neighbors of the polyhedron (the vertices). center: The atom in the center of the polyhedron. color: Color for text as RGB. opacity: Opacity of the polyhedron draw_edges: If set to True, the a line will be drawn at ...
pymatgen/vis/structure_vtk.py
def add_polyhedron(self, neighbors, center, color, opacity=1.0, draw_edges=False, edges_color=[0.0, 0.0, 0.0], edges_linewidth=2): """ Adds a polyhedron. Args: neighbors: Neighbors of the polyhedron (the vertices). center: Th...
def add_polyhedron(self, neighbors, center, color, opacity=1.0, draw_edges=False, edges_color=[0.0, 0.0, 0.0], edges_linewidth=2): """ Adds a polyhedron. Args: neighbors: Neighbors of the polyhedron (the vertices). center: Th...
[ "Adds", "a", "polyhedron", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L455-L509
[ "def", "add_polyhedron", "(", "self", ",", "neighbors", ",", "center", ",", "color", ",", "opacity", "=", "1.0", ",", "draw_edges", "=", "False", ",", "edges_color", "=", "[", "0.0", ",", "0.0", ",", "0.0", "]", ",", "edges_linewidth", "=", "2", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.add_triangle
Adds a triangular surface between three atoms. Args: atoms: Atoms between which a triangle will be drawn. color: Color for triangle as RGB. center: The "central atom" of the triangle opacity: opacity of the triangle draw_edges: If set to True, the a l...
pymatgen/vis/structure_vtk.py
def add_triangle(self, neighbors, color, center=None, opacity=0.4, draw_edges=False, edges_color=[0.0, 0.0, 0.0], edges_linewidth=2): """ Adds a triangular surface between three atoms. Args: atoms: Atoms between which a triangle will be draw...
def add_triangle(self, neighbors, color, center=None, opacity=0.4, draw_edges=False, edges_color=[0.0, 0.0, 0.0], edges_linewidth=2): """ Adds a triangular surface between three atoms. Args: atoms: Atoms between which a triangle will be draw...
[ "Adds", "a", "triangular", "surface", "between", "three", "atoms", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L511-L567
[ "def", "add_triangle", "(", "self", ",", "neighbors", ",", "color", ",", "center", "=", "None", ",", "opacity", "=", "0.4", ",", "draw_edges", "=", "False", ",", "edges_color", "=", "[", "0.0", ",", "0.0", ",", "0.0", "]", ",", "edges_linewidth", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
StructureVis.add_bonds
Adds bonds for a site. Args: neighbors: Neighbors of the site. center: The site in the center for all bonds. color: Color of the tubes representing the bonds opacity: Opacity of the tubes representing the bonds radius: Radius of tube s representing th...
pymatgen/vis/structure_vtk.py
def add_bonds(self, neighbors, center, color=None, opacity=None, radius=0.1): """ Adds bonds for a site. Args: neighbors: Neighbors of the site. center: The site in the center for all bonds. color: Color of the tubes representing the bonds ...
def add_bonds(self, neighbors, center, color=None, opacity=None, radius=0.1): """ Adds bonds for a site. Args: neighbors: Neighbors of the site. center: The site in the center for all bonds. color: Color of the tubes representing the bonds ...
[ "Adds", "bonds", "for", "a", "site", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/vis/structure_vtk.py#L677-L718
[ "def", "add_bonds", "(", "self", ",", "neighbors", ",", "center", ",", "color", "=", "None", ",", "opacity", "=", "None", ",", "radius", "=", "0.1", ")", ":", "points", "=", "vtk", ".", "vtkPoints", "(", ")", "points", ".", "InsertPoint", "(", "0", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_mi_vec
Convenience function which returns the unit vector aligned with the miller index.
pymatgen/analysis/adsorption.py
def get_mi_vec(slab): """ Convenience function which returns the unit vector aligned with the miller index. """ mvec = np.cross(slab.lattice.matrix[0], slab.lattice.matrix[1]) return mvec / np.linalg.norm(mvec)
def get_mi_vec(slab): """ Convenience function which returns the unit vector aligned with the miller index. """ mvec = np.cross(slab.lattice.matrix[0], slab.lattice.matrix[1]) return mvec / np.linalg.norm(mvec)
[ "Convenience", "function", "which", "returns", "the", "unit", "vector", "aligned", "with", "the", "miller", "index", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L567-L573
[ "def", "get_mi_vec", "(", "slab", ")", ":", "mvec", "=", "np", ".", "cross", "(", "slab", ".", "lattice", ".", "matrix", "[", "0", "]", ",", "slab", ".", "lattice", ".", "matrix", "[", "1", "]", ")", "return", "mvec", "/", "np", ".", "linalg", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_rot
Gets the transformation to rotate the z axis into the miller index
pymatgen/analysis/adsorption.py
def get_rot(slab): """ Gets the transformation to rotate the z axis into the miller index """ new_z = get_mi_vec(slab) a, b, c = slab.lattice.matrix new_x = a / np.linalg.norm(a) new_y = np.cross(new_z, new_x) x, y, z = np.eye(3) rot_matrix = np.array([np.dot(*el) for el in ...
def get_rot(slab): """ Gets the transformation to rotate the z axis into the miller index """ new_z = get_mi_vec(slab) a, b, c = slab.lattice.matrix new_x = a / np.linalg.norm(a) new_y = np.cross(new_z, new_x) x, y, z = np.eye(3) rot_matrix = np.array([np.dot(*el) for el in ...
[ "Gets", "the", "transformation", "to", "rotate", "the", "z", "axis", "into", "the", "miller", "index" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L576-L590
[ "def", "get_rot", "(", "slab", ")", ":", "new_z", "=", "get_mi_vec", "(", "slab", ")", "a", ",", "b", ",", "c", "=", "slab", ".", "lattice", ".", "matrix", "new_x", "=", "a", "/", "np", ".", "linalg", ".", "norm", "(", "a", ")", "new_y", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
put_coord_inside
converts a cartesian coordinate such that it is inside the unit cell.
pymatgen/analysis/adsorption.py
def put_coord_inside(lattice, cart_coordinate): """ converts a cartesian coordinate such that it is inside the unit cell. """ fc = lattice.get_fractional_coords(cart_coordinate) return lattice.get_cartesian_coords([c - np.floor(c) for c in fc])
def put_coord_inside(lattice, cart_coordinate): """ converts a cartesian coordinate such that it is inside the unit cell. """ fc = lattice.get_fractional_coords(cart_coordinate) return lattice.get_cartesian_coords([c - np.floor(c) for c in fc])
[ "converts", "a", "cartesian", "coordinate", "such", "that", "it", "is", "inside", "the", "unit", "cell", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L593-L598
[ "def", "put_coord_inside", "(", "lattice", ",", "cart_coordinate", ")", ":", "fc", "=", "lattice", ".", "get_fractional_coords", "(", "cart_coordinate", ")", "return", "lattice", ".", "get_cartesian_coords", "(", "[", "c", "-", "np", ".", "floor", "(", "c", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
reorient_z
reorients a structure such that the z axis is concurrent with the normal to the A-B plane
pymatgen/analysis/adsorption.py
def reorient_z(structure): """ reorients a structure such that the z axis is concurrent with the normal to the A-B plane """ struct = structure.copy() sop = get_rot(struct) struct.apply_operation(sop) return struct
def reorient_z(structure): """ reorients a structure such that the z axis is concurrent with the normal to the A-B plane """ struct = structure.copy() sop = get_rot(struct) struct.apply_operation(sop) return struct
[ "reorients", "a", "structure", "such", "that", "the", "z", "axis", "is", "concurrent", "with", "the", "normal", "to", "the", "A", "-", "B", "plane" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L601-L609
[ "def", "reorient_z", "(", "structure", ")", ":", "struct", "=", "structure", ".", "copy", "(", ")", "sop", "=", "get_rot", "(", "struct", ")", "struct", ".", "apply_operation", "(", "sop", ")", "return", "struct" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
plot_slab
Function that helps visualize the slab in a 2-D plot, for convenient viewing of output of AdsorbateSiteFinder. Args: slab (slab): Slab object to be visualized ax (axes): matplotlib axes with which to visualize scale (float): radius scaling for sites repeat (int): number of repea...
pymatgen/analysis/adsorption.py
def plot_slab(slab, ax, scale=0.8, repeat=5, window=1.5, draw_unit_cell=True, decay=0.2, adsorption_sites=True): """ Function that helps visualize the slab in a 2-D plot, for convenient viewing of output of AdsorbateSiteFinder. Args: slab (slab): Slab object to be visualized ...
def plot_slab(slab, ax, scale=0.8, repeat=5, window=1.5, draw_unit_cell=True, decay=0.2, adsorption_sites=True): """ Function that helps visualize the slab in a 2-D plot, for convenient viewing of output of AdsorbateSiteFinder. Args: slab (slab): Slab object to be visualized ...
[ "Function", "that", "helps", "visualize", "the", "slab", "in", "a", "2", "-", "D", "plot", "for", "convenient", "viewing", "of", "output", "of", "AdsorbateSiteFinder", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L619-L686
[ "def", "plot_slab", "(", "slab", ",", "ax", ",", "scale", "=", "0.8", ",", "repeat", "=", "5", ",", "window", "=", "1.5", ",", "draw_unit_cell", "=", "True", ",", "decay", "=", "0.2", ",", "adsorption_sites", "=", "True", ")", ":", "orig_slab", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.from_bulk_and_miller
This method constructs the adsorbate site finder from a bulk structure and a miller index, which allows the surface sites to be determined from the difference in bulk and slab coordination, as opposed to the height threshold. Args: structure (Structure): structure from which...
pymatgen/analysis/adsorption.py
def from_bulk_and_miller(cls, structure, miller_index, min_slab_size=8.0, min_vacuum_size=10.0, max_normal_search=None, center_slab=True, selective_dynamics=False, undercoord_threshold=0.09): """ This method construct...
def from_bulk_and_miller(cls, structure, miller_index, min_slab_size=8.0, min_vacuum_size=10.0, max_normal_search=None, center_slab=True, selective_dynamics=False, undercoord_threshold=0.09): """ This method construct...
[ "This", "method", "constructs", "the", "adsorbate", "site", "finder", "from", "a", "bulk", "structure", "and", "a", "miller", "index", "which", "allows", "the", "surface", "sites", "to", "be", "determined", "from", "the", "difference", "in", "bulk", "and", "...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L85-L148
[ "def", "from_bulk_and_miller", "(", "cls", ",", "structure", ",", "miller_index", ",", "min_slab_size", "=", "8.0", ",", "min_vacuum_size", "=", "10.0", ",", "max_normal_search", "=", "None", ",", "center_slab", "=", "True", ",", "selective_dynamics", "=", "Fals...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.find_surface_sites_by_height
This method finds surface sites by determining which sites are within a threshold value in height from the topmost site in a list of sites Args: site_list (list): list of sites from which to select surface sites height (float): threshold in angstroms of distance from topmost ...
pymatgen/analysis/adsorption.py
def find_surface_sites_by_height(self, slab, height=0.9, xy_tol=0.05): """ This method finds surface sites by determining which sites are within a threshold value in height from the topmost site in a list of sites Args: site_list (list): list of sites from which to select su...
def find_surface_sites_by_height(self, slab, height=0.9, xy_tol=0.05): """ This method finds surface sites by determining which sites are within a threshold value in height from the topmost site in a list of sites Args: site_list (list): list of sites from which to select su...
[ "This", "method", "finds", "surface", "sites", "by", "determining", "which", "sites", "are", "within", "a", "threshold", "value", "in", "height", "from", "the", "topmost", "site", "in", "a", "list", "of", "sites" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L150-L187
[ "def", "find_surface_sites_by_height", "(", "self", ",", "slab", ",", "height", "=", "0.9", ",", "xy_tol", "=", "0.05", ")", ":", "# Get projection of coordinates along the miller index", "m_projs", "=", "np", ".", "array", "(", "[", "np", ".", "dot", "(", "si...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.assign_site_properties
Assigns site properties.
pymatgen/analysis/adsorption.py
def assign_site_properties(self, slab, height=0.9): """ Assigns site properties. """ if 'surface_properties' in slab.site_properties.keys(): return slab else: surf_sites = self.find_surface_sites_by_height(slab, height) surf_props = ['surface' if s...
def assign_site_properties(self, slab, height=0.9): """ Assigns site properties. """ if 'surface_properties' in slab.site_properties.keys(): return slab else: surf_sites = self.find_surface_sites_by_height(slab, height) surf_props = ['surface' if s...
[ "Assigns", "site", "properties", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L189-L200
[ "def", "assign_site_properties", "(", "self", ",", "slab", ",", "height", "=", "0.9", ")", ":", "if", "'surface_properties'", "in", "slab", ".", "site_properties", ".", "keys", "(", ")", ":", "return", "slab", "else", ":", "surf_sites", "=", "self", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.get_extended_surface_mesh
Gets an extended surface mesh for to use for adsorption site finding by constructing supercell of surface sites Args: repeat (3-tuple): repeat for getting extended surface mesh
pymatgen/analysis/adsorption.py
def get_extended_surface_mesh(self, repeat=(5, 5, 1)): """ Gets an extended surface mesh for to use for adsorption site finding by constructing supercell of surface sites Args: repeat (3-tuple): repeat for getting extended surface mesh """ surf_str = Structur...
def get_extended_surface_mesh(self, repeat=(5, 5, 1)): """ Gets an extended surface mesh for to use for adsorption site finding by constructing supercell of surface sites Args: repeat (3-tuple): repeat for getting extended surface mesh """ surf_str = Structur...
[ "Gets", "an", "extended", "surface", "mesh", "for", "to", "use", "for", "adsorption", "site", "finding", "by", "constructing", "supercell", "of", "surface", "sites" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L202-L212
[ "def", "get_extended_surface_mesh", "(", "self", ",", "repeat", "=", "(", "5", ",", "5", ",", "1", ")", ")", ":", "surf_str", "=", "Structure", ".", "from_sites", "(", "self", ".", "surface_sites", ")", "surf_str", ".", "make_supercell", "(", "repeat", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.find_adsorption_sites
Finds surface sites according to the above algorithm. Returns a list of corresponding cartesian coordinates. Args: distance (float): distance from the coordinating ensemble of atoms along the miller index for the site (i. e. the distance from the slab itself...
pymatgen/analysis/adsorption.py
def find_adsorption_sites(self, distance=2.0, put_inside=True, symm_reduce=1e-2, near_reduce=1e-2, positions=['ontop', 'bridge', 'hollow'], no_obtuse_hollow=True): """ Finds surface sites according to the above alg...
def find_adsorption_sites(self, distance=2.0, put_inside=True, symm_reduce=1e-2, near_reduce=1e-2, positions=['ontop', 'bridge', 'hollow'], no_obtuse_hollow=True): """ Finds surface sites according to the above alg...
[ "Finds", "surface", "sites", "according", "to", "the", "above", "algorithm", ".", "Returns", "a", "list", "of", "corresponding", "cartesian", "coordinates", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L229-L307
[ "def", "find_adsorption_sites", "(", "self", ",", "distance", "=", "2.0", ",", "put_inside", "=", "True", ",", "symm_reduce", "=", "1e-2", ",", "near_reduce", "=", "1e-2", ",", "positions", "=", "[", "'ontop'", ",", "'bridge'", ",", "'hollow'", "]", ",", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.symm_reduce
Reduces the set of adsorbate sites by finding removing symmetrically equivalent duplicates Args: coords_set: coordinate set in cartesian coordinates threshold: tolerance for distance equivalence, used as input to in_coord_list_pbc for dupl. checking
pymatgen/analysis/adsorption.py
def symm_reduce(self, coords_set, threshold=1e-6): """ Reduces the set of adsorbate sites by finding removing symmetrically equivalent duplicates Args: coords_set: coordinate set in cartesian coordinates threshold: tolerance for distance equivalence, used ...
def symm_reduce(self, coords_set, threshold=1e-6): """ Reduces the set of adsorbate sites by finding removing symmetrically equivalent duplicates Args: coords_set: coordinate set in cartesian coordinates threshold: tolerance for distance equivalence, used ...
[ "Reduces", "the", "set", "of", "adsorbate", "sites", "by", "finding", "removing", "symmetrically", "equivalent", "duplicates" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L309-L336
[ "def", "symm_reduce", "(", "self", ",", "coords_set", ",", "threshold", "=", "1e-6", ")", ":", "surf_sg", "=", "SpacegroupAnalyzer", "(", "self", ".", "slab", ",", "0.1", ")", "symm_ops", "=", "surf_sg", ".", "get_symmetry_operations", "(", ")", "unique_coor...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.near_reduce
Prunes coordinate set for coordinates that are within threshold Args: coords_set (Nx3 array-like): list or array of coordinates threshold (float): threshold value for distance
pymatgen/analysis/adsorption.py
def near_reduce(self, coords_set, threshold=1e-4): """ Prunes coordinate set for coordinates that are within threshold Args: coords_set (Nx3 array-like): list or array of coordinates threshold (float): threshold value for distance """ unique_coord...
def near_reduce(self, coords_set, threshold=1e-4): """ Prunes coordinate set for coordinates that are within threshold Args: coords_set (Nx3 array-like): list or array of coordinates threshold (float): threshold value for distance """ unique_coord...
[ "Prunes", "coordinate", "set", "for", "coordinates", "that", "are", "within", "threshold" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L338-L354
[ "def", "near_reduce", "(", "self", ",", "coords_set", ",", "threshold", "=", "1e-4", ")", ":", "unique_coords", "=", "[", "]", "coords_set", "=", "[", "self", ".", "slab", ".", "lattice", ".", "get_fractional_coords", "(", "coords", ")", "for", "coords", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.ensemble_center
Finds the center of an ensemble of sites selected from a list of sites. Helper method for the find_adsorption_sites algorithm. Args: site_list (list of sites): list of sites indices (list of ints): list of ints from which to select sites from site list ...
pymatgen/analysis/adsorption.py
def ensemble_center(self, site_list, indices, cartesian=True): """ Finds the center of an ensemble of sites selected from a list of sites. Helper method for the find_adsorption_sites algorithm. Args: site_list (list of sites): list of sites indices (list...
def ensemble_center(self, site_list, indices, cartesian=True): """ Finds the center of an ensemble of sites selected from a list of sites. Helper method for the find_adsorption_sites algorithm. Args: site_list (list of sites): list of sites indices (list...
[ "Finds", "the", "center", "of", "an", "ensemble", "of", "sites", "selected", "from", "a", "list", "of", "sites", ".", "Helper", "method", "for", "the", "find_adsorption_sites", "algorithm", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L356-L374
[ "def", "ensemble_center", "(", "self", ",", "site_list", ",", "indices", ",", "cartesian", "=", "True", ")", ":", "if", "cartesian", ":", "return", "np", ".", "average", "(", "[", "site_list", "[", "i", "]", ".", "coords", "for", "i", "in", "indices", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.add_adsorbate
Adds an adsorbate at a particular coordinate. Adsorbate represented by a Molecule object, and is positioned relative to the input adsorbate coordinate. Args: molecule (Molecule): molecule object representing the adsorbate ads_coord (array): coordinate of adsorbate posit...
pymatgen/analysis/adsorption.py
def add_adsorbate(self, molecule, ads_coord, repeat=None, reorient=True): """ Adds an adsorbate at a particular coordinate. Adsorbate represented by a Molecule object, and is positioned relative to the input adsorbate coordinate. Args: molecule (Molecule): molecule ...
def add_adsorbate(self, molecule, ads_coord, repeat=None, reorient=True): """ Adds an adsorbate at a particular coordinate. Adsorbate represented by a Molecule object, and is positioned relative to the input adsorbate coordinate. Args: molecule (Molecule): molecule ...
[ "Adds", "an", "adsorbate", "at", "a", "particular", "coordinate", ".", "Adsorbate", "represented", "by", "a", "Molecule", "object", "and", "is", "positioned", "relative", "to", "the", "input", "adsorbate", "coordinate", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L376-L406
[ "def", "add_adsorbate", "(", "self", ",", "molecule", ",", "ads_coord", ",", "repeat", "=", "None", ",", "reorient", "=", "True", ")", ":", "if", "reorient", ":", "# Reorient the molecule along slab m_index", "sop", "=", "get_rot", "(", "self", ".", "slab", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.assign_selective_dynamics
Helper function to assign selective dynamics site_properties based on surface, subsurface site properties Args: slab (Slab): slab for which to assign selective dynamics
pymatgen/analysis/adsorption.py
def assign_selective_dynamics(self, slab): """ Helper function to assign selective dynamics site_properties based on surface, subsurface site properties Args: slab (Slab): slab for which to assign selective dynamics """ sd_list = [] sd_list = [[False,...
def assign_selective_dynamics(self, slab): """ Helper function to assign selective dynamics site_properties based on surface, subsurface site properties Args: slab (Slab): slab for which to assign selective dynamics """ sd_list = [] sd_list = [[False,...
[ "Helper", "function", "to", "assign", "selective", "dynamics", "site_properties", "based", "on", "surface", "subsurface", "site", "properties" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L408-L421
[ "def", "assign_selective_dynamics", "(", "self", ",", "slab", ")", ":", "sd_list", "=", "[", "]", "sd_list", "=", "[", "[", "False", ",", "False", ",", "False", "]", "if", "site", ".", "properties", "[", "'surface_properties'", "]", "==", "'subsurface'", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.generate_adsorption_structures
Function that generates all adsorption structures for a given molecular adsorbate. Can take repeat argument or minimum length/width of precursor slab as an input Args: molecule (Molecule): molecule corresponding to adsorbate repeat (3-tuple or list): repeat argument for...
pymatgen/analysis/adsorption.py
def generate_adsorption_structures(self, molecule, repeat=None, min_lw=5.0, reorient=True, find_args={}): """ Function that generates all adsorption structures for a given molecular adsorbate. Can take repeat argument or minimum length/width of pre...
def generate_adsorption_structures(self, molecule, repeat=None, min_lw=5.0, reorient=True, find_args={}): """ Function that generates all adsorption structures for a given molecular adsorbate. Can take repeat argument or minimum length/width of pre...
[ "Function", "that", "generates", "all", "adsorption", "structures", "for", "a", "given", "molecular", "adsorbate", ".", "Can", "take", "repeat", "argument", "or", "minimum", "length", "/", "width", "of", "precursor", "slab", "as", "an", "input" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L423-L449
[ "def", "generate_adsorption_structures", "(", "self", ",", "molecule", ",", "repeat", "=", "None", ",", "min_lw", "=", "5.0", ",", "reorient", "=", "True", ",", "find_args", "=", "{", "}", ")", ":", "if", "repeat", "is", "None", ":", "xrep", "=", "np",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.adsorb_both_surfaces
Function that generates all adsorption structures for a given molecular adsorbate on both surfaces of a slab. This is useful for calculating surface energy where both surfaces need to be equivalent or if we want to calculate nonpolar systems. Args: molecule (Molecule): molec...
pymatgen/analysis/adsorption.py
def adsorb_both_surfaces(self, molecule, repeat=None, min_lw=5.0, reorient=True, find_args={}): """ Function that generates all adsorption structures for a given molecular adsorbate on both surfaces of a slab. This is useful for calculating surface energy whe...
def adsorb_both_surfaces(self, molecule, repeat=None, min_lw=5.0, reorient=True, find_args={}): """ Function that generates all adsorption structures for a given molecular adsorbate on both surfaces of a slab. This is useful for calculating surface energy whe...
[ "Function", "that", "generates", "all", "adsorption", "structures", "for", "a", "given", "molecular", "adsorbate", "on", "both", "surfaces", "of", "a", "slab", ".", "This", "is", "useful", "for", "calculating", "surface", "energy", "where", "both", "surfaces", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L451-L501
[ "def", "adsorb_both_surfaces", "(", "self", ",", "molecule", ",", "repeat", "=", "None", ",", "min_lw", "=", "5.0", ",", "reorient", "=", "True", ",", "find_args", "=", "{", "}", ")", ":", "# Get the adsorbed surfaces first", "adslabs", "=", "self", ".", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
AdsorbateSiteFinder.generate_substitution_structures
Function that performs substitution-type doping on the surface and returns all possible configurations where one dopant is substituted per surface. Can substitute one surface or both. Args: atom (str): atom corresponding to substitutional dopant sub_both_sides (b...
pymatgen/analysis/adsorption.py
def generate_substitution_structures(self, atom, target_species=[], sub_both_sides=False, range_tol=1e-2, dist_from_surf=0): """ Function that performs substitution-type doping on the surface and returns all po...
def generate_substitution_structures(self, atom, target_species=[], sub_both_sides=False, range_tol=1e-2, dist_from_surf=0): """ Function that performs substitution-type doping on the surface and returns all po...
[ "Function", "that", "performs", "substitution", "-", "type", "doping", "on", "the", "surface", "and", "returns", "all", "possible", "configurations", "where", "one", "dopant", "is", "substituted", "per", "surface", ".", "Can", "substitute", "one", "surface", "or...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/adsorption.py#L503-L564
[ "def", "generate_substitution_structures", "(", "self", ",", "atom", ",", "target_species", "=", "[", "]", ",", "sub_both_sides", "=", "False", ",", "range_tol", "=", "1e-2", ",", "dist_from_surf", "=", "0", ")", ":", "# Get symmetrized structure in case we want to ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
ExcitingInput.from_string
Reads the exciting input from a string
pymatgen/io/exciting/inputs.py
def from_string(data): """ Reads the exciting input from a string """ root=ET.fromstring(data) speciesnode=root.find('structure').iter('species') elements = [] positions = [] vectors=[] lockxyz=[] # get title title_in=str(ro...
def from_string(data): """ Reads the exciting input from a string """ root=ET.fromstring(data) speciesnode=root.find('structure').iter('species') elements = [] positions = [] vectors=[] lockxyz=[] # get title title_in=str(ro...
[ "Reads", "the", "exciting", "input", "from", "a", "string" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/exciting/inputs.py#L80-L152
[ "def", "from_string", "(", "data", ")", ":", "root", "=", "ET", ".", "fromstring", "(", "data", ")", "speciesnode", "=", "root", ".", "find", "(", "'structure'", ")", ".", "iter", "(", "'species'", ")", "elements", "=", "[", "]", "positions", "=", "[...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.types_of_specie
List of types of specie. Only works for ordered structures. Disordered structures will raise TypeError.
pymatgen/core/structure.py
def types_of_specie(self): """ List of types of specie. Only works for ordered structures. Disordered structures will raise TypeError. """ if not self.is_ordered: raise TypeError("""\ types_of_species cannot be used with disordered structures and partial occupancies. ...
def types_of_specie(self): """ List of types of specie. Only works for ordered structures. Disordered structures will raise TypeError. """ if not self.is_ordered: raise TypeError("""\ types_of_species cannot be used with disordered structures and partial occupancies. ...
[ "List", "of", "types", "of", "specie", ".", "Only", "works", "for", "ordered", "structures", ".", "Disordered", "structures", "will", "raise", "TypeError", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L116-L132
[ "def", "types_of_specie", "(", "self", ")", ":", "if", "not", "self", ".", "is_ordered", ":", "raise", "TypeError", "(", "\"\"\"\\\ntypes_of_species cannot be used with disordered structures and partial occupancies.\nUse OrderDisorderedStructureTransformation or EnumerateStructureTrans...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.group_by_types
Iterate over species grouped by type
pymatgen/core/structure.py
def group_by_types(self): """Iterate over species grouped by type""" for t in self.types_of_specie: for site in self: if site.specie == t: yield site
def group_by_types(self): """Iterate over species grouped by type""" for t in self.types_of_specie: for site in self: if site.specie == t: yield site
[ "Iterate", "over", "species", "grouped", "by", "type" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L134-L139
[ "def", "group_by_types", "(", "self", ")", ":", "for", "t", "in", "self", ".", "types_of_specie", ":", "for", "site", "in", "self", ":", "if", "site", ".", "specie", "==", "t", ":", "yield", "site" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.indices_from_symbol
Returns a tuple with the sequential indices of the sites that contain an element with the given chemical symbol.
pymatgen/core/structure.py
def indices_from_symbol(self, symbol: str) -> tuple: """ Returns a tuple with the sequential indices of the sites that contain an element with the given chemical symbol. """ return tuple((i for i, specie in enumerate(self.species) if specie.symbol == symbol)...
def indices_from_symbol(self, symbol: str) -> tuple: """ Returns a tuple with the sequential indices of the sites that contain an element with the given chemical symbol. """ return tuple((i for i, specie in enumerate(self.species) if specie.symbol == symbol)...
[ "Returns", "a", "tuple", "with", "the", "sequential", "indices", "of", "the", "sites", "that", "contain", "an", "element", "with", "the", "given", "chemical", "symbol", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L141-L147
[ "def", "indices_from_symbol", "(", "self", ",", "symbol", ":", "str", ")", "->", "tuple", ":", "return", "tuple", "(", "(", "i", "for", "i", ",", "specie", "in", "enumerate", "(", "self", ".", "species", ")", "if", "specie", ".", "symbol", "==", "sym...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.site_properties
Returns the site properties as a dict of sequences. E.g., {"magmom": (5,-5), "charge": (-4,4)}.
pymatgen/core/structure.py
def site_properties(self): """ Returns the site properties as a dict of sequences. E.g., {"magmom": (5,-5), "charge": (-4,4)}. """ props = {} prop_keys = set() for site in self: prop_keys.update(site.properties.keys()) for k in prop_keys: ...
def site_properties(self): """ Returns the site properties as a dict of sequences. E.g., {"magmom": (5,-5), "charge": (-4,4)}. """ props = {} prop_keys = set() for site in self: prop_keys.update(site.properties.keys()) for k in prop_keys: ...
[ "Returns", "the", "site", "properties", "as", "a", "dict", "of", "sequences", ".", "E", ".", "g", ".", "{", "magmom", ":", "(", "5", "-", "5", ")", "charge", ":", "(", "-", "4", "4", ")", "}", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L163-L175
[ "def", "site_properties", "(", "self", ")", ":", "props", "=", "{", "}", "prop_keys", "=", "set", "(", ")", "for", "site", "in", "self", ":", "prop_keys", ".", "update", "(", "site", ".", "properties", ".", "keys", "(", ")", ")", "for", "k", "in", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.composition
(Composition) Returns the composition
pymatgen/core/structure.py
def composition(self): """ (Composition) Returns the composition """ elmap = collections.defaultdict(float) for site in self: for species, occu in site.species.items(): elmap[species] += occu return Composition(elmap)
def composition(self): """ (Composition) Returns the composition """ elmap = collections.defaultdict(float) for site in self: for species, occu in site.species.items(): elmap[species] += occu return Composition(elmap)
[ "(", "Composition", ")", "Returns", "the", "composition" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L216-L224
[ "def", "composition", "(", "self", ")", ":", "elmap", "=", "collections", ".", "defaultdict", "(", "float", ")", "for", "site", "in", "self", ":", "for", "species", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")", ":", "elmap", "[",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.charge
Returns the net charge of the structure based on oxidation states. If Elements are found, a charge of 0 is assumed.
pymatgen/core/structure.py
def charge(self): """ Returns the net charge of the structure based on oxidation states. If Elements are found, a charge of 0 is assumed. """ charge = 0 for site in self: for specie, amt in site.species.items(): charge += getattr(specie, "oxi_s...
def charge(self): """ Returns the net charge of the structure based on oxidation states. If Elements are found, a charge of 0 is assumed. """ charge = 0 for site in self: for specie, amt in site.species.items(): charge += getattr(specie, "oxi_s...
[ "Returns", "the", "net", "charge", "of", "the", "structure", "based", "on", "oxidation", "states", ".", "If", "Elements", "are", "found", "a", "charge", "of", "0", "is", "assumed", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L227-L236
[ "def", "charge", "(", "self", ")", ":", "charge", "=", "0", "for", "site", "in", "self", ":", "for", "specie", ",", "amt", "in", "site", ".", "species", ".", "items", "(", ")", ":", "charge", "+=", "getattr", "(", "specie", ",", "\"oxi_state\"", ",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.get_angle
Returns angle specified by three sites. Args: i: Index of first site. j: Index of second site. k: Index of third site. Returns: Angle in degrees.
pymatgen/core/structure.py
def get_angle(self, i: int, j: int, k: int) -> float: """ Returns angle specified by three sites. Args: i: Index of first site. j: Index of second site. k: Index of third site. Returns: Angle in degrees. """ v1 = self[i].c...
def get_angle(self, i: int, j: int, k: int) -> float: """ Returns angle specified by three sites. Args: i: Index of first site. j: Index of second site. k: Index of third site. Returns: Angle in degrees. """ v1 = self[i].c...
[ "Returns", "angle", "specified", "by", "three", "sites", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L246-L260
[ "def", "get_angle", "(", "self", ",", "i", ":", "int", ",", "j", ":", "int", ",", "k", ":", "int", ")", "->", "float", ":", "v1", "=", "self", "[", "i", "]", ".", "coords", "-", "self", "[", "j", "]", ".", "coords", "v2", "=", "self", "[", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.get_dihedral
Returns dihedral angle specified by four sites. Args: i: Index of first site j: Index of second site k: Index of third site l: Index of fourth site Returns: Dihedral angle in degrees.
pymatgen/core/structure.py
def get_dihedral(self, i: int, j: int, k: int, l: int) -> float: """ Returns dihedral angle specified by four sites. Args: i: Index of first site j: Index of second site k: Index of third site l: Index of fourth site Returns: ...
def get_dihedral(self, i: int, j: int, k: int, l: int) -> float: """ Returns dihedral angle specified by four sites. Args: i: Index of first site j: Index of second site k: Index of third site l: Index of fourth site Returns: ...
[ "Returns", "dihedral", "angle", "specified", "by", "four", "sites", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L262-L281
[ "def", "get_dihedral", "(", "self", ",", "i", ":", "int", ",", "j", ":", "int", ",", "k", ":", "int", ",", "l", ":", "int", ")", "->", "float", ":", "v1", "=", "self", "[", "k", "]", ".", "coords", "-", "self", "[", "l", "]", ".", "coords",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.is_valid
True if SiteCollection does not contain atoms that are too close together. Note that the distance definition is based on type of SiteCollection. Cartesian distances are used for non-periodic Molecules, while PBC is taken into account for periodic structures. Args: tol (float...
pymatgen/core/structure.py
def is_valid(self, tol: float = DISTANCE_TOLERANCE) -> bool: """ True if SiteCollection does not contain atoms that are too close together. Note that the distance definition is based on type of SiteCollection. Cartesian distances are used for non-periodic Molecules, while PBC is ...
def is_valid(self, tol: float = DISTANCE_TOLERANCE) -> bool: """ True if SiteCollection does not contain atoms that are too close together. Note that the distance definition is based on type of SiteCollection. Cartesian distances are used for non-periodic Molecules, while PBC is ...
[ "True", "if", "SiteCollection", "does", "not", "contain", "atoms", "that", "are", "too", "close", "together", ".", "Note", "that", "the", "distance", "definition", "is", "based", "on", "type", "of", "SiteCollection", ".", "Cartesian", "distances", "are", "used...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L283-L300
[ "def", "is_valid", "(", "self", ",", "tol", ":", "float", "=", "DISTANCE_TOLERANCE", ")", "->", "bool", ":", "if", "len", "(", "self", ".", "sites", ")", "==", "1", ":", "return", "True", "all_dists", "=", "self", ".", "distance_matrix", "[", "np", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.add_site_property
Adds a property to a site. Args: property_name (str): The name of the property to add. values (list): A sequence of values. Must be same length as number of sites.
pymatgen/core/structure.py
def add_site_property(self, property_name, values): """ Adds a property to a site. Args: property_name (str): The name of the property to add. values (list): A sequence of values. Must be same length as number of sites. """ if len(values) ...
def add_site_property(self, property_name, values): """ Adds a property to a site. Args: property_name (str): The name of the property to add. values (list): A sequence of values. Must be same length as number of sites. """ if len(values) ...
[ "Adds", "a", "property", "to", "a", "site", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L326-L338
[ "def", "add_site_property", "(", "self", ",", "property_name", ",", "values", ")", ":", "if", "len", "(", "values", ")", "!=", "len", "(", "self", ".", "sites", ")", ":", "raise", "ValueError", "(", "\"Values must be same length as sites.\"", ")", "for", "si...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.replace_species
Swap species. Args: species_mapping (dict): dict of species to swap. Species can be elements too. E.g., {Element("Li"): Element("Na")} performs a Li for Na substitution. The second species can be a sp_and_occu dict. For example, a site with 0.5 Si tha...
pymatgen/core/structure.py
def replace_species(self, species_mapping): """ Swap species. Args: species_mapping (dict): dict of species to swap. Species can be elements too. E.g., {Element("Li"): Element("Na")} performs a Li for Na substitution. The second species can be a ...
def replace_species(self, species_mapping): """ Swap species. Args: species_mapping (dict): dict of species to swap. Species can be elements too. E.g., {Element("Li"): Element("Na")} performs a Li for Na substitution. The second species can be a ...
[ "Swap", "species", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L350-L383
[ "def", "replace_species", "(", "self", ",", "species_mapping", ")", ":", "species_mapping", "=", "{", "get_el_sp", "(", "k", ")", ":", "v", "for", "k", ",", "v", "in", "species_mapping", ".", "items", "(", ")", "}", "sp_to_replace", "=", "set", "(", "s...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.add_oxidation_state_by_element
Add oxidation states. Args: oxidation_states (dict): Dict of oxidation states. E.g., {"Li":1, "Fe":2, "P":5, "O":-2}
pymatgen/core/structure.py
def add_oxidation_state_by_element(self, oxidation_states): """ Add oxidation states. Args: oxidation_states (dict): Dict of oxidation states. E.g., {"Li":1, "Fe":2, "P":5, "O":-2} """ try: for site in self.sites: new_sp = ...
def add_oxidation_state_by_element(self, oxidation_states): """ Add oxidation states. Args: oxidation_states (dict): Dict of oxidation states. E.g., {"Li":1, "Fe":2, "P":5, "O":-2} """ try: for site in self.sites: new_sp = ...
[ "Add", "oxidation", "states", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L385-L402
[ "def", "add_oxidation_state_by_element", "(", "self", ",", "oxidation_states", ")", ":", "try", ":", "for", "site", "in", "self", ".", "sites", ":", "new_sp", "=", "{", "}", "for", "el", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.add_oxidation_state_by_site
Add oxidation states to a structure by site. Args: oxidation_states (list): List of oxidation states. E.g., [1, 1, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, -2, -2, -2, -2]
pymatgen/core/structure.py
def add_oxidation_state_by_site(self, oxidation_states): """ Add oxidation states to a structure by site. Args: oxidation_states (list): List of oxidation states. E.g., [1, 1, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, -2, -2, -2, -2] """ if len(oxidation_states) ...
def add_oxidation_state_by_site(self, oxidation_states): """ Add oxidation states to a structure by site. Args: oxidation_states (list): List of oxidation states. E.g., [1, 1, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, -2, -2, -2, -2] """ if len(oxidation_states) ...
[ "Add", "oxidation", "states", "to", "a", "structure", "by", "site", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L404-L420
[ "def", "add_oxidation_state_by_site", "(", "self", ",", "oxidation_states", ")", ":", "if", "len", "(", "oxidation_states", ")", "!=", "len", "(", "self", ".", "sites", ")", ":", "raise", "ValueError", "(", "\"Oxidation states of all sites must be \"", "\"specified....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.remove_oxidation_states
Removes oxidation states from a structure.
pymatgen/core/structure.py
def remove_oxidation_states(self): """ Removes oxidation states from a structure. """ for site in self.sites: new_sp = collections.defaultdict(float) for el, occu in site.species.items(): sym = el.symbol new_sp[Element(sym)] += occu...
def remove_oxidation_states(self): """ Removes oxidation states from a structure. """ for site in self.sites: new_sp = collections.defaultdict(float) for el, occu in site.species.items(): sym = el.symbol new_sp[Element(sym)] += occu...
[ "Removes", "oxidation", "states", "from", "a", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L422-L431
[ "def", "remove_oxidation_states", "(", "self", ")", ":", "for", "site", "in", "self", ".", "sites", ":", "new_sp", "=", "collections", ".", "defaultdict", "(", "float", ")", "for", "el", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.add_oxidation_state_by_guess
Decorates the structure with oxidation state, guessing using Composition.oxi_state_guesses() Args: **kwargs: parameters to pass into oxi_state_guesses()
pymatgen/core/structure.py
def add_oxidation_state_by_guess(self, **kwargs): """ Decorates the structure with oxidation state, guessing using Composition.oxi_state_guesses() Args: **kwargs: parameters to pass into oxi_state_guesses() """ oxid_guess = self.composition.oxi_state_guesses(...
def add_oxidation_state_by_guess(self, **kwargs): """ Decorates the structure with oxidation state, guessing using Composition.oxi_state_guesses() Args: **kwargs: parameters to pass into oxi_state_guesses() """ oxid_guess = self.composition.oxi_state_guesses(...
[ "Decorates", "the", "structure", "with", "oxidation", "state", "guessing", "using", "Composition", ".", "oxi_state_guesses", "()" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L433-L444
[ "def", "add_oxidation_state_by_guess", "(", "self", ",", "*", "*", "kwargs", ")", ":", "oxid_guess", "=", "self", ".", "composition", ".", "oxi_state_guesses", "(", "*", "*", "kwargs", ")", "oxid_guess", "=", "oxid_guess", "or", "[", "dict", "(", "[", "(",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.add_spin_by_element
Add spin states to a structure. Args: spisn (dict): Dict of spins associated with elements or species, e.g. {"Ni":+5} or {"Ni2+":5}
pymatgen/core/structure.py
def add_spin_by_element(self, spins): """ Add spin states to a structure. Args: spisn (dict): Dict of spins associated with elements or species, e.g. {"Ni":+5} or {"Ni2+":5} """ for site in self.sites: new_sp = {} for sp, occu in s...
def add_spin_by_element(self, spins): """ Add spin states to a structure. Args: spisn (dict): Dict of spins associated with elements or species, e.g. {"Ni":+5} or {"Ni2+":5} """ for site in self.sites: new_sp = {} for sp, occu in s...
[ "Add", "spin", "states", "to", "a", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L446-L461
[ "def", "add_spin_by_element", "(", "self", ",", "spins", ")", ":", "for", "site", "in", "self", ".", "sites", ":", "new_sp", "=", "{", "}", "for", "sp", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")", ":", "sym", "=", "sp", "."...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.add_spin_by_site
Add spin states to a structure by site. Args: spins (list): List of spins E.g., [+5, -5, 0, 0]
pymatgen/core/structure.py
def add_spin_by_site(self, spins): """ Add spin states to a structure by site. Args: spins (list): List of spins E.g., [+5, -5, 0, 0] """ if len(spins) != len(self.sites): raise ValueError("Spin of all sites must be " ...
def add_spin_by_site(self, spins): """ Add spin states to a structure by site. Args: spins (list): List of spins E.g., [+5, -5, 0, 0] """ if len(spins) != len(self.sites): raise ValueError("Spin of all sites must be " ...
[ "Add", "spin", "states", "to", "a", "structure", "by", "site", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L463-L482
[ "def", "add_spin_by_site", "(", "self", ",", "spins", ")", ":", "if", "len", "(", "spins", ")", "!=", "len", "(", "self", ".", "sites", ")", ":", "raise", "ValueError", "(", "\"Spin of all sites must be \"", "\"specified in the dictionary.\"", ")", "for", "sit...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
SiteCollection.remove_spin
Removes spin states from a structure.
pymatgen/core/structure.py
def remove_spin(self): """ Removes spin states from a structure. """ for site in self.sites: new_sp = collections.defaultdict(float) for sp, occu in site.species.items(): oxi_state = getattr(sp, "oxi_state", None) new_sp[Specie(sp.s...
def remove_spin(self): """ Removes spin states from a structure. """ for site in self.sites: new_sp = collections.defaultdict(float) for sp, occu in site.species.items(): oxi_state = getattr(sp, "oxi_state", None) new_sp[Specie(sp.s...
[ "Removes", "spin", "states", "from", "a", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L484-L493
[ "def", "remove_spin", "(", "self", ")", ":", "for", "site", "in", "self", ".", "sites", ":", "new_sp", "=", "collections", ".", "defaultdict", "(", "float", ")", "for", "sp", ",", "occu", "in", "site", ".", "species", ".", "items", "(", ")", ":", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da