a0 = bulk.cell[0, 0] # get lattice constant from relaxed bulk print "got a0 ", a0 bulk = Diamond(symbol="Si", latticeconstant=a0, directions=[[1, -1, 0], [1, 0, -1], [1, 1, 1]]) bulk.set_calculator(model.calculator) # compute surface formation energy as difference of periodic and curface cell ebulk_per_atom = bulk.get_potential_energy() / bulk.get_number_of_atoms() print 'bulk per atom energy', ebulk_per_atom bulk *= (1, 1, 10) ebulk = bulk.get_potential_energy() print 'bulk 1x1x10 cell energy', ebulk # now calculate the relaxed unreconstructed 111 surface energy bulk.positions[:, 2] += 2.0 # select shuffle plane to be cut bulk.wrap() bulk.cell[2, :] += [0.0, 0.0, 10.0] np.random.seed(75) bulkNat = bulk.get_number_of_atoms() #bulk.positions += (np.random.rand((bulkNat*3))*0.1).reshape([bulkNat,3]) #bulk = relax_atoms(bulk, tol=fmax, traj_file="model-"+model.name+"-surface-energy-111-expanded-bulk-relaxed.opt.xyz") eexp = bulk.get_potential_energy() print 'expanded cell energy', eexp e111 = 0.5 * (eexp - ebulk) / np.linalg.norm( np.cross(bulk.cell[0, :], bulk.cell[1, :])) print '111 unreconstructed surface energy', e111 def surface_energy(n, bulk, ebulk_per_atom, e111): tmp = ase.io.read(os.path.dirname(__file__) + '/si111_' + str(n) + 'x' +