def EvocCalculator(self, EMT, PARAMETERS): # Return 0 is used when the method is not desired to be used # return 0 """ This method calculates the vacancy formation energy for the system of atoms. That is, this method calculates the potential energy for a complete system of atoms, then removes an atom and calculates the potential energy again. Then the energy for the full system (scaled with the number of atoms in the reduced system) are subtracted from that of the reduced system and the vacancy formation energy, Evoc, is returned. """ # The atoms object is initialized for the chosen size and type of system atoms = FaceCenteredCubic(size=(self.Size, self.Size, self.Size), symbol=self.Element) # The EMT calculator given is attached to the atoms object atoms.set_calculator(EMT) # The energy of the full system is calculated E_FullSystem = atoms.get_potential_energy() # an atom is removed from the system atoms.pop() # The energy of the reduced system is calculated E_ReducedSystem = atoms.get_potential_energy() # The energy of a full system compared to the energy pr atom of the reduced system is calculated and returned return E_ReducedSystem - E_FullSystem * len(atoms) / (len(atoms) + 1)
v1 = atoms.get_volume() print "v1:", v1 n1 = atoms.get_number_of_atoms() print "n1:", n1 v1pa = v1 / n1 print "v1pa:", v1pa # initial ene0 = atoms.get_potential_energy() print "ene0:", ene0 print "ene0pa:", ene0 / atoms.get_number_of_atoms() ene0pa = ene0 / atoms.get_number_of_atoms() # vacancy atoms.pop(0) nm1 = n1 - 1 ene1nm = atoms.get_potential_energy() print "ene1nm:", ene1nm print "ene1nmpa:", ene1nm / nm1 # minimize pos model.parameters["minimize"] = "1.0e-25 1.0e-25 10000 10000" # model.parameters["minimize"] = "1.0e-5 1.0e-5 10000 10000" ene2m = atoms.get_potential_energy() print "ene2m:", ene2m print "ene2mpa:", ene2m / nm1 atoms3 = calc.atoms # minimize pos and cell
v1 = atoms.get_volume() print "v1:", v1 n1 = atoms.get_number_of_atoms() print "n1:", n1 v1pa = v1 / n1 print "v1pa:", v1pa # initial ene0 = atoms.get_potential_energy() print "ene0:", ene0 print "ene0pa:", ene0 / atoms.get_number_of_atoms() ene0pa = ene0 / atoms.get_number_of_atoms() # vacancy atoms.pop(0) nm1 = n1 - 1 ene1nm = atoms.get_potential_energy() print "ene1nm:", ene1nm print "ene1nmpa:", ene1nm / nm1 # minimize pos model.parameters["minimize"] = "1.0e-25 1.0e-25 10000 10000" #model.parameters["minimize"] = "1.0e-5 1.0e-5 10000 10000" ene2m = atoms.get_potential_energy() print "ene2m:", ene2m print "ene2mpa:", ene2m / nm1 atoms3 = calc.atoms # minimize pos and cell