Exemplo n.º 1
0
def calc_elast_dipole_dft(input_file, vasp_calc=True):
    """Reads OUTCAR file in the same directory with one shot forces
    induced by removal of defect. Reads defect position
    from .xyz file (which contains the defect) defined by `input_file`
    calculates and returns the elastic dipole tensor of the defect.

    Args:
      input_file(str): name of input .xyz file containing defect cell.

    Returns:
      Elastic Dipole Tensor 3x3 numpy array.
    """

    elastic = ElasticDipole()
    ats_def = Atoms(input_file)
    defect = find_h_atom(ats_def)
    if vasp_calc:
        import ase.io.vasp as vasp
        ats_pos = vasp.read_vasp()
        ats = vasp.read_vasp_out()
        ats = Atoms(ats)
    else:
        pass

    print 'Defect index', defect.index, 'Position', defect.position, 'Type: ', defect.number
    f = ats.get_forces()
    ats.add_property('force', f.T)
    ats.write('force.xyz')
    return elastic.compute_vacancy_dipole(defect,
                                          ats_pos.copy(),
                                          forces=ats.get_forces())
Exemplo n.º 2
0
                         block=block,
                         corner=corner,
                         shape=shape,
                         exe    = vasp,
                         ediffg = -0.05,
                         nelmin = 6,
                         nelmdl = -15,
                         kpar   = 32,
                         parmode='cobalt',
                         xc='PBE',
                         lreal=False, ibrion=13, nsw=40,
                         algo='VeryFast', npar=8, 
                         lplane=False, lwave=False, lcharg=False, nsim=1,
                         voskown=1, ismear=1, sigma=0.01, iwavpr=11, isym=2, nelm=100)

sock_calc = SocketCalculator(vasp_client, ip=ip, bgq=True)

bulk.set_calculator(sock_calc)
opt = LBFGS(bulk)
opt.run(fmax=0.05, steps=100)

sock_e = bulk.get_potential_energy()
sock_f = bulk.get_forces()
sock_s = bulk.get_stress()

print 'energy', sock_e
print 'forces', sock_f
print 'stress', sock_s

sock_calc.shutdown()
Exemplo n.º 3
0
                         ibrion=13,
                         nsw=40,
                         algo='VeryFast',
                         npar=8,
                         lplane=False,
                         lwave=False,
                         lcharg=False,
                         nsim=1,
                         voskown=1,
                         ismear=1,
                         sigma=0.01,
                         iwavpr=11,
                         isym=2,
                         nelm=100)

sock_calc = SocketCalculator(vasp_client, ip=ip, bgq=True)

bulk.set_calculator(sock_calc)
opt = LBFGS(bulk)
opt.run(fmax=0.05, steps=100)

sock_e = bulk.get_potential_energy()
sock_f = bulk.get_forces()
sock_s = bulk.get_stress()

print 'energy', sock_e
print 'forces', sock_f
print 'stress', sock_s

sock_calc.shutdown()
Exemplo n.º 4
0
    THZ_to_mev = 4.135665538536
    unit_cell  = PhonopyAtoms(symbols=symbols, cell=cell, scaled_positions=scaled_positions)
    phonon     = Phonopy(unit_cell, [[n_sup_x,0,0],[0,n_sup_y,0],[0,0,n_sup_z]])
    phonon.generate_displacements(distance=0.05)
    supercells = phonon.get_supercells_with_displacements()

    #We need to get the forces on these atoms...
    forces = []
    print 'There are', len(supercells), 'displacement patterns'
    for sc in supercells:
        cell = aseAtoms(symbols=sc.get_chemical_symbols(), scaled_positions=sc.get_scaled_positions(),
                        cell=sc.get_cell(), pbc=(1,1,1))
        cell = Atoms(cell)
        cell.set_calculator(pot)
        forces.append(cell.get_forces())

    phonon.set_forces(forces)
    phonon.produce_force_constants()

    mesh = [nqx, nqy, nqz]
    phonon.set_mesh(mesh, is_eigenvectors=True)
    qpoints, weights, frequencies, eigvecs = phonon.get_mesh()

    #SHOW DOS STRUCTURE
    phonon.set_total_DOS(freq_min=0.0, freq_max=12.0, tetrahedron_method=False)
    phonon.get_total_DOS()
    phonon.write_total_DOS()
    phonon.plot_total_DOS().show()

    #BAND STRUCTURE