Skip to content

Commit

Permalink
WIP: adding to correct_binding_energy
Browse files Browse the repository at this point in the history
  • Loading branch information
mazeau committed Sep 21, 2020
1 parent cba6cab commit e344e20
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions rmgpy/data/thermo.py
Expand Up @@ -1228,8 +1228,7 @@ def get_thermo_data(self, species, metal=None, training_set=None):
return thermo0

if species.contains_surface_site():


#
thermo0 = self.get_thermo_data_for_surface_species(species)
thermo0 = self.correct_binding_energy(thermo0, species, metal)
return thermo0
Expand Down Expand Up @@ -1437,26 +1436,43 @@ def correct_binding_energy(self, thermo, species, metal):
metal_db = MetalDatabase()
metal_db.load(os.path.join(settings['database.directory'], 'surface'))

metal_db.

reference_metal, metal_to_scale_to = metal

if metal_to_scale_to is None:
# assume we want to scale to the binding energies provided in the input file
metal_to_scale_to = self.binding_energies
metal_to_scale_to_binding_energies = self.binding_energies

elif type(metal_to_scale_to) is str:
facet = re.search('\d+', metal_to_scale_to)
if facet is not None:
try:
metal_to_scale_to_binding_energies = metal_db.get_binding_energies(metal_to_scale_to)
except:
# no exact match was found, so continue on as if no facet was given
facet = None

if facet is None:
# no facet was specified, so assume
# no facet was specified, so assume 111? don't want to hard code this in...
# need to search through database to find entry that matches string metal, and what to do if there are multiple facets?
metal_entry_matches = metal_db.get_all_entries_on_metal(metal_to_scale_to)

if len(metal_entry_matches) is 1:
metal_to_scale_to_binding_energies = metal_db.get_binding_energies(metal_entry_matches[0])
else: # multiple matches. what to do? or no matches?


binding_energies = metal_db.get_binding_energies(metal_to_scale_to) # todo: does this not work anymore?!?!?!

for element, energy in binding_energies.items():
binding_energies[element] = rmgpy.quantity.Energy(binding_energies[element])
if reference_metal is None:
# assume the thermo is already corrected to the binding energies provided in the input file
reference_metal = self.binding_energies


for element, deltaEnergy in self.delta_atomic_adsorption_energy.items(): # don't want to store this globally... will this mess other things up?
deltaEnergy.value_si = metal_to_scale_to[element].value_si - reference_metal[element].value_si

molecule = species.molecule[0]
# only want/need to do one resonance structure
surface_sites = []
Expand Down

0 comments on commit e344e20

Please sign in to comment.