teqp 0.22.0
Loading...
Searching...
No Matches
json_builder.hpp
Go to the documentation of this file.
1#pragma once
2
3#pragma message("Header `teqp/json_builder.hpp` is deprecated!")
4
5#include "teqp/models/fwd.hpp"
8
9#include "teqp/exceptions.hpp"
11
12#include "nlohmann/json.hpp"
13#include <memory>
14
15namespace teqp {
16
17/*
18 inline AllowedModels build_model(const nlohmann::json& json) {
19
20 // Extract the name of the model and the model parameters
21 std::string kind = json.at("kind");
22 auto spec = json.at("model");
23
24 if (kind == "vdW1") {
25 return vdWEOS1(spec.at("a"), spec.at("b"));
26 }
27 else if (kind == "vdW") {
28 return vdWEOS<double>(spec.at("Tcrit / K"), spec.at("pcrit / Pa"));
29 }
30 else if (kind == "PR") {
31 std::valarray<double> Tc_K = spec.at("Tcrit / K"), pc_Pa = spec.at("pcrit / Pa"), acentric = spec.at("acentric");
32 Eigen::ArrayXXd kmat(0, 0);
33 if (spec.contains("kmat")){
34 kmat = build_square_matrix(spec.at("kmat"));
35 }
36 return canonical_PR(Tc_K, pc_Pa, acentric, kmat);
37 }
38 else if (kind == "SRK") {
39 std::valarray<double> Tc_K = spec.at("Tcrit / K"), pc_Pa = spec.at("pcrit / Pa"), acentric = spec.at("acentric");
40 Eigen::ArrayXXd kmat(0, 0);
41 if (spec.contains("kmat")){
42 kmat = build_square_matrix(spec.at("kmat"));
43 }
44 return canonical_SRK(Tc_K, pc_Pa, acentric, kmat);
45 }
46 else if (kind == "CPA") {
47 return CPA::CPAfactory(spec);
48 }
49 else if (kind == "PCSAFT") {
50 return PCSAFT::PCSAFTfactory(spec);
51 }
52 else if (kind == "SAFT-VR-Mie") {
53 return SAFTVRMie::SAFTVRMiefactory(spec);
54 }
55 else if (kind == "multifluid") {
56 return multifluidfactory(spec);
57 }
58 else if (kind == "SW_EspindolaHeredia2009"){
59 return squarewell::EspindolaHeredia2009(spec.at("lambda"));
60 }
61 else if (kind == "EXP6_Kataoka1992"){
62 return exp6::Kataoka1992(spec.at("alpha"));
63 }
64 else if (kind == "AmmoniaWaterTillnerRoth"){
65 return AmmoniaWaterTillnerRoth();
66 }
67 else if (kind == "LJ126_TholJPCRD2016"){
68 return build_LJ126_TholJPCRD2016();
69 }
70 else if (kind == "LJ126_KolafaNezbeda1994"){
71 return LJ126KolafaNezbeda1994();
72 }
73 else if (kind == "LJ126_Johnson1993"){
74 return LJ126Johnson1993();
75 }
76 else if (kind == "Mie_Pohl2023"){
77 return Mie::Mie6Pohl2023(spec.at("lambda_a"));
78 }
79 else if (kind == "2CLJF-Dipole"){
80 return twocenterljf::build_two_center_model_dipole(spec.at("author"), spec.at("L^*"), spec.at("(mu^*)^2"));
81 }
82 else if (kind == "2CLJF-Quadrupole"){
83 return twocenterljf::build_two_center_model_quadrupole(spec.at("author"), spec.at("L^*"), spec.at("(mu^*)^2"));
84 }
85 else if (kind == "IdealHelmholtz"){
86 return IdealHelmholtz(spec);
87 }
88 else {
89 throw teqpcException(30, "Unknown kind:" + kind);
90 }
91 }
92*/
93
94};