Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [monte-carlo]

Questions on Monte Carlo methods, methods that require the repeated generation of (pseudo-, quasi-)random numbers for computing their results.

0
votes
1answer
51 views

Writing parallel code for molecular computation [duplicate]

I recently moved towards computational biophysics from an experimental science background. As of now, I am learning the fundamentals and doing some basic monte carlo simulations of LJ fluid on my ...
2
votes
2answers
41 views

Generating a random number based on a numerical distribution function

I have a probability distribution function that I don't have its analytical form (so I can't determine its CDF). How can I generate random numbers based on this distribution function? I'm looking for ...
1
vote
2answers
259 views

2D Ising Model, heat capacity decreases with lattice size

The problem I'm trying to make a metropolis simulation of the 2D Ising model. Basically, it's the following, for each monte-carlo step: Visit each lattice site, Compute energy required to flip ...
1
vote
1answer
73 views

Weighted Monte Carlo Integration

I have a function $F(x)$ which drops exponentially (like differential QCD cross section vs. Invariant mass). I want to perform Monte-Carlo integration. The problem is that only small $x$'s which have ...
5
votes
2answers
146 views

Mean-squared displacement in Monte Carlo studies

Is measuring mean-squared-displacement in Monte Carlo simulations uncommon? I'm very interested to find out if this has actually ever been tried. For instance, in the context of spheres, or ...
1
vote
0answers
51 views

Is there a software package for Quantum Monte Carlo estimation of the exchange correlation functional?

Quantum Monte Carlo (QMC) calculations historically have been used to parameterise the exchange-correlation functionals for Density Functional Theory (DFT). For example, this article explains a way to ...
3
votes
1answer
245 views

Computing the Ising Model for NiO

I am trying to compute the Ising model for NiO. As O carries no magnetic moment, I only need to consider the case of Ni which requires a second nearest neighbour Ising model. As can be seen in the ...
0
votes
1answer
97 views

Sampling simulation steps logarithmically

The common case of for instance a Monte Carlo simulation is, if we want to run our simulation for $N$ steps, we define a delta $\Delta,$ such that $N/\Delta = n$ tells us the frequency with which we ...
4
votes
1answer
100 views

Diffusion properties of hard spheres in Monte Carlo simulation

In standard Monte Carlo simulations, say for hard sphere systems, how should one compute the mean-squared displacement of the spheres in order to extract dynamical properties such as the diffusion ...
1
vote
0answers
21 views

Uniform distribution in 3D space [duplicate]

Posted this at math stack exchange as well, but alas no replies! So, I have been trying to find ways of distributing particles of spherical or other shape in 3D space, e.g. rectangular space. Random() ...
2
votes
1answer
3k views

2D Ising Model in Python

I am trying to calculate the energy, magnetization and specific heat of a two dimensional lattice using the metropolis monte carlo algorithm. ...
3
votes
0answers
240 views

Using C/C++ for Markov chain Monte Carlo (MCMC) methods

I'm working on optimizing the parameters of a mathematical model to fit experimental data, using an existing formula for the likelihood of observing the data given a set of parameter values. At the ...
5
votes
1answer
113 views

Simple Monte Carlo in C++, result dependent from seed

I implemented as an exercise a program to sample the statistics of the escape time of a Brownian particle in a potential well. I used the Euler-Maruyama method to numerically integrate the ...
0
votes
2answers
60 views

Physical meaning behind the choice of the proposal distribution in Markov Chain Monte Carlo (MCMC) methods

Let us consider the conventions on names used in the theoretical derivation of Metropolis-Hastings Monte Carlo as outlined here, for the sake of common nomenclature. What we are building is a step-...
0
votes
1answer
54 views

Applying pressure on simulation box

We have a 3D simulation box (cubic, side $L$) filled with $N$ non-overlapping objects (say spheres). We are interested to study the evolution of the system under an applied pressure in the z-direction ...
4
votes
0answers
98 views

How to stochastically estimate the trace of a matrix?

Specifically, the diagonal elements (can possibly both positive and negative) of the matrix can be computed efficiently but the total number is large ($\mathcal O(10^{18})$). My first thought about ...
0
votes
2answers
157 views

Monte Carlo Simulation algorithm

The algorthim use for updating the voltage of each componant at every time step is $$v(t+\Delta t)=\begin{cases} v(t)e^{-\gamma \Delta t},& n=0\\ v(t)e^{-\gamma \Delta t}+h_{*}& n=1\end{cases}...
1
vote
0answers
72 views

Monte Carlo integration with reusable importance sampling

A problem at hand is solving the same multidimensional integral many times (my current estimation is $10^7$ times) while adjusting integrand through pair of parameters. As I expect the calculation to ...
11
votes
2answers
448 views

Estimate information entropy through Monte Carlo sampling

I am looking for methods that allow estimating the information entropy of a distribution when the only practical ways of sampling from that distribution are Monte Carlo methods. My problem is not ...
0
votes
0answers
35 views

Estimate information entropy through Monte Carlo sampling [duplicate]

I am looking for methods that allow estimating the information entropy of a distribution when the only practical ways of sampling from that distribution are Monte Carlo methods. My problem is not ...
3
votes
1answer
132 views

Why are Hamiltonian dynamics used in MCMC?

In Hamiltonian Monte Carlo, Hamiltonian dynamics are used to generate new proposals from the current state. I understand why these dynamics are used as opposed to random walk behavior to generate ...
3
votes
2answers
297 views

optimization problem. Monte Carlo stochastic method or another one?

I have the following problem, there is an objective function f() depending on 7 variables x=(x1,x2,...x7), so f(x)=f((x1,x2,...x7)) and I want to find the combination of variables that minimize the ...
0
votes
1answer
790 views

Use Monte Carlo method to simulate consecutive decay in MATLAB

I'm trying to use MATLAB to simulate an atom decay process by using Monte Carlo approach. The process is as follow: Suppose that atom 1 decay to atom 2, which, in turn, decay to stable atoms of type ...
0
votes
0answers
28 views

Use Monte Carlo method to simulate consecutive decay in Matlab [duplicate]

I'm trying to use Matlab to simulate an atom decay process by using Monte Carlo approach.The process is as follow: Suppose that atom 1 decay to atom 2, which, in turn, decay to stable atoms of type 3....
1
vote
0answers
60 views

Metropolis algorithm and thermal sine-Gordon model

I try to simulate thermal version of 1D $(x, t)$ sine-Gordon field model. I am interested in finding thermal static solution that minimizes functional of energy $E$: $$E = \int dx \left( \frac{1}{2} \...
0
votes
2answers
143 views

Fast Python implementation of short-range interacting particles under Metroplis algorithm

Can anyone write a Python implementation of a set of particles interacting in 2D according to a short-range particle-particle force and evolving in time under a Metropolis algorithm, which randomly ...
1
vote
1answer
63 views

RNG float range for metropolis monte carlo

I have a robust RNG that generates random 32-bit (unsigned) ints. As is probably well known, for metropolis MC simulation, a random number between 0 and 1 is needed to determine acceptance/rejection ...
1
vote
1answer
202 views

Efficiently rotate vector in 2D (and 3D)

I need to efficiently rotate a 2D (and 3D) vector in a CUDA kernel. I was thinking about generating random unitary rotation matrices. I don't need to know the angle, it just has to be randomly ...
9
votes
3answers
1k views

Parallel Mersenne Twister for Monte Carlo

Recently, I came across a comment claiming that almost all researchers doing Monte Carlo methods are doing it wrong. It went on to elaborate that merely choosing different seeds for different ...
2
votes
1answer
57 views

Use of Metropolis-Hasting algorithm for gathering statistics

I understand how MH work, I'm able to use it to simulate e.g. 2D Ising model. What I don't understand is what you actually take average of. When I run the simulation, it reaches equlibrium after some ...
4
votes
1answer
96 views

Efficient Quadrature Methods for Indicator Functions?

I am looking to numerically solve many different integrals where the integrand is simply the indicator function for a region (i.e. 1 on the region, 0 outside. This is for measuring areas). The ...
2
votes
1answer
87 views

Monte Carlo Metropolis method - trial step algorithm

I'm working on a Magnetization simulation and writing an algorithm using the metropolis method. I am using a change in energy and a Boltzmann distribution, but, my question is about the trial step. ...
6
votes
1answer
585 views

Convergence of Monte Carlo integration

In my research, one of the steps is to choose a numerical method to estimate $\int_a^b f(t)dt$, where $f$ is Lipschitz continuous but not differentiable. For simplicity, I used midpoint rule but the ...
2
votes
2answers
458 views

How to choose the number of random points in Monte Carlo simulations?

I am struggling with convergence criteria when performing a Monte carlo simulation on a uniform distribution. Any help would be much appreciated ! Say I want to sample uniformly a 1D interval (for ...
0
votes
1answer
309 views

Variational Monte Carlo: Variational energy is lower than ground state energy

I'm writing a VMC simulation for hydrogen and helium atoms, but in both my codes my variational energy for certain wavefunctions is not only statistically different from my expectation value, but it ...
1
vote
0answers
164 views

Maxwellian distribution of velocities with Shake algorithm present

I am writing a code to perform hybrid monte carlo molecular dynamics. To do this, I need to have a code to initialize the velocities of all particles according to a maxwell distribution. The code is ...
1
vote
0answers
101 views

Variational Monte Carlo to calculate local energy of hydrogen like ions in python

I'm writing up a code to calculate the local energy for electrons in hydrogen like ions for a given wavefunction. My code is giving me weird results, which leads me to believe something is wrong. ...
5
votes
1answer
66 views

Optimal partitioning of a graph

Consider a planar graph, where each node is associated with a weight. I would like to partition the graph such that the sum of the node weights in each group satisfy a minimum requirement. However, I ...
1
vote
0answers
108 views

Monte Carlo simulation

I am wondering if I am thinking correct about the following problem : ...
2
votes
1answer
212 views

Monte Carlo Double Integration Implementation

Am implementing a monte carlo integration routine to compute this double integral in eqn 0.3 of page 2 of this paper 'Mobius energy of knots and unknots', Annals of Mathematics, http://www.math.ucsb....
2
votes
1answer
174 views

Metropolis Monte Carlo integration of Area with unknown normalization

I probably miss something very basic. I don't see how to use Metropolis–Hastings algorithm for computation of integrals, if I don't know the volume of accessible phase space (i.e. proper normalization ...
3
votes
0answers
347 views

How to sample points in hyperbolic space?

Hyperbolic space in the Poincaré upper half space model looks like ordinary $\Bbb R^n$ but with the notion of angle and distance distorted in a relatively simple way. In Euclidean space I can sample a ...
1
vote
0answers
62 views

Monte Carlo sampling of particle system for velocity dependent potential

When sampling configurations of point particles in statistical mechanics by means of (Markov chain) Monte Carlo, we may work with a potential that only depends on the positions of the particles, and ...
7
votes
1answer
84 views

Choosing how many iterations to use in VEGAS

I'm using VEGAS integration, specifically the GSL implementation, for some QCD calculations, and I've been investigating the behavior of the algorithm for various numbers of iterations in an attempt ...
1
vote
0answers
215 views

Spin-spin correlation functions in the Ising Model Monte Carlo

I'm using the Metropolis algorithm for 2D up to 5D for the Ising Model and I want to compute the spin-spin correlation function. $$c(r)=<s_is_r>−〈s_i〉〈s_r 〉$$ but I'm not sure how to estimate $...
1
vote
1answer
26 views

Monte Carlo update based on sub-lattices

I would like to simulate a 2D classical spin system, whose interactions are only nearest neighbor, using Monte Carlo. I would like to use Metropolis for updating. I have seen that when updating one ...
1
vote
1answer
117 views

Parallel Monte Carlo simulation using PETSc

I am trying to do Monte Carlo simulation for a large problem which requires eigensolution of a matrix for each sample. The matrix itself is quite large so much so that I want the eigensolution itself ...
2
votes
1answer
113 views

What are the tradeoffs of using statically allocated arrays vs. pointers and dynamic allocation? [closed]

I am learning Monte Carlo simulation by C++. I begin with reading codes (from the internet and text books) of the 2D Ising model and the XY model. I find some people define spins simply by a two ...
3
votes
0answers
90 views

Tracking the speed of 2D oscillations on a lattice

I wrote a Monte Carlo simulation of the 2D Lotka-Volterra model on a discrete lattice (with periodic boundary conditions). A video that I produced (which images the system after some number of monte ...
0
votes
0answers
60 views

Monte Carlo simulation of a spin model and kinetic term

I have some C code simulating the following spin model (XY model) $$ H = - J \sum_{\langle ij \rangle} cos \left( \theta_i - \theta_j \right) $$ Now I'd want to extend my code to include a "kinetic ...