teqp
0.23.1
Toggle main menu visibility
Loading...
Searching...
No Matches
include
teqp
models
model_potentials
LJChain.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
teqp/types.hpp
"
4
#include "
teqp/exceptions.hpp
"
5
#include <map>
6
7
namespace
teqp
{
8
namespace
LJChain
{
9
13
template
<
typename
Monomer>
14
class
LJChain
{
15
private
:
16
const
Monomer monomer;
17
double
m;
18
const
std::valarray<std::valarray<double>> aij_Johnson = {
19
{},
20
{0, 0.49304346593882, 2.1528349894745 ,-15.955682329017, 24.035999666294 , -8.6437958513990},
21
{0,-0.47031983115362, 1.1471647487376 , 37.889828024211, -84.667121491179 , 39.643914108411},
22
{0, 5.0325486243620 ,-25.915399226419 ,-18.862251310090, 107.63707381726 ,-66.602649735720},
23
{0,-7.3633150434385 , 51.553565337453 ,-40.519369256098, -38.796692647218 , 44.605139198378},
24
{0, 2.9043607296043 ,-24.478812869291 , 31.500186765040, -5.3368920371407, -9.5183440180133}
25
};
26
27
public
:
28
LJChain
(Monomer &&monomer,
double
m) : monomer(monomer), m(m){};
29
30
template
<
typename
TType,
typename
RhoType>
31
auto
g_LJ
(
const
TType& Tstar,
const
RhoType& rhostar_monomer)
const
{
32
std::common_type_t<TType, RhoType> summer = 1.0;
33
for
(
auto
i = 1; i < 6; ++i){
34
for
(
auto
j = 1; j < 6; ++j){
35
summer += aij_Johnson[i][j]*
powi
(rhostar_monomer,i)*
powi
(Tstar, 1-j);
36
}
37
}
38
return
summer;
39
}
40
41
template
<
typename
TType,
typename
RhoType>
42
auto
get_lnyR
(
const
TType& Tstar,
const
RhoType& rhostar_monomer)
const
{
43
return
forceeval
(log(
g_LJ
(Tstar, rhostar_monomer)));
44
}
45
46
template
<
typename
TType,
typename
RhoType,
typename
MoleFracType>
47
auto
alphar
(
const
TType& Tstar,
48
const
RhoType& rho_chain_star,
49
const
MoleFracType& molefrac)
const
50
{
51
auto
rhostar_monomer =
forceeval
(rho_chain_star*m);
52
auto
alphar_monomer = m*monomer.alphar(Tstar, rhostar_monomer, molefrac);
53
auto
alphar_chain = (1-m)*
get_lnyR
(Tstar, rhostar_monomer);
54
return
forceeval
(alphar_chain + alphar_monomer);
55
}
56
57
template
<
class
VecType>
58
auto
R
(
const
VecType&
/*molefrac*/
)
const
{
59
return
1.0;
60
}
61
};
62
63
}
// namespace LJChain
64
};
// namespace teqp
teqp::LJChain::LJChain
Definition
LJChain.hpp:14
teqp::LJChain::LJChain::LJChain
LJChain(Monomer &&monomer, double m)
Definition
LJChain.hpp:28
teqp::LJChain::LJChain::get_lnyR
auto get_lnyR(const TType &Tstar, const RhoType &rhostar_monomer) const
Definition
LJChain.hpp:42
teqp::LJChain::LJChain::g_LJ
auto g_LJ(const TType &Tstar, const RhoType &rhostar_monomer) const
Definition
LJChain.hpp:31
teqp::LJChain::LJChain::R
auto R(const VecType &) const
Definition
LJChain.hpp:58
teqp::LJChain::LJChain::alphar
auto alphar(const TType &Tstar, const RhoType &rho_chain_star, const MoleFracType &molefrac) const
Definition
LJChain.hpp:47
exceptions.hpp
teqp
Definition
ancillary_builder.hpp:8
teqp::powi
T powi(const T &x, int n)
From Ulrich Deiters.
Definition
types.hpp:139
teqp::forceeval
auto forceeval(T &&expr)
Definition
types.hpp:52
types.hpp
Generated by
1.17.0