Difference between revisions of "ALPS 2 Tutorials:DWA-02 Density Profile"

From ALPS
Jump to: navigation, search
(Preparing and running the simulation from the command line)
(Mimicking the Bloch's experiment)
Line 3: Line 3:
 
As a second example of the dwa QMC code, we will study the density profile of an optical lattice in an harmonic trap which resembles the experiment
 
As a second example of the dwa QMC code, we will study the density profile of an optical lattice in an harmonic trap which resembles the experiment
  
== Mimicking the Bloch's experiment ==
+
== Mimicking the experiment ==
  
 
=== Preparing and running the simulation from the command line ===
 
=== Preparing and running the simulation from the command line ===
Line 34: Line 34:
 
=== Preparing and running the simulation from Python ===
 
=== Preparing and running the simulation from Python ===
  
Step 1: The usual business
+
  import pyalps
 
+
   
  import pyalps;
+
  parms = [
  import pyalps.dwa;
+
  {
 
+
    'LATTICE' : 'inhomogeneous simple cubic lattice' ,
Step 2: Preparing the parameter file
+
    'L'      : 100 ,
 
 
  tof_phase = pyalps.dwa.tofPhase(time_of_flight=15.5, wavelength=[843,765,765], mass=86.99)
 
 
   
 
   
params=[]
+
    'MODEL'  : 'boson Hubbard' ,
params.append(
+
    'Nmax'    : 20 ,
 
   
 
   
  { 'LATTICE'         : 'inhomogeneous simple cubic lattice'   # Refer to <lattice.xml> from ALPS Lattice Library
+
    't' : 1. ,
  , 'MODEL'           : 'boson Hubbard'                       # Refer to <model.xml>  from ALPS Model Library
+
    'U' : 8.11 ,
 +
    'mu' : '4.05 - (0.0073752*(x-(L-1)/2.)*(x-(L-1)/2.) + 0.0036849*(y-(L-1)/2.)*(y-(L-1)/2.) + 0.0039068155*(z-(L-1)/2.)*(z-(L-1)/2.))' ,
 
   
 
   
  , 'L'               : 100                # Length aspect of lattice             
+
    'T' : 1. ,
  , 'Nmax'            : 20                # Maximum number of bosons on each site
 
 
   
 
   
  , 't'               : 1.                # Hopping
+
    'THERMALIZATION' : 50000 ,
  , 'U'               : 8.11              # Onsite Interaction
+
    'SWEEPS'         : 2000000 ,
  , 'T'              : 1.                # Temperature
+
    'SKIP'           : 100 ,  
  , 'mu_homogeneous' : 4.05              # Chemical potential (homogeneous)
 
  , 'mu'              : 'mu_homogeneous - (0.0073752*(x-(L-1)/2.)*(x-(L-1)/2.) + 0.0036849*(y-(L-1)/2.)*(y-(L-1)/2.) + 0.0039068155*(z-(L-1)/2.)*(z-(L-1)/2.))'
 
 
   
 
   
  , 'tof_phase'       : str(tof_phase)
+
    'MEASURE[Local Density]': 1
 
 
  , 'SWEEPS'          : 100000            # Total number of sweeps
 
  , 'SKIP'            : 100                # Number of sweeps before measurement (You don't need to measure too often!) 
 
 
   }
 
   }
 +
)
 
   
 
   
  )
+
  input_file = pyalps.writeInputFiles('parm1a', parms)
 +
res = pyalps.runApplication('dwa', input_file, Tmin=5, writexml=True)
  
h5_infiles = pyalps.writeInputH5Files("parm9f",params);
 
  
 
or simply if existent,  
 
or simply if existent,  

Revision as of 14:35, 16 September 2013

Density profile

As a second example of the dwa QMC code, we will study the density profile of an optical lattice in an harmonic trap which resembles the experiment

Mimicking the experiment

Preparing and running the simulation from the command line

The parameter file parm2a sets up Monte Carlo simulation of a 1003 optical lattice trap that mimicks the Bloch experiment:

LATTICE="inhomogeneous simple cubic lattice"
L=100

MODEL='boson Hubbard"
Nmax=20

t=1.
U=8.11
mu="4.05 - (0.0073752*(x-(L-1)/2.)*(x-(L-1)/2.) + 0.0036849*(y-(L-1)/2.)*(y-(L-1)/2.) + 0.0039068155*(z-(L-1)/2.)*(z-(L-1)/2.))"
 
THERMALIZATION=50000
SWEEPS=200000
SKIP=100
 
MEASURE[Local Density]=1

{ T=1. }

Using the standard sequence of commands you can run the simulation using the quantum dwa code

parameter2xml parm2a
dwa parm2a.in.xml

Preparing and running the simulation from Python

import pyalps

parms = [
  {
    'LATTICE' : 'inhomogeneous simple cubic lattice' ,
    'L'       : 100 ,

    'MODEL'   : 'boson Hubbard' ,
    'Nmax'    : 20 ,

    't'  : 1. ,
    'U'  : 8.11 ,
    'mu' : '4.05 - (0.0073752*(x-(L-1)/2.)*(x-(L-1)/2.) + 0.0036849*(y-(L-1)/2.)*(y-(L-1)/2.) + 0.0039068155*(z-(L-1)/2.)*(z-(L-1)/2.))' ,

    'T'  : 1. ,

    'THERMALIZATION' : 50000 ,
    'SWEEPS'         : 2000000 ,
    'SKIP'           : 100 , 

    'MEASURE[Local Density]': 1
  }
)

input_file = pyalps.writeInputFiles('parm1a', parms)
res = pyalps.runApplication('dwa', input_file, Tmin=5, writexml=True)


or simply if existent,

h5_infiles = pyalps.getInputH5Files(prefix='parm9f');

Have a preliminary taste:

pyalps.runApplication('dwa', h5_infiles[0]);

Detailed step by step instruction for running this example is illustrated here.