Skip to content

Commit b5c37c4

Browse files
committed
Fixed atomtype charge checking
Now includes checks for negative charges temporary fix to an exponent overflow problem
1 parent be9e0c7 commit b5c37c4

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

rmgpy/molecule/group.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ def is_van_der_waals(self, wildcards=False):
10131013
else:
10141014
return abs(self.order[0]) <= 1e-9 and len(self.order) == 1
10151015

1016-
1016+
10171017
def is_reaction_bond(self, wildcards=False):
10181018
"""
10191019
Return ``True`` if the bond represents a van der Waals bond or ``False`` if
@@ -1851,7 +1851,7 @@ def specify_bond_extensions(self, i, j, basename, r_bonds):
18511851
else:
18521852
atom_type_j_str = atom_type_j[0].label
18531853

1854-
b = None
1854+
b = None
18551855
for v in bdict.keys():
18561856
if abs(v - bd) < 1e-4:
18571857
b = bdict[v]
@@ -2995,6 +2995,8 @@ def make_sample_molecule(self):
29952995
'S0sc', 'S2sc', 'S2dc', 'S2tc', 'S4sc', 'S4dc', 'S4tdc', 'S6sc', 'S6dc', 'S6tdc']
29962996
if atom.charge > 0 and any([group_atom.atomtype[0] is ATOMTYPES[x] or ATOMTYPES[x].is_specific_case_of(group_atom.atomtype[0]) for x in positive_charged]):
29972997
pass
2998+
elif atom.charge < 0 and any([group_atom.atomtype[0] is ATOMTYPES[x] or ATOMTYPES[x].is_specific_case_of(group_atom.atomtype[0]) for x in negative_charged]):
2999+
pass
29983000
elif atom.charge in group_atom.atomtype[0].charge:
29993001
# declared charge in original group is same as new charge
30003002
pass

rmgpy/rmg/reactors.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,18 @@ def to_rms(obj, species_names=None, rms_species_list=None, rmg_species=None):
601601
A = obj._A.value_si
602602
if obj._T0.value_si != 1.0:
603603
A /= ((obj._T0.value_si) ** obj._n.value_si)
604-
if obj._V0.value_si != 0.0:
605-
A *= np.exp(obj._alpha.value_si*obj._electrons.value_si*constants.F*obj.V0.value_si)
604+
# if obj._V0.value_si != 0.0:
605+
# A *= np.exp(obj._alpha.value_si*obj._electrons.value_si*constants.F*obj.V0.value_si/constants.R/300)
606606
n = obj._n.value_si
607607
Ea = obj._Ea.value_si
608-
q = obj._alpha.value_si*obj._electrons.value_si
608+
q = obj._alpha.value_si*obj._electrons.value_si
609609
return rms.Arrheniusq(A, n, Ea, q, rms.EmptyRateUncertainty())
610610
elif isinstance(obj, SurfaceChargeTransfer):
611611
A = obj._A.value_si
612612
if obj._T0.value_si != 1.0:
613613
A /= ((obj._T0.value_si) ** obj._n.value_si)
614-
if obj._V0.value_si != 0.0:
615-
A *= np.exp(obj._alpha.value_si*obj._electrons.value_si*constants.F*obj.V0.value_si)
614+
# if obj._V0.value_si != 0.0:
615+
# A *= np.exp(obj._alpha.value_si*obj._electrons.value_si*constants.F*obj.V0.value_si/constants.R/300)
616616
n = obj._n.value_si
617617
Ea = obj._Ea.value_si
618618
q = obj._alpha.value_si*obj._electrons.value_si
@@ -784,7 +784,7 @@ def to_rms(obj, species_names=None, rms_species_list=None, rmg_species=None):
784784
reactants = [rms_species_list[i] for i in reactantinds]
785785
products = [rms_species_list[i] for i in productinds]
786786
if isinstance(obj.kinetics, SurfaceChargeTransfer):
787-
obj.set_reference_potential(obj.kinetics._T0.value_si)
787+
obj.set_reference_potential(300)
788788
kinetics = to_rms(obj.kinetics, species_names=species_names, rms_species_list=rms_species_list, rmg_species=rmg_species)
789789
radchange = sum([spc.molecule[0].multiplicity-1 for spc in obj.products]) - sum([spc.molecule[0].multiplicity-1 for spc in obj.reactants])
790790
electronchange = -sum([spc.molecule[0].get_net_charge() for spc in obj.products]) + sum([spc.molecule[0].get_net_charge() for spc in obj.reactants])

0 commit comments

Comments
 (0)