Skip to content

Commit f8fdf43

Browse files
committed
Check species constraints in consistent order.
Doesn't make a real difference, just easier for a human to parse the code without making errors, when the "if" blocks are in the same order as the documentation and examples.
1 parent 88adf99 commit f8fdf43

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

rmgpy/constraints.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ def fails_species_constraints(species):
108108
if struct.get_num_atoms('S') > max_sulfur_atoms:
109109
return True
110110

111+
max_heavy_atoms = species_constraints.get('maximumHeavyAtoms', -1)
112+
if max_heavy_atoms != -1:
113+
if struct.get_num_atoms() - struct.get_num_atoms('H') > max_heavy_atoms:
114+
return True
115+
111116
max_surface_sites = species_constraints.get('maximumSurfaceSites', -1)
112117
if max_surface_sites != -1:
113118
if struct.get_num_atoms('X') > max_surface_sites:
@@ -119,11 +124,6 @@ def fails_species_constraints(species):
119124
if site.get_total_bond_order() > max_surface_bond_order:
120125
return True
121126

122-
max_heavy_atoms = species_constraints.get('maximumHeavyAtoms', -1)
123-
if max_heavy_atoms != -1:
124-
if struct.get_num_atoms() - struct.get_num_atoms('H') > max_heavy_atoms:
125-
return True
126-
127127
max_radicals = species_constraints.get('maximumRadicalElectrons', -1)
128128
if max_radicals != -1:
129129
if struct.get_radical_count() > max_radicals:

0 commit comments

Comments
 (0)