From e760e0800cc3db5c4215815de147eef98bf6ab98 Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Fri, 26 Aug 2022 16:06:51 -0400 Subject: [PATCH] Add dp/dT along critical locus (and to Python) --- include/teqp/algorithms/critical_tracing.hpp | 9 +++++++++ interface/pybind11_wrapper.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/include/teqp/algorithms/critical_tracing.hpp b/include/teqp/algorithms/critical_tracing.hpp index b2a41ef..3cdf044 100644 --- a/include/teqp/algorithms/critical_tracing.hpp +++ b/include/teqp/algorithms/critical_tracing.hpp @@ -765,6 +765,15 @@ struct CriticalTracing { return JSONdata; } + /** + * \brief Calculate dp/dT along the critical locus at given T, rhovec + */ + static auto get_dp_dT_crit(const Model& model, const Scalar& T, const VecType& rhovec) { + using id = IsochoricDerivatives<Model, Scalar, VecType>; + auto dpdrhovec = id::get_dpdrhovec_constT(model, T, rhovec); + return id::get_dpdT_constrhovec(model, T, rhovec) + (dpdrhovec.matrix() * get_drhovec_dT_crit(model, T, rhovec).matrix()).array(); + } + }; // namespace VecType }; // namespace teqp \ No newline at end of file diff --git a/interface/pybind11_wrapper.hpp b/interface/pybind11_wrapper.hpp index bbdc155..1e49bc1 100644 --- a/interface/pybind11_wrapper.hpp +++ b/interface/pybind11_wrapper.hpp @@ -72,6 +72,7 @@ void add_derivatives(py::module &m, Wrapper &cls) { cls.def("eigen_problem", &ct::eigen_problem); cls.def("get_minimum_eigenvalue_Psi_Hessian", &ct::get_minimum_eigenvalue_Psi_Hessian); cls.def("get_drhovec_dT_crit", &ct::get_drhovec_dT_crit); + cls.def("get_dp_dT_crit", &ct::get_dp_dT_crit); cls.def("extrapolate_from_critical", &extrapolate_from_critical<Model, double>); cls.def("pure_VLE_T", &pure_VLE_T<Model, double>); -- GitLab