Skip to content

Commit

Permalink
Merge pull request #88 from DjordjeDangic/master
Browse files Browse the repository at this point in the history
Added test for the lattice thermal conductivity
  • Loading branch information
mesonepigreco authored Feb 9, 2024
2 parents 2947a2b + 4be427f commit 33ab3ce
Show file tree
Hide file tree
Showing 10 changed files with 3,395 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cellconstructor/ThermalConductivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,7 @@ def get_self_energy_at_q(self, iqpt, temperature, energies, mode_mixing = 'no',
real_part = hilbert(self_energy.imag)
self_energy.real = -1.0*real_part.imag

self_energy /= float(self.nkpt)
if(write_self_energy):
with open('Self_energy_' + str(iqpt + 1), 'w+') as outfile:
outfile.write('# ' + format('Energy (THz)', STR_FMT))
Expand All @@ -1640,9 +1641,9 @@ def get_self_energy_at_q(self, iqpt, temperature, energies, mode_mixing = 'no',
for iband in range(self.nband):
if(mode_mixing == 'mode_mixing'):
for jband in range(self.nband):
outfile.write(3*' ' + format(self_energy[ie, iband, jband].real*SSCHA_TO_THZ, '.12e') + ' ' + format(self_energy[ie, iband, jband].imag*SSCHA_TO_THZ, '.12e'))
outfile.write(3*' ' + format(self_energy[ie, iband, jband].real*SSCHA_TO_THZ**2, '.12e') + ' ' + format(self_energy[ie, iband, jband].imag*SSCHA_TO_THZ**2, '.12e'))
else:
outfile.write(3*' ' + format(self_energy[ie, iband].real*SSCHA_TO_THZ, '.12e') + ' ' + format(self_energy[ie, iband].imag*SSCHA_TO_THZ, '.12e'))
outfile.write(3*' ' + format(self_energy[ie, iband].real*SSCHA_TO_THZ**2, '.12e') + ' ' + format(self_energy[ie, iband].imag*SSCHA_TO_THZ**2, '.12e'))
outfile.write('\n')

return self_energy
Expand Down Expand Up @@ -2242,10 +2243,10 @@ def calculate_kappa_srta_offdiag(self, temperature, ne, write_lifetimes, gauss_s
for istar in self.qstar:
for iqpt in istar:
for iband in range(self.nband):
if(self.freqs[iqpt, iband] != 0.0):
if(self.freqs[iqpt, iband] != 0.0 and scatt_rates[iqpt, iband] != 0.0):
for jband in range(self.nband):
#if(self.freqs[iqpt, jband] != 0.0 and np.abs(self.freqs[iqpt, jband] - self.freqs[iqpt, iband]) > 1.0e-4/SSCHA_TO_THZ and iband != jband):
if(self.freqs[iqpt, jband] != 0.0 and iband != jband):
if(self.freqs[iqpt, jband] != 0.0 and scatt_rates[iqpt, jband] != 0.0 and iband != jband):
if(self.group_velocity_mode == 'wigner'):
vel_fact = 1.0
else:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"FModules/third_order_cond_centering.f90",
"FModules/get_lf.f90"],
libraries= ["lapack", "blas"],
extra_f90_compile_args = ["-cpp", "-fcheck=all", "-fopenmp", "-lgomp"],
#extra_f90_compile_args = ["-cpp", "-O2", "-fopenmp", "-lgomp"],
#extra_f90_compile_args = ["-cpp", "-fcheck=all", "-fopenmp", "-lgomp"],
extra_f90_compile_args = ["-cpp", "-O2", "-fopenmp", "-lgomp"],
extra_link_args = ["-fopenmp"]
)

Expand Down
3,001 changes: 3,001 additions & 0 deletions tests/TestTC/Phonon_harmonic_properties

Large diffs are not rendered by default.

Binary file added tests/TestTC/d3_realspace_sym.npy
Binary file not shown.
31 changes: 31 additions & 0 deletions tests/TestTC/final_dyn1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Dynamical matrix file
File generated with the CellConstructor by Lorenzo Monacelli
1 1 0 1.8897259890000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
Basis vectors
-0.0000000000000000 2.0214847552276387 2.0214847552276392
2.0214847552276387 0.0000000000000000 2.0214847552276387
2.0214847552276387 2.0214847552276387 0.0000000000000001
1 'Al ' 24592.1687534073353163
1 1 0.0000000000000000 0.0000000000000000 -0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000000 0.000000000000 0.000000000000 )

1 1
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000

Diagonalizing the dynamical matrix

q = ( 0.000000000000 0.000000000000 0.000000000000 )

***************************************************************************
freq ( 1) = 0.00000000 [THz] = 0.00000000 [cm-1]
( 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 )
freq ( 2) = 0.00000000 [THz] = 0.00000000 [cm-1]
( 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 )
freq ( 3) = 0.00000000 [THz] = 0.00000000 [cm-1]
( 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 )
***************************************************************************
130 changes: 130 additions & 0 deletions tests/TestTC/final_dyn2
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
Dynamical matrix file
File generated with the CellConstructor by Lorenzo Monacelli
1 1 0 1.8897259890000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
Basis vectors
-0.0000000000000000 2.0214847552276387 2.0214847552276392
2.0214847552276387 0.0000000000000000 2.0214847552276387
2.0214847552276387 2.0214847552276387 0.0000000000000001
1 'Al ' 24592.1687534073353163
1 1 0.0000000000000000 0.0000000000000000 -0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.164895299097 0.164895299097 0.000000000000 )

1 1
0.1236150042280424 0.0000000000000000 0.0525314579783002 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0525314579783003 0.0000000000000000 0.1236150042280424 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1637332718535142 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.164895299097 -0.164895299097 0.000000000000 )

1 1
0.1236150042280424 0.0000000000000000 0.0525314579783002 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0525314579783003 0.0000000000000000 0.1236150042280424 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1637332718535142 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.164895299097 0.164895299097 -0.000000000000 )

1 1
0.1236150042280424 0.0000000000000000 -0.0525314579783003 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0525314579783002 0.0000000000000000 0.1236150042280424 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1637332718535142 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.164895299097 -0.164895299097 -0.000000000000 )

1 1
0.1236150042280424 0.0000000000000000 -0.0525314579783003 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0525314579783002 0.0000000000000000 0.1236150042280424 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1637332718535142 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000000 -0.164895299097 0.164895299097 )

1 1
0.1637332718535142 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.1236150042280424 0.0000000000000000 -0.0525314579783003 0.0000000000000000
0.0000000000000000 0.0000000000000000 -0.0525314579783003 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.000000000000 -0.164895299097 -0.164895299097 )

1 1
0.1637332718535142 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.1236150042280423 0.0000000000000000 0.0525314579783002 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0525314579783002 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000000 0.164895299097 -0.164895299097 )

1 1
0.1637332718535142 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.1236150042280424 0.0000000000000000 -0.0525314579783003 0.0000000000000000
0.0000000000000000 0.0000000000000000 -0.0525314579783003 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.000000000000 0.164895299097 0.164895299097 )

1 1
0.1637332718535142 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.1236150042280423 0.0000000000000000 0.0525314579783002 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0525314579783002 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.164895299097 -0.000000000000 0.164895299097 )

1 1
0.1236150042280424 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0525314579783003 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.1637332718535141 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0525314579783003 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.164895299097 0.000000000000 -0.164895299097 )

1 1
0.1236150042280424 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0525314579783002 0.0000000000000000
-0.0000000000000000 0.0000000000000000 0.1637332718535141 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0525314579783003 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.164895299097 0.000000000000 -0.164895299097 )

1 1
0.1236150042280424 0.0000000000000000 0.0000000000000000 0.0000000000000000 -0.0525314579783003 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.1637332718535141 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0525314579783003 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1236150042280424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.164895299097 -0.000000000000 0.164895299097 )

1 1
0.1236150042280424 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0525314579783002 0.0000000000000000
-0.0000000000000000 0.0000000000000000 0.1637332718535141 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0525314579783003 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1236150042280424 0.0000000000000000

Diagonalizing the dynamical matrix

q = ( 0.164895299097 0.164895299097 0.000000000000 )

***************************************************************************
freq ( 1) = 5.59321356 [THz] = 186.56949550 [cm-1]
( 0.707107 0.000000 -0.707107 0.000000 -0.000000 0.000000 )
freq ( 2) = 8.48878100 [THz] = 283.15521482 [cm-1]
( -0.000000 0.000000 -0.000000 0.000000 -1.000000 0.000000 )
freq ( 3) = 8.80468497 [THz] = 293.69263565 [cm-1]
( 0.707107 0.000000 0.707107 0.000000 -0.000000 0.000000 )
***************************************************************************
76 changes: 76 additions & 0 deletions tests/TestTC/final_dyn3
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Dynamical matrix file
File generated with the CellConstructor by Lorenzo Monacelli
1 1 0 1.8897259890000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
Basis vectors
-0.0000000000000000 2.0214847552276387 2.0214847552276392
2.0214847552276387 0.0000000000000000 2.0214847552276387
2.0214847552276387 2.0214847552276387 0.0000000000000001
1 'Al ' 24592.1687534073353163
1 1 0.0000000000000000 0.0000000000000000 -0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.000000000000 -0.000000000000 0.164895299097 )

1 1
0.0702206082320731 0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
-0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.1761114605793424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000000 0.000000000000 -0.164895299097 )

1 1
0.0702206082320731 0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
-0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.1761114605793424 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.164895299097 0.000000000000 -0.000000000000 )

1 1
0.1761114605793424 0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000
-0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
-0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( -0.164895299097 0.000000000000 0.000000000000 )

1 1
0.1761114605793424 0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
-0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0000000000000000 0.0702206082320731 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000000 0.164895299097 -0.000000000000 )

1 1
0.0702206082320731 0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
-0.0000000000000000 0.0000000000000000 0.1761114605793424 0.0000000000000000 -0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000000 -0.164895299097 0.000000000000 )

1 1
0.0702206082320731 0.0000000000000000 -0.0000000000000000 0.0000000000000000 -0.0000000000000000 -0.0000000000000000
0.0000000000000000 -0.0000000000000000 0.1761114605793424 0.0000000000000000 -0.0000000000000000 0.0000000000000000
-0.0000000000000000 -0.0000000000000000 -0.0000000000000000 -0.0000000000000000 0.0702206082320731 0.0000000000000000

Diagonalizing the dynamical matrix

q = ( -0.000000000000 -0.000000000000 0.164895299097 )

***************************************************************************
freq ( 1) = 5.55915973 [THz] = 185.43358201 [cm-1]
( 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 )
freq ( 2) = 5.55915973 [THz] = 185.43358201 [cm-1]
( 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 )
freq ( 3) = 8.80381015 [THz] = 293.66345473 [cm-1]
( 0.000000 0.000000 0.000000 0.000000 -1.000000 -0.000000 )
***************************************************************************
Loading

0 comments on commit 33ab3ce

Please sign in to comment.