Skip to content

Commit

Permalink
Merge pull request #1721 from ReactionMechanismGenerator/less_debug
Browse files Browse the repository at this point in the history
Reduce the amount of logging messages that get too frequently printed during debug
  • Loading branch information
amarkpayne committed Sep 27, 2019
2 parents 91cdd1d + 55ec216 commit 3e37656
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 33 deletions.
2 changes: 1 addition & 1 deletion rmgpy/constraints.py
Expand Up @@ -90,7 +90,7 @@ def fails_species_constraints(species):

max_radicals = species_constraints.get('maximumRadicalElectrons', -1)
if max_radicals != -1:
if (struct.get_radical_count() > max_radicals):
if struct.get_radical_count() > max_radicals:
return True

max_carbenes = species_constraints.get('maximumSingletCarbenes', 1)
Expand Down
5 changes: 2 additions & 3 deletions rmgpy/data/base.py
Expand Up @@ -968,10 +968,9 @@ def match_node_to_structure(self, node, structure, atoms, strict=False):
return False
elif group.has_bond(center, atom1): # but structure doesn't
return False
# but we don't mind if...
elif structure.has_bond(atom, atom2): # but group doesn't
logging.debug("We don't mind that structure " + str(structure) +
" has bond but group {0} doesn't".format(node))
# We don't mind that the structure has bond but the group doesn't
pass
# Passed semantic checks, so add to maps of already-matched atoms
if not (isinstance(center, list) or isinstance(atom, list)):
initial_map[atom] = center
Expand Down
1 change: 0 additions & 1 deletion rmgpy/data/kinetics/common.py
Expand Up @@ -199,7 +199,6 @@ def independent_ids():

# If they are not all different, reassign ids and remake resonance structures
if not independent_ids():
logging.debug('identical atom ids found between species. regenerating')
for species in input_species:
unreactive_mol_list = [mol for mol in species.molecule if not mol.reactive]
mol = [mol for mol in species.molecule if mol.reactive][0] # Choose first reactive molecule
Expand Down
11 changes: 0 additions & 11 deletions rmgpy/data/kinetics/family.py
Expand Up @@ -1002,26 +1002,19 @@ def generate_product_template(self, reactants0):
# First, generate a list of reactant structures that are actual
# structures, rather than unions
reactant_structures = []
logging.log(1, "Generating template for products.")
for reactant in reactants0:
if isinstance(reactant, list):
reactants = [reactant[0]]
else:
reactants = [reactant]

logging.log(1, "Reactants: {0}".format(reactants))
for s in reactants:
logging.log(1, "Reactant {0}".format(s))
struct = s.item
if isinstance(struct, LogicNode):
all_structures = struct.get_possible_structures(self.groups.entries)
logging.log(1, 'Expanding logic node {0} to {1}'.format(s, all_structures))
reactant_structures.append(all_structures)
for p in all_structures:
logging.log(1, p.to_adjacency_list())
else:
reactant_structures.append([struct])
logging.log(1, struct.to_adjacency_list())

# Second, get all possible combinations of reactant structures
reactant_structures = get_all_combinations(reactant_structures)
Expand All @@ -1048,10 +1041,6 @@ def generate_product_template(self, reactants0):
raise
else:
product_structure_list[i].append(struct)

logging.log(1, "Unique generated product structures:")
logging.log(1, "\n".join([p[0].to_adjacency_list() for p in product_structures]))

# Fifth, associate structures with product template
product_set = []
for index, products in enumerate(product_structure_list):
Expand Down
16 changes: 0 additions & 16 deletions rmgpy/data/kinetics/groups.py
Expand Up @@ -196,22 +196,6 @@ def get_reaction_template(self, reaction):
msg = 'Unable to find matching template for reaction {0} in reaction family {1}.'.format(str(reaction),
str(self))
msg += 'Trying to match {0} but matched {1}'.format(str(forward_template), str(template))
logging.debug('len(template): {0}'.format(len(template)))
logging.debug('len(forward_template): {0}'.format(len(forward_template)))
logging.debug('reactants:')
for reactant in reaction.reactants:
if isinstance(reactant, Species):
for mol in reactant.molecule:
logging.debug(mol.to_adjacency_list())
else:
logging.debug(reactant.to_adjacency_list())
logging.debug('products:')
for product in reaction.products:
if isinstance(product, Species):
for mol in product.molecule:
logging.debug(mol.to_adjacency_list())
else:
logging.debug(product.to_adjacency_list())
raise UndeterminableKineticsError(reaction, message=msg)

return template
Expand Down
1 change: 0 additions & 1 deletion rmgpy/data/thermo.py
Expand Up @@ -1191,7 +1191,6 @@ def get_thermo_data(self, species, training_set=None):
thermo0 = self.get_thermo_data_from_libraries(species)

if thermo0 is not None:
logging.debug("Found thermo for {0} in {1}".format(species.label, thermo0[0].comment.lower()))
if len(thermo0) != 3:
raise RuntimeError("thermo0 should be a tuple (thermo_data, library, entry), not {0}".format(thermo0))
thermo0 = thermo0[0]
Expand Down

0 comments on commit 3e37656

Please sign in to comment.