"""Module for building atomic structures""" from ASE import ListOfAtoms, Atom from math import sqrt def FCC100(symbol, a, layers, h): """Build a fcc(100) surface symbol: chmical symbol ('H', 'Li', ...) a : lattice constant layers: number of layers h : vacuum of unit cell""" # Distance between layers: dz = a / 2 # height of the unit cell (= length of a3) c = layers*dz + h # Unit Cell parameters: a1=a*sqrt(2.0)/2.0 c=layers*dz+h # Start with an empty ListOfAtoms object: atoms = ListOfAtoms([], cell=[(a1, 0, 0),(0, a1, 0),(0, 0, c)]) # Fill in the atoms using cartesian coordinates: for n in range(layers): z=-n*dz if (n%2)==0: x=0.0 y=0.0 else: x=0.5*a1 y=0.5*a1 atoms.append(Atom(symbol, (x,y,z))) return atoms if __name__ == '__main__': a = FCC100('Al', 4.05, 4, 20.0) from ASE.Visualization.xmakemol import * xmakemol(a, repeat=(3, 3, 2))