/usr/share/doc/libchemps2/html/sourcecode.html is in chemps2-doc 1.6-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | <!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/html; charset=utf-8" />
<title>1. Installation — CheMPS2 1.6 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.6',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="/usr/share/javascript/jquery/jquery.js"></script>
<script type="text/javascript" src="/usr/share/javascript/underscore/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="/usr/share/javascript/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="top" title="CheMPS2 1.6 documentation" href="index.html" />
<link rel="next" title="2. Publications" href="publications.html" />
<link rel="prev" title="CheMPS2 documentation" href="index.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="publications.html" title="2. Publications"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="CheMPS2 documentation"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">CheMPS2 1.6 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<span class="target" id="index-0"></span><span class="target" id="index-1"></span><span class="target" id="index-2"></span><span class="target" id="index-3"></span><span class="target" id="index-4"></span><div class="section" id="installation">
<span id="index-5"></span><h1>1. Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
<div class="section" id="dependencies">
<h2>1.1. Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline">¶</a></h2>
<p>CheMPS2 can be built with <a class="reference external" href="http://www.cmake.org/">CMake</a> and depends on</p>
<ul class="simple">
<li>BLAS</li>
<li>LAPACK</li>
<li>GSL (<a class="reference external" href="http://www.gnu.org/software/gsl/">GNU Scientific library</a>)</li>
<li>HDF5 (<a class="reference external" href="http://www.hdfgroup.org/HDF5/">Hierarchical Data Format Release 5</a>)</li>
</ul>
<p>It is parallelized for shared memory architectures with the Open Multi-Processing (<a class="reference external" href="http://openmp.org/wp/">OpenMP</a>) API and for distributed memory architectures with the Message Passing Interface (<a class="reference external" href="http://www.mpi-forum.org/">MPI</a>). A hybrid combination of both parallelization strategies is supported.</p>
</div>
<div class="section" id="download">
<h2>1.2. Download<a class="headerlink" href="#download" title="Permalink to this headline">¶</a></h2>
<p>It is advised to clone the CheMPS2 git repository from github. In your terminal, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder
<span class="nv">$ </span>git clone <span class="s1">'https://github.com/sebwouters/chemps2'</span>
<span class="nv">$ </span><span class="nb">cd </span>chemps2
</pre></div>
</div>
<p>That way, future updates and bug fixes can be easily pulled in:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2
<span class="nv">$ </span>git pull
</pre></div>
</div>
</div>
<div class="section" id="build-the-chemps2-library-and-binary">
<h2>1.3. Build the chemps2 library and binary<a class="headerlink" href="#build-the-chemps2-library-and-binary" title="Permalink to this headline">¶</a></h2>
<p>The files</p>
<div class="highlight-bash"><div class="highlight"><pre>/sourcefolder/chemps2/CMakeLists.txt
/sourcefolder/chemps2/CheMPS2/CMakeLists.txt
/sourcefolder/chemps2/tests/CMakeLists.txt
/sourcefolder/chemps2/sphinx/CMakeLists.txt
</pre></div>
</div>
<p>provide a minimal compilation. In your terminal, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2
<span class="nv">$ </span>mkdir build
<span class="nv">$ </span><span class="nb">cd </span>build
</pre></div>
</div>
<p>CMake generates makefiles based on the user’s specifications:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ CXX</span><span class="o">=</span>option1 cmake .. -DMKL<span class="o">=</span>option2 -DCMAKE_INSTALL_PREFIX<span class="o">=</span>/option3 -DWITH_MPI<span class="o">=</span>option4
</pre></div>
</div>
<ol class="arabic simple">
<li>Option1 is the <code class="docutils literal"><span class="pre">c++</span></code> compiler; typically <code class="docutils literal"><span class="pre">g++</span></code>, <code class="docutils literal"><span class="pre">icpc</span></code>, or <code class="docutils literal"><span class="pre">clang++</span></code> on Linux. It is advised to use the intel compiler if available.</li>
<li>Option2 can be <code class="docutils literal"><span class="pre">ON</span></code> or <code class="docutils literal"><span class="pre">OFF</span></code> and is used to switch on the intel math kernel library.</li>
<li>/option3 is the prefix of the installation directory; typically <code class="docutils literal"><span class="pre">/usr</span></code> or <code class="docutils literal"><span class="pre">/usr/local</span></code> on Linux. On my computer, libchemps2 is then installed in <code class="docutils literal"><span class="pre">/option3/lib/x86_64-linux-gnu</span></code>, the headers in <code class="docutils literal"><span class="pre">/option3/include/chemps2</span></code>, and the binary in <code class="docutils literal"><span class="pre">/option3/bin/chemps2</span></code>.</li>
<li>Option4 can be <code class="docutils literal"><span class="pre">ON</span></code> or <code class="docutils literal"><span class="pre">OFF</span></code> and is used to switch on the possibility to compile with MPI. Please note that the compiler should then provide <code class="docutils literal"><span class="pre">mpi.h</span></code>. Option1 should hence be the <code class="docutils literal"><span class="pre">mpic++</span></code> compiler; typically <code class="docutils literal"><span class="pre">mpic++</span></code> or <code class="docutils literal"><span class="pre">mpiicpc</span></code> on Linux. It is advised to use the intel compiler if available.</li>
</ol>
<p>If one or more of the required libraries are not found, use the command</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ CMAKE_INCLUDE_PATH</span><span class="o">=</span>option5 <span class="nv">CMAKE_LIBRARY_PATH</span><span class="o">=</span>option6 <span class="nv">CXX</span><span class="o">=</span>option1 cmake .. -DMKL<span class="o">=</span>option2 -DCMAKE_INSTALL_PREFIX<span class="o">=</span>/option3 -DWITH_MPI<span class="o">=</span>option4
</pre></div>
</div>
<p>instead, where option5 and option6 are respectively the missing colon-separated include and library paths:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">CMAKE_INCLUDE_PATH</span><span class="o">=</span>/my_libs/lib1/include:/my_libs/lib2/include
<span class="nv">CMAKE_LIBRARY_PATH</span><span class="o">=</span>/my_libs/lib1/lib:/my_libs/lib2/lib
</pre></div>
</div>
<p>For debian/sid, the HDF5 headers are located in the folder <code class="docutils literal"><span class="pre">/usr/include/hdf5/serial</span></code>. If CMake complains about the HDF5 headers, try to pass it with the option <code class="docutils literal"><span class="pre">-DHDF5_INCLUDE_DIRS=/usr/include/hdf5/serial</span></code>.</p>
<p>To compile, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>make
</pre></div>
</div>
<p>To install, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>make install
</pre></div>
</div>
<p>For non-standard installation directories, please remember to append the library path to <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code> in your <code class="docutils literal"><span class="pre">.bashrc</span></code>.</p>
</div>
<div class="section" id="test-libchemps2">
<h2>1.4. Test libchemps2<a class="headerlink" href="#test-libchemps2" title="Permalink to this headline">¶</a></h2>
<p>To test libchemps2 for compilation <strong>without MPI</strong>, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2/build
<span class="nv">$ </span>make <span class="nb">test</span>
</pre></div>
</div>
<p>To test libchemps2 for compilation <strong>with MPI</strong>, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2/build/tests
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test1
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test2
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test3
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test4
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test5
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test7
<span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./test10
</pre></div>
</div>
<p><code class="docutils literal"><span class="pre">YYY</span></code> specifies the number of threads per process and <code class="docutils literal"><span class="pre">ZZZ</span></code> the number of processes. The tests only require a very limited amount of memory (order 100 MB). Note that the tests are too small to see (near) linear scaling with the number of cores, although improvement should still be noticeable.</p>
</div>
<div class="section" id="test-the-chemps2-binary">
<h2>1.5. Test the chemps2 binary<a class="headerlink" href="#test-the-chemps2-binary" title="Permalink to this headline">¶</a></h2>
<p>To test the chemps2 binary for compilation <strong>without MPI</strong>, run:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>man /sourcefolder/chemps2/manpage.1
<span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2/build/CheMPS2
<span class="nv">$ </span>./chemps2 --help
<span class="nv">$ </span>./chemps2 --fcidump<span class="o">=</span>/sourcefolder/chemps2/tests/matrixelements/H2O.631G.FCIDUMP <span class="se">\</span>
--group<span class="o">=</span><span class="m">5</span> <span class="se">\</span>
--sweep_d<span class="o">=</span>200,1000 <span class="se">\</span>
--sweep_econv<span class="o">=</span>1e-8,1e-8 <span class="se">\</span>
--sweep_maxit<span class="o">=</span>2,10 <span class="se">\</span>
--sweep_noise<span class="o">=</span>0.05,0.0 <span class="se">\</span>
--twodmfile<span class="o">=</span>2dm.out <span class="se">\</span>
--print_corr <span class="se">\</span>
--reorder<span class="o">=</span>6,5,4,3,2,1,0,7,8,9,10,11,12
</pre></div>
</div>
<p>To test the chemps2 binary for compilation <strong>with MPI</strong>, prepend the binary with:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ OMP_NUM_THREADS</span><span class="o">=</span>YYY mpirun -np ZZZ ./chemps2 <span class="o">[</span>OPTIONS<span class="o">]</span>
</pre></div>
</div>
</div>
<div class="section" id="build-pychemps2">
<h2>1.6. Build PyCheMPS2<a class="headerlink" href="#build-pychemps2" title="Permalink to this headline">¶</a></h2>
<p>PyCheMPS2 is a python interface to libchemps2, for compilation <strong>without MPI</strong>. It can be built with <a class="reference external" href="http://cython.org/">Cython</a>. The installation is independent of CMake and assumes that you have installed the CheMPS2 library with <code class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></code>. For non-standard installation directories of CheMPS2, please remember to append the library path to <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code> in your <code class="docutils literal"><span class="pre">.bashrc</span></code>. In addition, the include path should be appended to <code class="docutils literal"><span class="pre">CPATH</span></code>:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">export </span><span class="nv">CPATH</span><span class="o">=</span><span class="si">${</span><span class="nv">CPATH</span><span class="si">}</span>:/option3/include
</pre></div>
</div>
<p>where <code class="docutils literal"><span class="pre">/option3</span></code> is the option provided to CMake with <code class="docutils literal"><span class="pre">-DCMAKE_INSTALL_PREFIX=/option3</span></code> above. For debian/sid, the HDF5 headers are located in the folder <code class="docutils literal"><span class="pre">/usr/include/hdf5/serial</span></code>. If it was explicitly passed to CMake, it should also be appended to <code class="docutils literal"><span class="pre">CPATH</span></code>:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">export </span><span class="nv">CPATH</span><span class="o">=</span><span class="si">${</span><span class="nv">CPATH</span><span class="si">}</span>:/option3/include:/usr/include/hdf5/serial
</pre></div>
</div>
<p>The python wrapper can be installed with:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2/PyCheMPS2
<span class="nv">$ </span>python setup.py build_ext -L <span class="si">${</span><span class="nv">LD_LIBRARY_PATH</span><span class="si">}</span>
<span class="nv">$ </span>python setup.py install --prefix<span class="o">=</span>/option3
</pre></div>
</div>
<p>On my machine, the python wrapper is installed to the folder <code class="docutils literal"><span class="pre">/option3/lib/python2.7/site-packages</span></code>, but the folder <code class="docutils literal"><span class="pre">lib</span></code> and the distribution of python can vary.</p>
<p>Compilation of PyCheMPS2 occurs by linking to the <code class="docutils literal"><span class="pre">c++</span></code> library in the installation directory. The installation of PyCheMPS2 will fail if that library is not properly installed. If you have pulled a newer version of CheMPS2, please remember to reinstall the <code class="docutils literal"><span class="pre">c++</span></code> library first, before reinstalling PyCheMPS2!</p>
</div>
<div class="section" id="test-pychemps2">
<h2>1.7. Test PyCheMPS2<a class="headerlink" href="#test-pychemps2" title="Permalink to this headline">¶</a></h2>
<p>When libchemps2 has been compiled <strong>without MPI</strong>, PyCheMPS2 can be tested by running (remember that the python site-packages folder can vary):</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">cd</span> /sourcefolder/chemps2/PyCheMPS2/tests
<span class="nv">$ </span><span class="nb">export </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="si">${</span><span class="nv">PYTHONPATH</span><span class="si">}</span>:/option3/lib/python2.7/site-packages
<span class="nv">$ </span>python test1.py
<span class="nv">$ </span>python test2.py
<span class="nv">$ </span>python test3.py
<span class="nv">$ </span>python test4.py
<span class="nv">$ </span>python test5.py
<span class="nv">$ </span>python test6.py
<span class="nv">$ </span>python test7.py
<span class="nv">$ </span>python test8.py
<span class="nv">$ </span>python test9.py
<span class="nv">$ </span>python test10.py
</pre></div>
</div>
<p>If you compiled the <code class="docutils literal"><span class="pre">c++</span></code> library with <code class="docutils literal"><span class="pre">-DMKL=ON</span></code>, you might get the error</p>
<div class="highlight-bash"><div class="highlight"><pre>Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so.
</pre></div>
</div>
<p>This issue of using Intel’s MKL inside python is known and reported. To get the python tests to run, you can set the variable <code class="docutils literal"><span class="pre">LD_PRELOAD</span></code> in order to preload libmkl_rt.so. On my system, this is done with</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span><span class="nb">export </span><span class="nv">LD_PRELOAD</span><span class="o">=</span>/opt/intel/mkl/lib/intel64/libmkl_rt.so
</pre></div>
</div>
<p>The python tests do exactly the same thing as the <code class="docutils literal"><span class="pre">c++</span></code> tests above, and illustrate the usage of the python interface to libchemps2. The tests should end with a line stating whether or not they succeeded. They only require a very limited amount of memory (order 100 MB). Note that the tests are too small to see (near) linear scaling with the number of cores, although improvement should still be noticeable.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/CheMPS2logo.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">1. Installation</a><ul>
<li><a class="reference internal" href="#dependencies">1.1. Dependencies</a></li>
<li><a class="reference internal" href="#download">1.2. Download</a></li>
<li><a class="reference internal" href="#build-the-chemps2-library-and-binary">1.3. Build the chemps2 library and binary</a></li>
<li><a class="reference internal" href="#test-libchemps2">1.4. Test libchemps2</a></li>
<li><a class="reference internal" href="#test-the-chemps2-binary">1.5. Test the chemps2 binary</a></li>
<li><a class="reference internal" href="#build-pychemps2">1.6. Build PyCheMPS2</a></li>
<li><a class="reference internal" href="#test-pychemps2">1.7. Test PyCheMPS2</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">CheMPS2 documentation</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="publications.html"
title="next chapter">2. Publications</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/sourcecode.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="publications.html" title="2. Publications"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="CheMPS2 documentation"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">CheMPS2 1.6 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2013-2015, Sebastian Wouters.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
</div>
</body>
</html>
|