Skip to content

Commit c4c0e7c

Browse files
Nora-Khalilrwest
authored andcommitted
fixed "sites" v. "size" problem, yaml_writer now works for catalysis and gas phase.
Time for pull request?
1 parent 8cd5917 commit c4c0e7c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

rmgpy/cantera.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ def obj_to_dict(obj, spcs, names=None, label="solvent"):
330330
result_dict["note"] = obj.transport_data.comment
331331
except:
332332
pass
333+
if "size" in species_data:
334+
sites = species_data["size"]
335+
species_data.pop("size", None)
336+
species_data["sites"] = sites
333337
species_data.update(result_dict)
334338
return (
335339
species_data # returns composition, name, thermo, and transport, and note

rmgpy/species.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,17 @@ def to_cantera(self, use_chemkin_identifier=False):
434434
else:
435435
element_dict[symbol] += 1
436436
if use_chemkin_identifier:
437-
ct_species = ct.Species(self.to_chemkin(), element_dict)
437+
label = self.to_chemkin()
438438
else:
439-
ct_species = ct.Species(self.label, element_dict)
439+
label = self.label
440+
441+
if self.contains_surface_site() and element_dict["X"] > 1:
442+
# for multidentate adsorbates, 'size' is the same as 'sites'? for some reason, cantera won't take the input 'size,' so will need to use 'sites'
443+
ct_species = ct.Species(label, element_dict, size=element_dict["X"])
444+
# hopefully this will be fixed soon, so that ct.Species can take a 'sites' parameter or that cantera can read input files with 'size' specified
445+
else:
446+
ct_species = ct.Species(label, element_dict)
447+
440448
if self.thermo:
441449
try:
442450
ct_species.thermo = self.thermo.to_cantera()

0 commit comments

Comments
 (0)