def dfpt(self): ''' ''' atoms = self.atoms self.log('-'*60) self.log('Submit job {0}'.format(job)) self.log.print_atoms(atoms) calc = Espresso( label = os.path.join(self.label, job), **self.calculator, ) calc.parameters['input_data']['prefix'] = job atoms.calc = calc energy = atoms.get_potential_energy() # dos calc.post(queue = queue, package = 'ph', tr2_ph = 1e-14, ldisp = True, nq1 = 4, nq2 = 4, nq3 = 3, ) calc.post(queue = queue, fildyn = 'matdyn', package = 'q2r', zasr = 'simple', flfrc = '%s.fc'%job, ) calc.post(queue = queue, package = 'matdyn', asr = 'simple', dos = True, flfrc = '%s.fc'%job, fldos = '%s.phdos'%job, nk1 = 40, nk2 = 40, nk3 = 30, ) calc.plot_phdos(fldos = '%s'%job, output = 'images/%s-phdos.png'%job) pass
label='scf/al', ecutwfc=40, occupations='smearing', degauss=0.01, kpts=(4, 4, 1)) atoms.calc = calc e = atoms.get_potential_energy() calc.read_results() e = calc.results['energy'] fermi = calc.get_fermi_level() print('Energy: {0:1.3f}'.format(e)) #=============================================================== # post calculation calc.post(package='pp', plot_num=5, sample_bias=0.0735, iflag=3, output_format=6, fileout='stm1_1eV.cube') # ======================== # Creates: 2d.png, 2d_I.png, line.png, dIdV.png from ase.dft.stm import STM from ase.io.cube import read_cube_data import pickle ldos, atoms = read_cube_data('scf/al/stm1_1eV.cube') with open('scf/al/datas.pickle', 'wb') as f: pickle.dump([ldos, 1.0, atoms.cell], f) stm = STM('scf/al/datas.pickle') z = 8.0 bias = 1.0 c = stm.get_averaged_current(bias, z) x, y, h = stm.scan(bias, c, repeat=(3, 5))
} pseudopotentials = { 'Fe': 'Fe.pbe-spn-rrkjus_psl.1.0.0.UPF', 'Fe1': 'Fe.pbe-spn-rrkjus_psl.1.0.0.UPF', } calc = Espresso(pseudopotentials=pseudopotentials, label='scf/fe-afm', input_data=input_data, kpts=(6, 6, 6)) atoms.calc = calc e = atoms.get_potential_energy() calc.read_results() e = calc.results['energy'] print('Energy {0:1.3f}'.format(e)) parameters_hp = { 'nq1': 1, 'nq2': 1, 'nq3': 1, 'equiv_type': 0, 'conv_thr_chi': 1e-5, 'perturb_only_atom': { '1': True } # key(i) } calc.post(package='hp', **parameters_hp) ''' Energy -6737.122 '''
calc = Espresso( label='scf/co', pseudopotentials=pseudopotentials, ecutwfc=30, occupations='smearing', degauss=0.03, kpts=(1, 1, 1), debug=True, ) atoms.calc = calc e = atoms.get_potential_energy() print('Energy = {0:1.3f} eV'.format(e)) #=============================================================== # start nscf calculation fe = calc.get_fermi_level() print('fermi level: ', fe) calc.nscf(occupations='tetrahedra', kpts=(3, 3, 3)) calc.nscf_calculate() # dos, projwfc calc.post(package='dos', Emin=fe - 30, Emax=fe + 30, DeltaE=0.01) calc.post(package='projwfc', Emin=fe - 30, Emax=fe + 30, DeltaE=0.01) # DOS analysis dos = DOS(label='scf/co', prefix='co') dos.read_dos() dos.plot_dos(Emin=-10, Emax=10, smearing=[0.02, 0.01]) plt.savefig('images/co-dos.png') dos.read_pdos() dos.plot_pdos(Emin=-10, Emax=10, smearing=[0.02, 0.01], legend=True) plt.savefig('images/co-pdos.png')
print('energy: ', e) # Phonon calculations at gamma input = { 'tr2_ph':1.0e-14, 'epsil':True, } # # phonon calculation on a (444) uniform grid of q-points input = { 'tr2_ph':1.0e-12, 'ldisp':True, 'nq1':4, 'nq2':4, 'nq3':4, } calc.post(queue = queue, package = 'ph', parallel = '-nk 4', **input) # input = { 'asr':'simple', 'dos': True, 'nk1':12, 'nk2':12, 'nk3':12, } calc.post(queue = queue, package = 'matdyn', **input) # oer = Phonon(atoms, # label = 'ZnO', # calculator = calc, # view = True, # ) # oer.run()
import matplotlib.pyplot as plt atoms = molecule('CO') atoms.center(5) atoms.pbc = [True, True, True] pseudopotentials = { 'O': 'O.pbe-n-rrkjus_psl.1.0.0.UPF', 'C': 'C.pbe-n-rrkjus_psl.1.0.0.UPF' } calc = Espresso( label='scf/co', pseudopotentials=pseudopotentials, ecutwfc=30, kpts=(1, 1, 1), ) atoms.calc = calc e = atoms.get_potential_energy() calc.read_results() print('Energy = {0:1.3f} eV'.format(e)) #=============================================================== # start nscf calculation, and dos, projwfc calc.read_results() fermi = calc.get_fermi_level() calc.nscf(kpts=(1, 1, 1)) calc.nscf_calculate() calc.post(package='dos', Emin=fermi - 20, Emax=fermi + 10, DeltaE=0.1) # DOS analysis dos = DOS(calc) dos.read_dos() dos.plot_dos() plt.savefig('images/co-dos.png')