def _scale_E(self, adsorbate, reference, fxn): """Provides a scaled value of the electronic energy. adsorbate is the name of an adsorbate (e.g., 'COOH') and reference is the name of the reference (e.g., 'CH3'). fxn is the function that links the two, as in: E[adsorbate] = fxn(E[reference]) it is assumed that fxn uses referenced values for all energies, that is E = E_elec[ads*] - E_elec[*] - E_ref(ads) where E_ref is the atomic reference energies of the adsorbate. Returns the adsorbate energy with normal reference, e.g., -55232.24 eV. Note that the electronic energy of the reference should be already set before this function is called. """ # FIXME: this function is so far only used within an external # script, I may want to change the approach and delete it, for # example if I change the reference to pull out the atomic # normalizing (I need to leave in the clean slab normalizing). # FIXME: I will need to update these to the new data form next # time I use it. x = (self._elec_energy[reference] - io.electronicenergy(self._surface) - calculate_reference_energ(reference)) y = fxn(x) self._elec_energy[adsorbate] = y + \ io.electronicenergy(self._surface) + \ calculate_reference_energy(adsorbate)
def _populate_elec_energies(self): """If the surface is specified, reads in electronic energies from the data files. Note that the io function will put a numpy nan in this spot if the data does not exist.""" data = self.data for ads in self.data.keys(): if self.surface is not None: data[ads]['E'] = io.electronicenergy(surface=self.surface, adsorbate=ads) self._changed['E'] = True
def set_surface(self, surface): """Looks up the electronic energies, and, if specified in vibrequest, vibrations, for each adsorbate on the surface specified using the io functions of the hori module, assigns them, and re-calculates G. Args: surface (string) """ for ads in self.data.keys(): self.data[ads]['E'] = io.electronicenergy(surface=surface, adsorbate=ads) self.surface = surface self._populate_vibrations() self._changed['E'] = True self._changed['vibs'] = True self.recalculate()