當前位置: 首頁>>代碼示例>>Python>>正文


Python Phonopy.get_band_structure方法代碼示例

本文整理匯總了Python中phonopy.Phonopy.get_band_structure方法的典型用法代碼示例。如果您正苦於以下問題:Python Phonopy.get_band_structure方法的具體用法?Python Phonopy.get_band_structure怎麽用?Python Phonopy.get_band_structure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在phonopy.Phonopy的用法示例。


在下文中一共展示了Phonopy.get_band_structure方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: obtain_phonon_dispersion_spectra

# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import get_band_structure [as 別名]
def obtain_phonon_dispersion_spectra(structure, bands_ranges, NAC=False, band_resolution=30):

    print("Calculating phonon dispersion spectra...")
    bulk = PhonopyAtoms(
        symbols=structure.get_atomic_types(),
        scaled_positions=structure.get_scaled_positions(),
        cell=structure.get_cell().T,
    )

    phonon = Phonopy(
        bulk,
        structure.get_super_cell_phonon(),
        primitive_matrix=structure.get_primitive_matrix(),
        is_auto_displacements=False,
    )

    if NAC:
        print("Phonopy warning: Using Non Analitical Corrections")
        print("BORN file is needed to do this")
        get_is_symmetry = True  # sfrom phonopy:   settings.get_is_symmetry()
        primitive = phonon.get_primitive()
        nac_params = parse_BORN(primitive, get_is_symmetry)
        phonon.set_nac_params(nac_params=nac_params)

    phonon.set_displacement_dataset(copy.deepcopy(structure.get_force_set()))
    phonon.produce_force_constants()

    bands = []
    for q_start, q_end in bands_ranges:
        band = []
        for i in range(band_resolution + 1):
            band.append(np.array(q_start) + (np.array(q_end) - np.array(q_start)) / band_resolution * i)
        bands.append(band)
    phonon.set_band_structure(bands)

    return phonon.get_band_structure()
開發者ID:vanceeasleaf,項目名稱:DynaPhoPy,代碼行數:38,代碼來源:phonopy_link.py

示例2: append_band

# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import get_band_structure [as 別名]
#            [0, 2.43533967, 0],
#            [0, 0, 2.43533967]]
# factors = 14.400
# nac_params = {'born': born,
#               'factor': factors,
#               'dielectric': epsilon}
phonon.set_nac_params(nac_params)

# BAND = 0.0 0.0 0.0  0.5 0.0 0.0  0.5 0.5 0.0  0.0 0.0 0.0  0.5 0.5 0.5
bands = []
append_band(bands, [0.0, 0.0, 0.0], [0.5, 0.0, 0.0])
append_band(bands, [0.5, 0.0, 0.0], [0.5, 0.5, 0.0])
append_band(bands, [0.5, 0.5, 0.0], [0.0, 0.0, 0.0])
append_band(bands, [0.0, 0.0, 0.0], [0.5, 0.5, 0.5])
phonon.set_band_structure(bands)
q_points, distances, frequencies, eigvecs = phonon.get_band_structure()
for q, d, freq in zip(q_points, distances, frequencies):
    print q, d, freq
phonon.plot_band_structure().show()

# Mesh sampling 20x20x20
phonon.set_mesh([20, 20, 20])
phonon.set_thermal_properties(t_step=10,
                              t_max=1000,
                              t_min=0)

# DOS
phonon.set_total_DOS(sigma=0.1)
for omega, dos in np.array(phonon.get_total_DOS()).T:
    print "%15.7f%15.7f" % (omega, dos)
phonon.plot_total_DOS().show()
開發者ID:,項目名稱:,代碼行數:33,代碼來源:

示例3: range

# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import get_band_structure [as 別名]
q_start = np.array([0, 0, 0])
q_end = np.array([1./3, 1./3, 1./2])
band = []
for i in range(51):
    band.append(q_start + ( q_end - q_start ) / 50 * i)
bands.append(band)

#*********************
# Matplotlib required
#*********************
print "\nPhonon dispersion:"
phonon.set_band_structure(bands,
                          is_eigenvectors=True)
phonon.plot_band_structure(["X", "$\Gamma$", "L"]).show()

bands = phonon.get_band_structure()
distances = bands[1]
frequencies = bands[2]
qpoints = bands[0]

for (qs_at_segments,
     dists_at_segments,
     freqs_at_segments) in zip(qpoints, distances, frequencies):

    for q, d, f in zip(qs_at_segments,
                       dists_at_segments,
                       freqs_at_segments):
        print "# %f %f %f" % tuple(q)
        print d, ("%f " * len(f)) % tuple(f)

# If you just want to plot along q-points of all band segments, the
開發者ID:arbegla,項目名稱:phonopy,代碼行數:33,代碼來源:Al2O3.py

示例4: __init__

# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import get_band_structure [as 別名]

#.........這裏部分代碼省略.........
         #print ("%12.3f " + "%15.7f" * 3) % ( t, free_energy, entropy, cv )
         f.write(("%12.3f " + "%15.7f" + "\n") % ( t, free_energy))
     f.close()
     
     fc = open('thermal_properties','w')
     for t, free_energy, entropy, cv in np.array(phonon.get_thermal_properties()).T:
         fc.write(("%12.3f " + "%15.7f" *3 + "\n") % ( t, free_energy, entropy, cv ))
     fc.close()
     
     #phonon.plot_thermal_properties().show()
     
     #phonon.plot_total_DOS().show()
     phonon.write_total_DOS()
     #phonon.write_partial_DOS()
     phonon.write_yaml_thermal_properties()
     
     bands = []
     
     #### PRIMITIVE
     
     q_start  = np.array([0.0, 0.0, 0.0])
     #q_start  = np.array([0.5, 0.5, 0.0])
     q_end    = np.array([-0.5, 0.5, 0.5])
     #q_end    = np.array([0., 0., 0.])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     
     band = []
     
     
     q_start  = np.array([-0.5, 0.5, 0.5])
     #q_start  = np.array([0., 0., 0.])
     q_end    = np.array([0.25, 0.25, 0.25])
     #q_end    = np.array([1., 0., 0.])
     
     for i in range(101):
         #band.append([-0.5+3*1/400*i, 0.5-1/400*i, 0.5-1/400*i])
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     #print band
     q_start  = np.array([0.25, 0.25, 0.25])
     q_end    = np.array([0., 0., 0.])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     
     q_start  = np.array([0., 0., 0.])
     q_end    = np.array([0.0, 0., 0.5])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     
     #q_start  = np.array([0.0, 0.0, 0.0])
     #q_end    = np.array([0.5, 0.5, 0.5])
     #band = []
     #for i in range(101):
     #    band.append(q_start + (q_end - q_start) / 100 * i)
     #bands.append(band)
     
     """
     ###### CONVENTIONAL CELL ######
     q_start  = np.array([0.0, 0.0, 0.0])
     q_end    = np.array([-0.5, 0.5, 0.5])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     
     
     q_start  = np.array([-0.5, 0.5, 0.5])
     q_end    = np.array([1./4., 1./4., 1./4.])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     q_start  = np.array([1./4., 1./4., 1./4.])
     q_end    = np.array([0.0, 0.0, 0.0])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     q_start  = np.array([0.0, 0.0, 0.0])
     q_end    = np.array([0.5, 0.0, 0.0])
     band = []
     for i in range(101):
         band.append(q_start + (q_end - q_start) / 100 * i)
     bands.append(band)
     """
     phonon.set_band_structure(bands)
     #phonon.plot_band_structure().show()
     
     q_points, distances, frequencies, eigvecs = phonon.get_band_structure()
     disp = {'q':q_points, 'distances':distances, 'frequencies':frequencies, 'eigvecs':eigvecs}
     f = open('ph_dispersion.pkl','w')
     pickle.dump(disp, f)
     f.close()
開發者ID:tdengg,項目名稱:pylastic,代碼行數:104,代碼來源:test.py


注:本文中的phonopy.Phonopy.get_band_structure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。