From 966bfac60858e2433465d754441dc78afd279975 Mon Sep 17 00:00:00 2001 From: ssun30 Date: Tue, 28 May 2024 14:12:37 -0400 Subject: [PATCH 1/3] Added reference potential to Arrheniusq --- src/Calculators/Rate.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Calculators/Rate.jl b/src/Calculators/Rate.jl index 602b98b6..37b1979f 100644 --- a/src/Calculators/Rate.jl +++ b/src/Calculators/Rate.jl @@ -27,15 +27,16 @@ end @inline (arr::StickingCoefficient)(T::Q;P::N=0.0,C::S=0.0,phi=0.0,dGrxn=0.0,d=0.0) where {Q<:Real,N<:Real,S<:Real} = @fastmath min(arr.A*T^arr.n*exp(-arr.Ea/(R*T)),1.0) export StickingCoefficient -@with_kw struct Arrheniusq{N<:Real,K<:Real,Q<:Real,P<:AbstractRateUncertainty,B} <: AbstractRate +@with_kw struct Arrheniusq{N<:Real,K<:Real,Q<:Real,R<:Real,P<:AbstractRateUncertainty,B} <: AbstractRate A::N n::K Ea::Q q::B = 0.0 + V0::R = 0.0 unc::P = EmptyRateUncertainty() end -@inline (arr::Arrheniusq)(;T::Q,P::N=0.0,C::S=0.0,phi=0.0,dGrxn=0.0,d=0.0) where {Q<:Real,N<:Real,S<:Real} = @fastmath arr.A*T^arr.n*exp((-arr.Ea-arr.q*F*phi)/(R*T)) -@inline (arr::Arrheniusq)(T::Q;P::N=0.0,C::S=0.0,phi=0.0,dGrxn=0.0,d=0.0) where {Q<:Real,N<:Real,S<:Real} = @fastmath arr.A*T^arr.n*exp((-arr.Ea-arr.q*F*phi)/(R*T)) +@inline (arr::Arrheniusq)(;T::Q,P::N=0.0,C::S=0.0,phi=0.0,dGrxn=0.0,d=0.0) where {Q<:Real,N<:Real,S<:Real} = @fastmath arr.A*T^arr.n*exp((-arr.Ea-arr.q*F*(phi-arr.V0))/(R*T)) +@inline (arr::Arrheniusq)(T::Q;P::N=0.0,C::S=0.0,phi=0.0,dGrxn=0.0,d=0.0) where {Q<:Real,N<:Real,S<:Real} = @fastmath arr.A*T^arr.n*exp((-arr.Ea-arr.q*F*(phi-arr.V0))/(R*T)) export Arrheniusq @with_kw struct Marcus{N<:Real,K<:Real,Q,P<:AbstractRateUncertainty,B} <: AbstractRate @@ -248,7 +249,7 @@ export getkineticstype @inline extracttypename(typ::Symbol) = string(typ) @inline extracttypename(typ) = string(typ.name) - + @inline function _calcdkdCeff(tbarr::ThirdBody,T::Float64,Ceff::Float64) return @fastmath tbarr.arr(T) end From 53995f604c3719a0a303a55ffed9f2e7b106a296 Mon Sep 17 00:00:00 2001 From: ssun30 Date: Tue, 6 Aug 2024 15:00:27 -0400 Subject: [PATCH 2/3] Fixed interfaces not setting phi correctly --- src/Interface.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Interface.jl b/src/Interface.jl index e56c6f39..30f28b98 100644 --- a/src/Interface.jl +++ b/src/Interface.jl @@ -95,6 +95,14 @@ function ReactiveInternalInterfaceConstantTPhi(domain1,domain2,reactions,T,A,phi M,Nrp1,Nrp2 = getstoichmatrix(domain1,domain2,reactions) Gpart = ArrayPartition(domain1.Gs,domain2.Gs) dGrxns = -M*Gpart + electronchanges = [hasproperty(reaction, :electronchange) ? reaction.electronchange : 0.0 for reaction in reactions] + referencepotentials = [hasproperty(reaction.kinetics, :V0) ? reaction.kinetics.V0 : 0.0 for reaction in reactions] + if isa(domain1.phase, IdealSurface) + phi = domain1.phi !== nothing ? domain1.phi : phi + elseif isa(domain2.phase, IdealSurface) + phi = domain2.phi !== nothing ? domain2.phi : phi + end + dGrxns .+= electronchanges.*(phi.-referencepotentials).*F kfs = getkf.(reactions,nothing,T,0.0,0.0,Ref([]),A,phi,dGrxns,0.0) Kc = getKcs(domain1.phase,domain2.phase,T,Nrp1,Nrp2,dGrxns) krevs = kfs./Kc From 6b9e9badfb3cf6d490aa4d26d0a46967ccb5a7b2 Mon Sep 17 00:00:00 2001 From: ssun30 Date: Tue, 6 Aug 2024 15:12:43 -0400 Subject: [PATCH 3/3] Parser uses RMG if RDKit fails to get structure --- src/Parse.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Parse.jl b/src/Parse.jl index 8e1241a8..5174a902 100644 --- a/src/Parse.jl +++ b/src/Parse.jl @@ -168,7 +168,12 @@ function getatomdictsmiles(smiles) mol.assign_representative_molecule() getatomdictfromrmg(mol.mol_repr) else - getatomdictfromrdkit(Chem.AddHs(Chem.MolFromSmiles(smiles))) + try + return getatomdictfromrdkit(Chem.AddHs(Chem.MolFromSmiles(smiles))) + catch e + println("RDKit parsing failed, using RMG instead", e) + return getatomdictfromrmg(molecule.Molecule().from_smiles(smiles)) + end end end