if not Grain_Boundary: unit_slab = crack.build_unit_slab() pot_dir = os.environ['POTDIR'] pot_file = os.path.join(pot_dir, crack_info['param_file']) mm_pot = Potential('IP EAM_ErcolAd do_rescale_r=T r_scale=1.00894848312', param_filename=pot_file, cutoff_skin=2.0) # gb_frac.py will generate the frac_cell.xyz file which contains # a crack_cell: if Grain_Boundary: unit_slab = Atoms('frac_cell.xyz') unit_slab.set_calculator(mm_pot) #calculate the elasticity tensor: crack.calculate_c(mm_pot) surface = crack.build_surface(mm_pot) E_surf = surface.get_potential_energy() bulk = bcc(2.82893) bulk.set_atoms(26) bulk.info['adsorbate_info']=None bulk.set_calculator(mm_pot) E_bulk = bulk.get_potential_energy()/len(bulk) area = (surface.get_cell()[0,0]*surface.get_cell()[2,2]) print E_surf, E_bulk gamma = (E_surf - E_bulk*len(surface))/(2.0*area) print('Surface energy of %s surface %.4f J/m^2\n' % (crack.cleavage_plane, gamma/(units.J/units.m**2))) crack_slab = crack.build_crack_cell(unit_slab, mm_pot) crack.write_crack_cell(crack_slab, mm_pot)
(0.25, 0.75, 0.75), (0.75, 0.25, 0.75), (0.75, 0.75, 0.25)]) atoms.set_cell([a,a,a], scale_atoms=True) return atoms xc = 'GLLB' a = 5.404 # Si if 1: # 2 atom unit cell bulk = diamond2('Si', a) calc = GPAW(nbands=2*3, width=0.01, kpts=(32, 32, 32), h = 0.3, xc=xc) bulk.set_calculator(calc) E2_tot = bulk.get_potential_energy() calc.write('Si2_GLLB.gpw') response = calc.hamiltonian.xc.xcs['RESPONSE'] response.calculate_delta_xc() Eks2, Dxc2 = response.calculate_delta_xc_perturbation() """ # 4 atom unit cell bulk = diamond4('Si', a) calc = GPAW(nbands=4*3, width=0.01, kpts=(24, 24, 20), h = 0.2, xc=xc) bulk.set_calculator(calc) E4_tot = bulk.get_potential_energy() calc.write('Si4_GLLB.gpw') response = calc.hamiltonian.xc.xcs['RESPONSE']
from gpaw.xc.rpa_correlation_energy import RPACorrelation from gpaw.test import equal kpts = monkhorst_pack((4,4,4)) kpts += np.array([1/8., 1/8., 1/8.]) bulk = bulk('Na', 'bcc', a=4.23) ecut = 350 calc = GPAW(mode=PW(ecut),dtype=complex, basis='dzp', kpts=kpts, parallel={'domain': 1}, txt='gs_occ_pw.txt', nbands=4, occupations=FermiDirac(0.01), setups={'Na': '1'}, ) bulk.set_calculator(calc) bulk.get_potential_energy() calc.write('gs_occ_pw.gpw') calc = GPAW('gs_occ_pw.gpw',txt='gs_pw.txt', parallel={'band': 1}) calc.diagonalize_full_hamiltonian(nbands=520) calc.write('gs_pw.gpw', 'all') ecut = 120 calc = GPAW('gs_pw.gpw', communicator=serial_comm, txt=None) rpa = RPACorrelation(calc, txt='rpa_%s.txt' %(ecut)) E = rpa.get_rpa_correlation_energy(ecut=ecut, skip_gamma=False, directions=[[0,1.0]], kcommsize=size, dfcommsize=size)
bulk = bulk('Na', 'bcc', a=4.23) ecut = 350 calc = GPAW( mode=PW(ecut), dtype=complex, basis='dzp', kpts={ 'size': (4, 4, 4), 'gamma': True }, parallel={'domain': 1}, txt='gs_occ_pw.txt', nbands=4, occupations=FermiDirac(0.01), setups={'Na': '1'}, ) bulk.set_calculator(calc) bulk.get_potential_energy() calc.write('gs_occ_pw.gpw') calc = GPAW('gs_occ_pw.gpw', txt='gs_pw.txt', parallel={'band': 1}) calc.diagonalize_full_hamiltonian(nbands=520) calc.write('gs_pw.gpw', 'all') ecut = 120 calc = GPAW('gs_pw.gpw', communicator=serial_comm, txt=None) rpa = RPACorrelation(calc, txt='rpa_%s.txt' % ecut) E = rpa.calculate(ecut=[ecut]) equal(E, -1.106, 0.005)
unit_slab = crack.build_unit_slab() pot_dir = os.environ['POTDIR'] pot_file = os.path.join(pot_dir, crack_info['param_file']) mm_pot = Potential('IP EAM_ErcolAd do_rescale_r=T r_scale=1.00894848312', param_filename=pot_file, cutoff_skin=2.0) # gb_frac.py will generate the frac_cell.xyz file which contains # a crack_cell: if Grain_Boundary: unit_slab = Atoms('frac_cell.xyz') unit_slab.set_calculator(mm_pot) #calculate the elasticity tensor: crack.calculate_c(mm_pot) surface = crack.build_surface(mm_pot) E_surf = surface.get_potential_energy() bulk = bcc(2.82893) bulk.set_atoms(26) bulk.info['adsorbate_info'] = None bulk.set_calculator(mm_pot) E_bulk = bulk.get_potential_energy() / len(bulk) area = (surface.get_cell()[0, 0] * surface.get_cell()[2, 2]) print E_surf, E_bulk gamma = (E_surf - E_bulk * len(surface)) / (2.0 * area) print('Surface energy of %s surface %.4f J/m^2\n' % (crack.cleavage_plane, gamma / (units.J / units.m**2))) crack_slab = crack.build_crack_cell(unit_slab, mm_pot) crack.write_crack_cell(crack_slab, mm_pot)