Debian Codegraph @

doc/tutorialsexercises/energetics/rpa_tut/con_freq.py

raw
1 from ase.parallel import paropen
2 from ase.units import Hartree
3
4 from gpaw.xc.rpa import RPACorrelation
5
6 f = paropen('con_freq.dat', 'w')
7 for N in [4, 6, 8, 12, 16, 24, 32]:
8 rpa = RPACorrelation('N2.gpw', txt='rpa_N2_frequencies.txt',
9 ecut=[50],
10 nfrequencies=N)
11 data = rpa.calculate_all_contributions()
12 energy = data.energy_i[0] * Hartree
13 print(N, energy, file=f)
14 if N == 16:
15 f16 = paropen('frequency_gauss16.dat', 'w')
16 for omega, energy_i in zip(
17 data.integral.omega_w, data.energy_wi):
18 print(omega * Hartree, energy_i[0], file=f16)
19 f16.close()
20 f.close()