INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Finds the fermi level at which the doping concentration at the given temperature ( T ) is equal to c. A greedy algorithm is used where the relative error is minimized by calculating the doping at a grid which is continuously become finer. | def get_fermi(self, c, T, rtol=0.01, nstep=50, step=0.1, precision=8):
"""
Finds the fermi level at which the doping concentration at the given
temperature (T) is equal to c. A greedy algorithm is used where the
relative error is minimized by calculating the doping at a grid which
... |
Get the Dos for a particular orbital of a particular site. | def get_site_orbital_dos(self, site, orbital):
"""
Get the Dos for a particular orbital of a particular site.
Args:
site: Site in Structure associated with CompleteDos.
orbital: Orbital in the site.
Returns:
Dos containing densities for orbital of si... |
Get the total Dos for a site ( all orbitals ). | def get_site_dos(self, site):
"""
Get the total Dos for a site (all orbitals).
Args:
site: Site in Structure associated with CompleteDos.
Returns:
Dos containing summed orbital densities for site.
"""
site_dos = functools.reduce(add_densities, se... |
Get orbital projected Dos of a particular site | def get_site_spd_dos(self, site):
"""
Get orbital projected Dos of a particular site
Args:
site: Site in Structure associated with CompleteDos.
Returns:
dict of {orbital: Dos}, e.g. {"s": Dos object, ...}
"""
spd_dos = dict()
for orb, pdo... |
Get the t2g eg projected DOS for a particular site. | def get_site_t2g_eg_resolved_dos(self, site):
"""
Get the t2g, eg projected DOS for a particular site.
Args:
site: Site in Structure associated with CompleteDos.
Returns:
A dict {"e_g": Dos, "t2g": Dos} containing summed e_g and t2g DOS
for the site.... |
Get orbital projected Dos. | def get_spd_dos(self):
"""
Get orbital projected Dos.
Returns:
dict of {orbital: Dos}, e.g. {"s": Dos object, ...}
"""
spd_dos = {}
for atom_dos in self.pdos.values():
for orb, pdos in atom_dos.items():
orbital_type = _get_orb_type... |
Get element projected Dos. | def get_element_dos(self):
"""
Get element projected Dos.
Returns:
dict of {Element: Dos}
"""
el_dos = {}
for site, atom_dos in self.pdos.items():
el = site.specie
for pdos in atom_dos.values():
if el not in el_dos:
... |
Calculates spin polarization at Fermi level. | def spin_polarization(self):
"""
Calculates spin polarization at Fermi level.
See Sanvito et al., doi: 10.1126/sciadv.1602241 for
an example usage.
:return (float): spin polarization in range [0, 1],
will also return NaN if spin polarization ill-defined
(e.g. fo... |
Json - serializable dict representation of CompleteDos. | def as_dict(self):
"""
Json-serializable dict representation of CompleteDos.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__, "efermi": self.efermi,
"structure": self.structure.as_dict(),
"energies": list(self.energi... |
Get element and spd projected Dos | def get_element_spd_dos(self, el):
"""
Get element and spd projected Dos
Args:
el: Element in Structure.composition associated with LobsterCompleteDos
Returns:
dict of {Element: {"S": densities, "P": densities, "D": densities}}
"""
el = get_el_s... |
Returns: CompleteDos object from dict representation. | def from_dict(cls, d):
"""
Returns: CompleteDos object from dict representation.
"""
tdos = Dos.from_dict(d)
struct = Structure.from_dict(d["structure"])
pdoss = {}
for i in range(len(d["pdos"])):
at = struct[i]
orb_dos = {}
for... |
Get prototype ( s ) structures for a given input structure. If you use this method in your work please cite the appropriate AFLOW publication: | def get_prototypes(self, structure):
"""
Get prototype(s) structures for a given
input structure. If you use this method in
your work, please cite the appropriate
AFLOW publication:
Mehl, M. J., Hicks, D., Toher, C., Levy, O.,
Hanson, R. M., Hart, G., & Curtarolo... |
General pattern reading on an input string | def read_pattern(text_str, patterns, terminate_on_match=False,
postprocess=str):
"""
General pattern reading on an input string
Args:
text_str (str): the input string to search for patterns
patterns (dict): A dict of patterns, e.g.,
{"energy"... |
Parse table - like data. A table composes of three parts: header main body footer. All the data matches row pattern in the main body will be returned. | def read_table_pattern(text_str,
header_pattern,
row_pattern,
footer_pattern,
postprocess=str,
attribute_name=None,
last_one_only=False):
"""
Parse table-like data. A table c... |
Takes a dictionary and makes all the keys lower case. Also replaces jobtype with job_type just so that key specifically can be called elsewhere without ambiguity. Finally ensures that multiple identical keys that differed only due to different capitalizations are not present. If there are multiple equivalent keys an Ex... | def lower_and_check_unique(dict_to_check):
"""
Takes a dictionary and makes all the keys lower case. Also replaces
"jobtype" with "job_type" just so that key specifically can be called
elsewhere without ambiguity. Finally, ensures that multiple identical
keys, that differed only due to different cap... |
Takes a set of parsed coordinates which come as an array of strings and returns a numpy array of floats. | def process_parsed_coords(coords):
"""
Takes a set of parsed coordinates, which come as an array of strings,
and returns a numpy array of floats.
"""
geometry = np.zeros(shape=(len(coords), 3), dtype=float)
for ii, entry in enumerate(coords):
for jj in range(3):
geometry[ii, ... |
Generates the transformation matricies that convert a set of 2D vectors into a super lattice of integer area multiple as proven in Cassels: | def gen_sl_transform_matricies(area_multiple):
"""
Generates the transformation matricies that convert a set of 2D
vectors into a super lattice of integer area multiple as proven
in Cassels:
Cassels, John William Scott. An introduction to the geometry of
numbers. Springer Science & Business Med... |
Calculate angle between two vectors | def vec_angle(a, b):
"""
Calculate angle between two vectors
"""
cosang = np.dot(a, b)
sinang = fast_norm(np.cross(a, b))
return np.arctan2(sinang, cosang) |
Generate independent and unique basis vectors based on the methodology of Zur and McGill | def reduce_vectors(a, b):
"""
Generate independent and unique basis vectors based on the
methodology of Zur and McGill
"""
if np.dot(a, b) < 0:
return reduce_vectors(a, -b)
if fast_norm(a) > fast_norm(b):
return reduce_vectors(b, a)
if fast_norm(b) > fast_norm(np.add(b, a))... |
Determine if two sets of vectors are the same within length and angle tolerances | def is_same_vectors(self, vec_set1, vec_set2):
"""
Determine if two sets of vectors are the same within length and angle
tolerances
Args:
vec_set1(array[array]): an array of two vectors
vec_set2(array[array]): second array of two vectors
"""
if (n... |
Generates transformation sets for film/ substrate pair given the area of the unit cell area for the film and substrate. The transformation sets map the film and substrate unit cells to super lattices with a maximum area | def generate_sl_transformation_sets(self, film_area, substrate_area):
"""
Generates transformation sets for film/substrate pair given the
area of the unit cell area for the film and substrate. The
transformation sets map the film and substrate unit cells to super
lattices with a ... |
Applies the transformation_sets to the film and substrate vectors to generate super - lattices and checks if they matches. Returns all matching vectors sets. | def get_equiv_transformations(self, transformation_sets, film_vectors,
substrate_vectors):
"""
Applies the transformation_sets to the film and substrate vectors
to generate super-lattices and checks if they matches.
Returns all matching vectors sets.
... |
Returns dict which contains ZSL match | def match_as_dict(self, film_sl_vectors, substrate_sl_vectors, film_vectors, substrate_vectors, match_area):
"""
Returns dict which contains ZSL match
Args:
film_miller(array)
substrate_miller(array)
"""
d = {}
d["film_sl_vecs"] = np.asarray(film_... |
Generates the film/ substrate slab combinations for a set of given miller indicies | def generate_surface_vectors(self, film_millers, substrate_millers):
"""
Generates the film/substrate slab combinations for a set of given
miller indicies
Args:
film_millers(array): all miller indices to generate slabs for
film
substrate_millers(a... |
Finds all topological matches for the substrate and calculates elastic strain energy and total energy for the film if elasticity tensor and ground state energy are provided: | def calculate(self, film, substrate, elasticity_tensor=None,
film_millers=None, substrate_millers=None,
ground_state_energy=0, lowest=False):
"""
Finds all topological matches for the substrate and calculates elastic
strain energy and total energy for the film... |
Calculates the multi - plane elastic energy. Returns 999 if no elastic tensor was given on init | def calculate_3D_elastic_energy(self, film, match, elasticity_tensor=None,
include_strain=False):
"""
Calculates the multi-plane elastic energy. Returns 999 if no elastic
tensor was given on init
Args:
film(Structure): conventional standar... |
Convert a single frame XYZ string to a molecule | def _from_frame_string(contents):
"""
Convert a single frame XYZ string to a molecule
"""
lines = contents.split("\n")
num_sites = int(lines[0])
coords = []
sp = []
coord_patt = re.compile(
r"(\w+)\s+([0-9\-\+\.eEdD]+)\s+([0-9\-\+\.eEdD]+)\s+([... |
Creates XYZ object from a string. | def from_string(contents):
"""
Creates XYZ object from a string.
Args:
contents: String representing an XYZ file.
Returns:
XYZ object
"""
if contents[-1] != "\n":
contents += "\n"
white_space = r"[ \t\r\f\v]"
natoms_li... |
Returns a chemical shielding tensor aligned to the principle axis system so that only the 3 diagnol components are non - zero | def principal_axis_system(self):
"""
Returns a chemical shielding tensor aligned to the principle axis system
so that only the 3 diagnol components are non-zero
"""
return ChemicalShielding(np.diag(np.sort(np.linalg.eigvals(self)))) |
Returns: the Chemical shielding tensor in Haeberlen Notation | def haeberlen_values(self):
"""
Returns: the Chemical shielding tensor in Haeberlen Notation
"""
pas=self.principal_axis_system
sigma_iso=pas.trace() / 3
sigmas=np.diag(pas)
sigmas=sorted(sigmas, key=lambda x: np.abs(x - sigma_iso))
sigma_yy, sigma_xx, sig... |
Returns: the Chemical shielding tensor in Mehring Notation | def mehring_values(self):
"""
Returns: the Chemical shielding tensor in Mehring Notation
"""
pas=self.principal_axis_system
sigma_iso=pas.trace() / 3
sigma_11, sigma_22, sigma_33=np.diag(pas)
return self.MehringNotation(sigma_iso, sigma_11, sigma_22, sigma_33) |
Returns: the Chemical shielding tensor in Maryland Notation | def maryland_values(self):
"""
Returns: the Chemical shielding tensor in Maryland Notation
"""
pas=self.principal_axis_system
sigma_iso=pas.trace() / 3
omega=np.diag(pas)[2] - np.diag(pas)[0]
# There is a typo in equation 20 from Magn. Reson. Chem. 2008, 46, 582–5... |
Returns a electric field gradient tensor aligned to the principle axis system so that only the 3 diagnol components are non - zero | def principal_axis_system(self):
"""
Returns a electric field gradient tensor aligned to the principle axis system so that only the 3 diagnol components are non-zero
"""
return ElectricFieldGradient(np.diag(np.sort(np.linalg.eigvals(self)))) |
Asymmetry of the electric field tensor defined as: ( V_yy - V_xx )/ V_zz | def asymmetry(self):
"""
Asymmetry of the electric field tensor defined as:
(V_yy - V_xx)/V_zz
"""
diags=np.diag(self.principal_axis_system)
V=sorted(diags, key=np.abs)
return np.abs((V[1] - V[0]) / V[2]) |
Computes the couplling constant C_q as defined in: Wasylishen R E Ashbrook S E Wimperis S. NMR of quadrupolar nuclei in solid materials [ M ]. John Wiley & Sons 2012. ( Chapter 3. 2 ) | def coupling_constant(self, specie):
"""
Computes the couplling constant C_q as defined in:
Wasylishen R E, Ashbrook S E, Wimperis S. NMR of quadrupolar nuclei
in solid materials[M]. John Wiley & Sons, 2012. (Chapter 3.2)
C_q for a specific atom type for this electric fi... |
Obtain an analysis of a given structure and if it may be Jahn - Teller active or not. This is a heuristic and may give false positives and false negatives ( false positives are preferred ). | def get_analysis_and_structure(self,
structure,
calculate_valences=True,
guesstimate_spin=False,
op_threshold=0.1):
"""
Obtain an analysis of a given structure and ... |
Get magnitude of Jahn - Teller effect from provided species spin state and motife. | def get_magnitude_of_effect_from_species(self, species, spin_state, motif):
"""
Get magnitude of Jahn-Teller effect from provided species, spin state and motife.
:param species: e.g. Fe2+
:param spin_state (str): "high" or "low"
:param motif (str): "oct" or "tet"
:retur... |
Roughly the magnitude of Jahn - Teller distortion will be: * in octahedral environments strong if e_g orbitals unevenly occupied but weak if t_2g orbitals unevenly occupied * in tetrahedral environments always weaker: param motif ( str ): oct or tet: param spin_config ( dict ): dict of e ( e_g ) and t ( t2_g ) with num... | def get_magnitude_of_effect_from_spin_config(motif, spin_config):
"""
Roughly, the magnitude of Jahn-Teller distortion will be:
* in octahedral environments, strong if e_g orbitals
unevenly occupied but weak if t_2g orbitals unevenly
occupied
* in tetrahedral environments... |
Simple heuristic to estimate spin state. If magnetic moment is sufficiently close to that predicted for a given spin state we assign it that state. If we only have data for one spin state then that s the one we use ( e. g. we assume all tetrahedral complexes are high - spin since this is typically the case ). | def _estimate_spin_state(species, motif, known_magmom):
"""
Simple heuristic to estimate spin state. If magnetic moment
is sufficiently close to that predicted for a given spin state,
we assign it that state. If we only have data for one spin
state then that's the one we use (e.g... |
Calculates the spin - only magnetic moment for a given species. Only supports transition metals. | def mu_so(species, motif, spin_state):
"""
Calculates the spin-only magnetic moment for a
given species. Only supports transition metals.
:param species: str or Species
:param motif: "oct" or "tet"
:param spin_state: "high" or "low"
:return: spin-only magnetic mo... |
Conversion factor to convert between cm^2/ s diffusivity measurements and mS/ cm conductivity measurements based on number of atoms of diffusing species. Note that the charge is based on the oxidation state of the species ( where available ) or else the number of valence electrons ( usually a good guess esp for main gr... | def get_conversion_factor(structure, species, temperature):
"""
Conversion factor to convert between cm^2/s diffusivity measurements and
mS/cm conductivity measurements based on number of atoms of diffusing
species. Note that the charge is based on the oxidation state of the
species (where available... |
Internal method to support multiprocessing. | def _get_vasprun(args):
"""
Internal method to support multiprocessing.
"""
return Vasprun(args[0], ionic_step_skip=args[1],
parse_dos=False, parse_eigen=False) |
Returns Ea c standard error of Ea from the Arrhenius fit: D = c * exp ( - Ea/ kT ) | def fit_arrhenius(temps, diffusivities):
"""
Returns Ea, c, standard error of Ea from the Arrhenius fit:
D = c * exp(-Ea/kT)
Args:
temps ([float]): A sequence of temperatures. units: K
diffusivities ([float]): A sequence of diffusivities (e.g.,
from DiffusionAnalyzer.dif... |
Returns ( Arrhenius ) extrapolated diffusivity at new_temp | def get_extrapolated_diffusivity(temps, diffusivities, new_temp):
"""
Returns (Arrhenius) extrapolated diffusivity at new_temp
Args:
temps ([float]): A sequence of temperatures. units: K
diffusivities ([float]): A sequence of diffusivities (e.g.,
from DiffusionAnalyzer.diffusivi... |
Returns extrapolated mS/ cm conductivity. | def get_extrapolated_conductivity(temps, diffusivities, new_temp, structure,
species):
"""
Returns extrapolated mS/cm conductivity.
Args:
temps ([float]): A sequence of temperatures. units: K
diffusivities ([float]): A sequence of diffusivities (e.g.,
... |
Returns an Arrhenius plot. | def get_arrhenius_plot(temps, diffusivities, diffusivity_errors=None,
**kwargs):
"""
Returns an Arrhenius plot.
Args:
temps ([float]): A sequence of temperatures.
diffusivities ([float]): A sequence of diffusivities (e.g.,
from DiffusionAnalyzer.diffusivit... |
Returns an iterator for the drift - corrected structures. Use of iterator is to reduce memory usage as # of structures in MD can be huge. You don t often need all the structures all at once. | def get_drift_corrected_structures(self, start=None, stop=None, step=None):
"""
Returns an iterator for the drift-corrected structures. Use of
iterator is to reduce memory usage as # of structures in MD can be
huge. You don't often need all the structures all at once.
Args:
... |
Provides a summary of diffusion information. | def get_summary_dict(self, include_msd_t=False, include_mscd_t=False):
"""
Provides a summary of diffusion information.
Args:
include_msd_t (bool): Whether to include mean square displace and
time data with the data.
include_msd_t (bool): Whether to inclu... |
Get the plot of rms framework displacement vs time. Useful for checking for melting especially if framework atoms can move via paddle - wheel or similar mechanism ( which would show up in max framework displacement but doesn t constitute melting ). | def get_framework_rms_plot(self, plt=None, granularity=200,
matching_s=None):
"""
Get the plot of rms framework displacement vs time. Useful for checking
for melting, especially if framework atoms can move via paddle-wheel
or similar mechanism (which would ... |
Get the plot of the smoothed msd vs time graph. Useful for checking convergence. This can be written to an image file. | def get_msd_plot(self, plt=None, mode="specie"):
"""
Get the plot of the smoothed msd vs time graph. Useful for
checking convergence. This can be written to an image file.
Args:
plt: A plot object. Defaults to None, which means one will be
generated.
... |
Writes MSD data to a csv file that can be easily plotted in other software. | def export_msdt(self, filename):
"""
Writes MSD data to a csv file that can be easily plotted in other
software.
Args:
filename (str): Filename. Supported formats are csv and dat. If
the extension is csv, a csv file is written. Otherwise,
a da... |
Convenient constructor that takes in a list of Structure objects to perform diffusion analysis. | def from_structures(cls, structures, specie, temperature,
time_step, step_skip, initial_disp=None,
initial_structure=None, **kwargs):
"""
Convenient constructor that takes in a list of Structure objects to
perform diffusion analysis.
Args:... |
Convenient constructor that takes in a list of Vasprun objects to perform diffusion analysis. | def from_vaspruns(cls, vaspruns, specie, initial_disp=None,
initial_structure=None, **kwargs):
"""
Convenient constructor that takes in a list of Vasprun objects to
perform diffusion analysis.
Args:
vaspruns ([Vasprun]): List of Vaspruns (must be ordere... |
Convenient constructor that takes in a list of vasprun. xml paths to perform diffusion analysis. | def from_files(cls, filepaths, specie, step_skip=10, ncores=None,
initial_disp=None, initial_structure=None, **kwargs):
"""
Convenient constructor that takes in a list of vasprun.xml paths to
perform diffusion analysis.
Args:
filepaths ([str]): List of pat... |
Applies the strategy to the structure_environments object in order to define the coordination environment of a given site.: param site: Site for which the coordination environment is looked for: return: The coordination environment of the site. For complex strategies where one allows multiple solutions this can return ... | def get_site_coordination_environments_fractions(self, site, isite=None, dequivsite=None, dthissite=None,
mysym=None, ordered=True, min_fraction=0.0, return_maps=True,
return_strategy_dict_info=False):
"""
... |
Applies the strategy to the structure_environments object in order to get coordination environments their fraction csm geometry_info and neighbors: param site: Site for which the above information is seeked: return: The list of neighbors of the site. For complex strategies where one allows multiple solutions this can r... | def get_site_ce_fractions_and_neighbors(self, site, full_ce_info=False, strategy_info=False):
"""
Applies the strategy to the structure_environments object in order to get coordination environments, their
fraction, csm, geometry_info, and neighbors
:param site: Site for which the above i... |
Bson - serializable dict representation of the SimplestChemenvStrategy object.: return: Bson - serializable dict representation of the SimplestChemenvStrategy object. | def as_dict(self):
"""
Bson-serializable dict representation of the SimplestChemenvStrategy object.
:return: Bson-serializable dict representation of the SimplestChemenvStrategy object.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class__.__n... |
Reconstructs the SimplestChemenvStrategy object from a dict representation of the SimplestChemenvStrategy object created using the as_dict method.: param d: dict representation of the SimplestChemenvStrategy object: return: StructureEnvironments object | def from_dict(cls, d):
"""
Reconstructs the SimplestChemenvStrategy object from a dict representation of the SimplestChemenvStrategy object
created using the as_dict method.
:param d: dict representation of the SimplestChemenvStrategy object
:return: StructureEnvironments object
... |
Bson - serializable dict representation of the SimpleAbundanceChemenvStrategy object.: return: Bson - serializable dict representation of the SimpleAbundanceChemenvStrategy object. | def as_dict(self):
"""
Bson-serializable dict representation of the SimpleAbundanceChemenvStrategy object.
:return: Bson-serializable dict representation of the SimpleAbundanceChemenvStrategy object.
"""
return {"@module": self.__class__.__module__,
"@class": self... |
Bson - serializable dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object.: return: Bson - serializable dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object. | def as_dict(self):
"""
Bson-serializable dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object.
:return: Bson-serializable dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object.
"""
return {"@module": self.__class__.__module__,
... |
Reconstructs the TargettedPenaltiedAbundanceChemenvStrategy object from a dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object created using the as_dict method.: param d: dict representation of the TargettedPenaltiedAbundanceChemenvStrategy object: return: TargettedPenaltiedAbundanceChemenvStrat... | def from_dict(cls, d):
"""
Reconstructs the TargettedPenaltiedAbundanceChemenvStrategy object from a dict representation of the
TargettedPenaltiedAbundanceChemenvStrategy object created using the as_dict method.
:param d: dict representation of the TargettedPenaltiedAbundanceChemenvStrat... |
Bson - serializable dict representation of the WeightedNbSetChemenvStrategy object.: return: Bson - serializable dict representation of the WeightedNbSetChemenvStrategy object. | def as_dict(self):
"""
Bson-serializable dict representation of the WeightedNbSetChemenvStrategy object.
:return: Bson-serializable dict representation of the WeightedNbSetChemenvStrategy object.
"""
return {"@module": self.__class__.__module__,
"@class": self.__c... |
Reconstructs the WeightedNbSetChemenvStrategy object from a dict representation of the WeightedNbSetChemenvStrategy object created using the as_dict method.: param d: dict representation of the WeightedNbSetChemenvStrategy object: return: WeightedNbSetChemenvStrategy object | def from_dict(cls, d):
"""
Reconstructs the WeightedNbSetChemenvStrategy object from a dict representation of the
WeightedNbSetChemenvStrategy object created using the as_dict method.
:param d: dict representation of the WeightedNbSetChemenvStrategy object
:return: WeightedNbSetC... |
Bson - serializable dict representation of the MultiWeightsChemenvStrategy object.: return: Bson - serializable dict representation of the MultiWeightsChemenvStrategy object. | def as_dict(self):
"""
Bson-serializable dict representation of the MultiWeightsChemenvStrategy object.
:return: Bson-serializable dict representation of the MultiWeightsChemenvStrategy object.
"""
return {"@module": self.__class__.__module__,
"@class": self.__cla... |
Reconstructs the MultiWeightsChemenvStrategy object from a dict representation of the MultipleAbundanceChemenvStrategy object created using the as_dict method.: param d: dict representation of the MultiWeightsChemenvStrategy object: return: MultiWeightsChemenvStrategy object | def from_dict(cls, d):
"""
Reconstructs the MultiWeightsChemenvStrategy object from a dict representation of the
MultipleAbundanceChemenvStrategy object created using the as_dict method.
:param d: dict representation of the MultiWeightsChemenvStrategy object
:return: MultiWeights... |
Returns the theoretical Pauling stability ratio ( rC/ rA ) for this environment. | def pauling_stability_ratio(self):
"""
Returns the theoretical Pauling stability ratio (rC/rA) for this environment.
"""
if self._pauling_stability_ratio is None:
if self.ce_symbol in ['S:1', 'L:2']:
self._pauling_stability_ratio = 0.0
else:
... |
Returns the number of permutations of this coordination geometry. | def number_of_permutations(self):
"""
Returns the number of permutations of this coordination geometry.
"""
if self.permutations_safe_override:
return factorial(self.coordination)
elif self.permutations is None:
return factorial(self.coordination)
... |
Returns the list of faces of this coordination geometry. Each face is given as a list of its vertices coordinates. | def faces(self, sites, permutation=None):
"""
Returns the list of faces of this coordination geometry. Each face is given as a
list of its vertices coordinates.
"""
if permutation is None:
coords = [site.coords for site in sites]
else:
coords = [si... |
Returns the list of edges of this coordination geometry. Each edge is given as a list of its end vertices coordinates. | def edges(self, sites, permutation=None, input='sites'):
"""
Returns the list of edges of this coordination geometry. Each edge is given as a
list of its end vertices coordinates.
"""
if input == 'sites':
coords = [site.coords for site in sites]
elif input == ... |
Returns the list of perfect solid angles Each edge is given as a list of its end vertices coordinates. | def solid_angles(self, permutation=None):
"""
Returns the list of "perfect" solid angles Each edge is given as a
list of its end vertices coordinates.
"""
if permutation is None:
return self._solid_angles
else:
return [self._solid_angles[ii] for ii... |
Returns the pmesh strings used for jmol to show this geometry. | def get_pmeshes(self, sites, permutation=None):
"""
Returns the pmesh strings used for jmol to show this geometry.
"""
pmeshes = []
# _vertices = [site.coords for site in sites]
if permutation is None:
_vertices = [site.coords for site in sites]
else:
... |
Returns a list of coordination geometries with the given coordination number.: param coordination: The coordination number of which the list of coordination geometries are returned. | def get_geometries(self, coordination=None, returned='cg'):
"""
Returns a list of coordination geometries with the given coordination number.
:param coordination: The coordination number of which the list of coordination geometries are returned.
"""
geom = list()
if coord... |
Returns a list of the implemented coordination geometries with the given coordination number.: param coordination: The coordination number of which the list of implemented coordination geometries are returned. | def get_implemented_geometries(self, coordination=None, returned='cg',
include_deactivated=False):
"""
Returns a list of the implemented coordination geometries with the given coordination number.
:param coordination: The coordination number of which the list o... |
Returns a list of the implemented coordination geometries with the given coordination number.: param coordination: The coordination number of which the list of implemented coordination geometries are returned. | def get_not_implemented_geometries(self, coordination=None,
returned='mp_symbol'):
"""
Returns a list of the implemented coordination geometries with the given coordination number.
:param coordination: The coordination number of which the list of implemente... |
Returns the coordination geometry of the given name.: param name: The name of the coordination geometry. | def get_geometry_from_name(self, name):
"""
Returns the coordination geometry of the given name.
:param name: The name of the coordination geometry.
"""
for gg in self.cg_list:
if gg.name == name or name in gg.alternative_names:
return gg
raise... |
Returns the coordination geometry of the given IUPAC symbol.: param IUPAC_symbol: The IUPAC symbol of the coordination geometry. | def get_geometry_from_IUPAC_symbol(self, IUPAC_symbol):
"""
Returns the coordination geometry of the given IUPAC symbol.
:param IUPAC_symbol: The IUPAC symbol of the coordination geometry.
"""
for gg in self.cg_list:
if gg.IUPAC_symbol == IUPAC_symbol:
... |
Returns the coordination geometry of the given IUCr symbol.: param IUCr_symbol: The IUCr symbol of the coordination geometry. | def get_geometry_from_IUCr_symbol(self, IUCr_symbol):
"""
Returns the coordination geometry of the given IUCr symbol.
:param IUCr_symbol: The IUCr symbol of the coordination geometry.
"""
for gg in self.cg_list:
if gg.IUCr_symbol == IUCr_symbol:
return... |
Returns the coordination geometry of the given mp_symbol.: param mp_symbol: The mp_symbol of the coordination geometry. | def get_geometry_from_mp_symbol(self, mp_symbol):
"""
Returns the coordination geometry of the given mp_symbol.
:param mp_symbol: The mp_symbol of the coordination geometry.
"""
for gg in self.cg_list:
if gg.mp_symbol == mp_symbol:
return gg
ra... |
Checks whether a given coordination geometry is valid ( exists ) and whether the parameters are coherent with each other.: param IUPAC_symbol:: param IUCr_symbol:: param name:: param cn:: param mp_symbol: The mp_symbol of the coordination geometry. | def is_a_valid_coordination_geometry(self, mp_symbol=None,
IUPAC_symbol=None, IUCr_symbol=None,
name=None, cn=None):
"""
Checks whether a given coordination geometry is valid (exists) and whether the parameters are coheren... |
True if species are exactly the same i. e. Fe2 + == Fe2 + but not Fe3 +. and the spins are reversed. i. e. spin up maps to spin down and vice versa. | def are_equal(self, sp1, sp2):
"""
True if species are exactly the same, i.e., Fe2+ == Fe2+ but not
Fe3+. and the spins are reversed. i.e., spin up maps to spin down,
and vice versa.
Args:
sp1: First species. A dict of {specie/element: amt} as per the
... |
True if element: amounts are exactly the same i. e. oxidation state is not considered. | def are_equal(self, sp1, sp2):
"""
True if element:amounts are exactly the same, i.e.,
oxidation state is not considered.
Args:
sp1: First species. A dict of {specie/element: amt} as per the
definition in Site and PeriodicSite.
sp2: Second species... |
True if there is some overlap in composition between the species | def are_equal(self, sp1, sp2):
"""
True if there is some overlap in composition between the species
Args:
sp1: First species. A dict of {specie/element: amt} as per the
definition in Site and PeriodicSite.
sp2: Second species. A dict of {specie/element: a... |
Args: sp1: First species. A dict of { specie/ element: amt } as per the definition in Site and PeriodicSite. sp2: Second species. A dict of { specie/ element: amt } as per the definition in Site and PeriodicSite. | def are_equal(self, sp1, sp2):
"""
Args:
sp1: First species. A dict of {specie/element: amt} as per the
definition in Site and PeriodicSite.
sp2: Second species. A dict of {specie/element: amt} as per the
definition in Site and PeriodicSite.
... |
Returns the supercell size and whether the supercell should be applied to s1. If fu == 1 s1_supercell is returned as true to avoid ambiguity. | def _get_supercell_size(self, s1, s2):
"""
Returns the supercell size, and whether the supercell should
be applied to s1. If fu == 1, s1_supercell is returned as
true, to avoid ambiguity.
"""
if self._supercell_size == 'num_sites':
fu = s2.num_sites / s1.num_s... |
Yields lattices for s with lengths and angles close to the lattice of target_s. If supercell_size is specified the returned lattice will have that number of primitive cells in it | def _get_lattices(self, target_lattice, s, supercell_size=1):
"""
Yields lattices for s with lengths and angles close to the
lattice of target_s. If supercell_size is specified, the
returned lattice will have that number of primitive cells
in it
Args:
s, targ... |
Computes all supercells of one structure close to the lattice of the other if s1_supercell == True it makes the supercells of struct1 otherwise it makes them of s2 | def _get_supercells(self, struct1, struct2, fu, s1_supercell):
"""
Computes all supercells of one structure close to the lattice of the
other
if s1_supercell == True, it makes the supercells of struct1, otherwise
it makes them of s2
yields: s1, s2, supercell_matrix, aver... |
Returns true if a matching exists between s2 and s2 under frac_tol. s2 should be a subset of s1 | def _cmp_fstruct(self, s1, s2, frac_tol, mask):
"""
Returns true if a matching exists between s2 and s2
under frac_tol. s2 should be a subset of s1
"""
if len(s2) > len(s1):
raise ValueError("s1 must be larger than s2")
if mask.shape != (len(s2), len(s1)):
... |
Finds a matching in cartesian space. Finds an additional fractional translation vector to minimize RMS distance | def _cart_dists(self, s1, s2, avg_lattice, mask, normalization, lll_frac_tol=None):
"""
Finds a matching in cartesian space. Finds an additional
fractional translation vector to minimize RMS distance
Args:
s1, s2: numpy arrays of fractional coordinates. len(s1) >= len(s2)
... |
Returns mask for matching struct2 to struct1. If struct1 has sites a b c and fu = 2 assumes supercells of struct2 will be ordered aabbcc ( rather than abcabc ) | def _get_mask(self, struct1, struct2, fu, s1_supercell):
"""
Returns mask for matching struct2 to struct1. If struct1 has sites
a b c, and fu = 2, assumes supercells of struct2 will be ordered
aabbcc (rather than abcabc)
Returns:
mask, struct1 translation indices, struct... |
Fit two structures. | def fit(self, struct1, struct2):
"""
Fit two structures.
Args:
struct1 (Structure): 1st structure
struct2 (Structure): 2nd structure
Returns:
True or False.
"""
struct1, struct2 = self._process_species([struct1, struct2])
if ... |
Calculate RMS displacement between two structures | def get_rms_dist(self, struct1, struct2):
"""
Calculate RMS displacement between two structures
Args:
struct1 (Structure): 1st structure
struct2 (Structure): 2nd structure
Returns:
rms displacement normalized by (Vol / nsites) ** (1/3)
an... |
Rescales finds the reduced structures ( primitive and niggli ) and finds fu the supercell size to make struct1 comparable to s2 | def _preprocess(self, struct1, struct2, niggli=True):
"""
Rescales, finds the reduced structures (primitive and niggli),
and finds fu, the supercell size to make struct1 comparable to
s2
"""
struct1 = struct1.copy()
struct2 = struct2.copy()
if niggli:
... |
Matches one struct onto the other | def _match(self, struct1, struct2, fu, s1_supercell=True, use_rms=False,
break_on_match=False):
"""
Matches one struct onto the other
"""
ratio = fu if s1_supercell else 1/fu
if len(struct1) * ratio >= len(struct2):
return self._strict_match(
... |
Matches struct2 onto struct1 ( which should contain all sites in struct2 ). | def _strict_match(self, struct1, struct2, fu, s1_supercell=True,
use_rms=False, break_on_match=False):
"""
Matches struct2 onto struct1 (which should contain all sites in
struct2).
Args:
struct1, struct2 (Structure): structures to be matched
... |
Given a list of structures use fit to group them by structural equality. | def group_structures(self, s_list, anonymous=False):
"""
Given a list of structures, use fit to group
them by structural equality.
Args:
s_list ([Structure]): List of structures to be grouped
anonymous (bool): Wheher to use anonymous mode.
Returns:
... |
Tries all permutations of matching struct1 to struct2. Args: struct1 struct2 ( Structure ): Preprocessed input structures Returns: List of ( mapping match ) | def _anonymous_match(self, struct1, struct2, fu, s1_supercell=True,
use_rms=False, break_on_match=False, single_match=False):
"""
Tries all permutations of matching struct1 to struct2.
Args:
struct1, struct2 (Structure): Preprocessed input structures
... |
Performs an anonymous fitting which allows distinct species in one structure to map to another. E. g. to compare if the Li2O and Na2O structures are similar. | def get_rms_anonymous(self, struct1, struct2):
"""
Performs an anonymous fitting, which allows distinct species in one
structure to map to another. E.g., to compare if the Li2O and Na2O
structures are similar.
Args:
struct1 (Structure): 1st structure
stru... |
Performs an anonymous fitting which allows distinct species in one structure to map to another. E. g. to compare if the Li2O and Na2O structures are similar. If multiple substitutions are within tolerance this will return the one which minimizes the difference in electronegativity between the matches species. | def get_best_electronegativity_anonymous_mapping(self, struct1, struct2):
"""
Performs an anonymous fitting, which allows distinct species in one
structure to map to another. E.g., to compare if the Li2O and Na2O
structures are similar. If multiple substitutions are within tolerance
... |
Performs an anonymous fitting which allows distinct species in one structure to map to another. Returns a dictionary of species substitutions that are within tolerance | def get_all_anonymous_mappings(self, struct1, struct2, niggli=True,
include_dist=False):
"""
Performs an anonymous fitting, which allows distinct species in one
structure to map to another. Returns a dictionary of species
substitutions that are within t... |
Performs an anonymous fitting which allows distinct species in one structure to map to another. E. g. to compare if the Li2O and Na2O structures are similar. | def fit_anonymous(self, struct1, struct2, niggli=True):
"""
Performs an anonymous fitting, which allows distinct species in one
structure to map to another. E.g., to compare if the Li2O and Na2O
structures are similar.
Args:
struct1 (Structure): 1st structure
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.