Band structure of Ni: Difference between revisions

From phys824
Jump to navigationJump to search
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Input files ==
==Input file ==


* Save two files below as *.py files.
*ni_lcao.py
 
===band.py===


<pre>
<pre>
from gpaw import GPAW, FermiDirac
from gpaw import GPAW, FermiDirac
from ase import Atoms
from ase import Atoms
Line 66: Line 63:


calc.get_potential_energy()
calc.get_potential_energy()
ef = calc.get_fermi_level()
calc.write('band_harris.gpw')
calc.write('band_harris.gpw')


</pre>
# Extract eigenenergies into a file for plotting with some external package


===find_band_as_dat.py===
import numpy as np
 
<pre>
from ase.lattice import bulk
from gpaw import GPAW


calc = GPAW('band_harris', txt=None)
calc = GPAW('band_harris', txt=None)
import numpy as np
eps_skn = np.array([[calc.get_eigenvalues(k,s)
eps_skn = np.array([[calc.get_eigenvalues(k,s)
                     for k in range(80)]
                     for k in range(80)]
                     for s in range(2)]) - 10.75103
                     for s in range(2)]) - ef


f = open('bands.dat', 'w')
for n in range(10):
for n in range(10):
     for k in range(80):
     for k in range(80):
         print k, eps_skn[0, k, n], eps_skn[1, k, n]
         print >>f, k, eps_skn[0, k, n], eps_skn[1, k, n]
     print
     print >>f
</pre>
</pre>


==Run job on ulam==
==Run job in parallel==


* Run band structure calculations in parallel using 8 cores on ulam:
  mpirun -np 8 gpaw-python_openmpi ni_lcao.py


==Plot the results==
==Plot the results==


* If your jobs are successful, you should be able to reproduce this figure (using [http://www.gnuplot.info/ gnuplot] on Mills or transfer data to your Windows PC via sftp and use Origin):
* Reproduce the figure below using [http://www.gnuplot.info/ gnuplot] or transfer data to your Windows PC via sftp and use Origin:


<pre>  
<pre>  
gnuplot> plot "result.dat" using 1:2 with lines title "Spin up", "result.dat" using 1:3 with lines title "Spin down"
gnuplot> plot "bands.dat" using 1:2 with lines title "Spin up", "bands.dat" using 1:3 with lines title "Spin down"


</pre>  
</pre>  

Latest revision as of 12:30, 16 November 2014

Input file

  • ni_lcao.py
from gpaw import GPAW, FermiDirac
from ase import Atoms
from ase.io import read, write
from gpaw import GPAW, PoissonSolver, MixerSum
from ase.structure import bulk

# -------------------------------------------------------------
# Bulk configuration
# -------------------------------------------------------------

a = 3.5249 
atoms = bulk('Ni', 'fcc', a=a)
atoms.center()

write('system.traj', atoms)

for a in atoms:
    if a.symbol == 'Ni':
        a.magmom = 0.6

# Make self-consistent calculation and save results
calc = GPAW(h=0.18,
            mode='lcao',
            xc='PBE',
            basis='dzp',
            kpts=(8,8,8),
            occupations=FermiDirac(width=0.05, maxiter=2000),
            mixer=MixerSum(beta=0.010, nmaxold=8, weight=100.0),
            poissonsolver=PoissonSolver(eps=1e-12),
            txt='band_sc.txt')

atoms.set_calculator(calc)
atoms.get_potential_energy()
calc.write('band_sc.gpw')


# Calculate band structure along Gamma-X 

from ase.dft.kpoints import ibz_points, get_bandpath
points = ibz_points['fcc']
G = points['Gamma']
X = points['X']
kpts, x, X = get_bandpath([G, X], atoms.cell, 80)

calc = GPAW('band_sc.gpw',
            mode='lcao',
            xc='PBE',
            basis='dzp',
            kpts=kpts,
            txt='band_harris.txt',
            fixdensity=True,
            parallel={'domain': 1},
            usesymm=None,
            convergence={'bands': 'all'})

if calc.input_parameters['mode'] == 'lcao':
    calc.scf.reset()

calc.get_potential_energy()
ef = calc.get_fermi_level()
calc.write('band_harris.gpw')

# Extract eigenenergies into a file for plotting with some external package

import numpy as np

calc = GPAW('band_harris', txt=None)
eps_skn = np.array([[calc.get_eigenvalues(k,s)
                     for k in range(80)]
                    for s in range(2)]) - ef

f = open('bands.dat', 'w')
for n in range(10):
    for k in range(80):
        print >>f, k, eps_skn[0, k, n], eps_skn[1, k, n]
    print >>f

Run job in parallel

  • Run band structure calculations in parallel using 8 cores on ulam:
 mpirun -np 8 gpaw-python_openmpi ni_lcao.py

Plot the results

  • Reproduce the figure below using gnuplot or transfer data to your Windows PC via sftp and use Origin:
 
gnuplot> plot "bands.dat" using 1:2 with lines title "Spin up", "bands.dat" using 1:3 with lines title "Spin down"

FIG. 1: Electronic band structure of fcc-Ni.