Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new "Lookup Scaler" for plotting #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions catmap/analyze/mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
except ImportError:
print('Warning! graphviz not imported.')
from itertools import chain, product
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
import pylab as plt

class MechanismAnalysis(MechanismPlot,ReactionModelWrapper,MapPlot):
"""
Expand Down
1 change: 1 addition & 0 deletions catmap/scalers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from .thermodynamic_scaler import *
from .concentration_scaler import *
from .null_scaler import *
from .lookup_scaler import *
31 changes: 31 additions & 0 deletions catmap/scalers/lookup_scaler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from .scaler_base import *

class LookupScaler(ScalerBase):
"""Scaler which looks up all available energies for a given surface."""

def get_electronic_energies(self,descriptors):

assert descriptors in self.surface_names, "Descriptor must be a surface name for LookupScaler."

surf_idx = self.surface_names.index(descriptors)
all_ads = self.adsorbate_names + self.transition_state_names

E_dict = {}
gas_names = list(self.gas_names)

for g in gas_names:
E_dict[g] = self.species_definitions[g]['formation_energy']

for sp in all_ads:
E = self.species_definitions[sp]['formation_energy'][surf_idx]
try:
E = float(E)
E_dict[sp] = E
except ValueError: #if the energy doesn't exist for a given surface it is stored as '-'
pass

return E_dict

def get_rxn_parameters(self,descriptors):
Gs = self.get_free_energies(descriptors)
return [Gs[d] for d in self.adsorbate_names+self.transition_state_names]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ ase == 3.17 ; python_version < "3.5"
ase ; python_version >= "3.5"
graphviz
tqdm
pathlib