Attachment 'Wannier-Pt4.py'
Download 1 #!/usr/bin/env python
2
3 # Localized Wannier orbitals for a Pt wire
4
5 from Dacapo import Dacapo
6 from ASE import Atom,ListOfAtoms
7 from ASE.Visualization.RasMol import RasMol
8 import os
9
10 # check if we have already calculated the nc file
11 if not os.path.isfile('pt4.nc'):
12
13 # Pt wire
14 lat = 2.41
15 atoms = ListOfAtoms([
16 Atom('Pt', ([0*lat,2*lat,2*lat]),tag=0),
17 Atom('Pt', ([1*lat,2*lat,2*lat]),tag=0),
18 Atom('Pt', ([2*lat,2*lat,2*lat]),tag=0),
19 Atom('Pt', ([3*lat,2*lat,2*lat]),tag=0)],
20 cell=([4*lat,4*lat,4*lat]), periodic=True)
21
22
23 # Dacapo calculator:
24 calc = Dacapo(planewavecutoff=350, nbands=30, xc='PBE',out='pt4.nc')
25
26 atoms.SetCalculator(calc)
27
28 plot = RasMol(atoms.Repeat((2,2,2)))
29 tot = atoms.GetPotentialEnergy()
30
31 # Wannier part
32 from Dacapo import Dacapo
33 from ASE.Utilities.Wannier.Wannier import Wannier
34 import Numeric as num
35
36 atoms = Dacapo.ReadAtoms('pt4.nc')
37 calc = atoms.GetCalculator()
38
39 #Initialize Wannier class
40 wannier = Wannier(numberofwannier=4*(5+1),calculator=calc)
41
42 # Perform localization
43 wannier.Localize()
44
45 # Print the WF centers
46 centers = wannier.GetCenters()
47 for center in centers:
48 print center
49
50
51 centers = wannier.GetCentersAsAtoms()
52
53 # plot centers together with atoms
54 try:
55 # first try with VMD
56 from ASE.Visualization.VMD import VMD
57 VMD(atoms,centers)
58 except:
59 from ASE.Visualization.RasMol import RasMol
60 centers.extend(atoms)
61 rasmol = RasMol(centers)
62
63
64 # make a 3D isosurface plot using VTK
65 from ASE.Visualization.VTK import VTKPlotElectronicState,VTKPlotAtoms
66
67 state = wannier.GetElectronicState(10)
68
69 plot = VTKPlotElectronicState(state)
70 plot.SetRepresentationToIsoSurface2([3.0])
71 atomsplot = VTKPlotAtoms(atoms,parent=plot)
72 plot.Update()
73 atomsplot.RemoveAvatar(atomsplot.GetAvatars()[0])
74 plot.Render()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.