mirror of https://github.com/phonopy/phonopy.git
Update PH_Q2R class and its document
This commit is contained in:
parent
6c0f93ebaf
commit
9d43e84d96
|
@ -49,9 +49,9 @@ copyright = u'2009, Atsushi Togo'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.13.0'
|
||||
version = '1.13.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.13.0'
|
||||
release = '1.13.2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -141,10 +141,10 @@ these files are controlled by :ref:`force constants tags
|
|||
use ``q2r.x`` to create force constants file by followng the
|
||||
instraction shown at :ref:`qe_q2r`
|
||||
|
||||
Force constants are stored in an array of the shape either
|
||||
Force constants are stored in either array shape of
|
||||
|
||||
(1) ``(n_satom, n_satom, 3, 3)``
|
||||
(2) ``(n_patom, n_satom, 3, 3)``
|
||||
- Compact format: ``(n_patom, n_satom, 3, 3)``
|
||||
- Full format: ``(n_satom, n_satom, 3, 3)``
|
||||
|
||||
where ``n_satom`` and ``n_patom`` are the numbers of atoms in
|
||||
supercell and primitive cell, respectively.
|
||||
|
|
|
@ -106,7 +106,7 @@ Short tutorials for force calculators are found in the following pages.
|
|||
|
||||
vasp
|
||||
wien2k
|
||||
pwscf
|
||||
qe
|
||||
abinit
|
||||
siesta
|
||||
elk
|
||||
|
|
|
@ -236,8 +236,6 @@ symmetrized by the translational invariance condition using
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
from phonopy.file_IO import write_FORCE_CONSTANTS
|
||||
from phonopy.file_IO import write_force_constants_to_hdf5
|
||||
from phonopy.interface.qe import read_pwscf, PH_Q2R
|
||||
|
||||
primcell_filename = sys.argv[1]
|
||||
|
@ -245,23 +243,7 @@ symmetrized by the translational invariance condition using
|
|||
cell, _ = read_pwscf(primcell_filename)
|
||||
q2r = PH_Q2R(q2r_filename)
|
||||
q2r.run(cell)
|
||||
write_force_constants_to_hdf5(q2r.fc)
|
||||
# write_FORCE_CONSTANTS(q2r.fc)
|
||||
|
||||
..
|
||||
import numpy as np
|
||||
from phonopy.structure.symmetry import elaborate_borns_and_epsilon
|
||||
if q2r.epsilon is not None:
|
||||
borns, epsilon, _ = elaborate_borns_and_epsilon(
|
||||
cell,
|
||||
q2r.borns,
|
||||
q2r.epsilon,
|
||||
supercell_matrix=np.diag(q2r.dimension),
|
||||
symmetrize_tensors=True)
|
||||
print("default")
|
||||
print(("%13.8f" * 9) % tuple(q2r.epsilon.ravel()))
|
||||
for z in q2r.borns:
|
||||
print(("%13.8f" * 9) % tuple(z.ravel()))
|
||||
q2r.write_force_constants()
|
||||
|
||||
Saving this script as ``make_fc_q2r.py``, this is used as, e.g.,
|
||||
|
||||
|
@ -269,6 +251,12 @@ Saving this script as ``make_fc_q2r.py``, this is used as, e.g.,
|
|||
|
||||
% python make_fc_q2r.py NaCl.in NaCl.fc
|
||||
|
||||
This gives ``force_constants.hdf5`` file in the compact format (see
|
||||
:ref:`file_force_constants`). From version 1.13.2, full supercell
|
||||
force constants can be written by ``q2r.run(cell, is_full_fc=True)``
|
||||
instead of ``q2r.run(cell)`` in the above
|
||||
script. ``FORCE_CONSTANTS`` file instead of ``force_constants.hdf5``
|
||||
can be obtained by ``q2r.write_force_constants(fc_format='text')``.
|
||||
|
||||
Non-analytical term correction
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@ -337,13 +337,10 @@ class PH_Q2R(object):
|
|||
---------
|
||||
#!/usr/bin/env python
|
||||
|
||||
from phonopy.file_IO import write_FORCE_CONSTANTS
|
||||
from phonopy.interface.qe import read_pwscf, PH_Q2R
|
||||
|
||||
cell, _ = read_pwscf(primcell_filename)
|
||||
q2r = PH_Q2R(q2r_filename)
|
||||
q2r.run(cell)
|
||||
write_FORCE_CONSTANTS(q2r.fc)
|
||||
q2r.write_force_constants()
|
||||
---------
|
||||
|
||||
To save memory/storage space of force constants, the shape of
|
||||
|
@ -390,6 +387,10 @@ class PH_Q2R(object):
|
|||
Born effective charges
|
||||
dtype='double'
|
||||
shape=(natom_prim, 3, 3)
|
||||
primitive : Primitive
|
||||
Primitive cell
|
||||
supercell : Supercell
|
||||
Supercell
|
||||
|
||||
"""
|
||||
|
||||
|
@ -398,6 +399,8 @@ class PH_Q2R(object):
|
|||
self.dimension = None
|
||||
self.epsilon = None
|
||||
self.borns = None
|
||||
self.primitive = None
|
||||
self.supercell = None
|
||||
self._symprec = symprec
|
||||
self._filename = filename
|
||||
|
||||
|
@ -429,8 +432,18 @@ class PH_Q2R(object):
|
|||
self.epsilon = fc_dct['dielectric']
|
||||
self.borns = fc_dct['born']
|
||||
if parse_fc:
|
||||
self.fc = self._arrange_supercell_fc(
|
||||
cell, fc_dct['fc'], is_full_fc=is_full_fc)
|
||||
(self.fc,
|
||||
self.primitive,
|
||||
self.supercell) = self._arrange_supercell_fc(
|
||||
cell, fc_dct['fc'], is_full_fc=is_full_fc)
|
||||
|
||||
def write_force_constants(self, fc_format='hdf5'):
|
||||
if self.fc is not None:
|
||||
if fc_format == 'hdf5':
|
||||
p2s_map = self.primitive.get_primitive_to_supercell_map()
|
||||
write_force_constants_to_hdf5(self.fc, p2s_map=p2s_map)
|
||||
else:
|
||||
write_FORCE_CONSTANTS(self.fc)
|
||||
|
||||
def _parse_q2r(self, f):
|
||||
"""Parse q2r output file
|
||||
|
@ -528,7 +541,7 @@ class PH_Q2R(object):
|
|||
fc = np.zeros((natom, natom_s, 3, 3), dtype='double', order='C')
|
||||
fc[:, :] = q2r_fc[:, site_map]
|
||||
|
||||
return fc
|
||||
return fc, pcell, scell
|
||||
|
||||
def _get_q2r_positions(self, cell):
|
||||
dim = self.dimension
|
||||
|
|
Loading…
Reference in New Issue