ALPSを使った...

32
ALPSを使った スピン格子系の数値シミュレーション 2014. 02. 27. 小野俊雄 1 14227日木曜日

Transcript of ALPSを使った...

Page 1: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

ALPSを使ったスピン格子系の数値シミュレーション

2014. 02. 27.小野俊雄

114年2月27日木曜日

Page 2: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

What is ALPS?

• 実験家の利点:相互作用パラメータの決定

• 的外れなモデルを立てていないか?をチェックできる!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

ALPSチュートリアル – ALPSの概要ALPSプロジェクト

ALPSとは?

ALPS = Algorithms and Libraries for Physics Simulations

量子スピン系, 電子系など強相関量子格子模型のシミュレーションためのオープンソースソフトウェアの開発を目指す国際共同プロジェクトALPSライブラリ = C++による格子模型のための汎用ライブラリ群ALPSアプリケーション = 最新のアルゴリズムに基づくアプリケーション群: QMC, DMRG, ED, DMFT等ALPSフレームワーク = 汎用入出力形式, 解析ツール, スケジューラなど, 大規模並列シミュレーションのための環境

9 / 27

214年2月27日木曜日

Page 3: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary files• You need to download 3 packages

1. alps-2.2.b1-winXX.exe (XX = 32 or 64)• 数値計算ライブラリ本体

2. alps-vistrails-2.2.b1-winXX.exe• PythonからALPSを動かす拡張コマンド

3. vistrails-setup-2.1.1-90975fc00211.zip• Pythonの環境:データの抽出・グラフ描画・ファイル書き出し

(Version numbers are those as of Feb. 2014.)

314年2月27日木曜日

Page 4: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary files

Setup and Installation

Web page: http://alps.comp-phys.org/

414年2月27日木曜日

Page 5: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary files

バイナリパッケージ

514年2月27日木曜日

Page 6: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary files

32 bit or 64 bit?

614年2月27日木曜日

Page 7: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary files

32 bit

64 bit

Caution! Release 2.1.1 (stable version) seems to do NOT work on Windows 7.

714年2月27日木曜日

Page 8: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary filesWeb page: http://ww.vistrails.org/

Downloading VisTrails

814年2月27日木曜日

Page 9: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step1: download binary files

32 bit

64 bit

914年2月27日木曜日

Page 10: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step2: Install Packages1. Install alps-2.2.b1

Choose one of these two

1-1. Start installer

1-2. Choose“Add alps to the system PATH for ...”

1014年2月27日木曜日

Page 11: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step2: Install Packages2. Install VisTrails 2.1.1

Unzip by right-clicking

2-2. Open the installer and install package.

2-1. Unzip downloaded file.

Python tools for ALPScollecting the data from the resultsexporting the .txt filesmaking plots of the results

1114年2月27日木曜日

Page 12: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step2: Install Packages3. Install alps-vistrails-2.2.b1

Execute the installer

ソフトのインストールはここまで

ALPS extensions for VisTrails

1214年2月27日木曜日

Page 13: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step3: Configure & Test

初期設定

1. Start VisTrails.

2. Select “Preference...” in Edit menu.

1. Start VisTrails & Open preference panel.

1314年2月27日木曜日

Page 14: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step3: Configure & Test

• Select “Module Packages” tab.

• Enable ‘matplotlib’, ‘vtlcreator’ and ‘alps’ modules in this order.

2. Enable several python modules in the panel

セットアップの完了1414年2月27日木曜日

Page 15: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step3: Configure & Test

• You can find many tutorial files in C:\Program Files\ALPS\tutorials\

• tutorial3b.py: magnetization process of the S=1/2 spin ladder system

3. First run of the quantum Monte Carlo simulation

1514年2月27日木曜日

Page 16: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step3: Configure & Test

• Create a new folder and put a copy of the tutorial file in that folder.

• Type “vispython tutorial3b.py” at the command prompt.

3. First run of the quantum Monte Carlo simulation

created folder

copied file

command to launch Python

1614年2月27日木曜日

Page 17: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Demo

1714年2月27日木曜日

Page 18: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Setup step3: Configure & Test

1814年2月27日木曜日

Page 19: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Workflow of the simulation 1. Define the spin network• Cluster (Molecular magnets such as V15)• Lattice• preinstalled: dimer, 1D chain, square (rectangular)

lattice, (coupled) ladder, triangular lattice, kagome lattice, honeycomb lattice

2. Set parameters for the simulation(s)• Magnitude of the exchange interaction(s)• Temperature & Magnetic field• Algorithm of Monte Carlo simulation

(looper, dirloop SSE....)• Physical quantity• Output data (text files, data visualization)

3. Start simulation1914年2月27日木曜日

Page 20: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Basic procedures of the simulation

Python scriptwith

parameters

my_simulation.py

Lattice XML file Model XML file

definitions of operators

Output files

Plots, Text files

square lattice

Definition ofthe lattice

Parameters of the simulation

2014年2月27日木曜日

Page 21: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Structure of ‘Lattice.xml’ file

<LATTICE name=”lattice name”>格子(unit cellの並べ方)の定義

</LATTICE>

<UNITCELL name=”unitcell name”>ユニットセルの内部構造

</UNITCELL>

<LATTICEGRAPH name=”spin network”><FINITELATTICE>

<LATTICE ref=”lattice name”/><EXTENT size=”L”/><BOUNDARY type=”periodic”/>

</FINITELATTICE><UNITCELL ref=”unitcell name”/>

</LATTICEGRAPH>

格子の参照サイズの指定境界条件

unitcellの参照

有限格子の名前この名前が参照される

<LATTICES>

</LATTICES>2114年2月27日木曜日

Page 22: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Example 1: alternating chain

• 方針:1次元的に並ぶunit cellに,   2つのsiteと2つのbondを持つ‘内部構造’を与える

1

offset=0 offset=1

2 1 2

offset=2 offset=3

1 2 1 2

<LATTICE name="chain lattice" dimension="1"> <PARAMETER name="a" default="1"/> <BASIS><VECTOR>a</VECTOR></BASIS> <RECIPROCALBASIS><VECTOR>2*pi/a</VECTOR></RECIPROCALBASIS></LATTICE>

<LATTICE name=”lattice name”>格子(unit cellの並べ方)の定義

</LATTICE>

C:\Program Files\ALPS\lib\xml\lattice.xml のchain latticeの定義を利用する2214年2月27日木曜日

Page 23: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Example 1: alternating chain

• サイト → VERTEX, ボンド → EDGE

1

offset=0 offset=1

2 1 2

offset=2 offset=3

1 2 1 2

<UNITCELL name=”unitcell name”>ユニットセルの内部構造

</UNITCELL>

<UNITCELL name="alt chain unit" dimension="1" vertices="2"> <VERTEX id="1"><COORDINATE> 0.00 </COORDINATE></VERTEX> <VERTEX id="2"><COORDINATE> 0.50 </COORDINATE></VERTEX> <EDGE type="0"><SOURCE vertex="1"/><TARGET vertex="2"/></EDGE> <EDGE type="1"><SOURCE vertex="2"/><TARGET vertex="1" offset="1"/></EDGE></UNITCELL>

corresponds to J0corresponds to J1

J1J0

2314年2月27日木曜日

Page 24: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Example 1: alternating chain

• 3つのブロックの組み合わせ

<LATTICE name="chain lattice" dimension="1"> <PARAMETER name="a" default="1"/> <BASIS><VECTOR>a</VECTOR></BASIS> <RECIPROCALBASIS><VECTOR>2*pi/a</VECTOR></RECIPROCALBASIS></LATTICE>

<UNITCELL name="alt chain unit" dimension="1" vertices="2"> <VERTEX id="1"><COORDINATE> 0.00 </COORDINATE></VERTEX> <VERTEX id="2"><COORDINATE> 0.50 </COORDINATE></VERTEX> <EDGE type="0"><SOURCE vertex="1"/><TARGET vertex="2"/></EDGE> <EDGE type="1"><SOURCE vertex="2"/><TARGET vertex="1" offset="1"/></EDGE></UNITCELL>

<LATTICEGRAPH name="alt chain"> <FINITELATTICE> <LATTICE ref="chain lattice"/> <PARAMETER name="L"/> <EXTENT dimension="1" size="L"/> <BOUNDARY type="periodic"/> </FINITELATTICE> <UNITCELL ref="alt chain unit"/></LATTICEGRAPH>

<LATTICES>

</LATTICES>

altchain_def.xml

Example 1: alternating chain

格子の定義ファイル2414年2月27日木曜日

Page 25: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Example 1: alternating chain• Python script for the simulation of the magnetization process

parms = []for h in [0.0, 0.2, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3]: parms.append( { 'LATTICE' : "alt chain", 'LATTICE_LIBRARY' : "altchain_def.xml", 'MODEL' : "spin", 'local_S' : 0.5, 'T' : 0.02, 'J0' : 1.0 , 'J1' : 0.30 , 'THERMALIZATION' : 1000, 'SWEEPS' : 10000, 'L' : 40, 'h' : h } )

import pyalpsimport matplotlib.pyplot as pltimport pyalps.plot

Import necessary modules

Set parameters for the mh-curve simulation

name of ‘LATTICE GRAPH’

name of definition file

magnetic fields

magnitude of interactions

2514年2月27日木曜日

Page 26: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

print "The results in plain text are:"print pyalps.plot.convertToText(magnetization)print "Saving int file alt_mh.txt"f = open ('alt_mh.txt','w')f.write(pyalps.plot.convertToText(magnetization))f.close()

input_file = pyalps.writeInputFiles('parm_altchain',parms)res = pyalps.runApplication('dirloop_sse',input_file,Tmin=5)

data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm_altchain'),'Magnetization Density')magnetization = pyalps.collectXY(data,x='h',y='Magnetization Density')

Create input_file for Monte Carlo program & start simulation

Collect desired physical quantity & create data array of M vs. H

Print result & write into a text file for

2614年2月27日木曜日

Page 27: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Example 1: alternating chain

• You can adjust the temperature used in the experiments.

0.5

0.4

0.3

0.2

0.1

0.0

Sz

2.52.01.51.00.50.0

gµBH / J

α = 0.30 α = 0.35 α = 0.40 α = 0.45 α = 0.50 α = 0.55 α = 0.60 α = 0.65 α = 0.70 α = 0.75 α = 0.80 α = 0.85 α = 0.90 α = 0.95 α = 1.00

kBT = 0.02 J

2714年2月27日木曜日

Page 28: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Example: tricolor bond honeycombYasu Shinpuku

2814年2月27日木曜日

Page 29: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Mapping on an orthorhombic lattice

1 21 2 1 2

1 21 2 1 2

1 21 2 1 2

(0,0) (1,0)(-1,0)

(0,-1) (1,-1)(-1,-1)

(0,1) (1,1)(-1,1)

2914年2月27日木曜日

Page 30: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Description of the lattice

• Lattice: orthorhombic or square(arrangement of the unit cell)

• Unit Cell: 2 sites and 3bonds

• Lattice Graph: L x W

1 21 2 1 2

1 21 2 1 2

1 21 2 1 2

(0,0) (1,0)(-1,0)

(0,-1) (1,-1)(-1,-1)

(0,1) (1,1)(-1,1)

3014年2月27日木曜日

Page 31: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Inside of the definition file<LATTICE name="square lattice" dimension="2"> <PARAMETER name="a" default="1"/> <BASIS><VECTOR>a 0</VECTOR><VECTOR>0 a</VECTOR></BASIS> <RECIPROCALBASIS><VECTOR>2*pi/a 0</VECTOR><VECTOR>0 2*pi/a</VECTOR></RECIPROCALBASIS></LATTICE>

<UNITCELL name="honeycomb 3bonds unit" dimension="2"> <VERTEX id="1" type="1"><COORDINATE>0.25 0.5</COORDINATE></VERTEX> <VERTEX id="2" type="1"><COORDINATE>0.75 0.5</COORDINATE></VERTEX> <EDGE type="0"><SOURCE vertex="1"/><TARGET vertex="2/></EDGE> <EDGE type="1"><SOURCE vertex="2"/><TARGET vertex="1" offset="1 0"/></EDGE> <EDGE type="2"><SOURCE vertex="1"/><TARGET vertex="2" offset="0 1"/></EDGE></UNITCELL>

<LATTICEGRAPH name = "honeycomb 3bonds lattice"> <FINITELATTICE> <LATTICE ref="square lattice"/> <PARAMETER name="W" default="L"/> <EXTENT dimension="1" size="L"/> <EXTENT dimension="2" size="W"/> <BOUNDARY type="open"/> </FINITELATTICE> <UNITCELL ref="honeycomb 3bonds unit"/></LATTICEGRAPH>

<LATTICES>

</LATTICES>

copied from ‘lattices.xml’

1 21 2 1 2

1 21 2 1 2

1 21 2 1 2

(0,0) (1,0)(-1,0)

(0,-1) (1,-1)(-1,-1)

(0,1) (1,1)(-1,1)

3114年2月27日木曜日

Page 32: ALPSを使った スピン格子系の数値シミュレーションt.ono/simulation/ALPS_install_and_workflow.pdf · • 数値計算ライブラリ本体 2. alps-vistrails-2.2.b1-winXX.exe

Calculated results1.0

0.8

0.6

0.4

0.2

0.0

M [µ

B / s

pin]

3.02.01.00.0B [T]

J1 / kB = -11.6 KJ2 / kB = 0.418 KJ3 / kB = 2.51 K

0.16

0.12

0.08

0.04

0.00

χ [ e

mu/

mol

]

0.1 1 10 100T [K]

J1 / kB = -11.6 KJ2 / kB = 0.418 KJ3 / kB = 2.51 K

0.5

0.4

0.3

0.2

0.1

0.0

χT [

emu

K / m

ol]

0.1 1 10 100T [K]

J1 / kB = -11.6 KJ2 / kB = 0.418 KJ3 / kB = 2.51 K

3214年2月27日木曜日