本文整理匯總了Python中phonopy.Phonopy.set_dynamical_matrix方法的典型用法代碼示例。如果您正苦於以下問題:Python Phonopy.set_dynamical_matrix方法的具體用法?Python Phonopy.set_dynamical_matrix怎麽用?Python Phonopy.set_dynamical_matrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phonopy.Phonopy
的用法示例。
在下文中一共展示了Phonopy.set_dynamical_matrix方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_dynamical_matrix [as 別名]
def __init__(self, numbatom=125, supercell=5):
#species = 'WRe_0.25_conv'
species = 'WRe_0.00'
#species = 'Re'
###read force constants from vasprun.xml###
vasprun = etree.iterparse('vasprun.xml', tag='varray')
#fc = vasp.get_force_constants_vasprun_xml(vasprun,1) #pass xml input and species atomic weight.
###########################################
########### read positionsl ###############
primitive = vasp.get_atoms_from_poscar(open('POSCAR-p'),'W')
superc = vasp.get_atoms_from_poscar(open('POSCAR'),'W')
###########################################
numbatom = superc.get_number_of_atoms()
#print primitive.get_cell()
#print primitive.get_scaled_positions()
#print superc.get_scaled_positions()
print numbatom, species, os.getcwd()
if species=='W':
#Tungsten
fc = vasp.get_force_constants_vasprun_xml(vasprun,1,0,64)
s = 4.
a = superc.get_cell()[0][0]*2.
print a
bulk = PhonopyAtoms(symbols=['W'] * 1,
scaled_positions= primitive.get_scaled_positions())
bulk.set_cell(np.diag((a, a, a)))
phonon = Phonopy(bulk,
[[s,0.,0.],[0.,s,0.],[0.,0.,s]],
primitive_matrix=[[-0.5, 0.5, 0.5],[0.5, -0.5, 0.5],[0.5, 0.5, -0.5]],
distance=0.01, factor=15.633302)
print fc
phonon.set_force_constants(fc[0])
phonon.set_dynamical_matrix()
#print phonon.get_dynamical_matrix_at_q([0,0,0])
mesh = [100, 100, 100]
phonon.set_mesh(mesh)
qpoints, weights, frequencies, eigvecs = phonon.get_mesh()
print frequencies
phonon.set_total_DOS()
phonon.set_thermal_properties(t_step=10,
t_max=3700,
t_min=0)
elif species=='W_conv_2x2x2':
#Tungsten
fc = vasp.get_force_constants_vasprun_xml(vasprun,1,2)
s = 2.
a = superc.get_cell()[0][0]*2.
print a
bulk = PhonopyAtoms(symbols=['W','W'] * 1,
scaled_positions= primitive.get_scaled_positions())
bulk.set_cell(np.diag((a, a, a)))
phonon = Phonopy(bulk,
[[s,0.,0.],[0.,s,0.],[0.,0.,s]],
primitive_matrix=[[-0.5, 0.5, 0.5],[0.5, -0.5, 0.5],[0.5, 0.5, -0.5]],
distance=0.01, factor=15.633302)
print fc
phonon.set_force_constants(fc[0])
phonon.set_dynamical_matrix()
#print phonon.get_dynamical_matrix_at_q([0,0,0])
mesh = [100, 100, 100]
phonon.set_mesh(mesh)
qpoints, weights, frequencies, eigvecs = phonon.get_mesh()
print frequencies
phonon.set_total_DOS()
phonon.set_thermal_properties(t_step=10,
t_max=3700,
t_min=0)
elif species=='W_conv':
#Tungsten
fc = vasp.get_force_constants_vasprun_xml(vasprun,1,2)
s = 4.
a = superc.get_cell()[0][0]*2.
print a
bulk = PhonopyAtoms(symbols=['W','W'] * 1,
scaled_positions= primitive.get_scaled_positions())
bulk.set_cell(np.diag((a, a, a)))
phonon = Phonopy(bulk,
[[s,0.,0.],[0.,s,0.],[0.,0.,s]],
primitive_matrix=[[-0.5, 0.5, 0.5],[0.5, -0.5, 0.5],[0.5, 0.5, -0.5]],
distance=0.01, factor=15.633302)
print fc
phonon.set_force_constants(fc[0])
phonon.set_dynamical_matrix()
#print phonon.get_dynamical_matrix_at_q([0,0,0])
mesh = [100, 100, 100]
phonon.set_mesh(mesh)
qpoints, weights, frequencies, eigvecs = phonon.get_mesh()
print frequencies
phonon.set_total_DOS()
phonon.set_thermal_properties(t_step=10,
t_max=3700,
t_min=0)
#.........這裏部分代碼省略.........
示例2: PhonopyAtoms
# 需要導入模塊: from phonopy import Phonopy [as 別名]
# 或者: from phonopy.Phonopy import set_dynamical_matrix [as 別名]
numbatom = superc.get_number_of_atoms()
#print primitive.get_cell()
#print primitive.get_scaled_positions()
#print superc.get_scaled_positions()
s = 5.
a = superc.get_cell()[0][0]*2.
bulk = PhonopyAtoms(symbols=['W'] * 1,
scaled_positions= primitive.get_scaled_positions())
bulk.set_cell(np.diag((a, a, a)))
phonon = Phonopy(bulk,
[[s,0.,0.],[0.,s,0.],[0.,0.,s]],
primitive_matrix=[[-0.5, 0.5, 0.5],[0.5, -0.5, 0.5],[0.5, 0.5, -0.5]],
distance=0.01, factor=15.633302)
phonon.set_force_constants(fc[0])
phonon.set_dynamical_matrix()
#print phonon.get_dynamical_matrix_at_q([0,0,0])
mesh = [100, 100, 100]
phonon.set_mesh(mesh)
qpoints, weights, frequencies, eigvecs = phonon.get_mesh()
print frequencies
phonon.set_total_DOS()
phonon.set_thermal_properties(t_step=10,
t_max=1000,
t_min=0)
f = open('F_TV','w')
for t, free_energy, entropy, cv in np.array(phonon.get_thermal_properties()).T:
print ("%12.3f " + "%15.7f" * 3) % ( t, free_energy, entropy, cv )
f.write(("%12.3f " + "%15.7f" + "\n") % ( t, free_energy))
f.close()