def phonons(): print("Preparing phonons object.") forceconstants = ForceConstants.from_folder( folder='kaldo/tests/si-crystal', supercell=[3, 3, 3], format='eskm') phonons = Phonons(forceconstants=forceconstants, kpts=[5, 5, 5], is_classic=False, temperature=300, storage='memory') return phonons
def phonons(): print("Preparing phonons object.") forceconstants = ForceConstants.from_folder( folder='kaldo/tests/si-amorphous', format='eskm') phonons = Phonons(forceconstants=forceconstants, is_classic=False, temperature=300, third_bandwidth=1 / 4.135, broadening_shape='triangle', storage='memory') return phonons
def phonons(): print("Preparing phonons object.") # Create a finite difference object forceconstants = ForceConstants.from_folder( folder='kaldo/tests/si-amorphous', format='eskm') # # Create a phonon object phonons = Phonons(forceconstants=forceconstants, is_classic=False, storage='memory') return phonons
def phononics(ge_concentration='0'): # Set up Forceconstants Object folder_string = 'structures/1728_atom/aSiGe_C' + ge_concentration + '/' atoms = read(folder_string + 'replicated_atoms.xyz', format='xyz') forceconstants = ForceConstants(atoms=atoms, folder=folder_string + '/ald') # Calculate the 2nd + 3rd Forceconstant matrices lammps_inputs = { 'lmpcmds': [ "pair_style tersoff", "pair_coeff * * forcefields/SiCGe.tersoff Si(D) Ge" ], "log_file": "min.log", "keep_alive": True } calc = LAMMPSlib(**lammps_inputs) second = forceconstants.second second.load(folder=folder_string + '/ald') print('Third') # second.calculate(calculator=calc) third = forceconstants.third third.calculate(calculator=calc, is_verbose=True) # Create Phonon Object phonons = Phonons( forceconstants=forceconstants, is_classic=False, # quantum stats temperature=300, # 300 K folder=folder_string, third_bandwidth=0.5 / 4.135, # 0.5 eV smearing broadening_shape='gauss') # shape of smearing # Phononic Data ## These save files to help us look at phononic properties ## with our plotter (4_plotting.py). These properties are "lazy" which ## means they won't be calculated unless explicitly called, or required ## by another calculation. np.save('frequency', phonons.frequency) np.save('bandwidth', phonons.bandwidth) np.save('diffusivity', phonons.diffusivity) #np.save('participation', phonons.participation_ratio) # Conductivity Object # This will print out the total conductivity and save the contribution per mode conductivity = Conductivity(phonons=phonons, method='qhgk').conductivity np.save('conductivity', 1 / 3 * np.einsum('iaa->i', conductivity)) print("Thermal Conductivity (W/m/K): %.3f" % conductivity.sum(axis=0).diagonal().mean())
def phonons(): print("Preparing phonons object.") # Create a finite difference object forceconstants = ForceConstants.from_folder( folder='kaldo/tests/si-amorphous', format='eskm') # # Create a phonon object phonons = Phonons(forceconstants=forceconstants, is_classic=True, temperature=300, third_bandwidth=0.05 / 4.135, storage='memory') return phonons
def phonons(): print("Preparing phonons object.") forceconstants = ForceConstants.from_folder( folder='kaldo/tests/si-crystal', supercell=[3, 3, 3], format='eskm') phonons_config = { 'kpts': [5, 5, 5], 'is_classic': 0, 'temperature': 300, 'folder': 'ald', 'storage': 'memory', 'third_bandwidth': .1, 'broadening_shape': 'gauss', 'is_balanced': True, 'grid_type': 'C' } phonons = Phonons(forceconstants=forceconstants, **phonons_config) return phonons
def phonons(): print("Preparing phonons object.") # Setup crystal and EMT calculator atoms = bulk('Al', 'fcc', a=4.05) with TemporaryDirectory() as td: forceconstants = ForceConstants(atoms=atoms, supercell=[5, 5, 5], folder=td) forceconstants.second.calculate(calculator=EMT()) is_classic = False phonons_config = { 'kpts': [5, 5, 5], 'is_classic': is_classic, 'temperature': 300, 'storage': 'memory' } phonons = Phonons(forceconstants=forceconstants, **phonons_config) return phonons
# Configure phonon object # 'is_classic': specify if the system is classic, True for classical and False for quantum # 'temperature: temperature (Kelvin) at which simulation is performed # 'folder': name of folder containing phonon property and thermal conductivity calculations # 'storage': Format to storage phonon properties ('formatted' for ASCII format data, 'numpy' # for python numpy array and 'memory' for quick calculations, no data stored) phonons_config = {'is_classic': False, 'temperature': 300, #'temperature'=300K 'folder': 'ALD_aSi512', 'third_bandwidth':0.5/4.135, # 0.5 eV is used here. 'broadening_shape':'triangle', 'storage': 'numpy'} # Set up phonon object by passing in configuration details and the forceconstants object computed above phonons = Phonons(forceconstants=forceconstants, **phonons_config) ### Set up the Conductivity object and thermal conductivity calculations #### # Compute thermal conductivity (t.c.) by solving Boltzmann Transport # Equation (BTE) with various of methods # 'phonons': phonon object obtained from the above calculations # 'method': specify methods to solve for BTE # ('qhgk' for Quasi-Harmonic Green Kubo (QHGK)) # 'storage': Format to storage phonon properties ('formatted' for ASCII format data, 'numpy' # for python numpy array and 'memory' for quick calculations, no data stored) print('\n') qhgk_cond = Conductivity(phonons=phonons, method='qhgk', storage='numpy') qhgk_cond.diffusivity_bandwidth = phonons.bandwidth
# 'temperature: temperature (Kelvin) at which simulation is performed # 'folder': name of folder containing phonon property and thermal conductivity calculations # 'storage': Format to storage phonon properties ('formatted' for ASCII format data, 'numpy' # for python numpy array and 'memory' for quick calculations, no data stored) # Define the k-point mesh using 'kpts' parameter k_points = 151 # For one dimension system, only replicate k-point mesh # along the direction of transport (z-axis) kpts = [1, 1, k_points] temperature = 300 # Create a phonon object phonons = Phonons(forceconstants=forceconstants, kpts=kpts, is_classic=False, temperature=temperature, is_nw=True, folder='ALD_CNT', storage='numpy') # Compute conductivity from direct inversion of # scattering matrix for infinite size samples # 29.92 is the rescale factor between # the volume of the simulation box and the # volume of the 10,0 Carbon Nanotube inverse_conductivity = Conductivity(phonons=phonons, method='inverse').conductivity inverse_conductivity_matrix = inverse_conductivity.sum(axis=0) print('Infinite size conductivity from inversion (W/m-K): %.3f' % (29.92 * inverse_conductivity_matrix[2, 2]))
} forceconstants = ForceConstants(atoms=atoms, supercell=supercell, folder='forceconstant') forceconstants.second.calculate(calculator=LAMMPSlib(**lammps_inputs)) forceconstants.third.calculate(calculator=LAMMPSlib(**lammps_inputs)) n_replicas = np.prod(supercell) kpts = [5, 5, 5] temperature = 300 # # Create a phonon object phonons = Phonons(forceconstants=forceconstants, kpts=kpts, is_classic=is_classic, temperature=temperature, folder='ald_out') plotter.plot_dispersion(phonons) print('Inverse conductivity in W/m/K') print(Conductivity(phonons=phonons, method='inverse').conductivity.sum(axis=0)) print('RTA conductivity in W/m/K') print(Conductivity(phonons=phonons, method='rta').conductivity.sum(axis=0)) plotter.plot_dos(phonons) plotter.plot_vs_frequency(phonons, phonons.heat_capacity, 'cv') plotter.plot_vs_frequency(phonons, phonons.bandwidth, 'gamma_THz') plotter.plot_vs_frequency(phonons, phonons.phase_space, 'phase_space')
# Compute phonon bandwith with different widths, in the unit of THz widths = [0.5 / 4.135, 1 / 4.135] widths_l = [.121, .242] plt.figure(figsize=(16, 12)) plt.suptitle("Amorphous Si (Tersoff '89)", y=0.98, fontsize=18, fontweight='bold') for i in index: for j in range(0, len(widths)): phonon_object = Phonons(forceconstants=forceconstants, is_classic=False, temperature=300, third_bandwidth=widths[j], broadening_shape=shapes[i], is_tf_backend=False, folder='ald_' + shapes[i]) freq = phonon_object.frequency gamma = phonon_object.bandwidth lbl = 'Width: ' + str(widths_l[j]) + 'THz' plt.scatter(freq, gamma, label=lbl, s=5) plt.title('Broadening Shape: ' + str(labels[i]), fontsize=18, fontweight='bold') plt.xticks(fontsize=16) plt.yticks(fontsize=16) plt.xlabel(r'$\nu$ (THz)', fontsize=18, fontweight='bold') plt.ylabel(r'$\Gamma$ (THz)', fontsize=18, fontweight='bold') lgnd = plt.legend(scatterpoints=1, fontsize=14)
from kaldo.controllers import plotter from kaldo.forceconstants import ForceConstants from kaldo.conductivity import Conductivity from kaldo.phonons import Phonons fold = 'ald' kpts = [5, 5, 5] supercell = [5, 5, 5] temperature = 300 folder = 'fc' forceconstant = ForceConstants.from_folder(folder=folder, supercell=[5, 5, 5], format='shengbte-qe') for k in [5]: kpts = [k, k, k] phonons = Phonons(forceconstants=forceconstant, kpts=kpts, is_classic=False, temperature=300, folder='ald', is_tf_backend=True, grid_type='C') print('Inverse conductivity W/m/K') print( Conductivity(phonons=phonons, method='inverse', storage='memory').conductivity.sum(axis=0))
import numpy as np supercell = np.array([3, 3, 3]) # forceconstants = ForceConstants.import_from_dlpoly_folder('si-dlpoly', supercell) forceconstants = ForceConstants.from_folder('structures', supercell=supercell, format='lammps') k = 5 kpts = [k, k, k] is_classic = False temperature = 300 # # Create a phonon object phonons = Phonons(forceconstants=forceconstants, kpts=kpts, is_classic=is_classic, temperature=temperature) print('AF conductivity') print(Conductivity(phonons=phonons, method='qhgk').conductivity.sum(axis=0)) plt.scatter(phonons.frequency.flatten()[3:], phonons.bandwidth.flatten()[3:], s=5) plt.ylabel('gamma_THz', fontsize=16, fontweight='bold') plt.xlabel("$\\nu$ (Thz)", fontsize=16, fontweight='bold') plt.show() plt.scatter(phonons.frequency.flatten()[3:], phonons.phase_space.flatten()[3:], s=5) plt.ylabel('ps', fontsize=16, fontweight='bold') plt.xlabel("$\\nu$ (Thz)", fontsize=16, fontweight='bold') plt.show()