def EfccEhcpCalculator(self, EMT, PARAMETERS):
        # Return 0 is used when the method is not desired to be used
        # return 0
        """ This method uses the EMT calculator to calculate and return the difference in energy between a system of 
            atoms placed in the HCP and FCC structure. """
        # The atoms objects are created using the input size and element and the energy calculator
        # is set to the EMT calculator
        # The Lattice Constants, a,c, for the HCP lattice is here given by the nearest neighbor distance of
        # the system in the FCC crystal structure, a = dnn, and the ideal relation between a and
        # c: a/c = sqrt(8/3) => c = dnn / sqrt(8/3)
        a = beta * PARAMETERS[self.Element][1] * Bohr
        c = a * numpy.sqrt(8. / 3.)

        # The HCP crystal is created, the size of the crystal is defined as 5,5,5, any smaller crystal will result in
        # Neighborlist errors.
        atoms1 = HexagonalClosedPacked(size=(5, 5, 5),
                                       directions=[[2, -1, -1,
                                                    0], [0, 1, -1, 0],
                                                   [0, 0, 0, 1]],
                                       symbol=self.Element,
                                       latticeconstant={
                                           'a': a,
                                           'c': c
                                       })
        atoms1.set_calculator(EMT)

        # The FCC crystal is created
        atoms2 = FaceCenteredCubic(size=(self.Size, self.Size, self.Size),
                                   symbol=self.Element)
        atoms2.set_calculator(EMT)

        # The energy difference pr atom is calculated and returned
        return atoms1.get_potential_energy() / len(
            atoms1) - atoms2.get_potential_energy() / len(atoms2)
Beispiel #2
0
from ase.lattice.hexagonal import HexagonalClosedPacked
from vasp import Vasp
import matplotlib.pyplot as plt
atoms = HexagonalClosedPacked(symbol='Ru',
                              latticeconstant={'a': 2.7,
                                               'c/a': 1.584})
a_list = [2.5, 2.6, 2.7, 2.8, 2.9]
covera_list = [1.4, 1.5, 1.6, 1.7, 1.8]
for a in a_list:
    energies = []
    for covera in covera_list:
        atoms = HexagonalClosedPacked(symbol='Ru',
                              latticeconstant={'a': a,
                                               'c/a': covera})
        wd = 'bulk/Ru/{0:1.2f}-{1:1.2f}'.format(a, covera)
        calc = Vasp(wd,
                    xc='PBE',
                    # the c-axis is longer than the a-axis, so we use
                    # fewer kpoints.
                    kpts=[6, 6, 4],
                    encut=350,
                    atoms=atoms)
        energies.append(atoms.get_potential_energy())
    if not None in energies:
        plt.plot(covera_list, energies, label=r'a={0} $\AA$'.format(a))
plt.xlabel('$c/a$')
plt.ylabel('Energy (eV)')
plt.legend()
plt.savefig('images/Ru-covera-scan.png')
Beispiel #3
0
atoms = HexagonalClosedPacked(symbol='Ru',
                              latticeconstant={
                                  'a': 2.7,
                                  'c/a': 1.584
                              })
a_list = [2.5, 2.6, 2.7, 2.8, 2.9]
covera_list = [1.4, 1.5, 1.6, 1.7, 1.8]
for a in a_list:
    energies = []
    for covera in covera_list:
        atoms = HexagonalClosedPacked(symbol='Ru',
                                      latticeconstant={
                                          'a': a,
                                          'c/a': covera
                                      })
        wd = 'bulk/Ru/{0:1.2f}-{1:1.2f}'.format(a, covera)
        calc = Vasp(
            wd,
            xc='PBE',
            # the c-axis is longer than the a-axis, so we use
            # fewer kpoints.
            kpts=[6, 6, 4],
            encut=350,
            atoms=atoms)
        energies.append(atoms.get_potential_energy())
    if not None in energies:
        plt.plot(covera_list, energies, label=r'a={0} $\AA$'.format(a))
plt.xlabel('$c/a$')
plt.ylabel('Energy (eV)')
plt.legend()
plt.savefig('images/Ru-covera-scan.png')