From 137a2db923b44759d691ceb20e7aa0564d7a6d28 Mon Sep 17 00:00:00 2001
From: Ian Bell <ian.bell@nist.gov>
Date: Mon, 8 May 2023 17:48:49 -0400
Subject: [PATCH] Fix vdW making and add error handling

---
 interface/CPP/teqp_impl_factory.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/interface/CPP/teqp_impl_factory.cpp b/interface/CPP/teqp_impl_factory.cpp
index bdecf6f..3e6b7e3 100644
--- a/interface/CPP/teqp_impl_factory.cpp
+++ b/interface/CPP/teqp_impl_factory.cpp
@@ -12,6 +12,7 @@ namespace teqp {
 
         static std::unordered_map<std::string, makefunc> pointer_factory = {
             {"vdW1", [](const nlohmann::json& spec){ return make_owned(vdWEOS1(spec.at("a"), spec.at("b"))); }},
+            {"vdW", [](const nlohmann::json& spec){ return make_owned(vdWEOS<double>(spec.at("Tcrit / K"), spec.at("pcrit / Pa"))); }},
             
             {"PR", [](const nlohmann::json& spec){ return make_owned(make_canonicalPR(spec));}},
             {"SRK", [](const nlohmann::json& spec){ return make_owned(make_canonicalSRK(spec));}},
@@ -45,7 +46,7 @@ namespace teqp {
                 return (itr->second)(spec);
             }
             else{
-                throw std::invalid_argument("aah");
+                throw std::invalid_argument("Don't understand \"kind\" of: " + kind);
             }
         }
     
-- 
GitLab