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
SiteCollection.extract_cluster
Extracts a cluster of atoms based on bond lengths Args: target_sites ([Site]): List of initial sites to nucleate cluster. \\*\\*kwargs: kwargs passed through to CovalentBond.is_bonded. Returns: [Site/PeriodicSite] Cluster of atoms.
pymatgen/core/structure.py
def extract_cluster(self, target_sites, **kwargs): """ Extracts a cluster of atoms based on bond lengths Args: target_sites ([Site]): List of initial sites to nucleate cluster. \\*\\*kwargs: kwargs passed through to CovalentBond.is_bonded. Returns: [...
def extract_cluster(self, target_sites, **kwargs): """ Extracts a cluster of atoms based on bond lengths Args: target_sites ([Site]): List of initial sites to nucleate cluster. \\*\\*kwargs: kwargs passed through to CovalentBond.is_bonded. Returns: [...
[ "Extracts", "a", "cluster", "of", "atoms", "based", "on", "bond", "lengths" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L495-L520
[ "def", "extract_cluster", "(", "self", ",", "target_sites", ",", "*", "*", "kwargs", ")", ":", "cluster", "=", "list", "(", "target_sites", ")", "others", "=", "[", "site", "for", "site", "in", "self", "if", "site", "not", "in", "cluster", "]", "size",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.from_sites
Convenience constructor to make a Structure from a list of sites. Args: sites: Sequence of PeriodicSites. Sites must have the same lattice. validate_proximity (bool): Whether to check if there are sites that are less than 0.01 Ang apart. Defaults to False...
pymatgen/core/structure.py
def from_sites(cls, sites, charge=None, validate_proximity=False, to_unit_cell=False): """ Convenience constructor to make a Structure from a list of sites. Args: sites: Sequence of PeriodicSites. Sites must have the same lattice. valid...
def from_sites(cls, sites, charge=None, validate_proximity=False, to_unit_cell=False): """ Convenience constructor to make a Structure from a list of sites. Args: sites: Sequence of PeriodicSites. Sites must have the same lattice. valid...
[ "Convenience", "constructor", "to", "make", "a", "Structure", "from", "a", "list", "of", "sites", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L603-L644
[ "def", "from_sites", "(", "cls", ",", "sites", ",", "charge", "=", "None", ",", "validate_proximity", "=", "False", ",", "to_unit_cell", "=", "False", ")", ":", "if", "len", "(", "sites", ")", "<", "1", ":", "raise", "ValueError", "(", "\"You need at lea...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.from_spacegroup
Generate a structure using a spacegroup. Note that only symmetrically distinct species and coords should be provided. All equivalent sites are generated from the spacegroup operations. Args: sg (str/int): The spacegroup. If a string, it will be interpreted as one of ...
pymatgen/core/structure.py
def from_spacegroup(cls, sg, lattice, species, coords, site_properties=None, coords_are_cartesian=False, tol=1e-5): """ Generate a structure using a spacegroup. Note that only symmetrically distinct species and coords should be provided. All equivalent sites are g...
def from_spacegroup(cls, sg, lattice, species, coords, site_properties=None, coords_are_cartesian=False, tol=1e-5): """ Generate a structure using a spacegroup. Note that only symmetrically distinct species and coords should be provided. All equivalent sites are g...
[ "Generate", "a", "structure", "using", "a", "spacegroup", ".", "Note", "that", "only", "symmetrically", "distinct", "species", "and", "coords", "should", "be", "provided", ".", "All", "equivalent", "sites", "are", "generated", "from", "the", "spacegroup", "opera...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L647-L730
[ "def", "from_spacegroup", "(", "cls", ",", "sg", ",", "lattice", ",", "species", ",", "coords", ",", "site_properties", "=", "None", ",", "coords_are_cartesian", "=", "False", ",", "tol", "=", "1e-5", ")", ":", "from", "pymatgen", ".", "symmetry", ".", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.from_magnetic_spacegroup
Generate a structure using a magnetic spacegroup. Note that only symmetrically distinct species, coords and magmoms should be provided.] All equivalent sites are generated from the spacegroup operations. Args: msg (str/list/:class:`pymatgen.symmetry.maggroups.MagneticSpaceGroup`): ...
pymatgen/core/structure.py
def from_magnetic_spacegroup( cls, msg, lattice, species, coords, site_properties, transform_setting=None, coords_are_cartesian=False, tol=1e-5): """ Generate a structure using a magnetic spacegroup. Note that only symmetrically distinct species, coords and magmoms should...
def from_magnetic_spacegroup( cls, msg, lattice, species, coords, site_properties, transform_setting=None, coords_are_cartesian=False, tol=1e-5): """ Generate a structure using a magnetic spacegroup. Note that only symmetrically distinct species, coords and magmoms should...
[ "Generate", "a", "structure", "using", "a", "magnetic", "spacegroup", ".", "Note", "that", "only", "symmetrically", "distinct", "species", "coords", "and", "magmoms", "should", "be", "provided", ".", "]", "All", "equivalent", "sites", "are", "generated", "from",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L733-L834
[ "def", "from_magnetic_spacegroup", "(", "cls", ",", "msg", ",", "lattice", ",", "species", ",", "coords", ",", "site_properties", ",", "transform_setting", "=", "None", ",", "coords_are_cartesian", "=", "False", ",", "tol", "=", "1e-5", ")", ":", "from", "py...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.density
Returns the density in units of g/cc
pymatgen/core/structure.py
def density(self): """ Returns the density in units of g/cc """ m = Mass(self.composition.weight, "amu") return m.to("g") / (self.volume * Length(1, "ang").to("cm") ** 3)
def density(self): """ Returns the density in units of g/cc """ m = Mass(self.composition.weight, "amu") return m.to("g") / (self.volume * Length(1, "ang").to("cm") ** 3)
[ "Returns", "the", "density", "in", "units", "of", "g", "/", "cc" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L870-L875
[ "def", "density", "(", "self", ")", ":", "m", "=", "Mass", "(", "self", ".", "composition", ".", "weight", ",", "\"amu\"", ")", "return", "m", ".", "to", "(", "\"g\"", ")", "/", "(", "self", ".", "volume", "*", "Length", "(", "1", ",", "\"ang\"",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_space_group_info
Convenience method to quickly get the spacegroup of a structure. Args: symprec (float): Same definition as in SpacegroupAnalyzer. Defaults to 1e-2. angle_tolerance (float): Same definition as in SpacegroupAnalyzer. Defaults to 5 degrees. Returns:...
pymatgen/core/structure.py
def get_space_group_info(self, symprec=1e-2, angle_tolerance=5.0): """ Convenience method to quickly get the spacegroup of a structure. Args: symprec (float): Same definition as in SpacegroupAnalyzer. Defaults to 1e-2. angle_tolerance (float): Same defini...
def get_space_group_info(self, symprec=1e-2, angle_tolerance=5.0): """ Convenience method to quickly get the spacegroup of a structure. Args: symprec (float): Same definition as in SpacegroupAnalyzer. Defaults to 1e-2. angle_tolerance (float): Same defini...
[ "Convenience", "method", "to", "quickly", "get", "the", "spacegroup", "of", "a", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L877-L894
[ "def", "get_space_group_info", "(", "self", ",", "symprec", "=", "1e-2", ",", "angle_tolerance", "=", "5.0", ")", ":", "# Import within method needed to avoid cyclic dependency.", "from", "pymatgen", ".", "symmetry", ".", "analyzer", "import", "SpacegroupAnalyzer", "a",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.matches
Check whether this structure is similar to another structure. Basically a convenience method to call structure matching fitting. Args: other (IStructure/Structure): Another structure. **kwargs: Same **kwargs as in :class:`pymatgen.analysis.structure_matcher.Struc...
pymatgen/core/structure.py
def matches(self, other, **kwargs): """ Check whether this structure is similar to another structure. Basically a convenience method to call structure matching fitting. Args: other (IStructure/Structure): Another structure. **kwargs: Same **kwargs as in ...
def matches(self, other, **kwargs): """ Check whether this structure is similar to another structure. Basically a convenience method to call structure matching fitting. Args: other (IStructure/Structure): Another structure. **kwargs: Same **kwargs as in ...
[ "Check", "whether", "this", "structure", "is", "similar", "to", "another", "structure", ".", "Basically", "a", "convenience", "method", "to", "call", "structure", "matching", "fitting", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L896-L912
[ "def", "matches", "(", "self", ",", "other", ",", "*", "*", "kwargs", ")", ":", "from", "pymatgen", ".", "analysis", ".", "structure_matcher", "import", "StructureMatcher", "m", "=", "StructureMatcher", "(", "*", "*", "kwargs", ")", "return", "m", ".", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_distance
Get distance between site i and j assuming periodic boundary conditions. If the index jimage of two sites atom j is not specified it selects the jimage nearest to the i atom and returns the distance and jimage indices in terms of lattice vector translations if the index jimage of atom j ...
pymatgen/core/structure.py
def get_distance(self, i, j, jimage=None): """ Get distance between site i and j assuming periodic boundary conditions. If the index jimage of two sites atom j is not specified it selects the jimage nearest to the i atom and returns the distance and jimage indices in terms of lat...
def get_distance(self, i, j, jimage=None): """ Get distance between site i and j assuming periodic boundary conditions. If the index jimage of two sites atom j is not specified it selects the jimage nearest to the i atom and returns the distance and jimage indices in terms of lat...
[ "Get", "distance", "between", "site", "i", "and", "j", "assuming", "periodic", "boundary", "conditions", ".", "If", "the", "index", "jimage", "of", "two", "sites", "atom", "j", "is", "not", "specified", "it", "selects", "the", "jimage", "nearest", "to", "t...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1000-L1018
[ "def", "get_distance", "(", "self", ",", "i", ",", "j", ",", "jimage", "=", "None", ")", ":", "return", "self", "[", "i", "]", ".", "distance", "(", "self", "[", "j", "]", ",", "jimage", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_sites_in_sphere
Find all sites within a sphere from the point. This includes sites in other periodic images. Algorithm: 1. place sphere of radius r in crystal and determine minimum supercell (parallelpiped) which would contain a sphere of radius r. for this we need the projection of a_1 ...
pymatgen/core/structure.py
def get_sites_in_sphere(self, pt, r, include_index=False, include_image=False): """ Find all sites within a sphere from the point. This includes sites in other periodic images. Algorithm: 1. place sphere of radius r in crystal and determine minimum supercell (paralle...
def get_sites_in_sphere(self, pt, r, include_index=False, include_image=False): """ Find all sites within a sphere from the point. This includes sites in other periodic images. Algorithm: 1. place sphere of radius r in crystal and determine minimum supercell (paralle...
[ "Find", "all", "sites", "within", "a", "sphere", "from", "the", "point", ".", "This", "includes", "sites", "in", "other", "periodic", "images", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1020-L1062
[ "def", "get_sites_in_sphere", "(", "self", ",", "pt", ",", "r", ",", "include_index", "=", "False", ",", "include_image", "=", "False", ")", ":", "site_fcoords", "=", "np", ".", "mod", "(", "self", ".", "frac_coords", ",", "1", ")", "neighbors", "=", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_neighbors
Get all neighbors to a site within a sphere of radius r. Excludes the site itself. Args: site (Site): Which is the center of the sphere. r (float): Radius of sphere. include_index (bool): Whether the non-supercell site index is included in the return...
pymatgen/core/structure.py
def get_neighbors(self, site, r, include_index=False, include_image=False): """ Get all neighbors to a site within a sphere of radius r. Excludes the site itself. Args: site (Site): Which is the center of the sphere. r (float): Radius of sphere. incl...
def get_neighbors(self, site, r, include_index=False, include_image=False): """ Get all neighbors to a site within a sphere of radius r. Excludes the site itself. Args: site (Site): Which is the center of the sphere. r (float): Radius of sphere. incl...
[ "Get", "all", "neighbors", "to", "a", "site", "within", "a", "sphere", "of", "radius", "r", ".", "Excludes", "the", "site", "itself", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1064-L1088
[ "def", "get_neighbors", "(", "self", ",", "site", ",", "r", ",", "include_index", "=", "False", ",", "include_image", "=", "False", ")", ":", "nn", "=", "self", ".", "get_sites_in_sphere", "(", "site", ".", "coords", ",", "r", ",", "include_index", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_all_neighbors
Get neighbors for each atom in the unit cell, out to a distance r Returns a list of list of neighbors for each site in structure. Use this method if you are planning on looping over all sites in the crystal. If you only want neighbors for a particular site, use the method get_neighbors a...
pymatgen/core/structure.py
def get_all_neighbors(self, r, include_index=False, include_image=False): """ Get neighbors for each atom in the unit cell, out to a distance r Returns a list of list of neighbors for each site in structure. Use this method if you are planning on looping over all sites in the cry...
def get_all_neighbors(self, r, include_index=False, include_image=False): """ Get neighbors for each atom in the unit cell, out to a distance r Returns a list of list of neighbors for each site in structure. Use this method if you are planning on looping over all sites in the cry...
[ "Get", "neighbors", "for", "each", "atom", "in", "the", "unit", "cell", "out", "to", "a", "distance", "r", "Returns", "a", "list", "of", "list", "of", "neighbors", "for", "each", "site", "in", "structure", ".", "Use", "this", "method", "if", "you", "ar...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1090-L1157
[ "def", "get_all_neighbors", "(", "self", ",", "r", ",", "include_index", "=", "False", ",", "include_image", "=", "False", ")", ":", "# Use same algorithm as get_sites_in_sphere to determine supercell but", "# loop over all atoms in crystal", "recp_len", "=", "np", ".", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_neighbors_in_shell
Returns all sites in a shell centered on origin (coords) between radii r-dr and r+dr. Args: origin (3x1 array): Cartesian coordinates of center of sphere. r (float): Inner radius of shell. dr (float): Width of shell. include_index (bool): Whether to inclu...
pymatgen/core/structure.py
def get_neighbors_in_shell(self, origin, r, dr, include_index=False, include_image=False): """ Returns all sites in a shell centered on origin (coords) between radii r-dr and r+dr. Args: origin (3x1 array): Cartesian coordinates of center of sphere. r (float): In...
def get_neighbors_in_shell(self, origin, r, dr, include_index=False, include_image=False): """ Returns all sites in a shell centered on origin (coords) between radii r-dr and r+dr. Args: origin (3x1 array): Cartesian coordinates of center of sphere. r (float): In...
[ "Returns", "all", "sites", "in", "a", "shell", "centered", "on", "origin", "(", "coords", ")", "between", "radii", "r", "-", "dr", "and", "r", "+", "dr", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1159-L1186
[ "def", "get_neighbors_in_shell", "(", "self", ",", "origin", ",", "r", ",", "dr", ",", "include_index", "=", "False", ",", "include_image", "=", "False", ")", ":", "outer", "=", "self", ".", "get_sites_in_sphere", "(", "origin", ",", "r", "+", "dr", ",",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_sorted_structure
Get a sorted copy of the structure. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species. Args: key: Specifies a function of one argument that is used to extract a comparison key from each list ele...
pymatgen/core/structure.py
def get_sorted_structure(self, key=None, reverse=False): """ Get a sorted copy of the structure. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species. Args: key: Specifies a function of one argumen...
def get_sorted_structure(self, key=None, reverse=False): """ Get a sorted copy of the structure. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species. Args: key: Specifies a function of one argumen...
[ "Get", "a", "sorted", "copy", "of", "the", "structure", ".", "The", "parameters", "have", "the", "same", "meaning", "as", "in", "list", ".", "sort", ".", "By", "default", "sites", "are", "sorted", "by", "the", "electronegativity", "of", "the", "species", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1188-L1202
[ "def", "get_sorted_structure", "(", "self", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "sites", "=", "sorted", "(", "self", ",", "key", "=", "key", ",", "reverse", "=", "reverse", ")", "return", "self", ".", "__class__", ".", "f...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_reduced_structure
Get a reduced structure. Args: reduction_algo (str): The lattice reduction algorithm to use. Currently supported options are "niggli" or "LLL".
pymatgen/core/structure.py
def get_reduced_structure(self, reduction_algo="niggli"): """ Get a reduced structure. Args: reduction_algo (str): The lattice reduction algorithm to use. Currently supported options are "niggli" or "LLL". """ if reduction_algo == "niggli": ...
def get_reduced_structure(self, reduction_algo="niggli"): """ Get a reduced structure. Args: reduction_algo (str): The lattice reduction algorithm to use. Currently supported options are "niggli" or "LLL". """ if reduction_algo == "niggli": ...
[ "Get", "a", "reduced", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1204-L1226
[ "def", "get_reduced_structure", "(", "self", ",", "reduction_algo", "=", "\"niggli\"", ")", ":", "if", "reduction_algo", "==", "\"niggli\"", ":", "reduced_latt", "=", "self", ".", "_lattice", ".", "get_niggli_reduced_lattice", "(", ")", "elif", "reduction_algo", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.copy
Convenience method to get a copy of the structure, with options to add site properties. Args: site_properties (dict): Properties to add or override. The properties are specified in the same way as the constructor, i.e., as a dict of the form {property: [value...
pymatgen/core/structure.py
def copy(self, site_properties=None, sanitize=False): """ Convenience method to get a copy of the structure, with options to add site properties. Args: site_properties (dict): Properties to add or override. The properties are specified in the same way as the ...
def copy(self, site_properties=None, sanitize=False): """ Convenience method to get a copy of the structure, with options to add site properties. Args: site_properties (dict): Properties to add or override. The properties are specified in the same way as the ...
[ "Convenience", "method", "to", "get", "a", "copy", "of", "the", "structure", "with", "options", "to", "add", "site", "properties", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1228-L1272
[ "def", "copy", "(", "self", ",", "site_properties", "=", "None", ",", "sanitize", "=", "False", ")", ":", "props", "=", "self", ".", "site_properties", "if", "site_properties", ":", "props", ".", "update", "(", "site_properties", ")", "if", "not", "sanitiz...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.interpolate
Interpolate between this structure and end_structure. Useful for construction of NEB inputs. Args: end_structure (Structure): structure to interpolate between this structure and end. nimages (int): No. of interpolation images. Defaults to 10 images. i...
pymatgen/core/structure.py
def interpolate(self, end_structure, nimages=10, interpolate_lattices=False, pbc=True, autosort_tol=0): """ Interpolate between this structure and end_structure. Useful for construction of NEB inputs. Args: end_structure (Structure): structure to interpol...
def interpolate(self, end_structure, nimages=10, interpolate_lattices=False, pbc=True, autosort_tol=0): """ Interpolate between this structure and end_structure. Useful for construction of NEB inputs. Args: end_structure (Structure): structure to interpol...
[ "Interpolate", "between", "this", "structure", "and", "end_structure", ".", "Useful", "for", "construction", "of", "NEB", "inputs", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1274-L1375
[ "def", "interpolate", "(", "self", ",", "end_structure", ",", "nimages", "=", "10", ",", "interpolate_lattices", "=", "False", ",", "pbc", "=", "True", ",", "autosort_tol", "=", "0", ")", ":", "# Check length of structures", "if", "len", "(", "self", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_miller_index_from_site_indexes
Get the Miller index of a plane from a set of sites indexes. A minimum of 3 sites are required. If more than 3 sites are given the best plane that minimises the distance to all points will be calculated. Args: site_ids (list of int): A list of site indexes to consider. A ...
pymatgen/core/structure.py
def get_miller_index_from_site_indexes(self, site_ids, round_dp=4, verbose=True): """ Get the Miller index of a plane from a set of sites indexes. A minimum of 3 sites are required. If more than 3 sites are given the best plane that minimises t...
def get_miller_index_from_site_indexes(self, site_ids, round_dp=4, verbose=True): """ Get the Miller index of a plane from a set of sites indexes. A minimum of 3 sites are required. If more than 3 sites are given the best plane that minimises t...
[ "Get", "the", "Miller", "index", "of", "a", "plane", "from", "a", "set", "of", "sites", "indexes", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1377-L1400
[ "def", "get_miller_index_from_site_indexes", "(", "self", ",", "site_ids", ",", "round_dp", "=", "4", ",", "verbose", "=", "True", ")", ":", "return", "self", ".", "lattice", ".", "get_miller_index_from_coords", "(", "self", ".", "frac_coords", "[", "site_ids", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.get_primitive_structure
This finds a smaller unit cell than the input. Sometimes it doesn"t find the smallest possible one, so this method is recursively called until it is unable to find a smaller cell. NOTE: if the tolerance is greater than 1/2 the minimum inter-site distance in the primitive cell, the algor...
pymatgen/core/structure.py
def get_primitive_structure(self, tolerance=0.25, use_site_props=False, constrain_latt=None): """ This finds a smaller unit cell than the input. Sometimes it doesn"t find the smallest possible one, so this method is recursively called until it is unable to...
def get_primitive_structure(self, tolerance=0.25, use_site_props=False, constrain_latt=None): """ This finds a smaller unit cell than the input. Sometimes it doesn"t find the smallest possible one, so this method is recursively called until it is unable to...
[ "This", "finds", "a", "smaller", "unit", "cell", "than", "the", "input", ".", "Sometimes", "it", "doesn", "t", "find", "the", "smallest", "possible", "one", "so", "this", "method", "is", "recursively", "called", "until", "it", "is", "unable", "to", "find",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1402-L1602
[ "def", "get_primitive_structure", "(", "self", ",", "tolerance", "=", "0.25", ",", "use_site_props", "=", "False", ",", "constrain_latt", "=", "None", ")", ":", "if", "constrain_latt", "is", "None", ":", "constrain_latt", "=", "[", "]", "def", "site_label", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.as_dict
Dict representation of Structure. Args: verbosity (int): Verbosity level. Default of 1 includes both direct and cartesian coordinates for all sites, lattice parameters, etc. Useful for reading and for insertion into a database. Set to 0 for an extreme...
pymatgen/core/structure.py
def as_dict(self, verbosity=1, fmt=None, **kwargs): """ Dict representation of Structure. Args: verbosity (int): Verbosity level. Default of 1 includes both direct and cartesian coordinates for all sites, lattice parameters, etc. Useful for reading an...
def as_dict(self, verbosity=1, fmt=None, **kwargs): """ Dict representation of Structure. Args: verbosity (int): Verbosity level. Default of 1 includes both direct and cartesian coordinates for all sites, lattice parameters, etc. Useful for reading an...
[ "Dict", "representation", "of", "Structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1644-L1683
[ "def", "as_dict", "(", "self", ",", "verbosity", "=", "1", ",", "fmt", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "fmt", "==", "\"abivars\"", ":", "\"\"\"Returns a dictionary with the ABINIT variables.\"\"\"", "from", "pymatgen", ".", "io", ".", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.from_dict
Reconstitute a Structure object from a dict representation of Structure created using as_dict(). Args: d (dict): Dict representation of structure. Returns: Structure object
pymatgen/core/structure.py
def from_dict(cls, d, fmt=None): """ Reconstitute a Structure object from a dict representation of Structure created using as_dict(). Args: d (dict): Dict representation of structure. Returns: Structure object """ if fmt == "abivars": ...
def from_dict(cls, d, fmt=None): """ Reconstitute a Structure object from a dict representation of Structure created using as_dict(). Args: d (dict): Dict representation of structure. Returns: Structure object """ if fmt == "abivars": ...
[ "Reconstitute", "a", "Structure", "object", "from", "a", "dict", "representation", "of", "Structure", "created", "using", "as_dict", "()", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1686-L1704
[ "def", "from_dict", "(", "cls", ",", "d", ",", "fmt", "=", "None", ")", ":", "if", "fmt", "==", "\"abivars\"", ":", "from", "pymatgen", ".", "io", ".", "abinit", ".", "abiobjects", "import", "structure_from_abivars", "return", "structure_from_abivars", "(", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.to
Outputs the structure to a file or string. Args: fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options include "cif", "poscar", "cssr", "json". Non-case sensit...
pymatgen/core/structure.py
def to(self, fmt=None, filename=None, **kwargs): """ Outputs the structure to a file or string. Args: fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options inc...
def to(self, fmt=None, filename=None, **kwargs): """ Outputs the structure to a file or string. Args: fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options inc...
[ "Outputs", "the", "structure", "to", "a", "file", "or", "string", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1706-L1775
[ "def", "to", "(", "self", ",", "fmt", "=", "None", ",", "filename", "=", "None", ",", "*", "*", "kwargs", ")", ":", "filename", "=", "filename", "or", "\"\"", "fmt", "=", "\"\"", "if", "fmt", "is", "None", "else", "fmt", ".", "lower", "(", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.from_str
Reads a structure from a string. Args: input_string (str): String to parse. fmt (str): A format specification. primitive (bool): Whether to find a primitive cell. Defaults to False. sort (bool): Whether to sort the sites in accordance to the defau...
pymatgen/core/structure.py
def from_str(cls, input_string, fmt, primitive=False, sort=False, merge_tol=0.0): """ Reads a structure from a string. Args: input_string (str): String to parse. fmt (str): A format specification. primitive (bool): Whether to find a primitive...
def from_str(cls, input_string, fmt, primitive=False, sort=False, merge_tol=0.0): """ Reads a structure from a string. Args: input_string (str): String to parse. fmt (str): A format specification. primitive (bool): Whether to find a primitive...
[ "Reads", "a", "structure", "from", "a", "string", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1778-L1830
[ "def", "from_str", "(", "cls", ",", "input_string", ",", "fmt", ",", "primitive", "=", "False", ",", "sort", "=", "False", ",", "merge_tol", "=", "0.0", ")", ":", "from", "pymatgen", ".", "io", ".", "cif", "import", "CifParser", "from", "pymatgen", "."...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IStructure.from_file
Reads a structure from a file. For example, anything ending in a "cif" is assumed to be a Crystallographic Information Format file. Supported formats include CIF, POSCAR/CONTCAR, CHGCAR, LOCPOT, vasprun.xml, CSSR, Netcdf and pymatgen's JSON serialized structures. Args: filen...
pymatgen/core/structure.py
def from_file(cls, filename, primitive=False, sort=False, merge_tol=0.0): """ Reads a structure from a file. For example, anything ending in a "cif" is assumed to be a Crystallographic Information Format file. Supported formats include CIF, POSCAR/CONTCAR, CHGCAR, LOCPOT, vasprun...
def from_file(cls, filename, primitive=False, sort=False, merge_tol=0.0): """ Reads a structure from a file. For example, anything ending in a "cif" is assumed to be a Crystallographic Information Format file. Supported formats include CIF, POSCAR/CONTCAR, CHGCAR, LOCPOT, vasprun...
[ "Reads", "a", "structure", "from", "a", "file", ".", "For", "example", "anything", "ending", "in", "a", "cif", "is", "assumed", "to", "be", "a", "Crystallographic", "Information", "Format", "file", ".", "Supported", "formats", "include", "CIF", "POSCAR", "/"...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1833-L1915
[ "def", "from_file", "(", "cls", ",", "filename", ",", "primitive", "=", "False", ",", "sort", "=", "False", ",", "merge_tol", "=", "0.0", ")", ":", "filename", "=", "str", "(", "filename", ")", "if", "filename", ".", "endswith", "(", "\".nc\"", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.center_of_mass
Center of mass of molecule.
pymatgen/core/structure.py
def center_of_mass(self): """ Center of mass of molecule. """ center = np.zeros(3) total_weight = 0 for site in self: wt = site.species.weight center += site.coords * wt total_weight += wt return center / total_weight
def center_of_mass(self): """ Center of mass of molecule. """ center = np.zeros(3) total_weight = 0 for site in self: wt = site.species.weight center += site.coords * wt total_weight += wt return center / total_weight
[ "Center", "of", "mass", "of", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2012-L2022
[ "def", "center_of_mass", "(", "self", ")", ":", "center", "=", "np", ".", "zeros", "(", "3", ")", "total_weight", "=", "0", "for", "site", "in", "self", ":", "wt", "=", "site", ".", "species", ".", "weight", "center", "+=", "site", ".", "coords", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.from_sites
Convenience constructor to make a Molecule from a list of sites. Args: sites ([Site]): Sequence of Sites. charge (int): Charge of molecule. Defaults to 0. spin_multiplicity (int): Spin multicipity. Defaults to None, in which it is determined automatically. ...
pymatgen/core/structure.py
def from_sites(cls, sites, charge=0, spin_multiplicity=None, validate_proximity=False): """ Convenience constructor to make a Molecule from a list of sites. Args: sites ([Site]): Sequence of Sites. charge (int): Charge of molecule. Defaults to 0. ...
def from_sites(cls, sites, charge=0, spin_multiplicity=None, validate_proximity=False): """ Convenience constructor to make a Molecule from a list of sites. Args: sites ([Site]): Sequence of Sites. charge (int): Charge of molecule. Defaults to 0. ...
[ "Convenience", "constructor", "to", "make", "a", "Molecule", "from", "a", "list", "of", "sites", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2032-L2053
[ "def", "from_sites", "(", "cls", ",", "sites", ",", "charge", "=", "0", ",", "spin_multiplicity", "=", "None", ",", "validate_proximity", "=", "False", ")", ":", "props", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "site", "in", "sit...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.break_bond
Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Basically, the code checks if the distance between...
pymatgen/core/structure.py
def break_bond(self, ind1, ind2, tol=0.2): """ Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Bas...
def break_bond(self, ind1, ind2, tol=0.2): """ Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Bas...
[ "Returns", "two", "molecules", "based", "on", "breaking", "the", "bond", "between", "atoms", "at", "index", "ind1", "and", "ind2", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2055-L2098
[ "def", "break_bond", "(", "self", ",", "ind1", ",", "ind2", ",", "tol", "=", "0.2", ")", ":", "sites", "=", "self", ".", "_sites", "clusters", "=", "[", "[", "sites", "[", "ind1", "]", "]", ",", "[", "sites", "[", "ind2", "]", "]", "]", "sites"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.get_covalent_bonds
Determines the covalent bonds in a molecule. Args: tol (float): The tol to determine bonds in a structure. See CovalentBond.is_bonded. Returns: List of bonds
pymatgen/core/structure.py
def get_covalent_bonds(self, tol=0.2): """ Determines the covalent bonds in a molecule. Args: tol (float): The tol to determine bonds in a structure. See CovalentBond.is_bonded. Returns: List of bonds """ bonds = [] for si...
def get_covalent_bonds(self, tol=0.2): """ Determines the covalent bonds in a molecule. Args: tol (float): The tol to determine bonds in a structure. See CovalentBond.is_bonded. Returns: List of bonds """ bonds = [] for si...
[ "Determines", "the", "covalent", "bonds", "in", "a", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2100-L2115
[ "def", "get_covalent_bonds", "(", "self", ",", "tol", "=", "0.2", ")", ":", "bonds", "=", "[", "]", "for", "site1", ",", "site2", "in", "itertools", ".", "combinations", "(", "self", ".", "_sites", ",", "2", ")", ":", "if", "CovalentBond", ".", "is_b...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.as_dict
Json-serializable dict representation of Molecule
pymatgen/core/structure.py
def as_dict(self): """ Json-serializable dict representation of Molecule """ d = {"@module": self.__class__.__module__, "@class": self.__class__.__name__, "charge": self._charge, "spin_multiplicity": self._spin_multiplicity, "sites": []...
def as_dict(self): """ Json-serializable dict representation of Molecule """ d = {"@module": self.__class__.__module__, "@class": self.__class__.__name__, "charge": self._charge, "spin_multiplicity": self._spin_multiplicity, "sites": []...
[ "Json", "-", "serializable", "dict", "representation", "of", "Molecule" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2156-L2170
[ "def", "as_dict", "(", "self", ")", ":", "d", "=", "{", "\"@module\"", ":", "self", ".", "__class__", ".", "__module__", ",", "\"@class\"", ":", "self", ".", "__class__", ".", "__name__", ",", "\"charge\"", ":", "self", ".", "_charge", ",", "\"spin_multi...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.from_dict
Reconstitute a Molecule object from a dict representation created using as_dict(). Args: d (dict): dict representation of Molecule. Returns: Molecule object
pymatgen/core/structure.py
def from_dict(cls, d): """ Reconstitute a Molecule object from a dict representation created using as_dict(). Args: d (dict): dict representation of Molecule. Returns: Molecule object """ sites = [Site.from_dict(sd) for sd in d["sites"]] ...
def from_dict(cls, d): """ Reconstitute a Molecule object from a dict representation created using as_dict(). Args: d (dict): dict representation of Molecule. Returns: Molecule object """ sites = [Site.from_dict(sd) for sd in d["sites"]] ...
[ "Reconstitute", "a", "Molecule", "object", "from", "a", "dict", "representation", "created", "using", "as_dict", "()", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2173-L2187
[ "def", "from_dict", "(", "cls", ",", "d", ")", ":", "sites", "=", "[", "Site", ".", "from_dict", "(", "sd", ")", "for", "sd", "in", "d", "[", "\"sites\"", "]", "]", "charge", "=", "d", ".", "get", "(", "\"charge\"", ",", "0", ")", "spin_multiplic...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.get_sites_in_sphere
Find all sites within a sphere from a point. Args: pt (3x1 array): Cartesian coordinates of center of sphere. r (float): Radius of sphere. Returns: [(site, dist) ...] since most of the time, subsequent processing requires the distance.
pymatgen/core/structure.py
def get_sites_in_sphere(self, pt, r): """ Find all sites within a sphere from a point. Args: pt (3x1 array): Cartesian coordinates of center of sphere. r (float): Radius of sphere. Returns: [(site, dist) ...] since most of the time, subsequent proces...
def get_sites_in_sphere(self, pt, r): """ Find all sites within a sphere from a point. Args: pt (3x1 array): Cartesian coordinates of center of sphere. r (float): Radius of sphere. Returns: [(site, dist) ...] since most of the time, subsequent proces...
[ "Find", "all", "sites", "within", "a", "sphere", "from", "a", "point", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2202-L2219
[ "def", "get_sites_in_sphere", "(", "self", ",", "pt", ",", "r", ")", ":", "neighbors", "=", "[", "]", "for", "site", "in", "self", ".", "_sites", ":", "dist", "=", "site", ".", "distance_from_point", "(", "pt", ")", "if", "dist", "<=", "r", ":", "n...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.get_neighbors
Get all neighbors to a site within a sphere of radius r. Excludes the site itself. Args: site (Site): Site at the center of the sphere. r (float): Radius of sphere. Returns: [(site, dist) ...] since most of the time, subsequent processing requir...
pymatgen/core/structure.py
def get_neighbors(self, site, r): """ Get all neighbors to a site within a sphere of radius r. Excludes the site itself. Args: site (Site): Site at the center of the sphere. r (float): Radius of sphere. Returns: [(site, dist) ...] since most...
def get_neighbors(self, site, r): """ Get all neighbors to a site within a sphere of radius r. Excludes the site itself. Args: site (Site): Site at the center of the sphere. r (float): Radius of sphere. Returns: [(site, dist) ...] since most...
[ "Get", "all", "neighbors", "to", "a", "site", "within", "a", "sphere", "of", "radius", "r", ".", "Excludes", "the", "site", "itself", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2221-L2235
[ "def", "get_neighbors", "(", "self", ",", "site", ",", "r", ")", ":", "nn", "=", "self", ".", "get_sites_in_sphere", "(", "site", ".", "coords", ",", "r", ")", "return", "[", "(", "s", ",", "dist", ")", "for", "(", "s", ",", "dist", ")", "in", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.get_neighbors_in_shell
Returns all sites in a shell centered on origin (coords) between radii r-dr and r+dr. Args: origin (3x1 array): Cartesian coordinates of center of sphere. r (float): Inner radius of shell. dr (float): Width of shell. Returns: [(site, dist) ...] s...
pymatgen/core/structure.py
def get_neighbors_in_shell(self, origin, r, dr): """ Returns all sites in a shell centered on origin (coords) between radii r-dr and r+dr. Args: origin (3x1 array): Cartesian coordinates of center of sphere. r (float): Inner radius of shell. dr (float...
def get_neighbors_in_shell(self, origin, r, dr): """ Returns all sites in a shell centered on origin (coords) between radii r-dr and r+dr. Args: origin (3x1 array): Cartesian coordinates of center of sphere. r (float): Inner radius of shell. dr (float...
[ "Returns", "all", "sites", "in", "a", "shell", "centered", "on", "origin", "(", "coords", ")", "between", "radii", "r", "-", "dr", "and", "r", "+", "dr", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2237-L2253
[ "def", "get_neighbors_in_shell", "(", "self", ",", "origin", ",", "r", ",", "dr", ")", ":", "outer", "=", "self", ".", "get_sites_in_sphere", "(", "origin", ",", "r", "+", "dr", ")", "inner", "=", "r", "-", "dr", "return", "[", "(", "site", ",", "d...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.get_boxed_structure
Creates a Structure from a Molecule by putting the Molecule in the center of a orthorhombic box. Useful for creating Structure for calculating molecules using periodic codes. Args: a (float): a-lattice parameter. b (float): b-lattice parameter. c (float): c-l...
pymatgen/core/structure.py
def get_boxed_structure(self, a, b, c, images=(1, 1, 1), random_rotation=False, min_dist=1, cls=None, offset=None, no_cross=False): """ Creates a Structure from a Molecule by putting the Molecule in the center of a orthorhombic box. Useful ...
def get_boxed_structure(self, a, b, c, images=(1, 1, 1), random_rotation=False, min_dist=1, cls=None, offset=None, no_cross=False): """ Creates a Structure from a Molecule by putting the Molecule in the center of a orthorhombic box. Useful ...
[ "Creates", "a", "Structure", "from", "a", "Molecule", "by", "putting", "the", "Molecule", "in", "the", "center", "of", "a", "orthorhombic", "box", ".", "Useful", "for", "creating", "Structure", "for", "calculating", "molecules", "using", "periodic", "codes", "...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2255-L2344
[ "def", "get_boxed_structure", "(", "self", ",", "a", ",", "b", ",", "c", ",", "images", "=", "(", "1", ",", "1", ",", "1", ")", ",", "random_rotation", "=", "False", ",", "min_dist", "=", "1", ",", "cls", "=", "None", ",", "offset", "=", "None", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.get_centered_molecule
Returns a Molecule centered at the center of mass. Returns: Molecule centered with center of mass at origin.
pymatgen/core/structure.py
def get_centered_molecule(self): """ Returns a Molecule centered at the center of mass. Returns: Molecule centered with center of mass at origin. """ center = self.center_of_mass new_coords = np.array(self.cart_coords) - center return self.__class__(s...
def get_centered_molecule(self): """ Returns a Molecule centered at the center of mass. Returns: Molecule centered with center of mass at origin. """ center = self.center_of_mass new_coords = np.array(self.cart_coords) - center return self.__class__(s...
[ "Returns", "a", "Molecule", "centered", "at", "the", "center", "of", "mass", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2346-L2358
[ "def", "get_centered_molecule", "(", "self", ")", ":", "center", "=", "self", ".", "center_of_mass", "new_coords", "=", "np", ".", "array", "(", "self", ".", "cart_coords", ")", "-", "center", "return", "self", ".", "__class__", "(", "self", ".", "species_...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.to
Outputs the molecule to a file or string. Args: fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options include "xyz", "gjf", "g03", "json". If you have OpenBabe...
pymatgen/core/structure.py
def to(self, fmt=None, filename=None): """ Outputs the molecule to a file or string. Args: fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options include "xyz",...
def to(self, fmt=None, filename=None): """ Outputs the molecule to a file or string. Args: fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options include "xyz",...
[ "Outputs", "the", "molecule", "to", "a", "file", "or", "string", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2360-L2415
[ "def", "to", "(", "self", ",", "fmt", "=", "None", ",", "filename", "=", "None", ")", ":", "from", "pymatgen", ".", "io", ".", "xyz", "import", "XYZ", "from", "pymatgen", ".", "io", ".", "gaussian", "import", "GaussianInput", "from", "pymatgen", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.from_str
Reads the molecule from a string. Args: input_string (str): String to parse. fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the filename is. Options include "xyz", "gjf", "g03", "js...
pymatgen/core/structure.py
def from_str(cls, input_string, fmt): """ Reads the molecule from a string. Args: input_string (str): String to parse. fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the ...
def from_str(cls, input_string, fmt): """ Reads the molecule from a string. Args: input_string (str): String to parse. fmt (str): Format to output to. Defaults to JSON unless filename is provided. If fmt is specifies, it overrides whatever the ...
[ "Reads", "the", "molecule", "from", "a", "string", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2418-L2450
[ "def", "from_str", "(", "cls", ",", "input_string", ",", "fmt", ")", ":", "from", "pymatgen", ".", "io", ".", "xyz", "import", "XYZ", "from", "pymatgen", ".", "io", ".", "gaussian", "import", "GaussianInput", "if", "fmt", ".", "lower", "(", ")", "==", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
IMolecule.from_file
Reads a molecule from a file. Supported formats include xyz, gaussian input (gjf|g03|g09|com|inp), Gaussian output (.out|and pymatgen's JSON serialized molecules. Using openbabel, many more extensions are supported but requires openbabel to be installed. Args: filena...
pymatgen/core/structure.py
def from_file(cls, filename): """ Reads a molecule from a file. Supported formats include xyz, gaussian input (gjf|g03|g09|com|inp), Gaussian output (.out|and pymatgen's JSON serialized molecules. Using openbabel, many more extensions are supported but requires openbabel to be ...
def from_file(cls, filename): """ Reads a molecule from a file. Supported formats include xyz, gaussian input (gjf|g03|g09|com|inp), Gaussian output (.out|and pymatgen's JSON serialized molecules. Using openbabel, many more extensions are supported but requires openbabel to be ...
[ "Reads", "a", "molecule", "from", "a", "file", ".", "Supported", "formats", "include", "xyz", "gaussian", "input", "(", "gjf|g03|g09|com|inp", ")", "Gaussian", "output", "(", ".", "out|and", "pymatgen", "s", "JSON", "serialized", "molecules", ".", "Using", "op...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2453-L2494
[ "def", "from_file", "(", "cls", ",", "filename", ")", ":", "filename", "=", "str", "(", "filename", ")", "from", "pymatgen", ".", "io", ".", "gaussian", "import", "GaussianOutput", "with", "zopen", "(", "filename", ")", "as", "f", ":", "contents", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.append
Append a site to the structure. Args: species: Species of inserted site coords (3x1 array): Coordinates of inserted site coords_are_cartesian (bool): Whether coordinates are cartesian. Defaults to False. validate_proximity (bool): Whether to check...
pymatgen/core/structure.py
def append(self, species, coords, coords_are_cartesian=False, validate_proximity=False, properties=None): """ Append a site to the structure. Args: species: Species of inserted site coords (3x1 array): Coordinates of inserted site coords_are_ca...
def append(self, species, coords, coords_are_cartesian=False, validate_proximity=False, properties=None): """ Append a site to the structure. Args: species: Species of inserted site coords (3x1 array): Coordinates of inserted site coords_are_ca...
[ "Append", "a", "site", "to", "the", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2636-L2656
[ "def", "append", "(", "self", ",", "species", ",", "coords", ",", "coords_are_cartesian", "=", "False", ",", "validate_proximity", "=", "False", ",", "properties", "=", "None", ")", ":", "return", "self", ".", "insert", "(", "len", "(", "self", ")", ",",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.insert
Insert a site to the structure. Args: i (int): Index to insert site species (species-like): Species of inserted site coords (3x1 array): Coordinates of inserted site coords_are_cartesian (bool): Whether coordinates are cartesian. Defaults to False...
pymatgen/core/structure.py
def insert(self, i, species, coords, coords_are_cartesian=False, validate_proximity=False, properties=None): """ Insert a site to the structure. Args: i (int): Index to insert site species (species-like): Species of inserted site coords (3x1 ar...
def insert(self, i, species, coords, coords_are_cartesian=False, validate_proximity=False, properties=None): """ Insert a site to the structure. Args: i (int): Index to insert site species (species-like): Species of inserted site coords (3x1 ar...
[ "Insert", "a", "site", "to", "the", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2658-L2690
[ "def", "insert", "(", "self", ",", "i", ",", "species", ",", "coords", ",", "coords_are_cartesian", "=", "False", ",", "validate_proximity", "=", "False", ",", "properties", "=", "None", ")", ":", "if", "not", "coords_are_cartesian", ":", "new_site", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.replace
Replace a single site. Takes either a species or a dict of species and occupations. Args: i (int): Index of the site in the _sites list. species (species-like): Species of replacement site coords (3x1 array): Coordinates of replacement site. If None, ...
pymatgen/core/structure.py
def replace(self, i, species, coords=None, coords_are_cartesian=False, properties=None): """ Replace a single site. Takes either a species or a dict of species and occupations. Args: i (int): Index of the site in the _sites list. species (species-...
def replace(self, i, species, coords=None, coords_are_cartesian=False, properties=None): """ Replace a single site. Takes either a species or a dict of species and occupations. Args: i (int): Index of the site in the _sites list. species (species-...
[ "Replace", "a", "single", "site", ".", "Takes", "either", "a", "species", "or", "a", "dict", "of", "species", "and", "occupations", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2692-L2716
[ "def", "replace", "(", "self", ",", "i", ",", "species", ",", "coords", "=", "None", ",", "coords_are_cartesian", "=", "False", ",", "properties", "=", "None", ")", ":", "if", "coords", "is", "None", ":", "frac_coords", "=", "self", "[", "i", "]", "....
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.substitute
Substitute atom at index with a functional group. Args: index (int): Index of atom to substitute. func_grp: Substituent molecule. There are two options: 1. Providing an actual Molecule as the input. The first atom must be a DummySpecie X, indicating t...
pymatgen/core/structure.py
def substitute(self, index, func_grp, bond_order=1): """ Substitute atom at index with a functional group. Args: index (int): Index of atom to substitute. func_grp: Substituent molecule. There are two options: 1. Providing an actual Molecule as the input...
def substitute(self, index, func_grp, bond_order=1): """ Substitute atom at index with a functional group. Args: index (int): Index of atom to substitute. func_grp: Substituent molecule. There are two options: 1. Providing an actual Molecule as the input...
[ "Substitute", "atom", "at", "index", "with", "a", "functional", "group", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2718-L2819
[ "def", "substitute", "(", "self", ",", "index", ",", "func_grp", ",", "bond_order", "=", "1", ")", ":", "# Find the nearest neighbor that is not a terminal atom.", "all_non_terminal_nn", "=", "[", "]", "for", "nn", ",", "dist", "in", "self", ".", "get_neighbors", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.remove_species
Remove all occurrences of several species from a structure. Args: species: Sequence of species to remove, e.g., ["Li", "Na"].
pymatgen/core/structure.py
def remove_species(self, species): """ Remove all occurrences of several species from a structure. Args: species: Sequence of species to remove, e.g., ["Li", "Na"]. """ new_sites = [] species = [get_el_sp(s) for s in species] for site in self._sites:...
def remove_species(self, species): """ Remove all occurrences of several species from a structure. Args: species: Sequence of species to remove, e.g., ["Li", "Na"]. """ new_sites = [] species = [get_el_sp(s) for s in species] for site in self._sites:...
[ "Remove", "all", "occurrences", "of", "several", "species", "from", "a", "structure", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2821-L2838
[ "def", "remove_species", "(", "self", ",", "species", ")", ":", "new_sites", "=", "[", "]", "species", "=", "[", "get_el_sp", "(", "s", ")", "for", "s", "in", "species", "]", "for", "site", "in", "self", ".", "_sites", ":", "new_sp_occu", "=", "{", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.remove_sites
Delete sites with at indices. Args: indices: Sequence of indices of sites to delete.
pymatgen/core/structure.py
def remove_sites(self, indices): """ Delete sites with at indices. Args: indices: Sequence of indices of sites to delete. """ self._sites = [s for i, s in enumerate(self._sites) if i not in indices]
def remove_sites(self, indices): """ Delete sites with at indices. Args: indices: Sequence of indices of sites to delete. """ self._sites = [s for i, s in enumerate(self._sites) if i not in indices]
[ "Delete", "sites", "with", "at", "indices", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2840-L2848
[ "def", "remove_sites", "(", "self", ",", "indices", ")", ":", "self", ".", "_sites", "=", "[", "s", "for", "i", ",", "s", "in", "enumerate", "(", "self", ".", "_sites", ")", "if", "i", "not", "in", "indices", "]" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.apply_operation
Apply a symmetry operation to the structure and return the new structure. The lattice is operated by the rotation matrix only. Coords are operated in full and then transformed to the new lattice. Args: symmop (SymmOp): Symmetry operation to apply. fractional (bool): Whet...
pymatgen/core/structure.py
def apply_operation(self, symmop, fractional=False): """ Apply a symmetry operation to the structure and return the new structure. The lattice is operated by the rotation matrix only. Coords are operated in full and then transformed to the new lattice. Args: symmop (...
def apply_operation(self, symmop, fractional=False): """ Apply a symmetry operation to the structure and return the new structure. The lattice is operated by the rotation matrix only. Coords are operated in full and then transformed to the new lattice. Args: symmop (...
[ "Apply", "a", "symmetry", "operation", "to", "the", "structure", "and", "return", "the", "new", "structure", ".", "The", "lattice", "is", "operated", "by", "the", "rotation", "matrix", "only", ".", "Coords", "are", "operated", "in", "full", "and", "then", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2850-L2883
[ "def", "apply_operation", "(", "self", ",", "symmop", ",", "fractional", "=", "False", ")", ":", "if", "not", "fractional", ":", "self", ".", "_lattice", "=", "Lattice", "(", "[", "symmop", ".", "apply_rotation_only", "(", "row", ")", "for", "row", "in",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.modify_lattice
Modify the lattice of the structure. Mainly used for changing the basis. Args: new_lattice (Lattice): New lattice
pymatgen/core/structure.py
def modify_lattice(self, new_lattice): """ Modify the lattice of the structure. Mainly used for changing the basis. Args: new_lattice (Lattice): New lattice """ self._lattice = new_lattice for site in self._sites: site.lattice = new_latti...
def modify_lattice(self, new_lattice): """ Modify the lattice of the structure. Mainly used for changing the basis. Args: new_lattice (Lattice): New lattice """ self._lattice = new_lattice for site in self._sites: site.lattice = new_latti...
[ "Modify", "the", "lattice", "of", "the", "structure", ".", "Mainly", "used", "for", "changing", "the", "basis", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2886-L2896
[ "def", "modify_lattice", "(", "self", ",", "new_lattice", ")", ":", "self", ".", "_lattice", "=", "new_lattice", "for", "site", "in", "self", ".", "_sites", ":", "site", ".", "lattice", "=", "new_lattice" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.apply_strain
Apply a strain to the lattice. Args: strain (float or list): Amount of strain to apply. Can be a float, or a sequence of 3 numbers. E.g., 0.01 means all lattice vectors are increased by 1%. This is equivalent to calling modify_lattice with a lattice w...
pymatgen/core/structure.py
def apply_strain(self, strain): """ Apply a strain to the lattice. Args: strain (float or list): Amount of strain to apply. Can be a float, or a sequence of 3 numbers. E.g., 0.01 means all lattice vectors are increased by 1%. This is equivalent to cal...
def apply_strain(self, strain): """ Apply a strain to the lattice. Args: strain (float or list): Amount of strain to apply. Can be a float, or a sequence of 3 numbers. E.g., 0.01 means all lattice vectors are increased by 1%. This is equivalent to cal...
[ "Apply", "a", "strain", "to", "the", "lattice", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2898-L2910
[ "def", "apply_strain", "(", "self", ",", "strain", ")", ":", "s", "=", "(", "1", "+", "np", ".", "array", "(", "strain", ")", ")", "*", "np", ".", "eye", "(", "3", ")", "self", ".", "lattice", "=", "Lattice", "(", "np", ".", "dot", "(", "self...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.sort
Sort a structure in place. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species. The difference between this method and get_sorted_structure (which also works in IStructure) is that the latter returns a new Structure, ...
pymatgen/core/structure.py
def sort(self, key=None, reverse=False): """ Sort a structure in place. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species. The difference between this method and get_sorted_structure (which also works in ISt...
def sort(self, key=None, reverse=False): """ Sort a structure in place. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species. The difference between this method and get_sorted_structure (which also works in ISt...
[ "Sort", "a", "structure", "in", "place", ".", "The", "parameters", "have", "the", "same", "meaning", "as", "in", "list", ".", "sort", ".", "By", "default", "sites", "are", "sorted", "by", "the", "electronegativity", "of", "the", "species", ".", "The", "d...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2912-L2928
[ "def", "sort", "(", "self", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "self", ".", "_sites", ".", "sort", "(", "key", "=", "key", ",", "reverse", "=", "reverse", ")" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.translate_sites
Translate specific sites by some vector, keeping the sites within the unit cell. Args: indices: Integer or List of site indices on which to perform the translation. vector: Translation vector for sites. frac_coords (bool): Whether the vector correspon...
pymatgen/core/structure.py
def translate_sites(self, indices, vector, frac_coords=True, to_unit_cell=True): """ Translate specific sites by some vector, keeping the sites within the unit cell. Args: indices: Integer or List of site indices on which to perform the ...
def translate_sites(self, indices, vector, frac_coords=True, to_unit_cell=True): """ Translate specific sites by some vector, keeping the sites within the unit cell. Args: indices: Integer or List of site indices on which to perform the ...
[ "Translate", "specific", "sites", "by", "some", "vector", "keeping", "the", "sites", "within", "the", "unit", "cell", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2930-L2957
[ "def", "translate_sites", "(", "self", ",", "indices", ",", "vector", ",", "frac_coords", "=", "True", ",", "to_unit_cell", "=", "True", ")", ":", "if", "not", "isinstance", "(", "indices", ",", "collections", ".", "abc", ".", "Iterable", ")", ":", "indi...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.rotate_sites
Rotate specific sites by some angle around vector at anchor. Args: indices (list): List of site indices on which to perform the translation. theta (float): Angle in radians axis (3x1 array): Rotation axis vector. anchor (3x1 array): Point of rotat...
pymatgen/core/structure.py
def rotate_sites(self, indices=None, theta=0, axis=None, anchor=None, to_unit_cell=True): """ Rotate specific sites by some angle around vector at anchor. Args: indices (list): List of site indices on which to perform the translation. ...
def rotate_sites(self, indices=None, theta=0, axis=None, anchor=None, to_unit_cell=True): """ Rotate specific sites by some angle around vector at anchor. Args: indices (list): List of site indices on which to perform the translation. ...
[ "Rotate", "specific", "sites", "by", "some", "angle", "around", "vector", "at", "anchor", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2959-L3000
[ "def", "rotate_sites", "(", "self", ",", "indices", "=", "None", ",", "theta", "=", "0", ",", "axis", "=", "None", ",", "anchor", "=", "None", ",", "to_unit_cell", "=", "True", ")", ":", "from", "numpy", ".", "linalg", "import", "norm", "from", "nump...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.perturb
Performs a random perturbation of the sites in a structure to break symmetries. Args: distance (float): Distance in angstroms by which to perturb each site.
pymatgen/core/structure.py
def perturb(self, distance): """ Performs a random perturbation of the sites in a structure to break symmetries. Args: distance (float): Distance in angstroms by which to perturb each site. """ def get_rand_vec(): # deals with zer...
def perturb(self, distance): """ Performs a random perturbation of the sites in a structure to break symmetries. Args: distance (float): Distance in angstroms by which to perturb each site. """ def get_rand_vec(): # deals with zer...
[ "Performs", "a", "random", "perturbation", "of", "the", "sites", "in", "a", "structure", "to", "break", "symmetries", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3002-L3019
[ "def", "perturb", "(", "self", ",", "distance", ")", ":", "def", "get_rand_vec", "(", ")", ":", "# deals with zero vectors.", "vector", "=", "np", ".", "random", ".", "randn", "(", "3", ")", "vnorm", "=", "np", ".", "linalg", ".", "norm", "(", "vector"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.make_supercell
Create a supercell. Args: scaling_matrix: A scaling matrix for transforming the lattice vectors. Has to be all integers. Several options are possible: a. A full 3x3 scaling matrix defining the linear combination the old lattice vectors. E.g., [[2,...
pymatgen/core/structure.py
def make_supercell(self, scaling_matrix, to_unit_cell=True): """ Create a supercell. Args: scaling_matrix: A scaling matrix for transforming the lattice vectors. Has to be all integers. Several options are possible: a. A full 3x3 scaling matrix defin...
def make_supercell(self, scaling_matrix, to_unit_cell=True): """ Create a supercell. Args: scaling_matrix: A scaling matrix for transforming the lattice vectors. Has to be all integers. Several options are possible: a. A full 3x3 scaling matrix defin...
[ "Create", "a", "supercell", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3021-L3046
[ "def", "make_supercell", "(", "self", ",", "scaling_matrix", ",", "to_unit_cell", "=", "True", ")", ":", "s", "=", "self", "*", "scaling_matrix", "if", "to_unit_cell", ":", "for", "site", "in", "s", ":", "site", ".", "to_unit_cell", "(", "in_place", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Structure.merge_sites
Merges sites (adding occupancies) within tol of each other. Removes site properties. Args: tol (float): Tolerance for distance to merge sites. mode (str): Three modes supported. "delete" means duplicate sites are deleted. "sum" means the occupancies are summed fo...
pymatgen/core/structure.py
def merge_sites(self, tol=0.01, mode="sum"): """ Merges sites (adding occupancies) within tol of each other. Removes site properties. Args: tol (float): Tolerance for distance to merge sites. mode (str): Three modes supported. "delete" means duplicate sites are ...
def merge_sites(self, tol=0.01, mode="sum"): """ Merges sites (adding occupancies) within tol of each other. Removes site properties. Args: tol (float): Tolerance for distance to merge sites. mode (str): Three modes supported. "delete" means duplicate sites are ...
[ "Merges", "sites", "(", "adding", "occupancies", ")", "within", "tol", "of", "each", "other", ".", "Removes", "site", "properties", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3058-L3103
[ "def", "merge_sites", "(", "self", ",", "tol", "=", "0.01", ",", "mode", "=", "\"sum\"", ")", ":", "mode", "=", "mode", ".", "lower", "(", ")", "[", "0", "]", "from", "scipy", ".", "spatial", ".", "distance", "import", "squareform", "from", "scipy", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.append
Appends a site to the molecule. Args: species: Species of inserted site coords: Coordinates of inserted site validate_proximity (bool): Whether to check if inserted site is too close to an existing site. Defaults to True. properties (dict): A dict...
pymatgen/core/structure.py
def append(self, species, coords, validate_proximity=True, properties=None): """ Appends a site to the molecule. Args: species: Species of inserted site coords: Coordinates of inserted site validate_proximity (bool): Whether to check if inserted site is ...
def append(self, species, coords, validate_proximity=True, properties=None): """ Appends a site to the molecule. Args: species: Species of inserted site coords: Coordinates of inserted site validate_proximity (bool): Whether to check if inserted site is ...
[ "Appends", "a", "site", "to", "the", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3199-L3215
[ "def", "append", "(", "self", ",", "species", ",", "coords", ",", "validate_proximity", "=", "True", ",", "properties", "=", "None", ")", ":", "return", "self", ".", "insert", "(", "len", "(", "self", ")", ",", "species", ",", "coords", ",", "validate_...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.set_charge_and_spin
Set the charge and spin multiplicity. Args: charge (int): Charge for the molecule. Defaults to 0. spin_multiplicity (int): Spin multiplicity for molecule. Defaults to None, which means that the spin multiplicity is set to 1 if the molecule has no unpaired...
pymatgen/core/structure.py
def set_charge_and_spin(self, charge, spin_multiplicity=None): """ Set the charge and spin multiplicity. Args: charge (int): Charge for the molecule. Defaults to 0. spin_multiplicity (int): Spin multiplicity for molecule. Defaults to None, which means tha...
def set_charge_and_spin(self, charge, spin_multiplicity=None): """ Set the charge and spin multiplicity. Args: charge (int): Charge for the molecule. Defaults to 0. spin_multiplicity (int): Spin multiplicity for molecule. Defaults to None, which means tha...
[ "Set", "the", "charge", "and", "spin", "multiplicity", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3217-L3244
[ "def", "set_charge_and_spin", "(", "self", ",", "charge", ",", "spin_multiplicity", "=", "None", ")", ":", "self", ".", "_charge", "=", "charge", "nelectrons", "=", "0", "for", "site", "in", "self", ".", "_sites", ":", "for", "sp", ",", "amt", "in", "s...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.insert
Insert a site to the molecule. Args: i (int): Index to insert site species: species of inserted site coords (3x1 array): coordinates of inserted site validate_proximity (bool): Whether to check if inserted site is too close to an existing site. De...
pymatgen/core/structure.py
def insert(self, i, species, coords, validate_proximity=False, properties=None): """ Insert a site to the molecule. Args: i (int): Index to insert site species: species of inserted site coords (3x1 array): coordinates of inserted site ...
def insert(self, i, species, coords, validate_proximity=False, properties=None): """ Insert a site to the molecule. Args: i (int): Index to insert site species: species of inserted site coords (3x1 array): coordinates of inserted site ...
[ "Insert", "a", "site", "to", "the", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3246-L3268
[ "def", "insert", "(", "self", ",", "i", ",", "species", ",", "coords", ",", "validate_proximity", "=", "False", ",", "properties", "=", "None", ")", ":", "new_site", "=", "Site", "(", "species", ",", "coords", ",", "properties", "=", "properties", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.remove_species
Remove all occurrences of a species from a molecule. Args: species: Species to remove.
pymatgen/core/structure.py
def remove_species(self, species): """ Remove all occurrences of a species from a molecule. Args: species: Species to remove. """ new_sites = [] species = [get_el_sp(sp) for sp in species] for site in self._sites: new_sp_occu = {sp: amt fo...
def remove_species(self, species): """ Remove all occurrences of a species from a molecule. Args: species: Species to remove. """ new_sites = [] species = [get_el_sp(sp) for sp in species] for site in self._sites: new_sp_occu = {sp: amt fo...
[ "Remove", "all", "occurrences", "of", "a", "species", "from", "a", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3270-L3285
[ "def", "remove_species", "(", "self", ",", "species", ")", ":", "new_sites", "=", "[", "]", "species", "=", "[", "get_el_sp", "(", "sp", ")", "for", "sp", "in", "species", "]", "for", "site", "in", "self", ".", "_sites", ":", "new_sp_occu", "=", "{",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.remove_sites
Delete sites with at indices. Args: indices: Sequence of indices of sites to delete.
pymatgen/core/structure.py
def remove_sites(self, indices): """ Delete sites with at indices. Args: indices: Sequence of indices of sites to delete. """ self._sites = [self._sites[i] for i in range(len(self._sites)) if i not in indices]
def remove_sites(self, indices): """ Delete sites with at indices. Args: indices: Sequence of indices of sites to delete. """ self._sites = [self._sites[i] for i in range(len(self._sites)) if i not in indices]
[ "Delete", "sites", "with", "at", "indices", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3287-L3295
[ "def", "remove_sites", "(", "self", ",", "indices", ")", ":", "self", ".", "_sites", "=", "[", "self", ".", "_sites", "[", "i", "]", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_sites", ")", ")", "if", "i", "not", "in", "indices", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.translate_sites
Translate specific sites by some vector, keeping the sites within the unit cell. Args: indices (list): List of site indices on which to perform the translation. vector (3x1 array): Translation vector for sites.
pymatgen/core/structure.py
def translate_sites(self, indices=None, vector=None): """ Translate specific sites by some vector, keeping the sites within the unit cell. Args: indices (list): List of site indices on which to perform the translation. vector (3x1 array): Translat...
def translate_sites(self, indices=None, vector=None): """ Translate specific sites by some vector, keeping the sites within the unit cell. Args: indices (list): List of site indices on which to perform the translation. vector (3x1 array): Translat...
[ "Translate", "specific", "sites", "by", "some", "vector", "keeping", "the", "sites", "within", "the", "unit", "cell", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3297-L3315
[ "def", "translate_sites", "(", "self", ",", "indices", "=", "None", ",", "vector", "=", "None", ")", ":", "if", "indices", "is", "None", ":", "indices", "=", "range", "(", "len", "(", "self", ")", ")", "if", "vector", "is", "None", ":", "vector", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Molecule.apply_operation
Apply a symmetry operation to the molecule. Args: symmop (SymmOp): Symmetry operation to apply.
pymatgen/core/structure.py
def apply_operation(self, symmop): """ Apply a symmetry operation to the molecule. Args: symmop (SymmOp): Symmetry operation to apply. """ def operate_site(site): new_cart = symmop.operate(site.coords) return Site(site.species, new_cart, ...
def apply_operation(self, symmop): """ Apply a symmetry operation to the molecule. Args: symmop (SymmOp): Symmetry operation to apply. """ def operate_site(site): new_cart = symmop.operate(site.coords) return Site(site.species, new_cart, ...
[ "Apply", "a", "symmetry", "operation", "to", "the", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L3375-L3388
[ "def", "apply_operation", "(", "self", ",", "symmop", ")", ":", "def", "operate_site", "(", "site", ")", ":", "new_cart", "=", "symmop", ".", "operate", "(", "site", ".", "coords", ")", "return", "Site", "(", "site", ".", "species", ",", "new_cart", ",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectTransformation.apply_transformation
:param structure (bulk structure to be scaled up - typically conventional unit cell) :return: defect_structure, with charge applied
pymatgen/transformations/defect_transformations.py
def apply_transformation(self, structure): """ :param structure (bulk structure to be scaled up - typically conventional unit cell) :return: defect_structure, with charge applied """ if structure != self.defect.bulk_structure: raise ValueError("Defect bulk...
def apply_transformation(self, structure): """ :param structure (bulk structure to be scaled up - typically conventional unit cell) :return: defect_structure, with charge applied """ if structure != self.defect.bulk_structure: raise ValueError("Defect bulk...
[ ":", "param", "structure", "(", "bulk", "structure", "to", "be", "scaled", "up", "-", "typically", "conventional", "unit", "cell", ")", ":", "return", ":", "defect_structure", "with", "charge", "applied" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/transformations/defect_transformations.py#L33-L44
[ "def", "apply_transformation", "(", "self", ",", "structure", ")", ":", "if", "structure", "!=", "self", ".", "defect", ".", "bulk_structure", ":", "raise", "ValueError", "(", "\"Defect bulk_structure is not the same as input structure.\"", ")", "def_structure", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Polymer._create
create the polymer from the monomer Args: monomer (Molecule) mon_vector (numpy.array): molecule vector that starts from the start atom index to the end atom index
pymatgen/io/lammps/utils.py
def _create(self, monomer, mon_vector): """ create the polymer from the monomer Args: monomer (Molecule) mon_vector (numpy.array): molecule vector that starts from the start atom index to the end atom index """ while self.length != (self.n...
def _create(self, monomer, mon_vector): """ create the polymer from the monomer Args: monomer (Molecule) mon_vector (numpy.array): molecule vector that starts from the start atom index to the end atom index """ while self.length != (self.n...
[ "create", "the", "polymer", "from", "the", "monomer" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L93-L107
[ "def", "_create", "(", "self", ",", "monomer", ",", "mon_vector", ")", ":", "while", "self", ".", "length", "!=", "(", "self", ".", "n_units", "-", "1", ")", ":", "if", "self", ".", "linear_chain", ":", "move_direction", "=", "np", ".", "array", "(",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Polymer._next_move_direction
pick a move at random from the list of moves
pymatgen/io/lammps/utils.py
def _next_move_direction(self): """ pick a move at random from the list of moves """ nmoves = len(self.moves) move = np.random.randint(1, nmoves+1) while self.prev_move == (move + 3) % nmoves: move = np.random.randint(1, nmoves+1) self.prev_move = move...
def _next_move_direction(self): """ pick a move at random from the list of moves """ nmoves = len(self.moves) move = np.random.randint(1, nmoves+1) while self.prev_move == (move + 3) % nmoves: move = np.random.randint(1, nmoves+1) self.prev_move = move...
[ "pick", "a", "move", "at", "random", "from", "the", "list", "of", "moves" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L109-L118
[ "def", "_next_move_direction", "(", "self", ")", ":", "nmoves", "=", "len", "(", "self", ".", "moves", ")", "move", "=", "np", ".", "random", ".", "randint", "(", "1", ",", "nmoves", "+", "1", ")", "while", "self", ".", "prev_move", "==", "(", "mov...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Polymer._align_monomer
rotate the monomer so that it is aligned along the move direction Args: monomer (Molecule) mon_vector (numpy.array): molecule vector that starts from the start atom index to the end atom index move_direction (numpy.array): the direction of the polymer chain ...
pymatgen/io/lammps/utils.py
def _align_monomer(self, monomer, mon_vector, move_direction): """ rotate the monomer so that it is aligned along the move direction Args: monomer (Molecule) mon_vector (numpy.array): molecule vector that starts from the start atom index to the end atom i...
def _align_monomer(self, monomer, mon_vector, move_direction): """ rotate the monomer so that it is aligned along the move direction Args: monomer (Molecule) mon_vector (numpy.array): molecule vector that starts from the start atom index to the end atom i...
[ "rotate", "the", "monomer", "so", "that", "it", "is", "aligned", "along", "the", "move", "direction" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L120-L135
[ "def", "_align_monomer", "(", "self", ",", "monomer", ",", "mon_vector", ",", "move_direction", ")", ":", "axis", "=", "np", ".", "cross", "(", "mon_vector", ",", "move_direction", ")", "origin", "=", "monomer", "[", "self", ".", "start", "]", ".", "coor...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Polymer._add_monomer
extend the polymer molecule by adding a monomer along mon_vector direction Args: monomer (Molecule): monomer molecule mon_vector (numpy.array): monomer vector that points from head to tail. move_direction (numpy.array): direction along which the monomer will ...
pymatgen/io/lammps/utils.py
def _add_monomer(self, monomer, mon_vector, move_direction): """ extend the polymer molecule by adding a monomer along mon_vector direction Args: monomer (Molecule): monomer molecule mon_vector (numpy.array): monomer vector that points from head to tail. move...
def _add_monomer(self, monomer, mon_vector, move_direction): """ extend the polymer molecule by adding a monomer along mon_vector direction Args: monomer (Molecule): monomer molecule mon_vector (numpy.array): monomer vector that points from head to tail. move...
[ "extend", "the", "polymer", "molecule", "by", "adding", "a", "monomer", "along", "mon_vector", "direction" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L137-L166
[ "def", "_add_monomer", "(", "self", ",", "monomer", ",", "mon_vector", ",", "move_direction", ")", ":", "translate_by", "=", "self", ".", "molecule", ".", "cart_coords", "[", "self", ".", "end", "]", "+", "self", ".", "link_distance", "*", "move_direction", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner._format_param_val
Internal method to format values in the packmol parameter dictionaries Args: param_val: Some object to turn into String Returns: string representation of the object
pymatgen/io/lammps/utils.py
def _format_param_val(self, param_val): """ Internal method to format values in the packmol parameter dictionaries Args: param_val: Some object to turn into String Returns: string representation of the object """ if isinst...
def _format_param_val(self, param_val): """ Internal method to format values in the packmol parameter dictionaries Args: param_val: Some object to turn into String Returns: string representation of the object """ if isinst...
[ "Internal", "method", "to", "format", "values", "in", "the", "packmol", "parameter", "dictionaries" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L224-L238
[ "def", "_format_param_val", "(", "self", ",", "param_val", ")", ":", "if", "isinstance", "(", "param_val", ",", "list", ")", ":", "return", "' '", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "param_val", ")", "else", ":", "return", "str...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner._set_box
Set the box size for the molecular assembly
pymatgen/io/lammps/utils.py
def _set_box(self): """ Set the box size for the molecular assembly """ net_volume = 0.0 for idx, mol in enumerate(self.mols): length = max([np.max(mol.cart_coords[:, i])-np.min(mol.cart_coords[:, i]) for i in range(3)]) + 2.0 ne...
def _set_box(self): """ Set the box size for the molecular assembly """ net_volume = 0.0 for idx, mol in enumerate(self.mols): length = max([np.max(mol.cart_coords[:, i])-np.min(mol.cart_coords[:, i]) for i in range(3)]) + 2.0 ne...
[ "Set", "the", "box", "size", "for", "the", "molecular", "assembly" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L240-L252
[ "def", "_set_box", "(", "self", ")", ":", "net_volume", "=", "0.0", "for", "idx", ",", "mol", "in", "enumerate", "(", "self", ".", "mols", ")", ":", "length", "=", "max", "(", "[", "np", ".", "max", "(", "mol", ".", "cart_coords", "[", ":", ",", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner._write_input
Write the packmol input file to the input directory. Args: input_dir (string): path to the input directory
pymatgen/io/lammps/utils.py
def _write_input(self, input_dir="."): """ Write the packmol input file to the input directory. Args: input_dir (string): path to the input directory """ with open(os.path.join(input_dir, self.input_file), 'wt', encoding="utf-8") as inp: for k, v in self....
def _write_input(self, input_dir="."): """ Write the packmol input file to the input directory. Args: input_dir (string): path to the input directory """ with open(os.path.join(input_dir, self.input_file), 'wt', encoding="utf-8") as inp: for k, v in self....
[ "Write", "the", "packmol", "input", "file", "to", "the", "input", "directory", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L254-L288
[ "def", "_write_input", "(", "self", ",", "input_dir", "=", "\".\"", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "input_dir", ",", "self", ".", "input_file", ")", ",", "'wt'", ",", "encoding", "=", "\"utf-8\"", ")", "as", "inp"...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner.run
Write the input file to the scratch directory, run packmol and return the packed molecule. Args: copy_to_current_on_exit (bool): Whether or not to copy the packmol input/output files from the scratch directory to the current directory. site_proper...
pymatgen/io/lammps/utils.py
def run(self, copy_to_current_on_exit=False, site_property=None): """ Write the input file to the scratch directory, run packmol and return the packed molecule. Args: copy_to_current_on_exit (bool): Whether or not to copy the packmol input/output files from t...
def run(self, copy_to_current_on_exit=False, site_property=None): """ Write the input file to the scratch directory, run packmol and return the packed molecule. Args: copy_to_current_on_exit (bool): Whether or not to copy the packmol input/output files from t...
[ "Write", "the", "input", "file", "to", "the", "scratch", "directory", "run", "packmol", "and", "return", "the", "packed", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L290-L324
[ "def", "run", "(", "self", ",", "copy_to_current_on_exit", "=", "False", ",", "site_property", "=", "None", ")", ":", "scratch", "=", "tempfile", ".", "gettempdir", "(", ")", "with", "ScratchDir", "(", "scratch", ",", "copy_to_current_on_exit", "=", "copy_to_c...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner.write_pdb
dump the molecule into pdb file with custom residue name and number.
pymatgen/io/lammps/utils.py
def write_pdb(self, mol, filename, name=None, num=None): """ dump the molecule into pdb file with custom residue name and number. """ # ugly hack to get around the openbabel issues with inconsistent # residue labelling. scratch = tempfile.gettempdir() with Scratc...
def write_pdb(self, mol, filename, name=None, num=None): """ dump the molecule into pdb file with custom residue name and number. """ # ugly hack to get around the openbabel issues with inconsistent # residue labelling. scratch = tempfile.gettempdir() with Scratc...
[ "dump", "the", "molecule", "into", "pdb", "file", "with", "custom", "residue", "name", "and", "number", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L326-L347
[ "def", "write_pdb", "(", "self", ",", "mol", ",", "filename", ",", "name", "=", "None", ",", "num", "=", "None", ")", ":", "# ugly hack to get around the openbabel issues with inconsistent", "# residue labelling.", "scratch", "=", "tempfile", ".", "gettempdir", "(",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner._set_residue_map
map each residue to the corresponding molecule.
pymatgen/io/lammps/utils.py
def _set_residue_map(self): """ map each residue to the corresponding molecule. """ self.map_residue_to_mol = {} lookup = {} for idx, mol in enumerate(self.mols): if not mol.formula in lookup: mol.translate_sites(indices=range(len(mol)), ...
def _set_residue_map(self): """ map each residue to the corresponding molecule. """ self.map_residue_to_mol = {} lookup = {} for idx, mol in enumerate(self.mols): if not mol.formula in lookup: mol.translate_sites(indices=range(len(mol)), ...
[ "map", "each", "residue", "to", "the", "corresponding", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L349-L360
[ "def", "_set_residue_map", "(", "self", ")", ":", "self", ".", "map_residue_to_mol", "=", "{", "}", "lookup", "=", "{", "}", "for", "idx", ",", "mol", "in", "enumerate", "(", "self", ".", "mols", ")", ":", "if", "not", "mol", ".", "formula", "in", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner.convert_obatoms_to_molecule
Convert list of openbabel atoms to MOlecule. Args: atoms ([OBAtom]): list of OBAtom objects residue_name (str): the key in self.map_residue_to_mol. Usec to restore the site properties in the final packed molecule. site_property (str): the site property to be ...
pymatgen/io/lammps/utils.py
def convert_obatoms_to_molecule(self, atoms, residue_name=None, site_property="ff_map"): """ Convert list of openbabel atoms to MOlecule. Args: atoms ([OBAtom]): list of OBAtom objects residue_name (str): the key in self.map_residue_to_mol. Usec to restor...
def convert_obatoms_to_molecule(self, atoms, residue_name=None, site_property="ff_map"): """ Convert list of openbabel atoms to MOlecule. Args: atoms ([OBAtom]): list of OBAtom objects residue_name (str): the key in self.map_residue_to_mol. Usec to restor...
[ "Convert", "list", "of", "openbabel", "atoms", "to", "MOlecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L362-L406
[ "def", "convert_obatoms_to_molecule", "(", "self", ",", "atoms", ",", "residue_name", "=", "None", ",", "site_property", "=", "\"ff_map\"", ")", ":", "restore_site_props", "=", "True", "if", "residue_name", "is", "not", "None", "else", "False", "if", "restore_si...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
PackmolRunner.restore_site_properties
Restore the site properties for the final packed molecule. Args: site_property (str): filename (str): path to the final packed molecule. Returns: Molecule
pymatgen/io/lammps/utils.py
def restore_site_properties(self, site_property="ff_map", filename=None): """ Restore the site properties for the final packed molecule. Args: site_property (str): filename (str): path to the final packed molecule. Returns: Molecule """ ...
def restore_site_properties(self, site_property="ff_map", filename=None): """ Restore the site properties for the final packed molecule. Args: site_property (str): filename (str): path to the final packed molecule. Returns: Molecule """ ...
[ "Restore", "the", "site", "properties", "for", "the", "final", "packed", "molecule", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L408-L443
[ "def", "restore_site_properties", "(", "self", ",", "site_property", "=", "\"ff_map\"", ",", "filename", "=", "None", ")", ":", "# only for pdb", "if", "not", "self", ".", "control_params", "[", "\"filetype\"", "]", "==", "\"pdb\"", ":", "raise", "ValueError", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
LammpsRunner.run
Write the input/data files and run LAMMPS.
pymatgen/io/lammps/utils.py
def run(self): """ Write the input/data files and run LAMMPS. """ lammps_cmd = self.lammps_bin + ['-in', self.input_filename] print("Running: {}".format(" ".join(lammps_cmd))) p = Popen(lammps_cmd, stdout=PIPE, stderr=PIPE) (stdout, stderr) = p.communicate() ...
def run(self): """ Write the input/data files and run LAMMPS. """ lammps_cmd = self.lammps_bin + ['-in', self.input_filename] print("Running: {}".format(" ".join(lammps_cmd))) p = Popen(lammps_cmd, stdout=PIPE, stderr=PIPE) (stdout, stderr) = p.communicate() ...
[ "Write", "the", "input", "/", "data", "files", "and", "run", "LAMMPS", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/utils.py#L464-L472
[ "def", "run", "(", "self", ")", ":", "lammps_cmd", "=", "self", ".", "lammps_bin", "+", "[", "'-in'", ",", "self", ".", "input_filename", "]", "print", "(", "\"Running: {}\"", ".", "format", "(", "\" \"", ".", "join", "(", "lammps_cmd", ")", ")", ")", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_el_sp
Utility method to get an Element or Specie from an input obj. If obj is in itself an element or a specie, it is returned automatically. If obj is an int or a string representing an integer, the Element with the atomic number obj is returned. If obj is a string, Specie parsing will be attempted (e.g., Mn...
pymatgen/core/periodic_table.py
def get_el_sp(obj): """ Utility method to get an Element or Specie from an input obj. If obj is in itself an element or a specie, it is returned automatically. If obj is an int or a string representing an integer, the Element with the atomic number obj is returned. If obj is a string, Specie par...
def get_el_sp(obj): """ Utility method to get an Element or Specie from an input obj. If obj is in itself an element or a specie, it is returned automatically. If obj is an int or a string representing an integer, the Element with the atomic number obj is returned. If obj is a string, Specie par...
[ "Utility", "method", "to", "get", "an", "Element", "or", "Specie", "from", "an", "input", "obj", ".", "If", "obj", "is", "in", "itself", "an", "element", "or", "a", "specie", "it", "is", "returned", "automatically", ".", "If", "obj", "is", "an", "int",...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1554-L1602
[ "def", "get_el_sp", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "(", "Element", ",", "Specie", ",", "DummySpecie", ")", ")", ":", "return", "obj", "if", "isinstance", "(", "obj", ",", "(", "list", ",", "tuple", ")", ")", ":", "return...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.average_ionic_radius
Average ionic radius for element (with units). The average is taken over all oxidation states of the element for which data is present.
pymatgen/core/periodic_table.py
def average_ionic_radius(self): """ Average ionic radius for element (with units). The average is taken over all oxidation states of the element for which data is present. """ if "Ionic radii" in self._data: radii = self._data["Ionic radii"] return sum(rad...
def average_ionic_radius(self): """ Average ionic radius for element (with units). The average is taken over all oxidation states of the element for which data is present. """ if "Ionic radii" in self._data: radii = self._data["Ionic radii"] return sum(rad...
[ "Average", "ionic", "radius", "for", "element", "(", "with", "units", ")", ".", "The", "average", "is", "taken", "over", "all", "oxidation", "states", "of", "the", "element", "for", "which", "data", "is", "present", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L494-L503
[ "def", "average_ionic_radius", "(", "self", ")", ":", "if", "\"Ionic radii\"", "in", "self", ".", "_data", ":", "radii", "=", "self", ".", "_data", "[", "\"Ionic radii\"", "]", "return", "sum", "(", "radii", ".", "values", "(", ")", ")", "/", "len", "(...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.average_cationic_radius
Average cationic radius for element (with units). The average is taken over all positive oxidation states of the element for which data is present.
pymatgen/core/periodic_table.py
def average_cationic_radius(self): """ Average cationic radius for element (with units). The average is taken over all positive oxidation states of the element for which data is present. """ if "Ionic radii" in self._data: radii = [v for k, v in self._data["Io...
def average_cationic_radius(self): """ Average cationic radius for element (with units). The average is taken over all positive oxidation states of the element for which data is present. """ if "Ionic radii" in self._data: radii = [v for k, v in self._data["Io...
[ "Average", "cationic", "radius", "for", "element", "(", "with", "units", ")", ".", "The", "average", "is", "taken", "over", "all", "positive", "oxidation", "states", "of", "the", "element", "for", "which", "data", "is", "present", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L507-L518
[ "def", "average_cationic_radius", "(", "self", ")", ":", "if", "\"Ionic radii\"", "in", "self", ".", "_data", ":", "radii", "=", "[", "v", "for", "k", ",", "v", "in", "self", ".", "_data", "[", "\"Ionic radii\"", "]", ".", "items", "(", ")", "if", "i...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.ionic_radii
All ionic radii of the element as a dict of {oxidation state: ionic radii}. Radii are given in ang.
pymatgen/core/periodic_table.py
def ionic_radii(self): """ All ionic radii of the element as a dict of {oxidation state: ionic radii}. Radii are given in ang. """ if "Ionic radii" in self._data: return {int(k): v for k, v in self._data["Ionic radii"].items()} else: return {}
def ionic_radii(self): """ All ionic radii of the element as a dict of {oxidation state: ionic radii}. Radii are given in ang. """ if "Ionic radii" in self._data: return {int(k): v for k, v in self._data["Ionic radii"].items()} else: return {}
[ "All", "ionic", "radii", "of", "the", "element", "as", "a", "dict", "of", "{", "oxidation", "state", ":", "ionic", "radii", "}", ".", "Radii", "are", "given", "in", "ang", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L537-L545
[ "def", "ionic_radii", "(", "self", ")", ":", "if", "\"Ionic radii\"", "in", "self", ".", "_data", ":", "return", "{", "int", "(", "k", ")", ":", "v", "for", "k", ",", "v", "in", "self", ".", "_data", "[", "\"Ionic radii\"", "]", ".", "items", "(", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.full_electronic_structure
Full electronic structure as tuple. E.g., The electronic structure for Fe is represented as: [(1, "s", 2), (2, "s", 2), (2, "p", 6), (3, "s", 2), (3, "p", 6), (3, "d", 6), (4, "s", 2)]
pymatgen/core/periodic_table.py
def full_electronic_structure(self): """ Full electronic structure as tuple. E.g., The electronic structure for Fe is represented as: [(1, "s", 2), (2, "s", 2), (2, "p", 6), (3, "s", 2), (3, "p", 6), (3, "d", 6), (4, "s", 2)] """ estr = self._data["Electronic stru...
def full_electronic_structure(self): """ Full electronic structure as tuple. E.g., The electronic structure for Fe is represented as: [(1, "s", 2), (2, "s", 2), (2, "p", 6), (3, "s", 2), (3, "p", 6), (3, "d", 6), (4, "s", 2)] """ estr = self._data["Electronic stru...
[ "Full", "electronic", "structure", "as", "tuple", ".", "E", ".", "g", ".", "The", "electronic", "structure", "for", "Fe", "is", "represented", "as", ":", "[", "(", "1", "s", "2", ")", "(", "2", "s", "2", ")", "(", "2", "p", "6", ")", "(", "3", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L591-L610
[ "def", "full_electronic_structure", "(", "self", ")", ":", "estr", "=", "self", ".", "_data", "[", "\"Electronic structure\"", "]", "def", "parse_orbital", "(", "orbstr", ")", ":", "m", "=", "re", ".", "match", "(", "r\"(\\d+)([spdfg]+)<sup>(\\d+)</sup>\"", ",",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.valence
# From full electron config obtain valence subshell # angular moment (L) and number of valence e- (v_e)
pymatgen/core/periodic_table.py
def valence(self): """ # From full electron config obtain valence subshell # angular moment (L) and number of valence e- (v_e) """ # the number of valence of noble gas is 0 if self.group == 18: return (np.nan, 0) L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ' ...
def valence(self): """ # From full electron config obtain valence subshell # angular moment (L) and number of valence e- (v_e) """ # the number of valence of noble gas is 0 if self.group == 18: return (np.nan, 0) L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ' ...
[ "#", "From", "full", "electron", "config", "obtain", "valence", "subshell", "#", "angular", "moment", "(", "L", ")", "and", "number", "of", "valence", "e", "-", "(", "v_e", ")" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L613-L633
[ "def", "valence", "(", "self", ")", ":", "# the number of valence of noble gas is 0", "if", "self", ".", "group", "==", "18", ":", "return", "(", "np", ".", "nan", ",", "0", ")", "L_symbols", "=", "'SPDFGHIKLMNOQRTUVWXYZ'", "valence", "=", "[", "]", "full_el...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.term_symbols
All possible Russell-Saunders term symbol of the Element eg. L = 1, n_e = 2 (s2) returns [['1D2'], ['3P0', '3P1', '3P2'], ['1S0']]
pymatgen/core/periodic_table.py
def term_symbols(self): """ All possible Russell-Saunders term symbol of the Element eg. L = 1, n_e = 2 (s2) returns [['1D2'], ['3P0', '3P1', '3P2'], ['1S0']] """ L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ' L, v_e = self.valence # for one electron i...
def term_symbols(self): """ All possible Russell-Saunders term symbol of the Element eg. L = 1, n_e = 2 (s2) returns [['1D2'], ['3P0', '3P1', '3P2'], ['1S0']] """ L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ' L, v_e = self.valence # for one electron i...
[ "All", "possible", "Russell", "-", "Saunders", "term", "symbol", "of", "the", "Element", "eg", ".", "L", "=", "1", "n_e", "=", "2", "(", "s2", ")", "returns", "[[", "1D2", "]", "[", "3P0", "3P1", "3P2", "]", "[", "1S0", "]]" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L636-L689
[ "def", "term_symbols", "(", "self", ")", ":", "L_symbols", "=", "'SPDFGHIKLMNOQRTUVWXYZ'", "L", ",", "v_e", "=", "self", ".", "valence", "# for one electron in subshell L", "ml", "=", "list", "(", "range", "(", "-", "L", ",", "L", "+", "1", ")", ")", "ms...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.ground_state_term_symbol
Ground state term symbol Selected based on Hund's Rule
pymatgen/core/periodic_table.py
def ground_state_term_symbol(self): """ Ground state term symbol Selected based on Hund's Rule """ L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ' term_symbols = self.term_symbols term_symbol_flat = {term: {"multiplicity": int(term[0]), "L...
def ground_state_term_symbol(self): """ Ground state term symbol Selected based on Hund's Rule """ L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ' term_symbols = self.term_symbols term_symbol_flat = {term: {"multiplicity": int(term[0]), "L...
[ "Ground", "state", "term", "symbol", "Selected", "based", "on", "Hund", "s", "Rule" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L692-L723
[ "def", "ground_state_term_symbol", "(", "self", ")", ":", "L_symbols", "=", "'SPDFGHIKLMNOQRTUVWXYZ'", "term_symbols", "=", "self", ".", "term_symbols", "term_symbol_flat", "=", "{", "term", ":", "{", "\"multiplicity\"", ":", "int", "(", "term", "[", "0", "]", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.from_Z
Get an element from an atomic number. Args: z (int): Atomic number Returns: Element with atomic number z.
pymatgen/core/periodic_table.py
def from_Z(z: int): """ Get an element from an atomic number. Args: z (int): Atomic number Returns: Element with atomic number z. """ for sym, data in _pt_data.items(): if data["Atomic no"] == z: return Element(sym) ...
def from_Z(z: int): """ Get an element from an atomic number. Args: z (int): Atomic number Returns: Element with atomic number z. """ for sym, data in _pt_data.items(): if data["Atomic no"] == z: return Element(sym) ...
[ "Get", "an", "element", "from", "an", "atomic", "number", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L756-L769
[ "def", "from_Z", "(", "z", ":", "int", ")", ":", "for", "sym", ",", "data", "in", "_pt_data", ".", "items", "(", ")", ":", "if", "data", "[", "\"Atomic no\"", "]", "==", "z", ":", "return", "Element", "(", "sym", ")", "raise", "ValueError", "(", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.from_row_and_group
Returns an element from a row and group number. Args: row (int): Row number group (int): Group number .. note:: The 18 group number system is used, i.e., Noble gases are group 18.
pymatgen/core/periodic_table.py
def from_row_and_group(row: int, group: int): """ Returns an element from a row and group number. Args: row (int): Row number group (int): Group number .. note:: The 18 group number system is used, i.e., Noble gases are group 18. """ ...
def from_row_and_group(row: int, group: int): """ Returns an element from a row and group number. Args: row (int): Row number group (int): Group number .. note:: The 18 group number system is used, i.e., Noble gases are group 18. """ ...
[ "Returns", "an", "element", "from", "a", "row", "and", "group", "number", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L772-L787
[ "def", "from_row_and_group", "(", "row", ":", "int", ",", "group", ":", "int", ")", ":", "for", "sym", "in", "_pt_data", ".", "keys", "(", ")", ":", "el", "=", "Element", "(", "sym", ")", "if", "el", ".", "row", "==", "row", "and", "el", ".", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.row
Returns the periodic table row of the element.
pymatgen/core/periodic_table.py
def row(self): """ Returns the periodic table row of the element. """ z = self.Z total = 0 if 57 <= z <= 71: return 8 elif 89 <= z <= 103: return 9 for i in range(len(_pt_row_sizes)): total += _pt_row_sizes[i] ...
def row(self): """ Returns the periodic table row of the element. """ z = self.Z total = 0 if 57 <= z <= 71: return 8 elif 89 <= z <= 103: return 9 for i in range(len(_pt_row_sizes)): total += _pt_row_sizes[i] ...
[ "Returns", "the", "periodic", "table", "row", "of", "the", "element", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L808-L823
[ "def", "row", "(", "self", ")", ":", "z", "=", "self", ".", "Z", "total", "=", "0", "if", "57", "<=", "z", "<=", "71", ":", "return", "8", "elif", "89", "<=", "z", "<=", "103", ":", "return", "9", "for", "i", "in", "range", "(", "len", "(",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.group
Returns the periodic table group of the element.
pymatgen/core/periodic_table.py
def group(self): """ Returns the periodic table group of the element. """ z = self.Z if z == 1: return 1 if z == 2: return 18 if 3 <= z <= 18: if (z - 2) % 8 == 0: return 18 elif (z - 2) % 8 <= 2: ...
def group(self): """ Returns the periodic table group of the element. """ z = self.Z if z == 1: return 1 if z == 2: return 18 if 3 <= z <= 18: if (z - 2) % 8 == 0: return 18 elif (z - 2) % 8 <= 2: ...
[ "Returns", "the", "periodic", "table", "group", "of", "the", "element", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L826-L854
[ "def", "group", "(", "self", ")", ":", "z", "=", "self", ".", "Z", "if", "z", "==", "1", ":", "return", "1", "if", "z", "==", "2", ":", "return", "18", "if", "3", "<=", "z", "<=", "18", ":", "if", "(", "z", "-", "2", ")", "%", "8", "=="...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.block
Return the block character "s,p,d,f"
pymatgen/core/periodic_table.py
def block(self): """ Return the block character "s,p,d,f" """ if (self.is_actinoid or self.is_lanthanoid) and self.Z not in [71, 103]: return "f" elif self.is_actinoid or self.is_lanthanoid: return "d" elif self.group in [1, 2]: return ...
def block(self): """ Return the block character "s,p,d,f" """ if (self.is_actinoid or self.is_lanthanoid) and self.Z not in [71, 103]: return "f" elif self.is_actinoid or self.is_lanthanoid: return "d" elif self.group in [1, 2]: return ...
[ "Return", "the", "block", "character", "s", "p", "d", "f" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L857-L871
[ "def", "block", "(", "self", ")", ":", "if", "(", "self", ".", "is_actinoid", "or", "self", ".", "is_lanthanoid", ")", "and", "self", ".", "Z", "not", "in", "[", "71", ",", "103", "]", ":", "return", "\"f\"", "elif", "self", ".", "is_actinoid", "or...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.is_transition_metal
True if element is a transition metal.
pymatgen/core/periodic_table.py
def is_transition_metal(self): """ True if element is a transition metal. """ ns = list(range(21, 31)) ns.extend(list(range(39, 49))) ns.append(57) ns.extend(list(range(72, 81))) ns.append(89) ns.extend(list(range(104, 113))) return self.Z ...
def is_transition_metal(self): """ True if element is a transition metal. """ ns = list(range(21, 31)) ns.extend(list(range(39, 49))) ns.append(57) ns.extend(list(range(72, 81))) ns.append(89) ns.extend(list(range(104, 113))) return self.Z ...
[ "True", "if", "element", "is", "a", "transition", "metal", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L881-L891
[ "def", "is_transition_metal", "(", "self", ")", ":", "ns", "=", "list", "(", "range", "(", "21", ",", "31", ")", ")", "ns", ".", "extend", "(", "list", "(", "range", "(", "39", ",", "49", ")", ")", ")", "ns", ".", "append", "(", "57", ")", "n...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.nmr_quadrupole_moment
Get a dictionary the nuclear electric quadrupole moment in units of e*millibarns for various isotopes
pymatgen/core/periodic_table.py
def nmr_quadrupole_moment(self): """ Get a dictionary the nuclear electric quadrupole moment in units of e*millibarns for various isotopes """ return {k: FloatWithUnit(v, "mbarn") for k, v in self.data.get("NMR Quadrupole Moment", {}).items()}
def nmr_quadrupole_moment(self): """ Get a dictionary the nuclear electric quadrupole moment in units of e*millibarns for various isotopes """ return {k: FloatWithUnit(v, "mbarn") for k, v in self.data.get("NMR Quadrupole Moment", {}).items()}
[ "Get", "a", "dictionary", "the", "nuclear", "electric", "quadrupole", "moment", "in", "units", "of", "e", "*", "millibarns", "for", "various", "isotopes" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L970-L976
[ "def", "nmr_quadrupole_moment", "(", "self", ")", ":", "return", "{", "k", ":", "FloatWithUnit", "(", "v", ",", "\"mbarn\"", ")", "for", "k", ",", "v", "in", "self", ".", "data", ".", "get", "(", "\"NMR Quadrupole Moment\"", ",", "{", "}", ")", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.as_dict
Makes Element obey the general json interface used in pymatgen for easier serialization.
pymatgen/core/periodic_table.py
def as_dict(self): """ Makes Element obey the general json interface used in pymatgen for easier serialization. """ return {"@module": self.__class__.__module__, "@class": self.__class__.__name__, "element": self.symbol}
def as_dict(self): """ Makes Element obey the general json interface used in pymatgen for easier serialization. """ return {"@module": self.__class__.__module__, "@class": self.__class__.__name__, "element": self.symbol}
[ "Makes", "Element", "obey", "the", "general", "json", "interface", "used", "in", "pymatgen", "for", "easier", "serialization", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L999-L1006
[ "def", "as_dict", "(", "self", ")", ":", "return", "{", "\"@module\"", ":", "self", ".", "__class__", ".", "__module__", ",", "\"@class\"", ":", "self", ".", "__class__", ".", "__name__", ",", "\"element\"", ":", "self", ".", "symbol", "}" ]
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Element.print_periodic_table
A pretty ASCII printer for the periodic table, based on some filter_function. Args: filter_function: A filtering function taking an Element as input and returning a boolean. For example, setting filter_function = lambda el: el.X > 2 will print a periodic ...
pymatgen/core/periodic_table.py
def print_periodic_table(filter_function: callable = None): """ A pretty ASCII printer for the periodic table, based on some filter_function. Args: filter_function: A filtering function taking an Element as input and returning a boolean. For example, setting ...
def print_periodic_table(filter_function: callable = None): """ A pretty ASCII printer for the periodic table, based on some filter_function. Args: filter_function: A filtering function taking an Element as input and returning a boolean. For example, setting ...
[ "A", "pretty", "ASCII", "printer", "for", "the", "periodic", "table", "based", "on", "some", "filter_function", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1009-L1031
[ "def", "print_periodic_table", "(", "filter_function", ":", "callable", "=", "None", ")", ":", "for", "row", "in", "range", "(", "1", ",", "10", ")", ":", "rowstr", "=", "[", "]", "for", "group", "in", "range", "(", "1", ",", "19", ")", ":", "try",...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Specie.ionic_radius
Ionic radius of specie. Returns None if data is not present.
pymatgen/core/periodic_table.py
def ionic_radius(self): """ Ionic radius of specie. Returns None if data is not present. """ if self._oxi_state in self.ionic_radii: return self.ionic_radii[self._oxi_state] d = self._el.data oxstr = str(int(self._oxi_state)) if oxstr in d.get("Ionic ...
def ionic_radius(self): """ Ionic radius of specie. Returns None if data is not present. """ if self._oxi_state in self.ionic_radii: return self.ionic_radii[self._oxi_state] d = self._el.data oxstr = str(int(self._oxi_state)) if oxstr in d.get("Ionic ...
[ "Ionic", "radius", "of", "specie", ".", "Returns", "None", "if", "data", "is", "not", "present", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1137-L1155
[ "def", "ionic_radius", "(", "self", ")", ":", "if", "self", ".", "_oxi_state", "in", "self", ".", "ionic_radii", ":", "return", "self", ".", "ionic_radii", "[", "self", ".", "_oxi_state", "]", "d", "=", "self", ".", "_el", ".", "data", "oxstr", "=", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Specie.from_string
Returns a Specie from a string representation. Args: species_string (str): A typical string representation of a species, e.g., "Mn2+", "Fe3+", "O2-". Returns: A Specie object. Raises: ValueError if species_string cannot be intepreted.
pymatgen/core/periodic_table.py
def from_string(species_string: str): """ Returns a Specie from a string representation. Args: species_string (str): A typical string representation of a species, e.g., "Mn2+", "Fe3+", "O2-". Returns: A Specie object. Raises: ...
def from_string(species_string: str): """ Returns a Specie from a string representation. Args: species_string (str): A typical string representation of a species, e.g., "Mn2+", "Fe3+", "O2-". Returns: A Specie object. Raises: ...
[ "Returns", "a", "Specie", "from", "a", "string", "representation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1165-L1190
[ "def", "from_string", "(", "species_string", ":", "str", ")", ":", "m", "=", "re", ".", "search", "(", "r\"([A-Z][a-z]*)([0-9.]*)([+\\-])(.*)\"", ",", "species_string", ")", "if", "m", ":", "sym", "=", "m", ".", "group", "(", "1", ")", "oxi", "=", "1", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Specie.get_nmr_quadrupole_moment
Gets the nuclear electric quadrupole moment in units of e*millibarns Args: isotope (str): the isotope to get the quadrupole moment for default is None, which gets the lowest mass isotope
pymatgen/core/periodic_table.py
def get_nmr_quadrupole_moment(self, isotope=None): """ Gets the nuclear electric quadrupole moment in units of e*millibarns Args: isotope (str): the isotope to get the quadrupole moment for default is None, which gets the lowest mass isotope """ ...
def get_nmr_quadrupole_moment(self, isotope=None): """ Gets the nuclear electric quadrupole moment in units of e*millibarns Args: isotope (str): the isotope to get the quadrupole moment for default is None, which gets the lowest mass isotope """ ...
[ "Gets", "the", "nuclear", "electric", "quadrupole", "moment", "in", "units", "of", "e", "*", "millibarns" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1206-L1229
[ "def", "get_nmr_quadrupole_moment", "(", "self", ",", "isotope", "=", "None", ")", ":", "quad_mom", "=", "self", ".", "_el", ".", "nmr_quadrupole_moment", "if", "len", "(", "quad_mom", ")", "==", "0", ":", "return", "0.0", "if", "isotope", "is", "None", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Specie.get_shannon_radius
Get the local environment specific ionic radius for species. Args: cn (str): Coordination using roman letters. Supported values are I-IX, as well as IIIPY, IVPY and IVSQ. spin (str): Some species have different radii for different spins. You can get speci...
pymatgen/core/periodic_table.py
def get_shannon_radius(self, cn: str, spin: str = "", radius_type: str = "ionic"): """ Get the local environment specific ionic radius for species. Args: cn (str): Coordination using roman letters. Supported values are I-IX, as well as IIIP...
def get_shannon_radius(self, cn: str, spin: str = "", radius_type: str = "ionic"): """ Get the local environment specific ionic radius for species. Args: cn (str): Coordination using roman letters. Supported values are I-IX, as well as IIIP...
[ "Get", "the", "local", "environment", "specific", "ionic", "radius", "for", "species", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1231-L1281
[ "def", "get_shannon_radius", "(", "self", ",", "cn", ":", "str", ",", "spin", ":", "str", "=", "\"\"", ",", "radius_type", ":", "str", "=", "\"ionic\"", ")", ":", "radii", "=", "self", ".", "_el", ".", "data", "[", "\"Shannon radii\"", "]", "# if cn ==...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
Specie.get_crystal_field_spin
Calculate the crystal field spin based on coordination and spin configuration. Only works for transition metal species. Args: coordination (str): Only oct and tet are supported at the moment. spin_config (str): Supported keywords are "high" or "low". Returns: ...
pymatgen/core/periodic_table.py
def get_crystal_field_spin(self, coordination: str = "oct", spin_config: str = "high"): """ Calculate the crystal field spin based on coordination and spin configuration. Only works for transition metal species. Args: coordination (str): Only o...
def get_crystal_field_spin(self, coordination: str = "oct", spin_config: str = "high"): """ Calculate the crystal field spin based on coordination and spin configuration. Only works for transition metal species. Args: coordination (str): Only o...
[ "Calculate", "the", "crystal", "field", "spin", "based", "on", "coordination", "and", "spin", "configuration", ".", "Only", "works", "for", "transition", "metal", "species", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1283-L1334
[ "def", "get_crystal_field_spin", "(", "self", ",", "coordination", ":", "str", "=", "\"oct\"", ",", "spin_config", ":", "str", "=", "\"high\"", ")", ":", "if", "coordination", "not", "in", "(", "\"oct\"", ",", "\"tet\"", ")", "or", "spin_config", "not", "i...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DummySpecie.from_string
Returns a Dummy from a string representation. Args: species_string (str): A string representation of a dummy species, e.g., "X2+", "X3+". Returns: A DummySpecie object. Raises: ValueError if species_string cannot be intepreted.
pymatgen/core/periodic_table.py
def from_string(species_string: str): """ Returns a Dummy from a string representation. Args: species_string (str): A string representation of a dummy species, e.g., "X2+", "X3+". Returns: A DummySpecie object. Raises: ValueE...
def from_string(species_string: str): """ Returns a Dummy from a string representation. Args: species_string (str): A string representation of a dummy species, e.g., "X2+", "X3+". Returns: A DummySpecie object. Raises: ValueE...
[ "Returns", "a", "Dummy", "from", "a", "string", "representation", "." ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1479-L1506
[ "def", "from_string", "(", "species_string", ":", "str", ")", ":", "m", "=", "re", ".", "search", "(", "r\"([A-Z][a-z]*)([0-9.]*)([+\\-]*)(.*)\"", ",", "species_string", ")", "if", "m", ":", "sym", "=", "m", ".", "group", "(", "1", ")", "if", "m", ".", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DummySpecie.safe_from_composition
Returns a DummySpecie object that can be safely used with (i.e. not present in) a given composition
pymatgen/core/periodic_table.py
def safe_from_composition(cls, comp: "Composition", oxidation_state: float = 0): """ Returns a DummySpecie object that can be safely used with (i.e. not present in) a given composition """ # We don't want to add a DummySpecie with the same # ...
def safe_from_composition(cls, comp: "Composition", oxidation_state: float = 0): """ Returns a DummySpecie object that can be safely used with (i.e. not present in) a given composition """ # We don't want to add a DummySpecie with the same # ...
[ "Returns", "a", "DummySpecie", "object", "that", "can", "be", "safely", "used", "with", "(", "i", ".", "e", ".", "not", "present", "in", ")", "a", "given", "composition" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1509-L1523
[ "def", "safe_from_composition", "(", "cls", ",", "comp", ":", "\"Composition\"", ",", "oxidation_state", ":", "float", "=", "0", ")", ":", "# We don't want to add a DummySpecie with the same", "# symbol as anything in the composition, even if the", "# oxidation state is different...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectCompatibility.process_entry
Process a given Defect entry with qualifiers given from initialization of class. Order of processing is: 1) perform all possible defect corrections with information given 2) consider delocalization analyses based on qualifier metrics given initialization of class. If delocali...
pymatgen/analysis/defects/defect_compatibility.py
def process_entry(self, defect_entry): """ Process a given Defect entry with qualifiers given from initialization of class. Order of processing is: 1) perform all possible defect corrections with information given 2) consider delocalization analyses based on qualifier met...
def process_entry(self, defect_entry): """ Process a given Defect entry with qualifiers given from initialization of class. Order of processing is: 1) perform all possible defect corrections with information given 2) consider delocalization analyses based on qualifier met...
[ "Process", "a", "given", "Defect", "entry", "with", "qualifiers", "given", "from", "initialization", "of", "class", ".", "Order", "of", "processing", "is", ":", "1", ")", "perform", "all", "possible", "defect", "corrections", "with", "information", "given", "2...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/defect_compatibility.py#L74-L166
[ "def", "process_entry", "(", "self", ",", "defect_entry", ")", ":", "self", ".", "perform_all_corrections", "(", "defect_entry", ")", "self", ".", "delocalization_analysis", "(", "defect_entry", ")", "# apply corrections based on delocalization analysis", "corrections", "...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
DefectCompatibility.delocalization_analysis
Do delocalization analysis. To do this, one considers: i) sampling region of planar averaged electrostatic potential (freysoldt approach) ii) sampling region of atomic site averaged potentials (kumagai approach) iii) structural relaxation amount outside of radius considered in kumaga...
pymatgen/analysis/defects/defect_compatibility.py
def delocalization_analysis(self, defect_entry): """ Do delocalization analysis. To do this, one considers: i) sampling region of planar averaged electrostatic potential (freysoldt approach) ii) sampling region of atomic site averaged potentials (kumagai approach) iii...
def delocalization_analysis(self, defect_entry): """ Do delocalization analysis. To do this, one considers: i) sampling region of planar averaged electrostatic potential (freysoldt approach) ii) sampling region of atomic site averaged potentials (kumagai approach) iii...
[ "Do", "delocalization", "analysis", ".", "To", "do", "this", "one", "considers", ":", "i", ")", "sampling", "region", "of", "planar", "averaged", "electrostatic", "potential", "(", "freysoldt", "approach", ")", "ii", ")", "sampling", "region", "of", "atomic", ...
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/defect_compatibility.py#L275-L318
[ "def", "delocalization_analysis", "(", "self", ",", "defect_entry", ")", ":", "defect_entry", ".", "parameters", ".", "update", "(", "{", "'is_compatible'", ":", "True", "}", ")", "#this will be switched to False if delocalization is detected", "if", "'freysoldt_meta'", ...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da
train
get_d
Determine the distance of space between each layer of atoms along c
pymatgen/core/surface.py
def get_d(slab): """ Determine the distance of space between each layer of atoms along c """ sorted_sites = sorted(slab, key=lambda site: site.frac_coords[2]) for i, site in enumerate(sorted_sites): if "%.6f" % (site.frac_coords[2]) == \ "%.6f" % (sorted_sites[i +...
def get_d(slab): """ Determine the distance of space between each layer of atoms along c """ sorted_sites = sorted(slab, key=lambda site: site.frac_coords[2]) for i, site in enumerate(sorted_sites): if "%.6f" % (site.frac_coords[2]) == \ "%.6f" % (sorted_sites[i +...
[ "Determine", "the", "distance", "of", "space", "between", "each", "layer", "of", "atoms", "along", "c" ]
materialsproject/pymatgen
python
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L1520-L1534
[ "def", "get_d", "(", "slab", ")", ":", "sorted_sites", "=", "sorted", "(", "slab", ",", "key", "=", "lambda", "site", ":", "site", ".", "frac_coords", "[", "2", "]", ")", "for", "i", ",", "site", "in", "enumerate", "(", "sorted_sites", ")", ":", "i...
4ca558cf72f8d5f8a1f21dfdfc0181a971c186da