GithubHelp home page GithubHelp logo

xy-model's Introduction

XY-MODEL

Monte Carlo simulation (Metropolis algorithm) on 2D XY-model

How to use this program

import the class

from XY_model import XYSystem

creating an object as a X-Y spin system with given width and temperature

Use XYSystem(temperature = , width = ) to creat a class object. Two variables can be assigned to initilize the system: the temperature and the width.

xy_system_1 = XYSystem(temperature  = 0.5, width = 15)

visulizingthe spin system

using .show() to visulize the xy spin system as arrows on two-dimensional plane.

xy_system_1.show()
print('Energy per spin:%.3f'%xy_system_1.energy)

png

Energy per spin:0.056

Now, let the system evolve to a equilibrium state

self.equilibrate(self,max_nsweeps=int(1e4),temperature=None,H=None,show = False) allows you to assign a new temperature, just simply do object.equilibrate(temperature = 3). If you want to keep the temperature defined before, leave it blank. And ·sohw=Ture` will let show the configuration of the system for each 1000 sweeps.

xy_system_1.equilibrate(show=True)
xy_system_1.show()
#sweeps=1
energy=-0.60

png

equilibrium state is reached at T=0.5
#sweep=504
energy=-1.72

png

Observing the thermal quantities in different temperature - annealing approach

xy_system_2 = XYSystem(width=7)
cool_dat=xy_system_2.annealing(T_init=2.5,T_final=0.1,nsteps = 10,show_equi=True)
equilibrium state is reached at T=2.5
#sweep=6802
energy=-0.48

png

equilibrium state is reached at T=2.2
#sweep=3429
energy=-0.48

png

equilibrium state is reached at T=2.0
#sweep=9999
energy=-0.47

png

equilibrium state is reached at T=1.7
#sweep=2809
energy=-0.60

png

equilibrium state is reached at T=1.4
#sweep=989
energy=-0.74

png

equilibrium state is reached at T=1.2
#sweep=2253
energy=-1.35

png

equilibrium state is reached at T=0.9
#sweep=636
energy=-1.68

png

equilibrium state is reached at T=0.6
#sweep=837
energy=-1.72

png

equilibrium state is reached at T=0.4
#sweep=548
energy=-1.86

png

equilibrium state is reached at T=0.1
#sweep=503
energy=-1.95

png

png

png

xy-model's People

Contributors

shiling42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.