All Projects → aromanro → IsingMonteCarlo

aromanro / IsingMonteCarlo

Licence: GPL-3.0 license
A program implementing Metropolis Monte Carlo for the 2D square-lattice Ising model and the spin block renormalization

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to IsingMonteCarlo

SpinMonteCarlo.jl
Markov chain Monte Carlo solver for lattice spin systems implemented by Julialang
Stars: ✭ 35 (+75%)
Mutual labels:  physics, ising-model, spin
NMRI
2D Fourier Transform of Nuclear Magnetic Resonance Imaging raw data
Stars: ✭ 13 (-35%)
Mutual labels:  physics, computational-physics, mfc
TimeEvolvingMPO
A Python 3 package to efficiently compute non-Markovian open quantum systems.
Stars: ✭ 43 (+115%)
Mutual labels:  physics, computational-physics
pylj
Teaching Utility for Classical Atomistic Simulation.
Stars: ✭ 23 (+15%)
Mutual labels:  physics, computational-physics
ign-physics
Abstract physics interface designed to support simulation and rapid development of robot applications.
Stars: ✭ 40 (+100%)
Mutual labels:  physics
unity-excavator
Physical simulations on Unity
Stars: ✭ 20 (+0%)
Mutual labels:  physics
three-to-cannon
Convert a THREE.Mesh to a CANNON.Shape.
Stars: ✭ 207 (+935%)
Mutual labels:  physics
magpylib
Python package for computation of magnetic fields of magnets, currents and moments.
Stars: ✭ 95 (+375%)
Mutual labels:  physics
3D-printed-mirror-array
3D-printable hexagonal mirror array capable of reflecting sunlight into arbitrary patterns
Stars: ✭ 2,242 (+11110%)
Mutual labels:  physics
spinw
SpinW Matlab library for spin wave calculation
Stars: ✭ 25 (+25%)
Mutual labels:  physics
bevy verlet
Verlet physics plugin for bevy.
Stars: ✭ 29 (+45%)
Mutual labels:  physics
hypergravity
Gravity simulation in Hyper terminal
Stars: ✭ 22 (+10%)
Mutual labels:  physics
my-math-notes
All of my math stuff from grad school.
Stars: ✭ 41 (+105%)
Mutual labels:  physics
KalmanFlow
A simple Kalman Filter built in TensorFlow
Stars: ✭ 22 (+10%)
Mutual labels:  physics
fdtd
A 3D electromagnetic FDTD simulator written in Python
Stars: ✭ 195 (+875%)
Mutual labels:  physics
Keldysh.jl
julia package for working with Keldysh Green's functions
Stars: ✭ 22 (+10%)
Mutual labels:  physics
FFmpegPlayer
Simple FFmpeg video player
Stars: ✭ 72 (+260%)
Mutual labels:  mfc
MFC
😳 mfc课程设计,学生成绩管理系统
Stars: ✭ 64 (+220%)
Mutual labels:  mfc
Incoherent-Light-Simulation
Simulation of the propagation of incoherent light, aiming to illustrate the concept of spatial coherence.
Stars: ✭ 98 (+390%)
Mutual labels:  physics
nest
Noble Element Simulation Technique is used to simulate noble-element energy deposition microphysics.
Stars: ✭ 14 (-30%)
Mutual labels:  physics

IsingMonteCarlo

A program implementing Metropolis Monte Carlo for the 2D square-lattice Ising model and the spin block renormalization.

CodeFactor

A more detailed description can be found at https://compphys.go.ro/metropolis-for-2d-ising-and-spin-block-renormalization/

PROGRAM IN ACTION

Program video

TOOLS

The project compiles on Windows with Visual Studio 2015.

LIBRARIES

Besides mfc and other typical VC++ runtime libraries, the program uses GDI+ for drawing.

CLASSES

Before presenting the classes, a little bit of a rant. I displayed the spins first with GDI+ calls - FillRectangle. I have a pretty decent monitor so it's quite a bit of resolution. With the application maximized, the frame rate achievable was very low. One would expect more from a dual Xeon workstation and a pretty decent video card (although with passive cooling). I 'downgraded' to simple GDI to learn that there is no much of a difference, which I expected, but I had to try... then I switched to Direct2D, although I hate using it with mfc because print preview does not work with it (I did use it in the electric field lines project, though, just for fun). It appeared to be faster, but not much faster. I did not time it until that point, so I cannot say what was the difference, but it was pretty small. I turned back at the plain old GDI and used a bitmap instead. More precisely, a memory device independent bitmap (DIB). You can get more speed by using a device dependent one (I did even that in the past) but it's not worth it. The big speed jump (as in from 2 frames/second to 50 frames/second or more) was due of avoiding calls into the slow library and implementing the equivalent call into my own class. Probably using device dependent bitmaps would make it a little bit faster and using Direct2D even faster, but just a little bit. Not worth it.

So, here are the classes in the order of importance (sort of):

SpinMatrix - More or less similar with what I presented in the previous post, but with the addition of pre-calculating the exponential values and with renormalization code added. It can be initialized at 'zero' temperature or infinite temperature. It's just the spin matrix with periodic boundary conditions, containing the implementation of a Metropolis Monte Carlo sweep on the spins.

MonteCarloThread - Has a SpinMatrix member called spins. In Calculate it runs a TemperatureStep for each temperature in the interval, starting with the lower one. Before this loop it runs a 'warmup' loop. The TemperatureStep just runs several sweeps for equilibration then several others for gathering statistics. The numbers are configurable, of course. One thread will pass the spin matrix to the main thread for displaying - in PassData, all threads will gather statistics in PassStats.

Statistics - Contains the accumulated statistics and has some operators overloaded and a CollectStats method. The usage is pretty straightforward.

CIsingMonteCarloDoc - The document class. Manages the threads, the data gathering and the spin matrices for display - both the ones that are displayed during threads running and when displaying the spin block renormalization. It also handles the charts and chart data. It has a copy of Options because the options that are stored in the application object can change during threads running.

MemoryBitmap - The class that helps with displaying the spin matrix. Plain old GDI for drawing, nothing fancy.

CIsingMonteCarloView - the view. Has a timer, deals with displaying and printing. Also holds some MemoryBitmap members for displaying.

Chart - The charting class. I just copied it from the nrg project. It uses GDI+ for drawing.

Options - The options class, it has methods to save them into registry and load them from registry.

COptionsPropertySheet, CIsingModelPropertyPage, CSimulationPropertyPage, CRenormalizationPropertyPage, CDisplayPropertyPage, CChartsPropertyPage, the property sheet class and the property pages classes, respectively. Quite standard mfc implementations, nothing hard to understand.

CNumberEdit - the edit control for double/float values. I just copied it from the nrg project.

ComputationThread - the base class for MonteCarloThread.

CMainFrame - the main frame. Deals with menu commands.

CIsingMonteCarloApp - the application class. Has an Option member, loads the options at startup and also deals with GDI+ initialization.

CAboutDlg - what the name says.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].