-
Notifications
You must be signed in to change notification settings - Fork 0
/
algebraic__potential_8cpp_source.html
131 lines (129 loc) · 44.9 KB
/
algebraic__potential_8cpp_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>BubbleProfiler: /home/michael/bubbleprofiler_release/src/algebraic_potential.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">BubbleProfiler
 <span id="projectnumber">0.3.0</span>
</div>
<div id="projectbrief">by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">algebraic_potential.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="algebraic__potential_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * This file is part of BubbleProfiler.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * BubbleProfiler is free software: you can redistribute it and/or modify</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * it under the terms of the GNU General Public License as published by</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * the Free Software Foundation, either version 3 of the License, or</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * (at your option) any later version.</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * BubbleProfiler is distributed in the hope that it will be useful,</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * GNU General Public License for more details.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> *</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * You should have received a copy of the GNU General Public License</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * along with BubbleProfiler. If not, see <http://www.gnu.org/licenses/>.</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> */</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> </div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "<a class="code" href="algebraic__potential_8hpp.html">algebraic_potential.hpp</a>"</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include "<a class="code" href="error_8hpp.html">error.hpp</a>"</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <sstream></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">namespace </span><a class="code" href="namespaceBubbleProfiler.html">BubbleProfiler</a> {</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment">// Potential constructor - from expression string</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#a84fab502351607e8713cb3e5fd2595aa"> 26</a></span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a84fab502351607e8713cb3e5fd2595aa">Algebraic_potential::Algebraic_potential</a>(</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keyword">const</span> std::vector<std::string>& fields_,</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">const</span> std::string& expr)</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  : fields(fields_)</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> {</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="comment">// Parse the field expression & get symbol table</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <a class="code" href="namespacesm__plus__singlet.html#a044d249bd240ad315fd8469cfe45bc4a">GiNaC::parser</a> reader;</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a> = reader(expr);</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  GiNaC::symtab table = reader.get_syms();</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="comment">// Match fields names to symbol table</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="comment">// TODO this should have error handling</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">for</span>(<span class="keyword">auto</span>& field : fields_) {</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>.push_back(GiNaC::ex_to<GiNaC::symbol>(table.at(field)));</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  }</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a95d3ab2ab7e9ae2191dbc1af81ff4cf7">build_derivatives</a>();</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  std::stringstream log_str;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  log_str << <span class="stringliteral">"Input potential: "</span> << <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adf624c352741260ed07c7717d324f2f9">logger</a>.<a class="code" href="classBubbleProfiler_1_1logging_1_1Basic__logger.html#ae1c167d04edd9d272a5753e40a8f1523">log_message</a>(<a class="code" href="namespaceBubbleProfiler_1_1logging.html#ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1">logging::Log_level::Trace</a>, log_str.str());</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> }</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#a95d3ab2ab7e9ae2191dbc1af81ff4cf7"> 49</a></span> <span class="keywordtype">void</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a95d3ab2ab7e9ae2191dbc1af81ff4cf7">Algebraic_potential::build_derivatives</a>()</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> {</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adc53e77dcecdb127f2a1f03fcf3f0b72">first_partials</a>.clear();</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aee05a645a0f760ea284aefac2092f5eb">second_partials</a>.clear();</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>& sym: <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>) {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  GiNaC::ex deriv = <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>.diff(sym);</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adc53e77dcecdb127f2a1f03fcf3f0b72">first_partials</a>.push_back(deriv);</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  std::vector<GiNaC::ex> row_partials;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>& col_sym: syms) {</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  GiNaC::ex deriv2 = <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>.diff(sym).diff(col_sym);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  row_partials.push_back(deriv2);</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  }</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aee05a645a0f760ea284aefac2092f5eb">second_partials</a>.push_back(row_partials);</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  }</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> }</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#aac9d2d4085dca1af791c06b3b8fdeb5d"> 69</a></span> <span class="keywordtype">void</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aac9d2d4085dca1af791c06b3b8fdeb5d">Algebraic_potential::translate_origin</a>(</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keyword">const</span> Eigen::VectorXd& translation)</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> {</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keyword">const</span> std::size_t n_coords = translation.size();</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">if</span> (n_coords != <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>.size()) {</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keywordflow">throw</span> <a class="code" href="classBubbleProfiler_1_1Setup__error.html">Setup_error</a>(</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="stringliteral">"Algebraic_potential::translate_origin: "</span></div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="stringliteral">"dimensions of translation do not match number of fields"</span>);</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  }</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">// Create coordinate substitutions</span></div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  GiNaC::lst l;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">for</span> (std::size_t i = 0; i < n_coords; ++i) {</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  l.append(<a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>[i] == <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>[i] + translation[i]);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="comment">// Apply them</span></div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a> = <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>.subs(l);</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="comment">// Rebuild algebraic derivatives</span></div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a95d3ab2ab7e9ae2191dbc1af81ff4cf7">build_derivatives</a>();</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  std::stringstream log_str;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  log_str << <span class="stringliteral">"Potential after translation: "</span> << <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adf624c352741260ed07c7717d324f2f9">logger</a>.<a class="code" href="classBubbleProfiler_1_1logging_1_1Basic__logger.html#ae1c167d04edd9d272a5753e40a8f1523">log_message</a>(<a class="code" href="namespaceBubbleProfiler_1_1logging.html#ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1">logging::Log_level::Trace</a>, log_str.str());</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> }</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#ab647bd7c8e2fb1fa93d34835b2310bc0"> 96</a></span> <span class="keywordtype">void</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#ab647bd7c8e2fb1fa93d34835b2310bc0">Algebraic_potential::apply_basis_change</a>(<span class="keyword">const</span> Eigen::MatrixXd &cob_matrix) {</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  Eigen::MatrixXd cob_matrix_t = cob_matrix.transpose();</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordtype">int</span> n_coords = <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>.size();</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="comment">// Create basis transformation substitution map</span></div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  GiNaC::exmap substitutions;</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> old_field_ix = 0; old_field_ix < n_coords; ++old_field_ix) {</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="comment">// Build the RHS of the substitution for this field.</span></div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  GiNaC::ex rhs = 0;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> new_field_ix = 0; new_field_ix < n_coords; ++new_field_ix) {</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordtype">double</span> coeff = cob_matrix(new_field_ix, old_field_ix);</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  rhs += coeff * <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>[new_field_ix];</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  }</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="comment">// Add the substitution for this field to the transformation map</span></div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  substitutions[<a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>[old_field_ix]] = rhs;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  }</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  std::stringstream subs_str;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  subs_str << <span class="stringliteral">"Subs: "</span> << substitutions;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adf624c352741260ed07c7717d324f2f9">logger</a>.<a class="code" href="classBubbleProfiler_1_1logging_1_1Basic__logger.html#ae1c167d04edd9d272a5753e40a8f1523">log_message</a>(<a class="code" href="namespaceBubbleProfiler_1_1logging.html#ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1">logging::Log_level::Trace</a>, subs_str.str());</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="comment">// Apply all of the transformations simultaneously</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a> = <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>.subs(substitutions);</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="comment">// Rebuild algebraic derivatives</span></div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a95d3ab2ab7e9ae2191dbc1af81ff4cf7">build_derivatives</a>();</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> </div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  std::stringstream expr_str;</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  expr_str << <span class="stringliteral">"Potential after translation: "</span> << <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>;</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adf624c352741260ed07c7717d324f2f9">logger</a>.<a class="code" href="classBubbleProfiler_1_1logging_1_1Basic__logger.html#ae1c167d04edd9d272a5753e40a8f1523">log_message</a>(<a class="code" href="namespaceBubbleProfiler_1_1logging.html#ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1">logging::Log_level::Trace</a>, expr_str.str());</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> }</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#aaaed04680c473a0ed0e81f611074bf08"> 132</a></span> <span class="keywordtype">void</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aaaed04680c473a0ed0e81f611074bf08">Algebraic_potential::add_constant_term</a>(<span class="keywordtype">double</span> offset)</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> {</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a> += offset;</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span> </div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  std::stringstream expr_str;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  expr_str << <span class="stringliteral">"Potential after adding constant term: "</span> << <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adf624c352741260ed07c7717d324f2f9">logger</a>.<a class="code" href="classBubbleProfiler_1_1logging_1_1Basic__logger.html#ae1c167d04edd9d272a5753e40a8f1523">log_message</a>(<a class="code" href="namespaceBubbleProfiler_1_1logging.html#ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1">logging::Log_level::Trace</a>, expr_str.str());</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> }</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span> </div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="comment">// Evaluate a GiNaC expression (i.e. potential, partial derivatives) on</span></div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> <span class="comment">// this potential.</span></div><div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#a55ef88e8eaa9610ebd019ab032098bee"> 143</a></span> <span class="keywordtype">double</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a55ef88e8eaa9610ebd019ab032098bee">Algebraic_potential::eval</a>(</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keyword">const</span> GiNaC::ex& expr, <span class="keyword">const</span> Eigen::VectorXd& coords)<span class="keyword"> const</span></div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> <span class="keyword"></span>{</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keyword">const</span> std::size_t n_coords = coords.size();</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordflow">if</span> (n_coords != <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>.size()) {</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordflow">throw</span> <a class="code" href="classBubbleProfiler_1_1Setup__error.html">Setup_error</a>(</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="stringliteral">"Algebraic_potential::eval: "</span></div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="stringliteral">"number of values does not match number of coordinates"</span>);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  }</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="comment">// A list of substitutions</span></div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  GiNaC::lst l;</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="keywordflow">for</span> (std::size_t i = 0; i < n_coords; ++i) {</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  l.append(<a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">syms</a>[i] == coords(i));</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  }</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="comment">// Make subs & eval</span></div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  GiNaC::ex result = GiNaC::evalf(expr.subs(l));</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> </div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">return</span> GiNaC::ex_to<GiNaC::numeric>(result).to_double();</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> }</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span> </div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="comment">// Evaluate potential at a coordinate</span></div><div class="line"><a name="l00166"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#a06a718445c7a2fe696165afebe7e9071"> 166</a></span> <span class="keywordtype">double</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a06a718445c7a2fe696165afebe7e9071">Algebraic_potential::operator()</a>(<span class="keyword">const</span> Eigen::VectorXd& coords)<span class="keyword"> const</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> <span class="keyword"></span>{</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keywordflow">return</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a55ef88e8eaa9610ebd019ab032098bee">Algebraic_potential::eval</a>(<a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">v</a>, coords);</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> }</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> </div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> <span class="comment">// Partial derivative WRT coordinate i at a point</span></div><div class="line"><a name="l00172"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#a7898036218702a00c3cc07e10577a54f"> 172</a></span> <span class="keywordtype">double</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a7898036218702a00c3cc07e10577a54f">Algebraic_potential::partial</a>(<span class="keyword">const</span> Eigen::VectorXd& coords, <span class="keywordtype">int</span> i)<span class="keyword"> const</span></div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span> <span class="keyword"></span>{</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <span class="keywordflow">return</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a55ef88e8eaa9610ebd019ab032098bee">Algebraic_potential::eval</a>(<a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#adc53e77dcecdb127f2a1f03fcf3f0b72">first_partials</a>[i], coords);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> }</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span> <span class="comment">// Partial derivatives WRT coordinates i, j at a a point</span></div><div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="classBubbleProfiler_1_1Algebraic__potential.html#ae80f623d515e38abf47ed90684b859e0"> 178</a></span> <span class="keywordtype">double</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a7898036218702a00c3cc07e10577a54f">Algebraic_potential::partial</a>(<span class="keyword">const</span> Eigen::VectorXd& coords,</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j)<span class="keyword"> const</span></div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span> <span class="keyword"></span>{</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="keywordflow">return</span> <a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#a55ef88e8eaa9610ebd019ab032098bee">Algebraic_potential::eval</a>(<a class="code" href="classBubbleProfiler_1_1Algebraic__potential.html#aee05a645a0f760ea284aefac2092f5eb">second_partials</a>[i][j], coords);</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> }</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span> </div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span> } <span class="comment">// namespace BubbleProfiler</span></div><div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_aaaed04680c473a0ed0e81f611074bf08"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#aaaed04680c473a0ed0e81f611074bf08">BubbleProfiler::Algebraic_potential::add_constant_term</a></div><div class="ttdeci">virtual void add_constant_term(double) override</div><div class="ttdoc">Add a constant offset to the potential. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00132">algebraic_potential.cpp:132</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_ab647bd7c8e2fb1fa93d34835b2310bc0"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#ab647bd7c8e2fb1fa93d34835b2310bc0">BubbleProfiler::Algebraic_potential::apply_basis_change</a></div><div class="ttdeci">virtual void apply_basis_change(const Eigen::MatrixXd &) override</div><div class="ttdoc">Apply a change of basis matrix. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00096">algebraic_potential.cpp:96</a></div></div>
<div class="ttc" id="namespaceBubbleProfiler_1_1logging_html_ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1"><div class="ttname"><a href="namespaceBubbleProfiler_1_1logging.html#ab9e7a962f5b8891f8306783be2218661add4ec0ac4e58f7c32a01244ae91150b1">BubbleProfiler::logging::Log_level::Trace</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_a7898036218702a00c3cc07e10577a54f"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#a7898036218702a00c3cc07e10577a54f">BubbleProfiler::Algebraic_potential::partial</a></div><div class="ttdeci">virtual double partial(const Eigen::VectorXd &coords, int i) const override</div><div class="ttdoc">Partial derivative WRT coordinate i at a point. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00172">algebraic_potential.cpp:172</a></div></div>
<div class="ttc" id="namespacesm__plus__singlet_html_a044d249bd240ad315fd8469cfe45bc4a"><div class="ttname"><a href="namespacesm__plus__singlet.html#a044d249bd240ad315fd8469cfe45bc4a">sm_plus_singlet.parser</a></div><div class="ttdeci">parser</div><div class="ttdef"><b>Definition:</b> <a href="sm__plus__singlet_8py_source.html#l00110">sm_plus_singlet.py:110</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1logging_1_1Basic__logger_html_ae1c167d04edd9d272a5753e40a8f1523"><div class="ttname"><a href="classBubbleProfiler_1_1logging_1_1Basic__logger.html#ae1c167d04edd9d272a5753e40a8f1523">BubbleProfiler::logging::Basic_logger::log_message</a></div><div class="ttdeci">void log_message(Log_level level, const std::string &msg) const </div><div class="ttdef"><b>Definition:</b> <a href="basic__logger_8cpp_source.html#l00024">basic_logger.cpp:24</a></div></div>
<div class="ttc" id="algebraic__potential_8hpp_html"><div class="ttname"><a href="algebraic__potential_8hpp.html">algebraic_potential.hpp</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_aff607987756992b34ee7921139478f5a"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#aff607987756992b34ee7921139478f5a">BubbleProfiler::Algebraic_potential::v</a></div><div class="ttdeci">GiNaC::ex v</div><div class="ttdoc">GiNaC expression to hold potential. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8hpp_source.html#l00075">algebraic_potential.hpp:75</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_a9982ab3be66bc4ffc23baef222ef5ce6"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#a9982ab3be66bc4ffc23baef222ef5ce6">BubbleProfiler::Algebraic_potential::syms</a></div><div class="ttdeci">std::vector< GiNaC::symbol > syms</div><div class="ttdoc">GiNaC symbols matched to fields vec. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8hpp_source.html#l00078">algebraic_potential.hpp:78</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_a84fab502351607e8713cb3e5fd2595aa"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#a84fab502351607e8713cb3e5fd2595aa">BubbleProfiler::Algebraic_potential::Algebraic_potential</a></div><div class="ttdeci">Algebraic_potential(const std::vector< std::string > &fields, const std::string &expr)</div><div class="ttdoc">Construct from list of fields and GiNaC potential string. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00026">algebraic_potential.cpp:26</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_aee05a645a0f760ea284aefac2092f5eb"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#aee05a645a0f760ea284aefac2092f5eb">BubbleProfiler::Algebraic_potential::second_partials</a></div><div class="ttdeci">std::vector< std::vector< GiNaC::ex > > second_partials</div><div class="ttdoc">Second partials. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8hpp_source.html#l00077">algebraic_potential.hpp:77</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_a06a718445c7a2fe696165afebe7e9071"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#a06a718445c7a2fe696165afebe7e9071">BubbleProfiler::Algebraic_potential::operator()</a></div><div class="ttdeci">virtual double operator()(const Eigen::VectorXd &coords) const override</div><div class="ttdoc">Evaluate potential at point. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00166">algebraic_potential.cpp:166</a></div></div>
<div class="ttc" id="error_8hpp_html"><div class="ttname"><a href="error_8hpp.html">error.hpp</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_a55ef88e8eaa9610ebd019ab032098bee"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#a55ef88e8eaa9610ebd019ab032098bee">BubbleProfiler::Algebraic_potential::eval</a></div><div class="ttdeci">double eval(const GiNaC::ex &, const Eigen::VectorXd &) const </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00143">algebraic_potential.cpp:143</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_aac9d2d4085dca1af791c06b3b8fdeb5d"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#aac9d2d4085dca1af791c06b3b8fdeb5d">BubbleProfiler::Algebraic_potential::translate_origin</a></div><div class="ttdeci">virtual void translate_origin(const Eigen::VectorXd &) override</div><div class="ttdoc">Shift the location of the origin by a specified vector. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00069">algebraic_potential.cpp:69</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_adc53e77dcecdb127f2a1f03fcf3f0b72"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#adc53e77dcecdb127f2a1f03fcf3f0b72">BubbleProfiler::Algebraic_potential::first_partials</a></div><div class="ttdeci">std::vector< GiNaC::ex > first_partials</div><div class="ttdoc">First partials. </div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8hpp_source.html#l00076">algebraic_potential.hpp:76</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Setup__error_html"><div class="ttname"><a href="classBubbleProfiler_1_1Setup__error.html">BubbleProfiler::Setup_error</a></div><div class="ttdoc">Exception indicating general setup error. </div><div class="ttdef"><b>Definition:</b> <a href="error_8hpp_source.html#l00032">error.hpp:32</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_adf624c352741260ed07c7717d324f2f9"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#adf624c352741260ed07c7717d324f2f9">BubbleProfiler::Algebraic_potential::logger</a></div><div class="ttdeci">logging::Basic_logger logger</div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8hpp_source.html#l00079">algebraic_potential.hpp:79</a></div></div>
<div class="ttc" id="namespaceBubbleProfiler_html"><div class="ttname"><a href="namespaceBubbleProfiler.html">BubbleProfiler</a></div><div class="ttdef"><b>Definition:</b> <a href="action_8hpp_source.html#l00033">action.hpp:33</a></div></div>
<div class="ttc" id="classBubbleProfiler_1_1Algebraic__potential_html_a95d3ab2ab7e9ae2191dbc1af81ff4cf7"><div class="ttname"><a href="classBubbleProfiler_1_1Algebraic__potential.html#a95d3ab2ab7e9ae2191dbc1af81ff4cf7">BubbleProfiler::Algebraic_potential::build_derivatives</a></div><div class="ttdeci">void build_derivatives()</div><div class="ttdef"><b>Definition:</b> <a href="algebraic__potential_8cpp_source.html#l00049">algebraic_potential.cpp:49</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 2 2019 13:08:19 for BubbleProfiler by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>