Project-4/docs/monte__carlo_8hpp_source.html
2023-12-05 19:32:43 +01:00

162 lines
15 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>2 Dimensional Ising Model: include/monte_carlo.hpp 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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.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 id="projectrow">
<td id="projectalign">
<div id="projectname">2 Dimensional Ising Model
</div>
<div id="projectbrief">Simulate the change in energy and magnetization in a ferro magnet</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('monte__carlo_8hpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">monte_carlo.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="monte__carlo_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#ifndef __MONTE_CARLO__</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#define __MONTE_CARLO__</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &quot;<a class="code" href="IsingModel_8hpp.html">IsingModel.hpp</a>&quot;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &quot;<a class="code" href="data__type_8hpp.html">data_type.hpp</a>&quot;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include &lt;omp.h&gt;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="comment">// #define BURN_IN_TIME 12500</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#define BURN_IN_TIME 5000</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="keyword">namespace </span>montecarlo {</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a781d946de16211ba18ad6671a5b6838d">progression</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keyword">const</span> std::string filename,</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordtype">int</span> burn_in_time = BURN_IN_TIME);</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a781d946de16211ba18ad6671a5b6838d">progression</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keywordtype">int</span> value,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keyword">const</span> std::string filename, <span class="keywordtype">int</span> burn_in_time = BURN_IN_TIME);</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">pd_estimate</a>(<span class="keywordtype">double</span> T, <span class="keywordtype">int</span> L, <span class="keywordtype">int</span> cycles, <span class="keyword">const</span> std::string filename,</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordtype">int</span> burn_in_time = BURN_IN_TIME);</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><a class="code hl_class" href="classdata__t.html">data_t</a> <a class="code hl_function" href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">mcmc_serial</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> T, <span class="keywordtype">int</span> cycles,</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordtype">int</span> burn_in_time = BURN_IN_TIME);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span><a class="code hl_class" href="classdata__t.html">data_t</a> <a class="code hl_function" href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">mcmc_parallel</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> T, <span class="keywordtype">int</span> cycles,</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordtype">int</span> burn_in_time = BURN_IN_TIME);</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="keywordtype">void</span> <a class="code hl_function" href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">phase_transition</a>(<span class="keywordtype">int</span> L, <span class="keywordtype">double</span> start_T, <span class="keywordtype">double</span> end_T, <span class="keywordtype">int</span> points_T,</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">int</span> cycles,</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> std::function&lt;<a class="code hl_class" href="classdata__t.html">data_t</a>(<span class="keywordtype">int</span>, <span class="keywordtype">double</span>, <span class="keywordtype">int</span>, <span class="keywordtype">int</span>)&gt; monte_carlo,</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> std::string outfile, <span class="keywordtype">int</span> burn_in_time = BURN_IN_TIME);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span>}; <span class="comment">// namespace montecarlo</span></div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="aIsingModel_8hpp_html"><div class="ttname"><a href="IsingModel_8hpp.html">IsingModel.hpp</a></div><div class="ttdoc">The definition of the Ising model.</div></div>
<div class="ttc" id="aclassdata__t_html"><div class="ttname"><a href="classdata__t.html">data_t</a></div><div class="ttdoc">Type to use with the IsingModel class and montecarlo module.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00019">data_type.hpp:19</a></div></div>
<div class="ttc" id="adata__type_8hpp_html"><div class="ttname"><a href="data__type_8hpp.html">data_type.hpp</a></div><div class="ttdoc">Header for the data_t type.</div></div>
<div class="ttc" id="amonte__carlo_8hpp_html_a34e9c3e24f26760693266b8a7b6b3d21"><div class="ttname"><a href="monte__carlo_8hpp.html#a34e9c3e24f26760693266b8a7b6b3d21">montecarlo::phase_transition</a></div><div class="ttdeci">void phase_transition(int L, double start_T, double end_T, int points_T, int cycles, std::function&lt; data_t(int, double, int, int)&gt; monte_carlo, std::string outfile, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Perform the MCMC algorithm using a range of temperatures.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00155">monte_carlo.cpp:155</a></div></div>
<div class="ttc" id="amonte__carlo_8hpp_html_a781d946de16211ba18ad6671a5b6838d"><div class="ttname"><a href="monte__carlo_8hpp.html#a781d946de16211ba18ad6671a5b6838d">montecarlo::progression</a></div><div class="ttdeci">void progression(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Write the expected values for each Monte Carlo cycles to file.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00015">monte_carlo.cpp:15</a></div></div>
<div class="ttc" id="amonte__carlo_8hpp_html_ae1e7f904ecfc3d8f3c4dd1ef155dd771"><div class="ttname"><a href="monte__carlo_8hpp.html#ae1e7f904ecfc3d8f3c4dd1ef155dd771">montecarlo::mcmc_parallel</a></div><div class="ttdeci">data_t mcmc_parallel(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles in parallel.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00127">monte_carlo.cpp:127</a></div></div>
<div class="ttc" id="amonte__carlo_8hpp_html_ae67483ff00d1b0594d543261c8283ffd"><div class="ttname"><a href="monte__carlo_8hpp.html#ae67483ff00d1b0594d543261c8283ffd">montecarlo::mcmc_serial</a></div><div class="ttdeci">data_t mcmc_serial(int L, double T, int cycles, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Execute the Metropolis algorithm for a certain amount of Monte Carlo cycles.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00108">monte_carlo.cpp:108</a></div></div>
<div class="ttc" id="amonte__carlo_8hpp_html_aea2dd1b5fac7c45633bc6f8dc4541226"><div class="ttname"><a href="monte__carlo_8hpp.html#aea2dd1b5fac7c45633bc6f8dc4541226">montecarlo::pd_estimate</a></div><div class="ttdeci">void pd_estimate(double T, int L, int cycles, const std::string filename, int burn_in_time=BURN_IN_TIME)</div><div class="ttdoc">Estimate the probability distribution for the energy.</div><div class="ttdef"><b>Definition:</b> <a href="monte__carlo_8cpp_source.html#l00077">monte_carlo.cpp:77</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="monte__carlo_8hpp.html">monte_carlo.hpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>