Skip to content

Commit ceffe63

Browse files
author
Roberto Di Remigio
committed
Tests are in place for AnisotropicLiquid
1 parent f74ad37 commit ceffe63

19 files changed

+600
-163
lines changed

doc/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ PAPER_TYPE = a4wide
13311331
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
13321332
# packages that should be included in the LaTeX output.
13331333

1334-
EXTRA_PACKAGES =
1334+
EXTRA_PACKAGES = "@CMAKE_SOURCE_DIR@/doc/pcmsolver.sty"
13351335

13361336
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
13371337
# the generated latex document. The header should contain everything until

doc/pcmsolver.sty

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
\NeedsTeXFormat{LaTeX2e}
2+
\ProvidesPackage{pcmsolver}
3+
\RequirePackage{calc}
4+
\RequirePackage{array}
5+
6+
\RequirePackage[utf8]{inputenc}
7+
\RequirePackage[scaled]{beramono}
8+
\RequirePackage[T1]{fontenc}
9+
\RequirePackage{garamondx}
10+
\RequirePackage[garamondx,cmbraces]{newtxmath}
11+
\linespread{1.05}
12+
\RequirePackage[english]{babel}
13+
\RequirePackage{verbatim}
14+
\RequirePackage{amstext}
15+
\RequirePackage{amssymb}
16+
\RequirePackage{bm}
17+
\RequirePackage{empheq}
18+
\RequirePackage{mathtools}
19+
\RequirePackage{textcomp}
20+
\RequirePackage{pdfcolmk}
21+
\RequirePackage[big]{layaureo}
22+
23+
\newcommand*{\diff}{\mathop{}\!\mathrm{d}}
24+
\newcommand*{\deriv}[3][]{%
25+
\frac{\diff^{#1}#2}{\diff #3^{#1}}}
26+
\newcommand*{\pderiv}[3][]{%
27+
\frac{\partial^{#1}#2}%
28+
{\partial #3^{#1}}}
29+
\newcommand*{\commutator}[3][]{\left[ #2, #3 \right]^{#1}}
30+
\newcommand*{\anticommutator}[2]{%
31+
\left[ #1, #2 \right]_{+}}
32+
33+
\newcommand*{\diel}{\varepsilon}
34+
\newcommand*{\vect}[1]{\bm{#1}}
35+
\newcommand*{\mat}[1]{\bm{\mathcal{#1}}}

src/green/AnisotropicLiquid.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "AnisotropicLiquid.hpp"
2727

28+
#include <algorithm>
2829
#include <cmath>
2930
#include <ostream>
3031
#include <stdexcept>
@@ -53,41 +54,50 @@ void AnisotropicLiquid<T>::build() {
5354
Eigen::Vector3d scratch;
5455
scratch << (1.0/epsilonLab_(0)), (1.0/epsilonLab_(1)), (1.0/epsilonLab_(2));
5556
epsilonInv_ = R_ * scratch.asDiagonal() * R_.transpose();
57+
// 4. As a final step, calculate the determinant
58+
detEps_ = epsilonLab_(0) * epsilonLab_(1) * epsilonLab_(2);
5659
}
5760

5861
template<typename T>
5962
double AnisotropicLiquid<T>::derivative(const Eigen::Vector3d & direction,
6063
const Eigen::Vector3d & p1, const Eigen::Vector3d & p2) const
6164
{
6265
// NORMALIZATION TEMPORARILY REMOVED /direction.norm();
63-
return 0.0; //epsilon_ * (this->derivativeProbe(direction, p1, p2));
66+
return this->derivativeProbe(direction, p1, p2);
6467
}
6568

6669
template<typename T>
6770
T AnisotropicLiquid<T>::operator()(T * sp, T * pp) const
6871
{
69-
T distance = sqrt((sp[0] - pp[0]) * (sp[0] - pp[0]) +
70-
(sp[1] - pp[1]) * (sp[1] - pp[1]) +
71-
(sp[2] - pp[2]) * (sp[2] - pp[2]));
72-
return 0.0;//(exp(-kappa_ * distance) / (epsilon_ * distance));
72+
// The distance has to be calculated using epsilonInv_ as metric:
73+
T scratch = 0.0;
74+
for (int i = 0; i < 3; ++i) {
75+
for (int j = 0; j < 3; ++j) {
76+
scratch += (sp[i] - pp[i]) * epsilonInv_(i, j) * (sp[j] - pp[j]);
77+
}
78+
}
79+
T distance = sqrt(scratch);
80+
81+
return (1.0/(sqrt(detEps_) * distance));
7382
}
7483

7584
template <typename T>
7685
double AnisotropicLiquid<T>::diagonalS(const Element & e) const {
77-
return 0.0; //this->diagonal_->computeS(this, e);
86+
return this->diagonal_->computeS(this, e);
7887
}
7988

8089
template <typename T>
8190
double AnisotropicLiquid<T>::diagonalD(const Element & e) const {
82-
return 0.0; //this->diagonal_->computeD(this, e);
91+
return this->diagonal_->computeD(this, e);
8392
}
8493

8594
template <typename T>
8695
std::ostream & AnisotropicLiquid<T>::printObject(std::ostream & os)
8796
{
8897
os << "Green's function type: anisotropic liquid" << std::endl;
89-
os << "Permittivity tensor diagonal (lab frame) = " << epsilon_.transpose() << std::endl;
90-
os << "Euler angles (molecule-to-lab frame) = " << eulerAngles_.transpose();
98+
os << "Permittivity tensor diagonal (lab frame) = " << epsilonLab_.transpose() << std::endl;
99+
os << "Permittivity tensor (molecule-fixed frame) =\n" << epsilon_ << std::endl;
100+
os << "Euler angles (molecule-to-lab frame) = " << eulerAngles_.transpose();
91101
return os;
92102
}
93103

src/green/AnisotropicLiquid.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ class AnisotropicLiquid : public GreensFunction<T>
114114
Eigen::Vector3d eulerAngles_;
115115
/// Permittivity tensor in molecule-fixed frame
116116
Eigen::Matrix3d epsilon_;
117-
/// Inverser of the permittivity tensor in molecule-fixed frame
117+
/// Inverse of the permittivity tensor in molecule-fixed frame
118118
Eigen::Matrix3d epsilonInv_;
119119
/// molecule-fixed to lab-fixed frames rotation matrix
120120
Eigen::Matrix3d R_;
121+
/// Determinant of the permittivity tensor
122+
double detEps_;
121123
virtual std::ostream & printObject(std::ostream & os);
122124
};
123125

src/green/IonicLiquid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ double IonicLiquid<T>::derivative(const Eigen::Vector3d & direction,
4545
const Eigen::Vector3d & p1, const Eigen::Vector3d & p2) const
4646
{
4747
// NORMALIZATION TEMPORARILY REMOVED /direction.norm();
48-
return epsilon_ * (this->derivativeProbe(direction, p1, p2));
48+
return (this->derivativeProbe(direction, p1, p2));
4949
}
5050

5151
template<typename T>

src/green/UniformDielectric.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@
4242
template<typename T>
4343
double UniformDielectric<T>::derivative(const Eigen::Vector3d & direction,
4444
const Eigen::Vector3d & p1, const Eigen::Vector3d & p2) const
45-
{
46-
return epsilon_ * (this->derivativeProbe(direction, p1,
47-
p2)); // NORMALIZTION TEMPORARY REMOVED /direction.norm();
45+
{ // NORMALIZTION TEMPORARY REMOVED /direction.norm();
46+
return (this->derivativeProbe(direction, p1, p2));
4847
}
4948

5049
template<typename T>
@@ -53,7 +52,7 @@ T UniformDielectric<T>::operator()(T * sp, T * pp) const
5352
T distance = sqrt((sp[0] - pp[0]) * (sp[0] - pp[0]) +
5453
(sp[1] - pp[1]) * (sp[1] - pp[1]) +
5554
(sp[2] - pp[2]) * (sp[2] - pp[2]));
56-
return 1/(epsilon_ * distance);
55+
return (1.0/(epsilon_ * distance));
5756
}
5857

5958
template <typename T>

src/operators_diagonal/CollocationIntegrator.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,53 @@ double CollocationIntegrator::computeD(const UniformDielectric<AD_hessian> * gf,
119119
}
120120

121121
double CollocationIntegrator::computeS(const IonicLiquid<double> * gf, const Element & e) const {
122+
return 0.0;
122123
}
123124
double CollocationIntegrator::computeS(const IonicLiquid<AD_directional> * gf, const Element & e) const {
125+
return 0.0;
124126
}
125127
double CollocationIntegrator::computeS(const IonicLiquid<AD_gradient> * gf, const Element & e) const {
128+
return 0.0;
126129
}
127130
double CollocationIntegrator::computeS(const IonicLiquid<AD_hessian> * gf, const Element & e) const {
131+
return 0.0;
128132
}
129133

130134
double CollocationIntegrator::computeD(const IonicLiquid<double> * gf, const Element & e) const {
135+
return 0.0;
131136
}
132137
double CollocationIntegrator::computeD(const IonicLiquid<AD_directional> * gf, const Element & e) const {
138+
return 0.0;
133139
}
134140
double CollocationIntegrator::computeD(const IonicLiquid<AD_gradient> * gf, const Element & e) const {
141+
return 0.0;
135142
}
136143
double CollocationIntegrator::computeD(const IonicLiquid<AD_hessian> * gf, const Element & e) const {
144+
return 0.0;
145+
}
146+
147+
double CollocationIntegrator::computeS(const AnisotropicLiquid<double> * gf, const Element & e) const {
148+
return 0.0;
149+
}
150+
double CollocationIntegrator::computeS(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const {
151+
return 0.0;
152+
}
153+
double CollocationIntegrator::computeS(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const {
154+
return 0.0;
155+
}
156+
double CollocationIntegrator::computeS(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const {
157+
return 0.0;
158+
}
159+
160+
double CollocationIntegrator::computeD(const AnisotropicLiquid<double> * gf, const Element & e) const {
161+
return 0.0;
162+
}
163+
double CollocationIntegrator::computeD(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const {
164+
return 0.0;
165+
}
166+
double CollocationIntegrator::computeD(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const {
167+
return 0.0;
168+
}
169+
double CollocationIntegrator::computeD(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const {
170+
return 0.0;
137171
}

src/operators_diagonal/CollocationIntegrator.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Element;
1212
#include "DerivativeTypes.hpp"
1313
#include "DiagonalIntegrator.hpp"
1414
#include "DiagonalIntegratorFactory.hpp"
15+
#include "AnisotropicLiquid.hpp"
1516
#include "IonicLiquid.hpp"
1617
#include "UniformDielectric.hpp"
1718
#include "Vacuum.hpp"
@@ -67,6 +68,16 @@ class CollocationIntegrator : public DiagonalIntegrator
6768
virtual double computeD(const IonicLiquid<AD_directional> * gf, const Element & e) const;
6869
virtual double computeD(const IonicLiquid<AD_gradient> * gf, const Element & e) const;
6970
virtual double computeD(const IonicLiquid<AD_hessian> * gf, const Element & e) const;
71+
72+
virtual double computeS(const AnisotropicLiquid<double> * gf, const Element & e) const;
73+
virtual double computeS(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const;
74+
virtual double computeS(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const;
75+
virtual double computeS(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const;
76+
77+
virtual double computeD(const AnisotropicLiquid<double> * gf, const Element & e) const;
78+
virtual double computeD(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const;
79+
virtual double computeD(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const;
80+
virtual double computeD(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const;
7081
private:
7182
/// Scaling factor for the collocation formulas
7283
double factor_;

src/operators_diagonal/DiagonalIntegrator.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "DerivativeTypes.hpp"
1111
#include "Element.hpp"
12+
#include "AnisotropicLiquid.hpp"
1213
#include "IonicLiquid.hpp"
1314
#include "UniformDielectric.hpp"
1415
#include "Vacuum.hpp"
@@ -56,6 +57,16 @@ class DiagonalIntegrator
5657
virtual double computeD(const IonicLiquid<AD_directional> * gf, const Element & e) const = 0;
5758
virtual double computeD(const IonicLiquid<AD_gradient> * gf, const Element & e) const = 0;
5859
virtual double computeD(const IonicLiquid<AD_hessian> * gf, const Element & e) const = 0;
60+
61+
virtual double computeS(const AnisotropicLiquid<double> * gf, const Element & e) const = 0;
62+
virtual double computeS(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const = 0;
63+
virtual double computeS(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const = 0;
64+
virtual double computeS(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const = 0;
65+
66+
virtual double computeD(const AnisotropicLiquid<double> * gf, const Element & e) const = 0;
67+
virtual double computeD(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const = 0;
68+
virtual double computeD(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const = 0;
69+
virtual double computeD(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const = 0;
5970
};
6071

6172
#endif // DIAGONALINTEGRATOR_HPP

src/operators_diagonal/NumericalIntegrator.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,55 +38,105 @@
3838
#include "Element.hpp"
3939

4040
double NumericalIntegrator::computeS(const Vacuum<double> * gf, const Element & e) const {
41+
return 0.0;
4142
}
4243
double NumericalIntegrator::computeS(const Vacuum<AD_directional> * gf, const Element & e) const {
44+
return 0.0;
4345
}
4446
double NumericalIntegrator::computeS(const Vacuum<AD_gradient> * gf, const Element & e) const {
47+
return 0.0;
4548
}
4649
double NumericalIntegrator::computeS(const Vacuum<AD_hessian> * gf, const Element & e) const {
50+
return 0.0;
4751
}
4852

4953
double NumericalIntegrator::computeD(const Vacuum<double> * gf, const Element & e) const {
54+
return 0.0;
5055
}
5156
double NumericalIntegrator::computeD(const Vacuum<AD_directional> * gf, const Element & e) const {
57+
return 0.0;
5258
}
5359
double NumericalIntegrator::computeD(const Vacuum<AD_gradient> * gf, const Element & e) const {
60+
return 0.0;
5461
}
5562
double NumericalIntegrator::computeD(const Vacuum<AD_hessian> * gf, const Element & e) const {
63+
return 0.0;
5664
}
5765

5866
double NumericalIntegrator::computeS(const UniformDielectric<double> * gf, const Element & e) const {
67+
return 0.0;
5968
}
6069
double NumericalIntegrator::computeS(const UniformDielectric<AD_directional> * gf, const Element & e) const {
70+
return 0.0;
6171
}
6272
double NumericalIntegrator::computeS(const UniformDielectric<AD_gradient> * gf, const Element & e) const {
73+
return 0.0;
6374
}
6475
double NumericalIntegrator::computeS(const UniformDielectric<AD_hessian> * gf, const Element & e) const {
76+
return 0.0;
6577
}
6678

6779
double NumericalIntegrator::computeD(const UniformDielectric<double> * gf, const Element & e) const {
80+
return 0.0;
6881
}
6982
double NumericalIntegrator::computeD(const UniformDielectric<AD_directional> * gf, const Element & e) const {
83+
return 0.0;
7084
}
7185
double NumericalIntegrator::computeD(const UniformDielectric<AD_gradient> * gf, const Element & e) const {
86+
return 0.0;
7287
}
7388
double NumericalIntegrator::computeD(const UniformDielectric<AD_hessian> * gf, const Element & e) const {
89+
return 0.0;
7490
}
7591

7692
double NumericalIntegrator::computeS(const IonicLiquid<double> * gf, const Element & e) const {
93+
return 0.0;
7794
}
7895
double NumericalIntegrator::computeS(const IonicLiquid<AD_directional> * gf, const Element & e) const {
96+
return 0.0;
7997
}
8098
double NumericalIntegrator::computeS(const IonicLiquid<AD_gradient> * gf, const Element & e) const {
99+
return 0.0;
81100
}
82101
double NumericalIntegrator::computeS(const IonicLiquid<AD_hessian> * gf, const Element & e) const {
102+
return 0.0;
83103
}
84104

85105
double NumericalIntegrator::computeD(const IonicLiquid<double> * gf, const Element & e) const {
106+
return 0.0;
86107
}
87108
double NumericalIntegrator::computeD(const IonicLiquid<AD_directional> * gf, const Element & e) const {
109+
return 0.0;
88110
}
89111
double NumericalIntegrator::computeD(const IonicLiquid<AD_gradient> * gf, const Element & e) const {
112+
return 0.0;
90113
}
91114
double NumericalIntegrator::computeD(const IonicLiquid<AD_hessian> * gf, const Element & e) const {
115+
return 0.0;
116+
}
117+
118+
double NumericalIntegrator::computeS(const AnisotropicLiquid<double> * gf, const Element & e) const {
119+
return 0.0;
120+
}
121+
double NumericalIntegrator::computeS(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const {
122+
return 0.0;
123+
}
124+
double NumericalIntegrator::computeS(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const {
125+
return 0.0;
126+
}
127+
double NumericalIntegrator::computeS(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const {
128+
return 0.0;
129+
}
130+
131+
double NumericalIntegrator::computeD(const AnisotropicLiquid<double> * gf, const Element & e) const {
132+
return 0.0;
133+
}
134+
double NumericalIntegrator::computeD(const AnisotropicLiquid<AD_directional> * gf, const Element & e) const {
135+
return 0.0;
136+
}
137+
double NumericalIntegrator::computeD(const AnisotropicLiquid<AD_gradient> * gf, const Element & e) const {
138+
return 0.0;
139+
}
140+
double NumericalIntegrator::computeD(const AnisotropicLiquid<AD_hessian> * gf, const Element & e) const {
141+
return 0.0;
92142
}

0 commit comments

Comments
 (0)