INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Computes the grand potential Phi at a given composition and chemical potential ( s ).
def _get_grand_potential(self, composition): """ Computes the grand potential Phi at a given composition and chemical potential(s). Args: composition (Composition): Composition object. Returns: Grand potential at a given composition at chemical potential...
Computes reaction energy in eV/ atom at mixing ratio x: ( 1 - x ) for self. comp1: self. comp2.
def _get_energy(self, x): """ Computes reaction energy in eV/atom at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction energy. """ return self.pd.g...
Generates balanced reaction at mixing ratio x: ( 1 - x ) for self. comp1: self. comp2.
def _get_reaction(self, x): """ Generates balanced reaction at mixing ratio x : (1-x) for self.comp1 : self.comp2. Args: x (float): Mixing ratio x of reactants, a float between 0 and 1. Returns: Reaction object. """ mix_comp = self.comp1 ...
Computes total number of atoms in a reaction formula for elements not in external reservoir. This method is used in the calculation of reaction energy per mol of reaction formula.
def _get_elmt_amt_in_rxt(self, rxt): """ Computes total number of atoms in a reaction formula for elements not in external reservoir. This method is used in the calculation of reaction energy per mol of reaction formula. Args: rxt (Reaction): a reaction. Ret...
List of formulas of potential products. E. g. [ Li O2 Mn ].
def get_products(self): """ List of formulas of potential products. E.g., ['Li','O2','Mn']. """ products = set() for _, _, _, react, _ in self.get_kinks(): products = products.union(set([k.reduced_formula for k in react.produ...
Converts mixing ratio x in comp1 - comp2 tie line to that in c1 - c2 tie line.
def _convert(x, factor1, factor2): """ Converts mixing ratio x in comp1 - comp2 tie line to that in c1 - c2 tie line. Args: x (float): Mixing ratio x in comp1 - comp2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio between ...
Converts mixing ratio x in c1 - c2 tie line to that in comp1 - comp2 tie line.
def _reverse_convert(x, factor1, factor2): """ Converts mixing ratio x in c1 - c2 tie line to that in comp1 - comp2 tie line. Args: x (float): Mixing ratio x in c1 - c2 tie line, a float between 0 and 1. factor1 (float): Compositional ratio betwee...
Finds all the kinks in mixing ratio where reaction products changes along the tie line of composition self. c1 and composition self. c2.
def get_kinks(self): """ Finds all the kinks in mixing ratio where reaction products changes along the tie line of composition self.c1 and composition self.c2. Returns: Zip object of tuples (index, mixing ratio, reaction energy per atom in e...
Returns a list of molar mixing ratio for each kink between ORIGINAL ( instead of processed ) reactant compositions. This is the same list as mixing ratio obtained from get_kinks method if self. norm = False.
def get_critical_original_kink_ratio(self): """ Returns a list of molar mixing ratio for each kink between ORIGINAL (instead of processed) reactant compositions. This is the same list as mixing ratio obtained from get_kinks method if self.norm = False. Returns: ...
Returns the molar mixing ratio between the reactants with ORIGINAL ( instead of processed ) compositions for a reaction.
def _get_original_composition_ratio(self, reaction): """ Returns the molar mixing ratio between the reactants with ORIGINAL ( instead of processed) compositions for a reaction. Args: reaction (Reaction): Reaction object that contains the original reactant com...
Returns a dictionary containing kink information: { index: x = mixing_ratio energy = reaction_energy reaction_equation }. E. g. { 1: x = 0. 0 energy = 0. 0 Mn - > Mn 2: x = 0. 5 energy = - 15. 0 O2 + Mn - > MnO2 3: x = 1. 0 energy = 0. 0 O2 - > O2 }.
def labels(self): """ Returns a dictionary containing kink information: {index: 'x= mixing_ratio energy= reaction_energy reaction_equation'}. E.g., {1: 'x= 0.0 energy = 0.0 Mn -> Mn', 2: 'x= 0.5 energy = -15.0 O2 + Mn -> MnO2', 3: 'x= 1.0 energy = 0.0 O2 -> ...
Plots reaction energy as a function of mixing ratio x in self. c1 - self. c2 tie line using pylab.
def plot(self): """ Plots reaction energy as a function of mixing ratio x in self.c1 - self.c2 tie line using pylab. Returns: Pylab object that plots reaction energy as a function of mixing ratio x. """ plt.rcParams['xtick.major.pad'] = '6' ...
Finds the minimum reaction energy E_min and corresponding mixing ratio x_min.
def minimum(self): """ Finds the minimum reaction energy E_min and corresponding mixing ratio x_min. Returns: Tuple (x_min, E_min). """ return min([(x, energy) for _, x, energy, _, _ in self.get_kinks()], key=lambda i: i[1])
Generates the opposite number of energy above grand potential convex hull for both reactants.
def get_no_mixing_energy(self): """ Generates the opposite number of energy above grand potential convex hull for both reactants. Returns: [(reactant1, no_mixing_energy1),(reactant2,no_mixing_energy2)]. """ assert self.grand == 1, \ 'Please provid...
Get the normalized correction term Δμ for chemical potential of a gas phase consisting of element at given temperature and pressure referenced to that in the standard state ( T_std = 298. 15 K T_std = 1 bar ). The gas phase is limited to be one of O2 N2 Cl2 F2 H2. Calculation formula can be found in the documentation o...
def get_chempot_correction(element, temp, pres): """ Get the normalized correction term Δμ for chemical potential of a gas phase consisting of element at given temperature and pressure, referenced to that in the standard state (T_std = 298.15 K, T_std = 1 bar). The gas phase is l...
Returns a dict that maps each atomic symbol to a unique integer starting from 1.
def get_atom_map(structure): """ Returns a dict that maps each atomic symbol to a unique integer starting from 1. Args: structure (Structure) Returns: dict """ syms = [site.specie.symbol for site in structure] unique_pot_atoms = [] [unique_pot_atoms.append(i) for i ...
Return the absorbing atom symboll and site index in the given structure.
def get_absorbing_atom_symbol_index(absorbing_atom, structure): """ Return the absorbing atom symboll and site index in the given structure. Args: absorbing_atom (str/int): symbol or site index structure (Structure) Returns: str, int: symbol and site index """ if isinst...
Static method to create Header object from cif_file
def from_cif_file(cif_file, source='', comment=''): """ Static method to create Header object from cif_file Args: cif_file: cif_file path and name source: User supplied identifier, i.e. for Materials Project this would be the material ID number ...
Reads Header string from either a HEADER file or feff. inp file Will also read a header from a non - pymatgen generated feff. inp file
def header_string_from_file(filename='feff.inp'): """ Reads Header string from either a HEADER file or feff.inp file Will also read a header from a non-pymatgen generated feff.inp file Args: filename: File name containing the Header data. Returns: Reads ...
Reads Header string and returns Header object if header was generated by pymatgen. Note: Checks to see if generated by pymatgen if not it is impossible to generate structure object so it is not possible to generate header object and routine ends
def from_string(header_str): """ Reads Header string and returns Header object if header was generated by pymatgen. Note: Checks to see if generated by pymatgen, if not it is impossible to generate structure object so it is not possible to generate header object a...
Writes Header into filename on disk.
def write_file(self, filename='HEADER'): """ Writes Header into filename on disk. Args: filename: Filename and path for file to be written to disk """ with open(filename, "w") as f: f.write(str(self) + "\n")
Compute and set the cluster of atoms as a Molecule object. The siteato coordinates are translated such that the absorbing atom ( aka central atom ) is at the origin.
def _set_cluster(self): """ Compute and set the cluster of atoms as a Molecule object. The siteato coordinates are translated such that the absorbing atom(aka central atom) is at the origin. Returns: Molecule """ center = self.struct[self.center_index...
Reads atomic shells from file such as feff. inp or ATOMS file The lines are arranged as follows:
def atoms_string_from_file(filename): """ Reads atomic shells from file such as feff.inp or ATOMS file The lines are arranged as follows: x y z ipot Atom Symbol Distance Number with distance being the shell radius and ipot an integer identifying the potential u...
Parse the feff input file and return the atomic cluster as a Molecule object.
def cluster_from_file(filename): """ Parse the feff input file and return the atomic cluster as a Molecule object. Args: filename (str): path the feff input file Returns: Molecule: the atomic cluster as Molecule object. The absorbing atom ...
Returns a list of string representations of the atomic configuration information ( x y z ipot atom_symbol distance id ).
def get_lines(self): """ Returns a list of string representations of the atomic configuration information(x, y, z, ipot, atom_symbol, distance, id). Returns: list: list of strings, sorted by the distance from the absorbing atom. """ lines = [[...
Dict representation.
def as_dict(self): """ Dict representation. Returns: Dictionary of parameters from fefftags object """ tags_dict = dict(self) tags_dict['@module'] = self.__class__.__module__ tags_dict['@class'] = self.__class__.__name__ return tags_dict
Creates Tags object from a dictionary.
def from_dict(d): """ Creates Tags object from a dictionary. Args: d: Dict of feff parameters and values. Returns: Tags object """ i = Tags() for k, v in d.items(): if k not in ("@module", "@class"): i[k] = v ...
Returns a string representation of the Tags. The reason why this method is different from the __str__ method is to provide options for pretty printing.
def get_string(self, sort_keys=False, pretty=False): """ Returns a string representation of the Tags. The reason why this method is different from the __str__ method is to provide options for pretty printing. Args: sort_keys: Set to True to sort the Feff parameters ...
Convert the given value to string.
def _stringify_val(val): """ Convert the given value to string. """ if isinstance(val, list): return " ".join([str(i) for i in val]) else: return str(val)
Creates a Feff_tag dictionary from a PARAMETER or feff. inp file.
def from_file(filename="feff.inp"): """ Creates a Feff_tag dictionary from a PARAMETER or feff.inp file. Args: filename: Filename for either PARAMETER or feff.inp file Returns: Feff_tag object """ with zopen(filename, "rt") as f: line...
Static helper method to convert Feff parameters to proper types e. g. integers floats lists etc.
def proc_val(key, val): """ Static helper method to convert Feff parameters to proper types, e.g. integers, floats, lists, etc. Args: key: Feff parameter key val: Actual value of Feff parameter. """ list_type_keys = list(VALID_FEFF_TAGS) ...
Reads Potential parameters from a feff. inp or FEFFPOT file. The lines are arranged as follows:
def pot_string_from_file(filename='feff.inp'): """ Reads Potential parameters from a feff.inp or FEFFPOT file. The lines are arranged as follows: ipot Z element lmax1 lmax2 stoichometry spinph Args: filename: file name containing potential data. ...
Creates atomic symbol/ potential number dictionary forward and reverse
def pot_dict_from_string(pot_data): """ Creates atomic symbol/potential number dictionary forward and reverse Arg: pot_data: potential data in string format Returns: forward and reverse atom symbol and potential number dictionaries. """ ...
Write paths. dat.
def write_file(self, filename="paths.dat"): """ Write paths.dat. """ with zopen(filename, "wt") as f: f.write(str(self) + "\n")
Returns a Lattice object from a dictionary with the Abinit variables acell and either rprim in Bohr or angdeg If acell is not given the Abinit default is used i. e. [ 1 1 1 ] Bohr
def lattice_from_abivars(cls=None, *args, **kwargs): """ Returns a `Lattice` object from a dictionary with the Abinit variables `acell` and either `rprim` in Bohr or `angdeg` If acell is not given, the Abinit default is used i.e. [1,1,1] Bohr Args: cls: Lattice class to be instantiated. pym...
Build a: class: Structure object from a dictionary with ABINIT variables.
def structure_from_abivars(cls=None, *args, **kwargs): """ Build a :class:`Structure` object from a dictionary with ABINIT variables. Args: cls: Structure class to be instantiated. pymatgen.core.structure.Structure if cls is None example: al_structure = structure_from_abivars( ...
Receives a structure and returns a dictionary with the ABINIT variables.
def structure_to_abivars(structure, **kwargs): """ Receives a structure and returns a dictionary with the ABINIT variables. """ if not structure.is_ordered: raise ValueError("""\ Received disordered structure with partial occupancies that cannot be converted into an Abinit input Please use Order...
>>> assert contract ( 1 1 1 2 2 3 ) == 3 * 1 2 * 2 1 * 3 >>> assert contract ( 1 1 3 2 3 ) == 2 * 1 1 * 3 1 * 2 1 * 3
def contract(s): """ >>> assert contract("1 1 1 2 2 3") == "3*1 2*2 1*3" >>> assert contract("1 1 3 2 3") == "2*1 1*3 1*2 1*3" """ if not s: return s tokens = s.split() old = tokens[0] count = [[1, old]] for t in tokens[1:]: if t == old: count[-1][0] += 1 ...
Converts obj into a SpinMode instance
def as_spinmode(cls, obj): """Converts obj into a `SpinMode` instance""" if isinstance(obj, cls): return obj else: # Assume a string with mode try: return _mode2spinvars[obj] except KeyError: raise KeyError("Wrong va...
Constructs an instance of Smearing from obj. Accepts obj in the form:
def as_smearing(cls, obj): """ Constructs an instance of `Smearing` from obj. Accepts obj in the form: * Smearing instance * "name:tsmear" e.g. "gaussian:0.004" (Hartree units) * "name:tsmear units" e.g. "gaussian:0.1 eV" * None --> no smearing ...
json friendly dict representation
def as_dict(self): "json friendly dict representation" d = {} d["@module"] = self.__class__.__module__ d["@class"] = self.__class__.__name__ d["spin_mode"] = self.spin_mode.as_dict() d["smearing"] = self.smearing.as_dict() d["algorithm"] = self.algorithm.as_dict()...
Convenient static constructor for an automatic Gamma centered Kpoint grid.
def gamma_centered(cls, kpts=(1, 1, 1), use_symmetries=True, use_time_reversal=True): """ Convenient static constructor for an automatic Gamma centered Kpoint grid. Args: kpts: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors. use_symmetries: False if spati...
Convenient static constructor for a Monkhorst - Pack mesh.
def monkhorst(cls, ngkpt, shiftk=(0.5, 0.5, 0.5), chksymbreak=None, use_symmetries=True, use_time_reversal=True, comment=None): """ Convenient static constructor for a Monkhorst-Pack mesh. Args: ngkpt: Subdivisions N_1, N_2 and N_3 along reciprocal lattice vectors....
Convenient static constructor for an automatic Monkhorst - Pack mesh.
def monkhorst_automatic(cls, structure, ngkpt, use_symmetries=True, use_time_reversal=True, chksymbreak=None, comment=None): """ Convenient static constructor for an automatic Monkhorst-Pack mesh. Args: structure: :class:`Structure` object. ng...
Static constructor for path in k - space.
def _path(cls, ndivsm, structure=None, kpath_bounds=None, comment=None): """ Static constructor for path in k-space. Args: structure: :class:`Structure` object. kpath_bounds: List with the reduced coordinates of the k-points defining the path. ndivsm: Number ...
See _path for the meaning of the variables
def path_from_structure(cls, ndivsm, structure): """See _path for the meaning of the variables""" return cls._path(ndivsm, structure=structure, comment="K-path generated automatically from structure")
See _path for the meaning of the variables
def explicit_path(cls, ndivsm, kpath_bounds): """See _path for the meaning of the variables""" return cls._path(ndivsm, kpath_bounds=kpath_bounds, comment="Explicit K-path")
Returns an automatic Kpoint object based on a structure and a kpoint density. Uses Gamma centered meshes for hexagonal cells and Monkhorst - Pack grids otherwise.
def automatic_density(cls, structure, kppa, chksymbreak=None, use_symmetries=True, use_time_reversal=True, shifts=(0.5, 0.5, 0.5)): """ Returns an automatic Kpoint object based on a structure and a kpoint density. Uses Gamma centered meshes for hexagonal cells and Monkh...
Returns a dictionary with the abinit variables
def to_abivars(self): """Returns a dictionary with the abinit variables""" # These variables are always present. out_vars = { "ionmov" : self.abivars.ionmov, "optcell": self.abivars.optcell, "ntime" : self.abivars.ntime, } # Atom relaxation. ...
Constructs an instance of PPModel from obj.
def as_ppmodel(cls, obj): """ Constructs an instance of PPModel from obj. Accepts obj in the form: * PPmodel instance * string. e.g "godby:12.3 eV", "linden". """ if isinstance(obj, cls): return obj # obj is a string if ":" no...
Returns a dictionary with the abinit variables
def to_abivars(self): """Returns a dictionary with the abinit variables""" return { # Spectral function "nomegasf": self.nomegasf, "domegasf": self.domegasf, "spmeth" : self.spmeth, # Frequency mesh for the polarizability ...
Returns a dictionary with the abinit variables
def to_abivars(self): """Returns a dictionary with the abinit variables""" abivars = { "ecuteps" : self.ecuteps, "ecutwfn" : self.ecutwfn, "inclvkb" : self.inclvkb, "gwpara" : self.gwpara, "awtr" : self.awtr, "symchi" ...
Returns the value of the gwcalctyp input variable.
def gwcalctyp(self): """Returns the value of the gwcalctyp input variable.""" dig0 = str(self._SIGMA_TYPES[self.type]) dig1 = str(self._SC_MODES[self.sc_mode]) return dig1.strip() + dig0.strip()
Returns a dictionary with the abinit variables.
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( gwcalctyp=self.gwcalctyp, ecuteps=self.ecuteps, ecutsigx=self.ecutsigx, symsigma=self.symsigma, gw_qprange=self.gw_qprange, gwpara=self.gwpa...
Returns a dictionary with the abinit variables.
def to_abivars(self): """Returns a dictionary with the abinit variables.""" abivars = dict( bs_calctype=1, bs_loband=self.bs_loband, #nband=self.nband, mbpt_sciss=self.mbpt_sciss, ecuteps=self.ecuteps, bs_algorithm=self._ALGO2VAR[se...
Set fake upper/ lower bands useful to set the same energy range in the spin up/ down bands when calculating the DOS
def set_upper_lower_bands(self,e_lower,e_upper): """ Set fake upper/lower bands, useful to set the same energy range in the spin up/down bands when calculating the DOS """ lower_band = e_lower*np.ones((1,self.ebands.shape[1])) upper_band = e_upper*np.ones((1,self....
Get a vasprun. xml file and return a VasprunLoader
def from_file(self, vasprun_file): """Get a vasprun.xml file and return a VasprunLoader""" vrun_obj = Vasprun(vasprun_file, parse_projected_eigen=True) return VasprunLoader(vrun_obj)
Cut out bands outside the range ( emin emax )
def bandana(self, emin=-np.inf, emax=np.inf): """Cut out bands outside the range (emin,emax)""" bandmin = np.min(self.ebands, axis=1) bandmax = np.max(self.ebands, axis=1) ii = np.nonzero(bandmin < emax) nemax = ii[0][-1] ii = np.nonzero(bandmax > emin) nemin = ii...
Return a BandStructureSymmLine object interpolating bands along a High symmetry path calculated from the structure using HighSymmKpath function
def get_band_structure(self): """Return a BandStructureSymmLine object interpolating bands along a High symmetry path calculated from the structure using HighSymmKpath function""" kpath = HighSymmKpath(self.data.structure) kpt_line = [Kpoint(k, self.data.structure.lattice) for k ...
Return a Dos object interpolating bands
def get_dos(self, partial_dos=False, npts_mu=10000, T=None): """ Return a Dos object interpolating bands Args: partial_dos: if True, projections will be interpolated as well and partial doses will be return. Projections must be available ...
Return a CompleteDos object interpolating the projections
def get_partial_doses(self, tdos, npts_mu, T): """ Return a CompleteDos object interpolating the projections tdos: total dos previously calculated npts_mu: number of energy points of the Dos T: parameter used to smooth the Dos """ spin = self.data...
Calculate all the properties w. r. t. the doping levels in input.
def compute_properties_doping(self, doping, temp_r=None): """ Calculate all the properties w.r.t. the doping levels in input. Args: doping: numpy array specifing the doping levels When executed, it add the following variable at the BztTransportProperties object: ...
Function to plot the transport properties.
def plot_props(self, prop_y, prop_x, prop_z='temp', output='avg_eigs', dop_type='n', doping=None, temps=None, xlim=(-2, 2), ax=None): """ Function to plot the transport properties. Args: prop_y: property to plot among ("Conductivity...
Plot a band structure on symmetry line using BSPlotter ()
def plot_bands(self): """ Plot a band structure on symmetry line using BSPlotter() """ if self.bzt_interp is None: raise BoltztrapError("BztInterpolator not present") sbs = self.bzt_interp.get_band_structure() return BSPlotter(sbs).get_plot()
Plot the total Dos using DosPlotter ()
def plot_dos(self, T=None, npoints=10000): """ Plot the total Dos using DosPlotter() """ if self.bzt_interp is None: raise BoltztrapError("BztInterpolator not present") tdos = self.bzt_interp.get_dos(T=T,npts_mu=npoints) #print(npoints) dosPlotter...
Calculates the energy of the reaction.
def calculate_energy(self, energies): """ Calculates the energy of the reaction. Args: energies ({Composition: float}): Energy for each composition. E.g ., {comp1: energy1, comp2: energy2}. Returns: reaction energy as a float. """ ...
Normalizes the reaction to one of the compositions. By default normalizes such that the composition given has a coefficient of 1. Another factor can be specified.
def normalize_to(self, comp, factor=1): """ Normalizes the reaction to one of the compositions. By default, normalizes such that the composition given has a coefficient of 1. Another factor can be specified. Args: comp (Composition): Composition to normalize to ...
Normalizes the reaction to one of the elements. By default normalizes such that the amount of the element is 1. Another factor can be specified.
def normalize_to_element(self, element, factor=1): """ Normalizes the reaction to one of the elements. By default, normalizes such that the amount of the element is 1. Another factor can be specified. Args: element (Element/Specie): Element to normalize to. ...
Returns the amount of the element in the reaction.
def get_el_amount(self, element): """ Returns the amount of the element in the reaction. Args: element (Element/Specie): Element in the reaction Returns: Amount of that element in the reaction. """ return sum([self._all_comp[i][element] * abs(sel...
List of reactants
def reactants(self): """ List of reactants """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] < 0]
List of products
def products(self): """ List of products """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] > 0]
Returns a ComputedEntry representation of the reaction.: return:
def as_entry(self, energies): """ Returns a ComputedEntry representation of the reaction. :return: """ relevant_comp = [comp * abs(coeff) for coeff, comp in zip(self._coeffs, self._all_comp)] comp = sum(relevant_comp, Composition()) entry ...
Generates a balanced reaction from a string. The reaction must already be balanced.
def from_string(rxn_string): """ Generates a balanced reaction from a string. The reaction must already be balanced. Args: rxn_string: The reaction string. For example, "4 Li + O2-> 2Li2O" Returns: BalancedReaction """ rct...
Equivalent of all_comp but returns entries in the same order as the coefficients.
def all_entries(self): """ Equivalent of all_comp but returns entries, in the same order as the coefficients. """ entries = [] for c in self._all_comp: for e in self._all_entries: if e.composition.reduced_formula == c.reduced_formula: ...
Compute the energy of a structure using Tersoff potential.
def get_energy_tersoff(structure, gulp_cmd='gulp'): """ Compute the energy of a structure using Tersoff potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: GULP command if not in standard place """ gio = GulpIO() gc = GulpCaller(gulp_cmd) gin = gio.tersof...
Compute the energy of a structure using Buckingham potential.
def get_energy_buckingham(structure, gulp_cmd='gulp', keywords=('optimise', 'conp', 'qok'), valence_dict=None): """ Compute the energy of a structure using Buckingham potential. Args: structure: pymatgen.core.structure.Structure gulp_cmd: ...
Relax a structure and compute the energy using Buckingham potential.
def get_energy_relax_structure_buckingham(structure, gulp_cmd='gulp', keywords=('optimise', 'conp'), valence_dict=None): """ Relax a structure and compute the energy using Buckingham pot...
Generates GULP input string corresponding to pymatgen structure.
def structure_lines(self, structure, cell_flg=True, frac_flg=True, anion_shell_flg=True, cation_shell_flg=False, symm_flg=True): """ Generates GULP input string corresponding to pymatgen structure. Args: structure: pymatgen Structure o...
Specifies GULP library file to read species and potential parameters. If using library don t specify species and potential in the input file and vice versa. Make sure the elements of structure are in the library file.
def library_line(self, file_name): """ Specifies GULP library file to read species and potential parameters. If using library don't specify species and potential in the input file and vice versa. Make sure the elements of structure are in the library file. Args: ...
Gets a GULP input for an oxide structure and buckingham potential from library.
def buckingham_input(self, structure, keywords, library=None, uc=True, valence_dict=None): """ Gets a GULP input for an oxide structure and buckingham potential from library. Args: structure: pymatgen.core.structure.Structure keywords: GU...
Generate species buckingham and spring options for an oxide structure using the parameters in default libraries.
def buckingham_potential(self, structure, val_dict=None): """ Generate species, buckingham, and spring options for an oxide structure using the parameters in default libraries. Ref: 1. G.V. Lewis and C.R.A. Catlow, J. Phys. C: Solid State Phys., 18, 1149-1161 ...
Gets a GULP input with Tersoff potential for an oxide structure
def tersoff_input(self, structure, periodic=False, uc=True, *keywords): """ Gets a GULP input with Tersoff potential for an oxide structure Args: structure: pymatgen.core.structure.Structure periodic (Default=False): Flag denoting whether periodic boundar...
Generate the species tersoff potential lines for an oxide structure
def tersoff_potential(self, structure): """ Generate the species, tersoff potential lines for an oxide structure Args: structure: pymatgen.core.structure.Structure """ bv = BVAnalyzer() el = [site.specie.symbol for site in structure] valences = bv.get...
Run GULP using the gin as input
def run(self, gin): """ Run GULP using the gin as input Args: gin: GULP input string Returns: gout: GULP output string """ with ScratchDir("."): p = subprocess.Popen( self._gulp_cmd, stdout=subprocess.PIPE, ...
Print to the given string the documentation for the events and the associated handlers.
def autodoc_event_handlers(stream=sys.stdout): """ Print to the given string, the documentation for the events and the associated handlers. """ lines = [] for cls in all_subclasses(EventHandler): if cls in _ABC_EVHANDLER_CLASSES: continue event_class = cls.event_class lin...
Return the list of handler classes.
def get_event_handler_classes(categories=None): """Return the list of handler classes.""" classes = [c for c in all_subclasses(EventHandler) if c not in _ABC_EVHANDLER_CLASSES] return classes
Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag
def as_event_class(obj): """ Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag """ if is_string(obj): for c in all_subclasses(AbinitEvent): if c.__name__ == obj or c.yaml_tag == obj: return c raise ValueE...
The baseclass of self.
def baseclass(self): """The baseclass of self.""" for cls in _BASE_CLASSES: if isinstance(self, cls): return cls raise ValueError("Cannot determine the base class of %s" % self.__class__.__name__)
Add an event to the list.
def append(self, event): """Add an event to the list.""" self._events.append(event) self._events_by_baseclass[event.baseclass].append(event)
Set the value of _run_completed.
def set_run_completed(self, boolean, start_datetime, end_datetime): """Set the value of _run_completed.""" self._run_completed = boolean if (start_datetime, end_datetime) != (None, None): # start_datetime: Sat Feb 28 23:54:27 2015 # end_datetime: Sat Feb 28 23:54:30 2015...
Wall - time of the run as timedelta object.
def run_etime(self): """Wall-time of the run as `timedelta` object.""" if self.start_datetime is None or self.end_datetime is None: return None return self.end_datetime - self.start_datetime
Parse the given file. Return: class: EventReport.
def parse(self, filename, verbose=0): """ Parse the given file. Return :class:`EventReport`. """ run_completed, start_datetime, end_datetime = False, None, None filename = os.path.abspath(filename) report = EventReport(filename) w = WildCard("*Error|*Warning|*Com...
This method is used when self. parser raises an Exception so that we can report a customized: class: EventReport object with info the exception.
def report_exception(self, filename, exc): """ This method is used when self.parser raises an Exception so that we can report a customized :class:`EventReport` object with info the exception. """ # Build fake event. event = AbinitError(src_file="Unknown", src_line=0, mess...
Return the number of times the event associated to this handler has been already fixed in the: class: Task.
def count(self, task): """ Return the number of times the event associated to this handler has been already fixed in the :class:`Task`. """ return len([c for c in task.corrections if c["event"]["@class"] == self.event_class])
Sets the stable charges and transition states for a series of defect entries. This function uses scipy s HalfspaceInterection to oncstruct the polygons corresponding to defect stability as a function of the Fermi - level. The Halfspace Intersection constructs N - dimensional hyperplanes in this case N = 2 based on the ...
def find_stable_charges(self): """ Sets the stable charges and transition states for a series of defect entries. This function uses scipy's HalfspaceInterection to oncstruct the polygons corresponding to defect stability as a function of the Fermi-level. The Halfspace Intersectio...
List all unstable entries ( defect + charge ) in the DefectPhaseDiagram
def all_unstable_entries(self): """ List all unstable entries (defect+charge) in the DefectPhaseDiagram """ all_stable_entries = self.all_stable_entries return [e for e in self.entries if e not in all_stable_entries]
Give list of all concentrations at specified efermi in the DefectPhaseDiagram args: chemical_potentials = { Element: number } is dictionary of chemical potentials to provide formation energies for temperature = temperature to produce concentrations from fermi_level: ( float ) is fermi level relative to valence band max...
def defect_concentrations(self, chemical_potentials, temperature=300, fermi_level=0.): """ Give list of all concentrations at specified efermi in the DefectPhaseDiagram args: chemical_potentials = {Element: number} is dictionary of chemical potentials to provide formation energies fo...
Suggest possible charges for defects to computee based on proximity of known transitions from entires to VBM and CBM
def suggest_charges(self, tolerance=0.1): """ Suggest possible charges for defects to computee based on proximity of known transitions from entires to VBM and CBM Args: tolerance (float): tolerance with respect to the VBM and CBM to ` continue to...
Solve for the Fermi energy self - consistently as a function of T and p_O2 Observations are Defect concentrations electron and hole conc Args: bulk_dos: bulk system dos ( pymatgen Dos object ) gap: Can be used to specify experimental gap. Will be useful if the self consistent Fermi level is > DFT gap Returns: Fermi ene...
def solve_for_fermi_energy(self, temperature, chemical_potentials, bulk_dos): """ Solve for the Fermi energy self-consistently as a function of T and p_O2 Observations are Defect concentrations, electron and hole conc Args: bulk_dos: bulk system dos (pymatgen Dos obje...
Convert object into Xcfunc.
def asxc(cls, obj): """Convert object into Xcfunc.""" if isinstance(obj, cls): return obj if is_string(obj): return cls.from_name(obj) raise TypeError("Don't know how to convert <%s:%s> to Xcfunc" % (type(obj), str(obj)))