From 7d1447cf53b50ad368e422e6e409f0fa654adbde Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Fri, 27 May 2022 10:03:07 -0400 Subject: [PATCH] Switch to reals for Ar0n Oddly this fixes the error in derivative, but it should have no impact --- include/teqp/derivs.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/teqp/derivs.hpp b/include/teqp/derivs.hpp index 8ddf11c..b228009 100644 --- a/include/teqp/derivs.hpp +++ b/include/teqp/derivs.hpp @@ -207,9 +207,10 @@ struct TDXDerivatives { static auto get_Ar0n(const Model& model, const Scalar& T, const Scalar& rho, const VectorType& molefrac) { std::valarray<Scalar> o(Nderiv+1); if constexpr (be == ADBackends::autodiff) { - autodiff::HigherOrderDual<Nderiv, double> rhodual = rho; - auto f = [&model, &T, &molefrac](const auto& rho_) { return eval(model.alphar(T, rho_, molefrac)); }; - auto ders = derivatives(f, wrt(rhodual), at(rhodual)); + // If a pure derivative, then we can use autodiff::Real for that variable and Scalar for other variable + autodiff::Real<Nderiv, Scalar> rho_ = rho; + auto f = [&model, &T, &molefrac](const auto& rho__) { return model.alphar(T, rho__, molefrac); }; + auto ders = derivatives(f, along(1), at(rho_)); for (auto n = 0; n <= Nderiv; ++n) { o[n] = forceeval(powi(rho, n) * ders[n]); } -- GitLab