本文整理匯總了Python中phonopy.Phonopy.set_band_structure方法的典型用法代碼示例。如果您正苦於以下問題:Python Phonopy.set_band_structure方法的具體用法?Python Phonopy.set_band_structure怎麽用?Python Phonopy.set_band_structure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phonopy.Phonopy
的用法示例。
在下文中一共展示了Phonopy.set_band_structure方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: obtain_phonon_dispersion_spectra
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_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()
示例2: append_band
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_band_structure [as 別名]
# epsilon = [[2.43533967, 0, 0],
# [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)
示例3: range
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_band_structure [as 別名]
for i in range(51):
band.append(q_start + (q_end - q_start) / 50 * i)
bands.append(band)
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)
示例4: Phonopy
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_band_structure [as 別名]
phonon2 = Phonopy(bulk,
[[2, 0, 0],
[0, 2, 0],
[0, 0, 2]],
primitive_matrix=[[0, 0.5, 0.5],
[0.5, 0, 0.5],
[0.5, 0.5, 0]],
is_auto_displacements=False)
phonon2.set_force_constants(fc)
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])
phonon2.set_band_structure(bands)
phonon2.plot_band_structure().show()
# Artificially increase phonon frequency of the highest band(s) at Gamma
frequencies[0, 3:] = 7.5
dynmat2fc.set_dynamical_matrices(frequencies / VaspToTHz, eigenvectors)
dynmat2fc.run()
fc = dynmat2fc.get_force_constants()
phonon3 = Phonopy(bulk,
[[2, 0, 0],
[0, 2, 0],
[0, 0, 2]],
primitive_matrix=[[0, 0.5, 0.5],
[0.5, 0, 0.5],
[0.5, 0.5, 0]],
is_auto_displacements=False)
示例5: __init__
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_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()