Тёмный

The Ising Model in Python: Statistical Mechanics and Permanent Magnets 

Mr. P Solver
Подписаться 134 тыс.
Просмотров 40 тыс.
50% 1

The simplest model of a permanent magnet is the Ising model. In this video I implement the 2D Ising Model in python using the metropolis algorithm. Numba is used to rapidly increase the speed of the algorithm.
Code: github.com/lukepolson/youtube...

Наука

Опубликовано:

 

14 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 57   
@adwaitnaravane5285
@adwaitnaravane5285 3 года назад
Stat mech is the most beautiful thing in Physics.
@ricomajestic
@ricomajestic 4 месяца назад
It really is!
@MrPSolver
@MrPSolver 2 года назад
Correction: In the function I used to originally get the energy of the lattice, I should have divided the return value by 2 to avoid double counting of pairs. This doesn't effect the dynamics of the system (since this only depends on change in energy), but it slightly changes the energy plot.
@laika4048
@laika4048 2 года назад
why did you calculate the total energy of all the lattice? I think you should only calculate energy for one site i,j and then because ergodic theorem it would be equal to the energy of all the lattice. Or i am missing something?
@godwinosabutey2876
@godwinosabutey2876 Год назад
Thank you! Very nice work and good explanation there. The Numba and the codes work incredibly well and fast. I was wondering how higher order interactions, such as those involving three bodies as opposed to two, might be implemented in a similar manner. Any advice you can give me?
@charltonwake6813
@charltonwake6813 3 года назад
"Did this in undergrad without numba"'; gave me flashbacks when I had to do Ising Models in undergrad, taking my side panels off and setting up 2 desk fans to blow into my pc in fear of it over heating. God bless numba!
@peabrane8067
@peabrane8067 2 года назад
Wow that convolve operation to get the energy is so smart. I never thought of that Would probably gave me a 10x speedup for my PhD....
@AJ-et3vf
@AJ-et3vf 2 года назад
Awesome! Love your videos! This channel is seriously underrated and needs more views :) very quality and enjoyable videos.
@corneldevilliers461
@corneldevilliers461 2 года назад
Clear and straightforward, excellent resource for the topic
@CarlosRoberto-vb9gi
@CarlosRoberto-vb9gi 3 года назад
Finally I understand the meaning of the Ising model. Thanks for this great video.
@JonathonRiddell
@JonathonRiddell 3 года назад
Great video! Numba seems super powerful, my code in undergrad for this similarly took forever to complete :).
@muhammadhidayat1337
@muhammadhidayat1337 2 года назад
I'm currently in undergraduate trying to understand what ising model is, and suddenly found this video. Thank you so much!
@generaliroh842
@generaliroh842 Год назад
Sama ngab
@ganstabreakincity
@ganstabreakincity 3 года назад
Here before this channel has million subscribers, give it some time. Pure knowledge, I wish I can learn and collaborate with you given the time. Appreciate your work.
@randomstuff9960
@randomstuff9960 Год назад
Why doesn't this have more views and likes? That was simply amazing!
@estebanrodriguez3922
@estebanrodriguez3922 3 года назад
This is outstanding great quality content. I've always wanted to make similar videos on youtube but PhD and academia are just too frantic! Keep it up!
@adityadhardwivedi634
@adityadhardwivedi634 Год назад
Glad I got internship in the very first summer at my Institute under condensed matter professor just because of curiosity of phase transition that occurs in matter. I'll get to learn many things, thanks for this video, man!
@ayabongandlungwana4407
@ayabongandlungwana4407 2 года назад
Wow this video has helped me to complete my assignment, although I'm using C to simulate the results. It gave me an idea about the how results should look like and better understand for the whole Ising model.. Thank you bro
@chisomdim2031
@chisomdim2031 2 года назад
Whao, You just saved a life! Thanks man! This is so on point👌
@NGBigfield
@NGBigfield 2 года назад
You are an absolute genius!
@TheAbdel
@TheAbdel 2 года назад
Amazing work. Bravo !
@md.tohidulislam7041
@md.tohidulislam7041 2 года назад
Thank you so very much. It saved a lot of time. I do appreciate your knowledge.
@joyzhong7279
@joyzhong7279 2 года назад
Thank you so much for the content!
@henryouang
@henryouang 2 года назад
This was really great. Thanks!
@markushaysnielsen4885
@markushaysnielsen4885 3 года назад
There’s that njit :-) Amazing video!
@AlessandroAmbler
@AlessandroAmbler 3 года назад
Really cool vids man! Stumbled across one of your reddit posts and thought I reconised your face haha, subbed!
@MrPSolver
@MrPSolver 3 года назад
Hahaha cheers dude 😂
@ahxmeds
@ahxmeds 2 года назад
Great content. You are too good, Luke.
@MrPSolver
@MrPSolver 2 года назад
Thank you Shadab!
@deltascience7252
@deltascience7252 3 года назад
dude I saw this on reddit and you're so underrated, i'll ask my friends to subscribe to you
@drissboutat6430
@drissboutat6430 2 года назад
You're amazing 👏 a lot of thanks for this video
@lasinar9090
@lasinar9090 7 месяцев назад
Nice work…❤
@westmoreland5889
@westmoreland5889 3 года назад
waiting for your sympy video...
@benburdick9834
@benburdick9834 3 года назад
These are some great videos! I would love to see your process of putting the notebooks together.
@aaronthomas6434
@aaronthomas6434 2 года назад
Great Video! Helping me so much for my assignment! One question, for the full Hamiltonian where you would include the external energy contribution i.e the external field multiplied by the sum over all spins, would you simply add this into the get energy function or amend it somehow within the metropolis algorithm? Kepp up the brilliant work!
@GabrielleduVent
@GabrielleduVent 2 года назад
Thanks for uploading this video! I'm a python newbie who needs to run Ising models and this clarified quite a few things. Few questions: 1. For the total initial energy, if I am using a very specific energy equation, do I need to change it from convolution to something else? My set up is that it starts with all down or up spins. 2. Since my setup is starting with 100% down or upspin, how would that affect the probability equation (2nd line after #3/4. change state...)? 3. How would I change the probability function to incorporate my energy equation? Thanks in advance!
@godwinosabutey2876
@godwinosabutey2876 Год назад
Thank you! Very nice work and good explanation there. The Numba and the codes work incredibly well and fast. I was wondering how higher order interactions, such as those involving three bodies as opposed to two, might be implemented in a similar manner. Any advice you can give me? @Mr. P Solver
@thomsday
@thomsday 2 года назад
that cuttings :D
@cscsquad1902
@cscsquad1902 2 года назад
okay how do you apply it to a real system? for example, we want to study magnetic behavior of some ferromagnetic metal (ie cobalt) which has a hcp structure. In that case, you would need the exact positions of the spins. Do you have any idea?
@physicsguy9774
@physicsguy9774 2 года назад
amazing work mate! are you a physicist?
@anuranbhunia
@anuranbhunia Год назад
How do I view the final spin array bitmap after the Metropolis algorithm has worked upon it?
@quornnugget7799
@quornnugget7799 5 месяцев назад
Does the energy calculation allow for periodic boundary conditions on our lattice?
@J-rb9dx
@J-rb9dx Год назад
Hello! Is there any way to display the new ising model with the updated spins?
@homaghaedi7001
@homaghaedi7001 Год назад
How would you introduce the presence of an external magnetic field to this code?
@sadaf6295
@sadaf6295 2 года назад
Hey .. How to make code in python for.. Spin correlation function for Heisenberg spin Hamiltonian.. ?? I am new to python.. Please give me some your suggestion
@user-er1lo1hj4x
@user-er1lo1hj4x 3 года назад
Hello..I am a PhD student in physics from Iraq..I hope you can help me find codes in the Python program to study the Fe(phen) molecule to investigation of the spin crossover phenomenon by monte carlo (ising model 2D)..with many thanks to you
@sadaf6295
@sadaf6295 2 года назад
Hey.. Can you make video on Heisenberg spin hamiltonian in python like yo find eigen value and eigen vectors and what happens when N change.. M a total Biggener in python.. But i have write a program.. Please help me..
@muditgaur9736
@muditgaur9736 6 месяцев назад
Can u do the same for Classical XY model
@raa9558
@raa9558 Год назад
Ab So Lu Te Ly Brilliant
@kasraburiaey7862
@kasraburiaey7862 2 года назад
Is the code complete?
@mB-mp6io
@mB-mp6io 2 года назад
where the code disappear
@sagarpatel3043
@sagarpatel3043 2 года назад
I do not understand. Why positive spin sample and negative spin sample are separated in the starting? If +1 means spin-up and -1 means spin-down one sample is enough. Forgive my lack of intelligence.
@clf400
@clf400 2 года назад
Your mic is clipping. I recommend lowering the gain during recording because it sounds bad
@prikarsartam
@prikarsartam 2 года назад
I get trouble with the "plt.style.use(['science','notebook', 'grid'])" part, would you kindly provide solution?
@Eta_Carinae__
@Eta_Carinae__ Год назад
Hi! I tried more or less the same thing, except the way I noised the lattice is by randomly flipping every cell per timestep according to a bernoulli trial with the chance of success standing in for the chance to flip (I use numpy.random.binomial, and just set the no. trials to 1). Is there a reason why you flip one cell per timestep instead of a random number? Cheers!
@banditadas3420
@banditadas3420 Год назад
plt.style.use(['science', 'notebook','grid']) isnt working for me , its showing lot of error with OSError: 'science' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles
Далее
The hardest sum aka the Ising model #SoME3
34:50
Просмотров 18 тыс.
Этот Пёс Кое-Что Наделал 😳
00:31
Metropolis-Hastings - VISUALLY EXPLAINED!
24:45
Просмотров 31 тыс.
100x Faster Than NumPy... (GPU Acceleration)
28:49
Просмотров 82 тыс.
Ising Computers #1: Introduction
12:00
Просмотров 7 тыс.
ChatGPT Vs. Stack Overflow Be Like...
3:26
Просмотров 74 тыс.
6. Monte Carlo Simulation
50:05
Просмотров 2 млн
10x Faster Than NumPy (GPU Magnet Simulation)
43:15
Просмотров 14 тыс.
Grad School Be Like...
3:35
Просмотров 96 тыс.
Understanding Metropolis-Hastings algorithm
9:49
Просмотров 69 тыс.