Beispiel #1
0
def get_aims_calculator(dimensions,
                        k_grid=None,
                        xc="pbe",
                        compute_forces="true",
                        **kwargs):
    '''
    Method to return a "default" FHI-aims calculator.
    Note: This file should not be changed without consultation,
          as changes could affect many users in the group.

    Parameters:

    dimensions: Integer
        Determines whether we have a "gas"-phase (0) or "periodic" structure (2 or 3)
    k_grid: List of integers
        Gives the k-grid sampling in x-, y- and z- direction. e.g. [3, 3, 3]
    xc: String
        XC of choice
    compute_forces: String
        Determines whether forces are enabled ("true") or not enabled ("false").
    **kwargs:
        Any other keyword arguments that a user wants to set.

TODO: Reorder inputs so most necessary are first i.e. xc, compute_forces, k_grid (I think?)
  AL, March 2021: Doesn't matter - if named, the arguments are dynamic (i.e. can be any order)
    '''

    from ase.calculators.aims import Aims

    # Default is suitable for molecular calculations
    fhi_calc = Aims(spin='none',
                    relativistic=('atomic_zora', 'scalar'),
                    compute_forces=compute_forces,
                    **kwargs)

    # Set the XC for the calculation. For LibXC, override_warning_libxc *needs*
    # to be set first, otherwise we get a termination.
    if "libxc" in xc:
        fhi_calc.set(override_warning_libxc="true")
    fhi_calc.set(xc=xc)

    if dimensions == 2:
        fhi_calc.set(use_dipole_correction='true')

    if dimensions >= 2:
        fhi_calc.set(k_grid=k_grid)

    return fhi_calc
              relax_unit_cell = 'full')
atoms.set_calculator(calc)
energies.append(atoms.get_potential_energy())
mydb.write(atoms, name='ceo2-relax', relax=True)

lattices.append(norm(atoms.cell[0]))
thetas.append(arccos(dot(atoms.cell[0], atoms.cell[1]) / 
       (norm(atoms.cell[0]) * norm(atoms.cell[0])))/pi*180)
print('----------------------------')
print('# U    lattice constant (A)  angle (degree)  energy (eV) ')
print(' {0:1.2f}       {1:1.4f}    {2:1.2f}   {3:1.5f}'
       .format(0, lattices[0], thetas[0], energies[0]))

u = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]
for i in range(8):
       calc.set(plus_u='4 f {0}'.format(u[i]))
       calc.label='bulk/ceo2-relax-u-{0}'.format(u[i])
       atoms.set_calculator(calc)
       energies.append(atoms.get_potential_energy())
       mydb.write(atoms, name='ceo2-relax-u-{0}'.format(u[i]), relax=True)
       lattices.append(norm(atoms.cell[0]))
       thetas.append(arccos(dot(atoms.cell[0], atoms.cell[1]) / 
       (norm(atoms.cell[0]) * norm(atoms.cell[0])))/pi*180)
       print(' {0:1.2f}       {1:1.4f}    {2:1.2f}   {3:1.5f}'
              .format(u[i], lattices[0], thetas[0], energies[0]))
plt.plot(u, energies[1:], 'bo ')
plt.axhline(y=energies[0], xmin=0, xmax=1, hold=None)
plt.xlabel('u')
plt.ylabel('Total energy (eV)')
plt.savefig('images/ceo2-relax-u.png')
Beispiel #3
0
SPECIES_DIR = '/home/mka/Programs/fhi-aims.071711_6/species_defaults/light/'

LOG_FILE = open("ase-qm-mm-output.log","w")
sys.stdout = LOG_FILE

infile_name = sys.argv[1]

CALC_QM1 = Aims(charge = 0,
                xc = 'pbe',
                sc_accuracy_etot = 1e-5,
                sc_accuracy_eev = 1e-2,
                sc_accuracy_rho = 1e-5,
                sc_accuracy_forces = 1e-3,
                species_dir = SPECIES_DIR,
                run_command = RUN_COMMAND)
CALC_QM1.set(output = 'hirshfeld')

CALC_QM2 = Aims(charge = 0,
                xc = 'pbe',
                sc_accuracy_etot = 1e-5,
                sc_accuracy_eev = 1e-2,
                sc_accuracy_rho = 1e-5,
                sc_accuracy_forces = 1e-3,
                species_dir = SPECIES_DIR,
                run_command = RUN_COMMAND)
CALC_QM2.set(output = 'hirshfeld')

CALC_QM3 = Aims(charge = 0,
                xc = 'pbe',
                sc_accuracy_etot = 1e-5,
                sc_accuracy_eev = 1e-2,
SPECIES_DIR = '/home/mka/Programs/fhi-aims.071711_6/species_defaults/light/'

LOG_FILE = open("ase-qm-mm-output.log", "w")
sys.stdout = LOG_FILE

infile_name = sys.argv[1]

CALC_QM1 = Aims(charge=0,
                xc='pbe',
                sc_accuracy_etot=1e-5,
                sc_accuracy_eev=1e-2,
                sc_accuracy_rho=1e-5,
                sc_accuracy_forces=1e-3,
                species_dir=SPECIES_DIR,
                run_command=RUN_COMMAND)
CALC_QM1.set(output='hirshfeld')

CALC_QM2 = Aims(charge=0,
                xc='pbe',
                sc_accuracy_etot=1e-5,
                sc_accuracy_eev=1e-2,
                sc_accuracy_rho=1e-5,
                sc_accuracy_forces=1e-3,
                species_dir=SPECIES_DIR,
                run_command=RUN_COMMAND)
CALC_QM2.set(output='hirshfeld')

CALC_QM3 = Aims(charge=0,
                xc='pbe',
                sc_accuracy_etot=1e-5,
                sc_accuracy_eev=1e-2,
Beispiel #5
0
              relax_unit_cell = 'full')
atoms.set_calculator(calc)
energies.append(atoms.get_potential_energy())
mydb.write(atoms, name='tio2-relax', relax=True)

lattices.append(norm(atoms.cell[0]))
thetas.append(arccos(dot(atoms.cell[0], atoms.cell[1]) / 
       (norm(atoms.cell[0]) * norm(atoms.cell[0])))/pi*180)
print('----------------------------')
print('# U    lattice constant (A)  angle (degree)  energy (eV) ')
print(' {0:1.2f}       {1:1.4f}    {2:1.2f}   {3:1.5f}'
       .format(0, lattices[0], thetas[0], energies[0]))

u = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]
for i in range(8):
       calc.set(plus_u='4 f {0}'.format(u[i]),
                label = 'bulk/tio2-relax-u-{0}'.format(u[i]))
       atoms.set_calculator(calc)
       energies.append(atoms.get_potential_energy())
       mydb.write(atoms, name='tio2-relax-u-{0}'.format(u[i]), relax=True)
       lattices.append(norm(atoms.cell[0]))
       thetas.append(arccos(dot(atoms.cell[0], atoms.cell[1]) / 
       (norm(atoms.cell[0]) * norm(atoms.cell[0])))/pi*180)
       print(' {0:1.2f}       {1:1.4f}    {2:1.2f}   {3:1.5f}'
              .format(u[i], lattices[0], thetas[0], energies[0]))
plt.plot(u, energies[1:], 'bo ')
plt.axhline(y=energies[0], xmin=0, xmax=1, hold=None)
plt.xlabel('u')
plt.ylabel('Total energy (eV)')
plt.savefig('images/tio2-relax-u.png')

Beispiel #6
0
              relax_unit_cell = 'full')
atoms.set_calculator(calc)
energies.append(atoms.get_potential_energy())
mydb.write(atoms, name='ceo2-relax', relax=True)

lattices.append(norm(atoms.cell[0]))
thetas.append(arccos(dot(atoms.cell[0], atoms.cell[1]) / 
       (norm(atoms.cell[0]) * norm(atoms.cell[0])))/pi*180)
print('----------------------------')
print('# U    lattice constant (A)  angle (degree)  energy (eV) ')
print(' {0:1.2f}       {1:1.4f}    {2:1.2f}   {3:1.5f}'
       .format(0, lattices[0], thetas[0], energies[0]))

u = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]
for i in range(8):
       calc.set(plus_u='4 f {0}'.format(u[i]),
       calc.label='bulk/ceo2-relax-u-{0}'.format(u[i])
       atoms.set_calculator(calc)
       energies.append(atoms.get_potential_energy())
       mydb.write(atoms, name='ceo2-relax-u-{0}'.format(u[i]), relax=True)
       lattices.append(norm(atoms.cell[0]))
       thetas.append(arccos(dot(atoms.cell[0], atoms.cell[1]) / 
       (norm(atoms.cell[0]) * norm(atoms.cell[0])))/pi*180)
       print(' {0:1.2f}       {1:1.4f}    {2:1.2f}   {3:1.5f}'
              .format(u[i], lattices[0], thetas[0], energies[0]))
plt.plot(u, energies[1:], 'bo ')
plt.axhline(y=energies[0], xmin=0, xmax=1, hold=None)
plt.xlabel('u')
plt.ylabel('Total energy (eV)')
plt.savefig('images/ceo2-relax-u.png')