From e7d29d82431efef50e08d9b072d35997375232ce Mon Sep 17 00:00:00 2001 From: Michel Ferrero Date: Mon, 9 Sep 2013 10:55:54 +0200 Subject: [PATCH] New notation for Monte Carlo variables --- doc/reference/c++/mctools/ising.rst | 16 +++++------ doc/reference/c++/mctools/loop.rst | 4 +-- doc/reference/c++/mctools/overview.rst | 38 +++++++++++++------------- doc/reference/c++/mctools/random.rst | 4 +-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/doc/reference/c++/mctools/ising.rst b/doc/reference/c++/mctools/ising.rst index dc953a76..bc4532f9 100644 --- a/doc/reference/c++/mctools/ising.rst +++ b/doc/reference/c++/mctools/ising.rst @@ -168,16 +168,16 @@ The Monte-Carlo itself can now be written:: if (world.rank() == 0) std::cout << "Ising chain" << std::endl; // Prepare the MC parameters - int N_Cycles = 500000; - int Length_Cycle = 50; - int N_Warmup_Cycles = 100000; - std::string Random_Name = ""; - int Random_Seed = 374982 + world.rank() * 273894; - int Verbosity = (world.rank() == 0 ? 2 : 0); + int n_cycles = 500000; + int length_cycle = 50; + int n_warmup_cycles = 100000; + std::string random_name = ""; + int random_seed = 374982 + world.rank() * 273894; + int verbosity = (world.rank() == 0 ? 2 : 0); // Construct a Monte Carlo loop - triqs::mc_tools::mc_generic IsingMC(N_Cycles, Length_Cycle, N_Warmup_Cycles, - Random_Name, Random_Seed, Verbosity); + triqs::mc_tools::mc_generic IsingMC(n_cycles, length_cycle, n_warmup_cycles, + random_name, random_seed, verbosity); // parameters of the model int length = 100; diff --git a/doc/reference/c++/mctools/loop.rst b/doc/reference/c++/mctools/loop.rst index d31f0b0c..a4e1b503 100644 --- a/doc/reference/c++/mctools/loop.rst +++ b/doc/reference/c++/mctools/loop.rst @@ -48,8 +48,8 @@ C++ variable names In the C++ examples, these variables will be called: - * ``N_Cycles`` :math:`= N` - * ``Length_Cycle`` :math:`= L` + * ``n_cycles`` :math:`= N` + * ``length_cycle`` :math:`= L` * ``N_Warmup_Cycle`` :math:`= W` You will also have to use these names if you will construct an ``mc_generic`` diff --git a/doc/reference/c++/mctools/overview.rst b/doc/reference/c++/mctools/overview.rst index 669d7edb..2b7fce3c 100644 --- a/doc/reference/c++/mctools/overview.rst +++ b/doc/reference/c++/mctools/overview.rst @@ -87,16 +87,16 @@ but obviously you would usually want to cut this into pieces for clarity:: if (world.rank() == 0) std::cout << "Isolated spin" << std::endl; // prepare the MC parameters - int N_Cycles = 5000000; - int Length_Cycle = 10; - int N_Warmup_Cycles = 10000; - std::string Random_Name = ""; - int Random_Seed = 374982 + world.rank() * 273894; - int Verbosity = (world.rank() == 0 ? 2 : 0); + int n_cycles = 5000000; + int length_cycle = 10; + int n_warmup_cycles = 10000; + std::string random_name = ""; + int random_seed = 374982 + world.rank() * 273894; + int verbosity = (world.rank() == 0 ? 2 : 0); // construct a Monte Carlo loop - triqs::mc_tools::mc_generic SpinMC(N_Cycles, Length_Cycle, N_Warmup_Cycles, - Random_Name, Random_Seed, Verbosity); + triqs::mc_tools::mc_generic SpinMC(n_cycles, length_cycle, n_warmup_cycles, + random_name, random_seed, verbosity); // parameters of the model double beta = 0.3; @@ -140,15 +140,15 @@ The lines that follow, define the parameters of the Monte Carlo simulation and construct a Monte Carlo object called ``SpinMC``:: - int N_Cycles = 5000000; - int Length_Cycle = 10; - int N_Warmup_Cycles = 10000; - std::string Random_Name = ""; - int Random_Seed = 374982 + world.rank() * 273894; - int Verbosity = (world.rank() == 0 ? 2 : 0); + int n_cycles = 5000000; + int length_cycle = 10; + int n_warmup_cycles = 10000; + std::string random_name = ""; + int random_seed = 374982 + world.rank() * 273894; + int verbosity = (world.rank() == 0 ? 2 : 0); - triqs::mc_tools::mc_generic SpinMC(N_Cycles, Length_Cycle, N_Warmup_Cycles, - Random_Name, Random_Seed, Verbosity); + triqs::mc_tools::mc_generic SpinMC(n_cycles, length_cycle, n_warmup_cycles, + random_name, random_seed, verbosity); The ``SpinMC`` is an instance of the ``mc_generic`` class. First of all, note that you need to include the header ```` in @@ -161,14 +161,14 @@ number of measurements and the warmup length. The definition of these variables has been detailed earlier in :ref:`montecarloloop`. The next two define the random number generator by giving its name in -``Random_Name`` (an empty string means the default generator, i.e. the Mersenne +``random_name`` (an empty string means the default generator, i.e. the Mersenne Twister) and the random seed in ``Random_See``. As you see the seed is different for all node with the use of ``world.rank()``. Finally, the last parameter sets the verbosity level. 0 means no output, 1 will output the progress level for the current node and 2 additionally shows some statistics about the simulation when you call ``collect_results``. As you see, -we have put ``Verbosity`` to 2 only for the master node and 0 for all the other +we have put ``verbosity`` to 2 only for the master node and 0 for all the other ones. This way the information will be printed only by the master. Moves and measures @@ -269,7 +269,7 @@ Let's look at ``compute_m``:: Here only two methods are expected, ``accumulate`` and ``collect_results``. -The method ``accumulate`` is called every ``Length_Cycle`` Monte Carlo loops. +The method ``accumulate`` is called every ``length_cycle`` Monte Carlo loops. It takes one argument which is the current sign in the Monte Carlo simulation. Here, we sum the sign in ``Z`` (the partition function) and the magnetization in ``M``. The other method ``collect_results`` is usually called just once at diff --git a/doc/reference/c++/mctools/random.rst b/doc/reference/c++/mctools/random.rst index 638bdd18..298a8923 100644 --- a/doc/reference/c++/mctools/random.rst +++ b/doc/reference/c++/mctools/random.rst @@ -81,8 +81,8 @@ When you construct an instance of a Monte Carlo class ``mc_generic``, this instance automatically has an access to a random number generator. Imagine you constructed an instance:: - triqs::mc_tools::mc_generic SpinMC(N_Cycles, Length_Cycle, N_Warmup_Cycles, - Random_Name, Random_Seed, Verbosity); + triqs::mc_tools::mc_generic SpinMC(n_cycles, length_cycle, n_warmup_cycles, + random_name, random_seed, verbosity); Now, you can use ``SpinMC`` to have a random number generator::