Attachment 'bee.py'

Download

   1 import Numeric as na
   2 from ASE.Utilities.BEE import GetEnsembleEnergies
   3 from ASE import Atom, ListOfAtoms
   4 from Dacapo import Dacapo
   5 
   6 a = 4.0  # Size of unit cell (Angstrom)
   7 
   8 
   9 # Hydrogen atom:
  10 atom = ListOfAtoms([Atom('H', (0, 0, 0), magmom=1)],
  11                    cell=(a, a, a), periodic=True)
  12 
  13 # Hydrogen molecule:
  14 d = 0.74  # Experimental bond length
  15 molecule = ListOfAtoms([Atom('H', (0, 0, 0)),
  16                         Atom('H', (d, 0, 0))],
  17                        cell=(a, a, a), periodic=True)
  18 
  19 for xc in ['PBE','RPBE']:
  20     print xc + ':'
  21     calc = Dacapo(planewavecutoff=400, spinpol=True,nbands=1, xc=xc, out='H1.%s.out' % xc)
  22     calc.SetExecutable('/home/niflheim/lhansen/svol/dacapo/src/pglinux_serial/dacapo.run')
  23     atom.SetCalculator(calc)
  24 
  25     e1 = atom.GetPotentialEnergy()
  26     c1 = calc.GetEnsembleCoefficients()
  27 
  28     calc = Dacapo(planewavecutoff=400, nbands=1, xc=xc, out='H2.%s.out' % xc)
  29     calc.SetExecutable('/home/niflheim/lhansen/svol/dacapo/src/pglinux_serial/dacapo.run')
  30     molecule.SetCalculator(calc)
  31     
  32     e2 = molecule.GetPotentialEnergy()
  33     c2 = calc.GetEnsembleCoefficients()
  34 
  35     print 'hydrogen atom energy:     %5.2f eV' % e1
  36     print 'hydrogen molecule energy: %5.2f eV' % e2
  37     print 'atomization energy:       %5.2f eV' % (2 * e1 - e2)
  38     print c1
  39     print c2
  40     print c2 - 2 * c1
  41     
  42     e1i = GetEnsembleEnergies(c1)
  43     e2i = GetEnsembleEnergies(c2)
  44     eai = 2 * e1i - e2i
  45 
  46     n = len(eai)
  47     ea0 = na.sum(eai) / n
  48     sigma = (na.sum((eai - ea0)**2) / n)**0.5
  49     print 'Best fit:', ea0, '+-', sigma, 'eV'

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.
  • [get | view] (2005-11-10 12:53:31, 1.7 KB) [[attachment:Al_equation_of_state.py]]
  • [get | view] (2006-02-07 13:26:56, 5.2 KB) [[attachment:Al_murn.png]]
  • [get | view] (2005-11-10 12:52:32, 0.6 KB) [[attachment:CO_in_a_box.py]]
  • [get | view] (2005-11-10 12:52:58, 0.6 KB) [[attachment:CO_relaxed_in_a_box.py]]
  • [get | view] (2006-02-09 10:15:54, 0.5 KB) [[attachment:CO_vibrations.py]]
  • [get | view] (2006-02-07 13:34:52, 41.6 KB) [[attachment:HCo.jpg]]
  • [get | view] (2006-02-09 09:11:07, 1.7 KB) [[attachment:H_Co_ontop.py]]
  • [get | view] (2006-02-09 10:23:21, 3.0 KB) [[attachment:STM.py]]
  • [get | view] (2006-02-09 10:25:18, 3.4 KB) [[attachment:Wannier-Fe-bcc.py]]
  • [get | view] (2006-02-09 10:24:12, 1.9 KB) [[attachment:Wannier-Pt4.py]]
  • [get | view] (2006-02-09 10:24:44, 2.3 KB) [[attachment:Wannier-Ptwire.py]]
  • [get | view] (2006-02-09 10:23:48, 2.0 KB) [[attachment:Wannier-ethylene.py]]
  • [get | view] (2006-02-09 12:14:10, 1.5 KB) [[attachment:bee.py]]
  • [get | view] (2006-02-09 12:15:01, 1.5 KB) [[attachment:bee2.py]]
  • [get | view] (2006-02-07 13:39:49, 8.6 KB) [[attachment:dipole.gif]]
  • [get | view] (2006-02-09 10:16:22, 2.5 KB) [[attachment:electrostatic.py]]
  • [get | view] (2006-02-09 09:19:06, 1.8 KB) [[attachment:filter.py]]
  • [get | view] (2006-02-07 13:38:35, 51.2 KB) [[attachment:final.jpg]]
  • [get | view] (2006-02-07 13:36:15, 474.9 KB) [[attachment:h2o-hessian.png]]
  • [get | view] (2006-02-07 13:37:47, 10.7 KB) [[attachment:harris.gif]]
  • [get | view] (2006-02-09 10:06:30, 2.6 KB) [[attachment:harris.py]]
  • [get | view] (2006-02-07 13:38:12, 49.2 KB) [[attachment:initial.jpg]]
  • [get | view] (2006-02-09 10:14:38, 3.4 KB) [[attachment:neb.py]]
  • [get | view] (2006-02-07 13:39:08, 130.0 KB) [[attachment:nebpath.gif]]
  • [get | view] (2006-02-07 13:36:37, 82.3 KB) [[attachment:plottrajectory.gif]]
  • [get | view] (2006-02-09 10:05:51, 1.8 KB) [[attachment:plotwavefunction.py]]
  • [get | view] (2006-02-09 10:15:10, 1.9 KB) [[attachment:restart-neb.py]]
  • [get | view] (2006-02-09 10:38:41, 1.6 KB) [[attachment:setupham.py]]
  • [get | view] (2006-02-07 13:40:51, 84.3 KB) [[attachment:stm.jpg]]
  • [get | view] (2006-02-09 10:38:07, 3.3 KB) [[attachment:transport_1dmodel.py]]
  • [get | view] (2006-02-07 13:37:23, 69.9 KB) [[attachment:vtk.gif]]
  • [get | view] (2006-07-07 07:01:50, 108.7 KB) [[attachment:workfunction.pdf]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.