INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Applies heuristics to return a magnetic ordering for a collinear magnetic structure. Result is not guaranteed for correctness.: return: Ordering Enum ( FiM is used as the abbreviation for ferrimagnetic ) | def ordering(self):
"""
Applies heuristics to return a magnetic ordering for a collinear
magnetic structure. Result is not guaranteed for correctness.
:return: Ordering Enum ('FiM' is used as the abbreviation for
ferrimagnetic)
"""
if not self.is_collinear:
... |
Returns the information on the symmetry of the Hamiltonian describing the exchange energy of the system taking into account relative direction of magnetic moments but not their absolute direction. | def get_exchange_group_info(self, symprec=1e-2, angle_tolerance=5.0):
"""
Returns the information on the symmetry of the Hamiltonian
describing the exchange energy of the system, taking into
account relative direction of magnetic moments but not their
absolute direction.
... |
Compares the magnetic orderings of one structure with another.: param other: Structure: return ( bool ): | def matches_ordering(self, other):
"""
Compares the magnetic orderings of one structure with another.
:param other: Structure
:return (bool):
"""
a = CollinearMagneticStructureAnalyzer(
self.structure, overwrite_magmom_mode="normalize"
).get_structure... |
Sanitize our input structure by removing magnetic information and making primitive. | def _sanitize_input_structure(input_structure):
"""
Sanitize our input structure by removing magnetic information
and making primitive.
Args:
input_structure: Structure
Returns: Structure
"""
input_structure = input_structure.copy()
# remov... |
The central problem with trying to enumerate magnetic orderings is that we have to enumerate orderings that might plausibly be magnetic ground states while not enumerating orderings that are physically implausible. The problem is that it is not always obvious by e. g. symmetry arguments alone which orderings to prefer.... | def _generate_transformations(self, structure):
"""
The central problem with trying to enumerate magnetic orderings is
that we have to enumerate orderings that might plausibly be magnetic
ground states, while not enumerating orderings that are physically
implausible. The problem ... |
Apply our input structure to our list of transformations and output a list of ordered structures that have been pruned for duplicates and for those with low symmetry ( optional ). | def _generate_ordered_structures(self, sanitized_input_structure, transformations):
"""
Apply our input structure to our list of transformations and output a list
of ordered structures that have been pruned for duplicates and for those
with low symmetry (optional).
Args:
... |
Remove uncertainty brackets from strings and return the float. | def str2float(text):
"""
Remove uncertainty brackets from strings and return the float.
"""
try:
# Note that the ending ) is sometimes missing. That is why the code has
# been modified to treat it as optional. Same logic applies to lists.
return float(re.sub(r"\(.+\)*", "", text... |
Some CIF files do not conform to spec. This function corrects known issues particular in regards to Springer materials/ Pauling files. | def _sanitize_data(self, data):
"""
Some CIF files do not conform to spec. This function corrects
known issues, particular in regards to Springer materials/
Pauling files.
This function is here so that CifParser can assume its
input conforms to spec, simplifying its impl... |
Generate unique coordinates using coord and symmetry positions and also their corresponding magnetic moments if supplied. | def _unique_coords(self, coords_in, magmoms_in=None, lattice=None):
"""
Generate unique coordinates using coord and symmetry positions
and also their corresponding magnetic moments, if supplied.
"""
coords = []
if magmoms_in:
magmoms = []
if len(ma... |
Generate the lattice from the provided lattice parameters. In the absence of all six lattice parameters the crystal system and necessary parameters are parsed | def get_lattice(self, data, length_strings=("a", "b", "c"),
angle_strings=("alpha", "beta", "gamma"),
lattice_type=None):
"""
Generate the lattice from the provided lattice parameters. In
the absence of all six lattice parameters, the crystal system
... |
In order to generate symmetry equivalent positions the symmetry operations are parsed. If the symops are not present the space group symbol is parsed and symops are generated. | def get_symops(self, data):
"""
In order to generate symmetry equivalent positions, the symmetry
operations are parsed. If the symops are not present, the space
group symbol is parsed, and symops are generated.
"""
symops = []
for symmetry_label in ["_symmetry_equ... |
Equivalent to get_symops except for magnetic symmetry groups. Separate function since additional operation for time reversal symmetry ( which changes magnetic moments on sites ) needs to be returned. | def get_magsymops(self, data):
"""
Equivalent to get_symops except for magnetic symmetry groups.
Separate function since additional operation for time reversal symmetry
(which changes magnetic moments on sites) needs to be returned.
"""
magsymmops = []
# check to... |
Parse oxidation states from data dictionary | def parse_oxi_states(self, data):
"""
Parse oxidation states from data dictionary
"""
try:
oxi_states = {
data["_atom_type_symbol"][i]:
str2float(data["_atom_type_oxidation_number"][i])
for i in range(len(data["_atom_type_sy... |
Parse atomic magnetic moments from data dictionary | def parse_magmoms(self, data, lattice=None):
"""
Parse atomic magnetic moments from data dictionary
"""
if lattice is None:
raise Exception(
'Magmoms given in terms of crystal axes in magCIF spec.')
try:
magmoms = {
data["_a... |
Parse a string with a symbol to extract a string representing an element. | def _parse_symbol(self, sym):
"""
Parse a string with a symbol to extract a string representing an element.
Args:
sym (str): A symbol to be parsed.
Returns:
A string with the parsed symbol. None if no parsing was possible.
"""
# Common representa... |
Generate structure from part of the cif. | def _get_structure(self, data, primitive):
"""
Generate structure from part of the cif.
"""
def get_num_implicit_hydrogens(sym):
num_h = {"Wat": 2, "wat": 2, "O-H": 1}
return num_h.get(sym[:3], 0)
lattice = self.get_lattice(data)
# if magCIF, ge... |
Return list of structures in CIF file. primitive boolean sets whether a conventional cell structure or primitive cell structure is returned. | def get_structures(self, primitive=True):
"""
Return list of structures in CIF file. primitive boolean sets whether a
conventional cell structure or primitive cell structure is returned.
Args:
primitive (bool): Set to False to return conventional unit cells.
... |
Get BibTeX reference from CIF file.: param data:: return: BibTeX string | def get_bibtex_string(self):
"""
Get BibTeX reference from CIF file.
:param data:
:return: BibTeX string
"""
bibtex_keys = {'author': ('_publ_author_name', '_citation_author_name'),
'title': ('_publ_section_title', '_citation_title'),
... |
Converts a list of SlabEntry to an appropriate dictionary. It is assumed that if there is no adsorbate then it is a clean SlabEntry and that adsorbed SlabEntry has the clean_entry parameter set. | def entry_dict_from_list(all_slab_entries):
"""
Converts a list of SlabEntry to an appropriate dictionary. It is
assumed that if there is no adsorbate, then it is a clean SlabEntry
and that adsorbed SlabEntry has the clean_entry parameter set.
Args:
all_slab_entries (list): List of SlabEntr... |
Uses dot product of numpy array to sub chemical potentials into the surface grand potential. This is much faster than using the subs function in sympy. Args: gamma_dict ( dict ): Surface grand potential equation as a coefficient dictionary chempots ( dict ): Dictionary assigning each chemical potential ( key ) in gamma... | def sub_chempots(gamma_dict, chempots):
"""
Uses dot product of numpy array to sub chemical potentials
into the surface grand potential. This is much faster
than using the subs function in sympy.
Args:
gamma_dict (dict): Surface grand potential equation
as a coefficient d... |
Returns dict which contains Slab Entry data. | def as_dict(self):
"""
Returns dict which contains Slab Entry data.
"""
d = {"@module": self.__class__.__module__,
"@class": self.__class__.__name__}
d["structure"] = self.structure
d["energy"] = self.energy
d["miller_index"] = self.miller_index
... |
Returns the adsorption energy or Gibb s binding energy of an adsorbate on a surface Args: eads ( bool ): Whether to calculate the adsorption energy ( True ) or the binding energy ( False ) which is just adsorption energy normalized by number of adsorbates. | def gibbs_binding_energy(self, eads=False):
"""
Returns the adsorption energy or Gibb's binding energy
of an adsorbate on a surface
Args:
eads (bool): Whether to calculate the adsorption energy
(True) or the binding energy (False) which is just
... |
Calculates the surface energy of this SlabEntry. Args: ucell_entry ( entry ): An entry object for the bulk ref_entries ( list: [ entry ] ): A list of entries for each type of element to be used as a reservoir for nonstoichiometric systems. The length of this list MUST be n - 1 where n is the number of different element... | def surface_energy(self, ucell_entry, ref_entries=None):
"""
Calculates the surface energy of this SlabEntry.
Args:
ucell_entry (entry): An entry object for the bulk
ref_entries (list: [entry]): A list of entries for each type
of element to be used as a re... |
Returns the surface area of the adsorbed system per unit area of the primitive slab system. | def get_unit_primitive_area(self):
"""
Returns the surface area of the adsorbed system per
unit area of the primitive slab system.
"""
A_ads = self.surface_area
A_clean = self.clean_entry.surface_area
n = (A_ads / A_clean)
return n |
Returns the primitive unit surface area density of the adsorbate. | def get_monolayer(self):
"""
Returns the primitive unit surface area density of the
adsorbate.
"""
unit_a = self.get_unit_primitive_area
Nsurfs = self.Nsurfs_ads_in_slab
Nads = self.Nads_in_slab
return Nads / (unit_a * Nsurfs) |
Returns the TOTAL number of adsorbates in the slab on BOTH sides | def Nads_in_slab(self):
"""
Returns the TOTAL number of adsorbates in the slab on BOTH sides
"""
return sum([self.composition.as_dict()[a] for a \
in self.ads_entries_dict.keys()]) |
Returns the TOTAL number of adsorbed surfaces in the slab | def Nsurfs_ads_in_slab(self):
"""
Returns the TOTAL number of adsorbed surfaces in the slab
"""
struct = self.structure
weights = [s.species.weight for s in struct]
center_of_mass = np.average(struct.frac_coords,
weights=weights, axis=... |
Returns a SlabEntry by reading in an dictionary | def from_dict(cls, d):
"""
Returns a SlabEntry by reading in an dictionary
"""
structure = SlabEntry.from_dict(d["structure"])
energy = SlabEntry.from_dict(d["energy"])
miller_index = d["miller_index"]
label = d["label"]
coverage = d["coverage"]
a... |
Returns a slab with the adsorbates removed | def cleaned_up_slab(self):
"""
Returns a slab with the adsorbates removed
"""
ads_strs = list(self.ads_entries_dict.keys())
cleaned = self.structure.copy()
cleaned.remove_species(ads_strs)
return cleaned |
Returns a label ( str ) for this particular slab based on composition coverage and Miller index. | def create_slab_label(self):
"""
Returns a label (str) for this particular slab based
on composition, coverage and Miller index.
"""
if "label" in self.data.keys():
return self.data["label"]
label = str(self.miller_index)
ads_strs = list(self.ads... |
Returns SlabEntry from a ComputedStructureEntry | def from_computed_structure_entry(entry, miller_index, label=None,
adsorbates=None, clean_entry=None, **kwargs):
"""
Returns SlabEntry from a ComputedStructureEntry
"""
return SlabEntry(entry.structure, entry.energy, miller_index, label=label,
... |
Returns the entry corresponding to the most stable slab for a particular facet at a specific chempot. We assume that surface energy is constant so all free variables must be set with delu_dict otherwise they are assumed to be equal to delu_default. | def get_stable_entry_at_u(self, miller_index, delu_dict=None, delu_default=0,
no_doped=False, no_clean=False):
"""
Returns the entry corresponding to the most stable slab for a particular
facet at a specific chempot. We assume that surface energy is constant
... |
Method to get the Wulff shape at a specific chemical potential. | def wulff_from_chempot(self, delu_dict=None, delu_default=0, symprec=1e-5,
no_clean=False, no_doped=False):
"""
Method to get the Wulff shape at a specific chemical potential.
Args:
delu_dict (Dict): Dictionary of the chemical potentials to be set as
... |
1D plot. Plots the change in the area contribution of each facet as a function of chemical potential. | def area_frac_vs_chempot_plot(self, ref_delu, chempot_range, delu_dict=None,
delu_default=0, increments=10, no_clean=False, no_doped=False):
"""
1D plot. Plots the change in the area contribution
of each facet as a function of chemical potential.
Args:
... |
Takes in a list of SlabEntries and calculates the chemical potentials at which all slabs in the list coexists simultaneously. Useful for building surface phase diagrams. Note that to solve for x equations ( x slab_entries ) there must be x free variables ( chemical potentials ). Adjust delu_dict as need be to get the c... | def get_surface_equilibrium(self, slab_entries, delu_dict=None):
"""
Takes in a list of SlabEntries and calculates the chemical potentials
at which all slabs in the list coexists simultaneously. Useful for
building surface phase diagrams. Note that to solve for x equations
... |
Creates a dictionary where each entry is a key pointing to a chemical potential range where the surface of that entry is stable. Does so by enumerating through all possible solutions ( intersect ) for surface energies of a specific facet. | def stable_u_range_dict(self, chempot_range, ref_delu, no_doped=True,
no_clean=False, delu_dict={}, miller_index=(),
dmu_at_0=False, return_se_dict=False):
"""
Creates a dictionary where each entry is a key pointing to a
chemical potential ... |
Helper function to assign each facet a unique color using a dictionary. | def color_palette_dict(self, alpha=0.35):
"""
Helper function to assign each facet a unique color using a dictionary.
Args:
alpha (float): Degree of transparency
return (dict): Dictionary of colors (r,g,b,a) when plotting surface
energy stability. The keys are i... |
Helper function to help plot the surface energy of a single SlabEntry as a function of chemical potential. | def chempot_vs_gamma_plot_one(self, plt, entry, ref_delu, chempot_range,
delu_dict={}, delu_default=0, label='', JPERM2=False):
"""
Helper function to help plot the surface energy of a
single SlabEntry as a function of chemical potential.
Args:
... |
Plots the surface energy as a function of chemical potential. Each facet will be associated with its own distinct colors. Dashed lines will represent stoichiometries different from that of the mpid s compound. Transparent lines indicates adsorption. | def chempot_vs_gamma(self, ref_delu, chempot_range, miller_index=(),
delu_dict={}, delu_default=0, JPERM2=False,
show_unstable=False, ylim=[], plt=None,
no_clean=False, no_doped=False,
use_entry_labels=False, no_label=Fa... |
Plots the binding energy energy as a function of monolayers ( ML ) i. e. the fractional area adsorbate density for all facets. For each facet at a specific monlayer only plot the lowest binding energy. | def monolayer_vs_BE(self, plot_eads=False):
"""
Plots the binding energy energy as a function of monolayers (ML), i.e.
the fractional area adsorbate density for all facets. For each
facet at a specific monlayer, only plot the lowest binding energy.
Args:
plot... |
Helper function to a chempot plot look nicer. | def chempot_plot_addons(self, plt, xrange, ref_el, axes, pad=2.4,
rect=[-0.047, 0, 0.84, 1], ylim=[]):
"""
Helper function to a chempot plot look nicer.
Args:
plt (Plot) Plot to add things to.
xrange (list): xlim parameter
ref_el ... |
For each facet plot the clean surface energy against the most stable binding energy. Args: delu_dict ( Dict ): Dictionary of the chemical potentials to be set as constant. Note the key should be a sympy Symbol object of the format: Symbol ( delu_el ) where el is the name of the element. delu_default ( float ): Default ... | def BE_vs_clean_SE(self, delu_dict, delu_default=0, plot_eads=False,
annotate_monolayer=True, JPERM2=False):
"""
For each facet, plot the clean surface energy against the most
stable binding energy.
Args:
delu_dict (Dict): Dictionary of the chemical... |
Adapted from the get_chempot_range_map () method in the PhaseDiagram class. Plot the chemical potential range map based on surface energy stability. Currently works only for 2 - component PDs. At the moment uses a brute force method by enumerating through the range of the first element chempot with a specified incremen... | def surface_chempot_range_map(self, elements, miller_index, ranges,
incr=50, no_doped=False, no_clean=False,
delu_dict=None, plt=None, annotate=True,
show_unphyiscal_only=False, fontsize=10):
"""
Adapte... |
Sets all chemical potential values and returns a dictionary where the key is a sympy Symbol and the value is a float ( chempot ). | def set_all_variables(self, delu_dict, delu_default):
"""
Sets all chemical potential values and returns a dictionary where
the key is a sympy Symbol and the value is a float (chempot).
Args:
entry (SlabEntry): Computed structure entry of the slab
delu_dict (... |
Returns a plot of the local potential ( eV ) vs the position along the c axis of the slab model ( Ang ) | def get_locpot_along_slab_plot(self, label_energies=True,
plt=None, label_fontsize=10):
"""
Returns a plot of the local potential (eV) vs the
position along the c axis of the slab model (Ang)
Args:
label_energies (bool): Whether to labe... |
Handles the optional labelling of the plot with relevant quantities Args: plt ( plt ): Plot of the locpot vs c axis label_fontsize ( float ): Fontsize of labels Returns Labelled plt | def get_labels(self, plt, label_fontsize=10):
"""
Handles the optional labelling of the plot with relevant quantities
Args:
plt (plt): Plot of the locpot vs c axis
label_fontsize (float): Fontsize of labels
Returns Labelled plt
"""
# center of vac... |
A well converged work function should have a flat electrostatic potential within some distance ( min_point ) about where the peak electrostatic potential is found along the c direction of the slab. This is dependent on the size of the slab. Args: min_point ( fractional coordinates ): The number of data points +/ - the ... | def is_converged(self, min_points_frac=0.015, tol=0.0025):
"""
A well converged work function should have a flat electrostatic
potential within some distance (min_point) about where the peak
electrostatic potential is found along the c direction of the
slab. This is d... |
Gives the radial size of two particles where equilibrium is reached between both particles. NOTE: the solution here is not the same as the solution visualized in the plot because solving for r requires that both the total surface area and volume of the particles are functions of r. | def solve_equilibrium_point(self, analyzer1, analyzer2,
delu_dict={}, delu_default=0, units="nanometers"):
"""
Gives the radial size of two particles where equilibrium is reached
between both particles. NOTE: the solution here is not the same
as th... |
Calculates the formation energy of the particle with arbitrary radius r. | def wulff_gform_and_r(self, wulffshape, bulk_entry, r, from_sphere_area=False,
r_units="nanometers", e_units="keV", normalize=False,
scale_per_atom=False):
"""
Calculates the formation energy of the particle with arbitrary radius r.
Args:
... |
Scales the Wulff shape with an effective radius r. Note that the resulting Wulff does not neccesarily have the same effective radius as the one provided. The Wulff shape is scaled by its surface energies where first the surface energies are scale by the minimum surface energy and then multiplied by the given effective ... | def scaled_wulff(self, wulffshape, r):
"""
Scales the Wulff shape with an effective radius r. Note that the resulting
Wulff does not neccesarily have the same effective radius as the one
provided. The Wulff shape is scaled by its surface energies where first
the surfa... |
Returns the plot of the formation energy of a particle against its effect radius | def plot_one_stability_map(self, analyzer, max_r, delu_dict=None, label="",
increments=50, delu_default=0, plt=None,
from_sphere_area=False, e_units="keV",
r_units="nanometers", normalize=False,
s... |
Returns the plot of the formation energy of a particles of different polymorphs against its effect radius | def plot_all_stability_map(self, max_r, increments=50, delu_dict=None,
delu_default=0, plt=None, labels=None,
from_sphere_area=False, e_units="keV",
r_units="nanometers", normalize=False,
scale_pe... |
Maximum volume change along insertion | def max_delta_volume(self):
"""
Maximum volume change along insertion
"""
vols = [v.vol_charge for v in self.voltage_pairs]
vols.extend([v.vol_discharge for v in self.voltage_pairs])
return max(vols) / min(vols) - 1 |
Maximum absolute difference in adjacent voltage steps | def max_voltage_step(self):
"""
Maximum absolute difference in adjacent voltage steps
"""
steps = [self.voltage_pairs[i].voltage
- self.voltage_pairs[i + 1].voltage
for i in range(len(self.voltage_pairs) - 1)]
return max(steps) if len(steps) > 0 ... |
Average voltage for path satisfying between a min and max voltage. | def get_average_voltage(self, min_voltage=None, max_voltage=None):
"""
Average voltage for path satisfying between a min and max voltage.
Args:
min_voltage (float): The minimum allowable voltage for a given
step.
max_voltage (float): The maximum allowable... |
Get the gravimetric capacity of the electrode. | def get_capacity_grav(self, min_voltage=None, max_voltage=None,
use_overall_normalization=True):
"""
Get the gravimetric capacity of the electrode.
Args:
min_voltage (float): The minimum allowable voltage for a given
step.
max_vo... |
Get the volumetric capacity of the electrode. | def get_capacity_vol(self, min_voltage=None, max_voltage=None,
use_overall_normalization=True):
"""
Get the volumetric capacity of the electrode.
Args:
min_voltage (float): The minimum allowable voltage for a given
step.
max_volta... |
Returns the specific energy of the battery in mAh/ g. | def get_specific_energy(self, min_voltage=None, max_voltage=None,
use_overall_normalization=True):
"""
Returns the specific energy of the battery in mAh/g.
Args:
min_voltage (float): The minimum allowable voltage for a given
step.
... |
Args: min_voltage ( float ): The minimum allowable voltage for a given step. max_voltage ( float ): The maximum allowable voltage allowable for a given step. use_overall_normalization ( booL ): If False normalize by the discharged state of only the voltage pairs matching the voltage criteria. if True use default normal... | def get_energy_density(self, min_voltage=None, max_voltage=None,
use_overall_normalization=True):
"""
Args:
min_voltage (float): The minimum allowable voltage for a given
step.
max_voltage (float): The maximum allowable voltage allowable... |
Selects VoltagePairs within a certain voltage range. | def _select_in_voltage_range(self, min_voltage=None, max_voltage=None):
"""
Selects VoltagePairs within a certain voltage range.
Args:
min_voltage (float): The minimum allowable voltage for a given
step.
max_voltage (float): The maximum allowable voltage ... |
Returns pymatgen Molecule object. | def pymatgen_mol(self):
"""
Returns pymatgen Molecule object.
"""
sp = []
coords = []
for atom in ob.OBMolAtomIter(self._obmol):
sp.append(atom.GetAtomicNum())
coords.append([atom.GetX(), atom.GetY(), atom.GetZ()])
return Molecule(sp, coord... |
A wrapper to pybel s localopt method to optimize a Molecule. | def localopt(self, forcefield='mmff94', steps=500):
"""
A wrapper to pybel's localopt method to optimize a Molecule.
Args:
forcefield: Default is mmff94. Options are 'gaff', 'ghemical',
'mmff94', 'mmff94s', and 'uff'.
steps: Default is 500.
"""
... |
A wrapper to pybel s make3D method generate a 3D structure from a 2D or 0D structure. The 3D structure is made very quickly using a combination of rules ( e. g. sp3 atoms should have four bonds arranged in a tetrahedron ) and ring templates ( e. g. cyclohexane is shaped like a chair ). Once 3D coordinates are generated... | def make3d(self, forcefield="mmff94", steps=50):
"""
A wrapper to pybel's make3D method generate a 3D structure from a
2D or 0D structure.
The 3D structure is made very quickly using a combination of rules
(e.g. sp3 atoms should have four bonds arranged in a tetrahedron) and
... |
Remove a bond from an openbabel molecule | def remove_bond(self, idx1, idx2):
"""
Remove a bond from an openbabel molecule
Args:
idx1: The atom index of one of the atoms participating the in bond
idx2: The atom index of the other atom participating in the bond
"""
for obbond in ob.OBMolBondIter(s... |
Conformer search based on several Rotor Search algorithms of openbabel. If the input molecule is not 3D make3d will be called ( generate 3D structure add hydrogen a quick localopt ). All hydrogen atoms need to be made explicit. | def rotor_conformer(self, *rotor_args, algo="WeightedRotorSearch",
forcefield="mmff94"):
"""
Conformer search based on several Rotor Search algorithms of openbabel.
If the input molecule is not 3D, make3d will be called (generate 3D
structure, add hydrogen, a quic... |
A combined method to first generate 3D structures from 0D or 2D structures and then find the minimum energy conformer: 1. Use OBBuilder to create a 3D structure using rules and ring templates 2. Do 250 steps of a steepest descent geometry optimization with the MMFF94 forcefield 3. Do 200 iterations of a Weighted Rotor ... | def gen3d_conformer(self):
"""
A combined method to first generate 3D structures from 0D or 2D
structures and then find the minimum energy conformer:
1. Use OBBuilder to create a 3D structure using rules and ring templates
2. Do 250 steps of a steepest descent geometry optimizati... |
Conformer generation based on Confab to generate all diverse low - energy conformers for molecules. This is different from rotor_conformer or gen3d_conformer as it aims to not simply to find a low energy conformation but to generate several different conformations. | def confab_conformers(self, forcefield="mmff94", freeze_atoms=None,
rmsd_cutoff=0.5, energy_cutoff=50.0,
conf_cutoff=100000, verbose=False):
"""
Conformer generation based on Confab to generate all diverse low-energy
conformers for molecules. T... |
Uses OpenBabel to output all supported formats. | def write_file(self, filename, file_format="xyz"):
"""
Uses OpenBabel to output all supported formats.
Args:
filename: Filename of file to output
file_format: String specifying any OpenBabel supported formats.
"""
mol = pb.Molecule(self._obmol)
re... |
Uses OpenBabel to read a molecule from a file in all supported formats. | def from_file(filename, file_format="xyz"):
"""
Uses OpenBabel to read a molecule from a file in all supported formats.
Args:
filename: Filename of input file
file_format: String specifying any OpenBabel supported formats.
Returns:
BabelMolAdaptor ob... |
Uses OpenBabel to read a molecule from a string in all supported formats. | def from_string(string_data, file_format="xyz"):
"""
Uses OpenBabel to read a molecule from a string in all supported
formats.
Args:
string_data: String containing molecule data.
file_format: String specifying any OpenBabel supported formats.
Returns:
... |
Finds the list of bonded atoms. | def find_connected_atoms(struct, tolerance=0.45, ldict=JmolNN().el_radius):
"""
Finds the list of bonded atoms.
Args:
struct (Structure): Input structure
tolerance: length in angstroms used in finding bonded atoms. Two atoms are considered bonded if (radius of atom 1) + (radius of atom 2) +... |
Finds bonded clusters of atoms in the structure with periodic boundary conditions. If there are atoms that are not bonded to anything returns [ 0 1 0 ]. ( For faster computation time in FindDimension () ) | def find_clusters(struct, connected_list):
"""
Finds bonded clusters of atoms in the structure with periodic boundary conditions.
If there are atoms that are not bonded to anything, returns [0,1,0].(For faster computation time in FindDimension())
Args:
struct (Structure): Input structure
... |
Algorithm for finding the dimensions of connected subunits in a crystal structure. This method finds the dimensionality of the material even when the material is not layered along low - index planes or does not have flat layers/ molecular wires. See details at: Cheon G. ; Duerloo K. - A. N. ; Sendek A. D. ; Porter C. ;... | def find_dimension(structure_raw, tolerance=0.45, ldict=JmolNN().el_radius, standardize=True):
"""
Algorithm for finding the dimensions of connected subunits in a crystal structure.
This method finds the dimensionality of the material even when the material is not layered along low-index planes, or does not... |
Returns a string with the structure in XSF format See http:// www. xcrysden. org/ doc/ XSF. html | def to_string(self):
"""
Returns a string with the structure in XSF format
See http://www.xcrysden.org/doc/XSF.html
"""
lines = []
app = lines.append
app("CRYSTAL")
app("# Primitive lattice vectors in Angstrom")
app("PRIMVEC")
cell = self.... |
Initialize a Structure object from a string with data in XSF format. | def from_string(cls, input_string, cls_=None):
"""
Initialize a `Structure` object from a string with data in XSF format.
Args:
input_string: String with the structure in XSF format.
See http://www.xcrysden.org/doc/XSF.html
cls_: Structure class to be cre... |
Returns: the kpoints along the paths in cartesian coordinates together with the labels for symmetry points - Wei | def get_kpoints(self, line_density=20, coords_are_cartesian=True):
"""
Returns:
the kpoints along the paths in cartesian coordinates
together with the labels for symmetry points -Wei
"""
list_k_points = []
sym_point_labels = []
for b in self.kpath[... |
Initialize an instance from a: class: Work instance. | def from_node(cls, work):
"""Initialize an instance from a :class:`Work` instance."""
new = super().from_node(work)
# Will put all files found in outdir in GridFs
# Warning: assuming binary files.
d = {os.path.basename(f): f for f in work.outdir.list_filepaths()}
new.reg... |
Returns the number of cores reserved in this moment. A core is reserved if it s still not running but we have submitted the task to the queue manager. | def ncores_reserved(self):
"""
Returns the number of cores reserved in this moment.
A core is reserved if it's still not running but
we have submitted the task to the queue manager.
"""
return sum(task.manager.num_cores for task in self if task.status == task.S_SUB) |
Returns the number of CPUs allocated in this moment. A core is allocated if it s running a task or if we have submitted a task to the queue manager but the job is still pending. | def ncores_allocated(self):
"""
Returns the number of CPUs allocated in this moment.
A core is allocated if it's running a task or if we have
submitted a task to the queue manager but the job is still pending.
"""
return sum(task.manager.num_cores for task in self if task... |
Returns the number of cores used in this moment. A core is used if there s a job that is running on it. | def ncores_used(self):
"""
Returns the number of cores used in this moment.
A core is used if there's a job that is running on it.
"""
return sum(task.manager.num_cores for task in self if task.status == task.S_RUN) |
Returns the first task that is ready to run or None if no task can be submitted at present | def fetch_task_to_run(self):
"""
Returns the first task that is ready to run or
None if no task can be submitted at present"
Raises:
`StopIteration` if all tasks are done.
"""
# All the tasks are done so raise an exception
# that will be handled by th... |
Connect the signals within the work. The: class: Work is responsible for catching the important signals raised from its task and raise new signals when some particular condition occurs. | def connect_signals(self):
"""
Connect the signals within the work.
The :class:`Work` is responsible for catching the important signals raised from
its task and raise new signals when some particular condition occurs.
"""
for task in self:
dispatcher.connect(s... |
Disable the signals within the work. This function reverses the process of connect_signals | def disconnect_signals(self):
"""
Disable the signals within the work. This function reverses the process of `connect_signals`
"""
for task in self:
try:
dispatcher.disconnect(self.on_ok, signal=task.S_OK, sender=task)
except dispatcher.errors.Disp... |
This callback is called when one task reaches status S_OK. It executes on_all_ok when all tasks in self have reached S_OK. | def on_ok(self, sender):
"""
This callback is called when one task reaches status `S_OK`.
It executes on_all_ok when all tasks in self have reached `S_OK`.
"""
logger.debug("in on_ok with sender %s" % sender)
if self.all_ok:
if self.finalized:
... |
Register a Scf task. | def register_scf_task(self, *args, **kwargs):
"""Register a Scf task."""
kwargs["task_class"] = ScfTask
return self.register_task(*args, **kwargs) |
Register a Scf task that perform a SCF run first with nsppol = 2 and then nspinor = 2 | def register_collinear_then_noncollinear_scf_task(self, *args, **kwargs):
"""Register a Scf task that perform a SCF run first with nsppol = 2 and then nspinor = 2"""
kwargs["task_class"] = CollinearThenNonCollinearScfTask
return self.register_task(*args, **kwargs) |
Register a nscf task. | def register_nscf_task(self, *args, **kwargs):
"""Register a nscf task."""
kwargs["task_class"] = NscfTask
return self.register_task(*args, **kwargs) |
Register a task for structural optimization. | def register_relax_task(self, *args, **kwargs):
"""Register a task for structural optimization."""
kwargs["task_class"] = RelaxTask
return self.register_task(*args, **kwargs) |
Register a phonon task. | def register_phonon_task(self, *args, **kwargs):
"""Register a phonon task."""
kwargs["task_class"] = PhononTask
return self.register_task(*args, **kwargs) |
Register an elastic task. | def register_elastic_task(self, *args, **kwargs):
"""Register an elastic task."""
kwargs["task_class"] = ElasticTask
return self.register_task(*args, **kwargs) |
Register a ddk task. | def register_ddk_task(self, *args, **kwargs):
"""Register a ddk task."""
kwargs["task_class"] = DdkTask
return self.register_task(*args, **kwargs) |
Register a screening task. | def register_scr_task(self, *args, **kwargs):
"""Register a screening task."""
kwargs["task_class"] = ScrTask
return self.register_task(*args, **kwargs) |
Register a sigma task. | def register_sigma_task(self, *args, **kwargs):
"""Register a sigma task."""
kwargs["task_class"] = SigmaTask
return self.register_task(*args, **kwargs) |
Register a Dde task. | def register_dde_task(self, *args, **kwargs):
"""Register a Dde task."""
kwargs["task_class"] = DdeTask
return self.register_task(*args, **kwargs) |
Register a Dte task. | def register_dte_task(self, *args, **kwargs):
"""Register a Dte task."""
kwargs["task_class"] = DteTask
return self.register_task(*args, **kwargs) |
Register a BEC task. | def register_bec_task(self, *args, **kwargs):
"""Register a BEC task."""
kwargs["task_class"] = BecTask
return self.register_task(*args, **kwargs) |
Register a Bethe - Salpeter task. | def register_bse_task(self, *args, **kwargs):
"""Register a Bethe-Salpeter task."""
kwargs["task_class"] = BseTask
return self.register_task(*args, **kwargs) |
Register an electron - phonon task. | def register_eph_task(self, *args, **kwargs):
"""Register an electron-phonon task."""
kwargs["task_class"] = EphTask
return self.register_task(*args, **kwargs) |
Set the values of the ABINIT variables in the input files of the nodes | def walknset_vars(self, task_class=None, *args, **kwargs):
"""
Set the values of the ABINIT variables in the input files of the nodes
Args:
task_class: If not None, only the input files of the tasks belonging
to class `task_class` are modified.
Example:
... |
Set the: class: TaskManager to use to launch the: class: Task. | def set_manager(self, manager):
"""Set the :class:`TaskManager` to use to launch the :class:`Task`."""
self.manager = manager.deepcopy()
for task in self:
task.set_manager(manager) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.