Attachment 'Build.py'

Download

   1 """Module for building atomic structures"""
   2 
   3 from ASE import ListOfAtoms, Atom
   4 
   5 
   6 def BCC100(symbol, a, layers, h):
   7     """Build a bcc(100) surface
   8 
   9     symbol: chmical symbol ('H', 'Li', ...)
  10     a     : lattice constant
  11     layers: number of layers
  12     h     : height of unit cell"""
  13 
  14     # Distance between layers:
  15     z = a / 2
  16 
  17     assert h > layers * z, 'unit cell too small for ' + str(layers) + ' layers'
  18     
  19     # Start with an empty ListOfAtoms object:
  20     atoms = ListOfAtoms([], periodic=True)
  21     
  22     # Fill in the atoms using scaled coordinates:
  23     for n in range(layers):
  24         position = [0.5 * (n % 2),
  25                     0.5 * (n % 2),
  26                     -n * z / h]
  27         atoms.append(Atom(symbol, position))
  28         
  29     # The unit cell is orthorhombic:
  30     atoms.SetUnitCell((a, a, h))
  31     # The unit cell could also have been set like this:
  32     # atoms.SetUnitCell([(a, 0, 0),
  33     #                    (0, a, 0),
  34     #                    (0, 0, h)])
  35     return atoms
  36 
  37 
  38 if __name__ == '__main__':
  39     bcc = BCC100('Al', 3.25, 4, 20.0)
  40     from ASE.Visualization.RasMol import RasMol
  41     p = RasMol(bcc, (4, 4, 2))
  42     raw_input('Press [enter] to finish. ')

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] (2006-02-02 11:56:04, 0.4 KB) [[attachment:Al111.py]]
  • [get | view] (2006-02-02 11:49:39, 1.2 KB) [[attachment:Build.py]]
  • [get | view] (2006-02-02 11:56:26, 1.0 KB) [[attachment:Relax.py]]
  • [get | view] (2006-02-13 15:20:54, 0.4 KB) [[attachment:atomplot.py]]
  • [get | view] (2006-02-13 15:23:50, 1.0 KB) [[attachment:densitydiff.py]]
  • [get | view] (2006-02-01 14:17:35, 5.5 KB) [[attachment:fcc.gif]]
  • [get | view] (2006-02-01 14:17:56, 5.7 KB) [[attachment:fcc111.gif]]
  • [get | view] (2006-02-21 14:56:31, 0.3 KB) [[attachment:vmd_input.py]]
 All files | Selected Files: delete move to page copy to page

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