CRYSTAL interface for Phono3py

This commit is contained in:
Antti Karttunen 2017-02-06 17:18:58 +02:00
parent 4ee5251add
commit 7e5276a592
16 changed files with 1474 additions and 6 deletions

View File

@ -103,6 +103,10 @@ Let ``kaccum`` read a Pwscf unit cell file with ``-c`` option, for example::
|ipwscf|
``--crystal``
^^^^^^^^^^^^^
Analogous to ``--pwscf``, but to be used with the CRYSTAL interface.
``--temperature``
^^^^^^^^^^^^^^^^^^

92
doc/crystal.rst Normal file
View File

@ -0,0 +1,92 @@
.. _crystal_interface:
CRYSTAL & phono3py calculation
=============================
CRYSTAL program package has a robust built-in phonon calculation
workflow for harmonic phonon properties. However, combining CRYSTAL
with Phono3py enables convenient access to anharmonic phonon properties.
An example for CRYSTAL is found in the ``example/Si-CRYSTAL`` directory.
To invoke the CRYSTAL interface, ``--crystal`` option has to be always
specified::
% phono3py --crystal [options] [arguments]
When the file name of the unit cell is different from the default one
(see :ref:`default_unit_cell_file_name_for_calculator`), ``-c`` option
is used to specify the file name. CRYSTAL unit cell file parser used in
phono3py is the same as that in phonopy. It can read
only limited number of keywords that are shown in the phonopy web site
(http://atztogo.github.io/phonopy/crystal.html#crystal-interface).
.. _crystal_workflow:
Workflow
---------
In this example (Si-CRYSTAL), the CRYSTAL output file is crystal.o.
This is the default file name for the CRYSTAL interface,
so the -c crystal.o parameter is not needed.
1) Create supercells with displacements
(4x4x4 for 2nd order FC, 2x2x2 for 3rd order FC)
::
% phono3py --crystal --dim="2 2 2" --dim_fc2="4 4 4" -d
57 supercell files (``supercell-xxx.d12/.ext``) for the third order
force constants are created. In addition, one supercell file
(``supercell_fc2-00001.d12/.ext``) is created for the second order
force constants.
2) To make valid CRYSTAL input files, there are two possible options:
a) Manually: modify the generated supercell-xxx.d12 and supercell_fc2-xxxxx.d12
files by replacing the line ``Insert basis sets and parameters here`` with the
basis set and computational parameters.
b) Recommended option: before generating the supercells, include files named
``TEMPLATE`` and ``TEMPLATE3`` in the current directory. These files should
contain the basis sets and computational parameters for CRYSTAL (see the example).
When phono3py finds these files it automatically generates complete
CRYSTAL input files in the step 1.
Note that supercells with displacements must not be relaxed in the
force calculations, because atomic forces induced by a small atomic
displacement are what we need for phonon calculation. To get accurate
forces, TOLDEE parameter should be 10 or higher. Phonopy includes this
parameter and the necessary GRADCAL keyword automatically in the inputs.
Then, CRYSTAL supercell calculations are executed to obtain forces on
atoms, e.g., as follows::
% runcry14 supercell-001.d12
3) Collect forces in ``FORCES_FC3`` and ``FORCES_FC2``::
% phono3py --crystal --cf3 supercell-*o
% phono3py --crystal --cf2 supercell_fc2-*o
``disp_fc3.yaml`` and ``disp_fc2.yaml`` are used to create ``FORCES_FC3`` and
``FORCES_FC2``, therefore they must exist in current directory.
4) Calculate 3rd and 2nd order force constants in files ``fc3.hdf5`` and ``fc2.hdf5``::
% phono3py --crystal --dim="2 2 2" --dim_fc2="4 4 4" --sym_fc3r --sym_fc2 --tsym
``--sym_fc2``, ``--sym_fc3r``, and ``--tsym`` are used to symmetrize second- and third-order
force constants.
5) Thermal conductivity calculation::
% phono3py --crystal --fc3 --fc2 --dim="2 2 2" --dim_fc2="4 4 4" --mesh="20 20 20" --br
``--br`` invokes the Relaxation Time Approximation.
Add ``--isotope`` for isotope scattering.
Check the effect of ``--nac`` for polar systems.
Carefully test the convergence with respect to ``--mesh``!

View File

@ -15,8 +15,8 @@ The theoretical background is summarized in the paper found at
http://dx.doi.org/10.1103/PhysRevB.91.094306 or the draft in arxiv at
http://arxiv.org/abs/1501.00691 .
:ref:`Interfaces to calculators <calculator_interfaces>` for VASP and
pwscf are built-in.
:ref:`Interfaces to calculators <calculator_interfaces>` for VASP,
pwscf, and CRYSTAL are built-in.
Documentation
@ -30,6 +30,7 @@ Documentation
interfaces
vasp
pwscf
crystal
command-options
output-files
tips

View File

@ -3,16 +3,17 @@
Interfaces to calculators
==========================
Currently the built-in interfaces for VASP and Pwscf are
Currently the built-in interfaces for VASP, Pwscf, and CRYSTAL are
prepared. VASP is the default interface and no special option is
necessary to invoke it, but for the other interfaces, each special
option has to be specified, e.g. ``--pwscf``.
option has to be specified, e.g. ``--pwscf`` or ``--crystal``.
.. toctree::
:maxdepth: 1
vasp
pwscf
crystal
Calculator specific behaviors
------------------------------
@ -20,7 +21,7 @@ Calculator specific behaviors
Physical unit
^^^^^^^^^^^^^^
The interfaces for VASP and Pwscf are built in to the phono3py command.
The interfaces for VASP, Pwscf, and CRYSTAL are built in to the phono3py command.
For each calculator, each physical unit system is used. The physical
unit systems used for the calculators are summarized below.
@ -31,6 +32,7 @@ unit systems used for the calculators are summarized below.
-----------------------------------------------
VASP | Angstrom eV/Angstrom Angstrom
Pwscf | au (bohr) Ry/au au
CRYSTAL | Angstrom eV/Angstrom Angstrom
``FORCES_FC2`` and ``disp_fc2.yaml`` have the same physical units as
``FORCES_FC3`` and ``disp_fc3.yaml``, respectively.
@ -44,6 +46,7 @@ Default unit cell file names are also changed according to the calculators::
VASP | POSCAR
Pwscf | unitcell.in
CRYSTAL | crystal.o
.. _default_displacement_distance_for_calculator:
@ -56,5 +59,6 @@ Default displacement distances created by ``-d`` option without
VASP | 0.03 Angstrom
Pwscf | 0.06 au (bohr)
CRYSTAL | 0.03 Angstrom

View File

@ -0,0 +1,130 @@
# File: 1
# 1 0.0000000000000000 0.0212132034355964 0.0212132034355964
0.0150976605 -0.3163819396 -0.3163819277
-0.0054602591 0.0087171452 0.0087171442
-0.0000437632 0.0008860815 0.0008860764
0.0054065797 0.0084647803 0.0084647870
0.0072700323 -0.0134898680 0.0067130300
-0.0003425048 0.0005255843 0.0002913698
0.0001092286 0.0002141440 0.0007133425
-0.0072386504 0.0068925342 -0.0135907834
0.0007938985 -0.0037625558 0.0001684110
-0.0000019785 0.0008487945 0.0008448124
-0.0007262144 0.0000923840 -0.0037863325
-0.0000744613 0.0008682887 0.0008075646
0.0019126545 -0.0081228720 0.0013522477
-0.0017805163 0.0014261364 -0.0080896560
0.0003798291 0.0003711173 0.0004988628
-0.0002242597 0.0005713680 0.0005128868
0.0072700223 0.0067130253 -0.0134898717
-0.0003425079 0.0002913515 0.0005255850
0.0001092128 0.0007133426 0.0002141419
-0.0072386408 -0.0135907884 0.0068925378
0.0005934919 -0.0005295764 -0.0005295749
0.0001049676 0.0002369483 0.0002369366
-0.0005117262 -0.0003186875 -0.0003187059
0.0000840176 0.0004934495 0.0004934474
0.0010350740 -0.0002178299 -0.0002995492
-0.0010624196 -0.0003010124 -0.0001827984
0.0000354204 0.0002497281 0.0002187150
-0.0000141969 0.0002453053 0.0002632214
0.0000450642 -0.0004972834 -0.0004029749
-0.0000524363 0.0002264256 0.0005114953
0.0000289109 0.0002329099 0.0002180236
0.0000021968 0.0005288888 0.0000998905
0.0007939085 0.0001684174 -0.0037625284
-0.0000019764 0.0008448116 0.0008487883
-0.0007261914 -0.0037863172 0.0000923906
-0.0000744374 0.0008075691 0.0008682961
0.0010350876 -0.0002995289 -0.0002178050
-0.0010624364 -0.0001828011 -0.0003010229
0.0000354084 0.0002187104 0.0002497348
-0.0000141760 0.0002632292 0.0002453116
0.0000000994 -0.0006325457 -0.0006325633
-0.0000454780 0.0002348777 0.0002348755
-0.0000009003 0.0001879496 0.0001879511
0.0000413368 0.0002230884 0.0002230796
0.0008636117 -0.0004790172 0.0000087743
0.0000370405 0.0002134394 0.0002881943
-0.0000284279 0.0002670895 0.0001800384
-0.0008616020 -0.0000621134 -0.0004043397
0.0019126494 0.0013522302 -0.0081228984
-0.0017805242 -0.0080896598 0.0014261211
0.0003798274 0.0004988624 0.0003711110
-0.0002242478 0.0005129134 0.0005713888
0.0000450575 -0.0004029829 -0.0004972923
-0.0000524277 0.0005115123 0.0002264515
0.0000289057 0.0002180064 0.0002329146
0.0000021909 0.0000998951 0.0005288889
0.0008636298 0.0000087886 -0.0004790212
0.0000370343 0.0002881816 0.0002134153
-0.0000284308 0.0001800532 0.0002670926
-0.0008615816 -0.0004043475 -0.0000621283
0.0009096140 -0.0002923207 -0.0002923132
-0.0000546316 0.0005483269 0.0005483302
-0.0008528723 -0.0003736493 -0.0003736575
-0.0000135065 0.0001383702 0.0001383687
0.0940259460 0.1237610724 0.1237610697
-0.1074750502 0.1335935647 0.1335935642
0.0020945508 0.0009774950 0.0009774937
-0.0020997064 0.0008164474 0.0008164484
-0.0010921579 0.0287655206 0.0273879080
-0.0000522363 -0.0011793956 -0.0011964612
0.0000208779 -0.0000333893 -0.0000131292
0.0001807783 -0.0009937077 -0.0013565717
0.0014352883 0.0055844176 0.0015188572
0.0002133943 -0.0005027673 -0.0001882659
-0.0001833857 -0.0002482003 -0.0005296154
-0.0013943858 0.0015136065 0.0056748094
-0.0006869295 0.0034637249 -0.0006008870
0.0000668131 -0.0012068723 -0.0011016380
0.0005802701 -0.0004550163 0.0036036305
-0.0000749226 -0.0011125598 -0.0010105746
-0.0010921532 0.0273879145 0.0287655199
-0.0000522324 -0.0011964548 -0.0011793946
0.0000208783 -0.0000131238 -0.0000333828
0.0001807778 -0.0013565643 -0.0009937115
-0.0017853483 0.0002405606 0.0002405642
-0.0000697686 -0.0002833354 -0.0002833353
-0.0000605993 -0.0001692702 -0.0001692786
0.0016146737 0.0000616185 0.0000616178
-0.0004760496 0.0002192043 0.0005034363
-0.0000114179 -0.0002176520 -0.0002235621
0.0005429647 0.0004721528 0.0001815748
0.0000080300 -0.0003476301 -0.0003363376
-0.0014247595 0.0002591475 0.0006096810
0.0014241416 0.0005866693 0.0002821379
-0.0000007649 -0.0001211218 -0.0003392563
0.0000239044 -0.0003227733 -0.0000958257
0.0014352846 0.0015188592 0.0055844268
0.0002133920 -0.0001882723 -0.0005027777
-0.0001833792 -0.0005295925 -0.0002481861
-0.0013943904 0.0056747942 0.0015135890
-0.0004760461 0.0005034376 0.0002192074
-0.0000114126 -0.0002235620 -0.0002176541
0.0005429525 0.0001815609 0.0004721516
0.0000080328 -0.0003363289 -0.0003476229
-0.0007153041 0.0002881965 0.0002881946
0.0007123602 0.0002895198 0.0002895263
0.0000322988 -0.0002152397 -0.0002152371
-0.0000439948 -0.0002241525 -0.0002241513
0.0000140268 0.0001155596 0.0000947410
0.0000503583 -0.0001306265 -0.0003834122
0.0000068092 -0.0002562272 -0.0002560770
-0.0000269462 -0.0003764980 -0.0001375593
-0.0006869303 -0.0006008874 0.0034637282
0.0000668006 -0.0011016604 -0.0012068846
0.0005802619 0.0036036250 -0.0004550103
-0.0000749057 -0.0010105654 -0.0011125428
-0.0014247567 0.0006096877 0.0002591561
0.0014241380 0.0002821414 0.0005866699
-0.0000007783 -0.0003392669 -0.0001211442
0.0000238925 -0.0000958317 -0.0003227683
0.0000140314 0.0000947461 0.0001155809
0.0000503497 -0.0003834264 -0.0001306401
0.0000068086 -0.0002560744 -0.0002562210
-0.0000269567 -0.0001375724 -0.0003764931
-0.0013902779 0.0003019739 0.0003019710
0.0000320540 -0.0003584461 -0.0003584451
-0.0000157402 -0.0003775628 -0.0003775495
0.0013912666 0.0003560504 0.0003560465

File diff suppressed because it is too large Load Diff

29
example/Si-CRYSTAL/README Normal file
View File

@ -0,0 +1,29 @@
Si lattice thermal conductivity
CRYSTAL output file is crystal.o. This is the default file name
for the CRYSTAL interface, so the -c crystal.o parameter is not needed
1) Create displaced supercells:
(4x4x4 for 2nd order FC, 2x2x2 for 3rd order FC)
phono3py --crystal --dim="2 2 2" --dim_fc2="4 4 4" -d
Complete CRYSTAL inputs can be prepared manually
or with the help of a template
(TEMPLATE for FC2-supercells, TEMPLATE3 for FC3-supercells)
2) Run the supercell input with CRYSTAL
Here the supercells have been pre-calculated (outputs.tar.gz).
3) Collect forces:
phono3py --crystal --cf3 supercell-*o
phono3py --crystal --cf2 supercell_fc2-*o
(Here the pre-calculated forces are available as FORCES_FC2 and FORCES_FC3)
4) Create force constant files fc2.hdf5 and fc3.hdf5:
phono3py --crystal --dim="2 2 2" --dim_fc2="4 4 4" --sym_fc3r --sym_fc2 --tsym
5) Thermal conductivity calculation:
phono3py --crystal --fc3 --fc2 --dim="2 2 2" --dim_fc2="4 4 4" --mesh="20 20 20" --br
--br -> Relaxation time approximation
Add --isotope for isotope scattering
Check the effect of --nac for polar systems

View File

@ -0,0 +1,45 @@
14 7
0 0 5 2.0 1.0
6903.7118686 0.13373962995E-02
1038.4346419 0.99966546241E-02
235.87581480 0.44910165101E-01
66.069385169 0.11463638540
20.247945761 0.10280063858
0 0 3 2.0 1.0
34.353481730 0.70837285010E-01
3.6370788192 -0.43028836252
1.4002048599 -0.41382774969
0 0 1 2.0 1.0
0.25943211957 1.0000000000
0 1 1 0.0 1.0
0.12000000000 1.0 1.0
0 2 5 6.0 1.0
179.83907373 0.61916656462E-02
41.907258846 0.43399431982E-01
12.955294367 0.15632019351
4.4383267393 0.29419996982
1.5462247904 0.23536823814
0 2 1 2.0 1.0
0.40981363585 1.0000000000
0 3 1 0.0 1.0
0.35000000000 1.0000000000
99 0
ENDBAS
DFT
PBE0
END
SHRINK
1 1
TOLINTEG
8 8 8 8 16
MAXCYCLE
60
FMIXING
80
BROYDEN
0.01 50 4
NOSHIFT
EXCHSIZE
30000000
BIPOSIZE
30000000

View File

@ -0,0 +1,45 @@
14 7
0 0 5 2.0 1.0
6903.7118686 0.13373962995E-02
1038.4346419 0.99966546241E-02
235.87581480 0.44910165101E-01
66.069385169 0.11463638540
20.247945761 0.10280063858
0 0 3 2.0 1.0
34.353481730 0.70837285010E-01
3.6370788192 -0.43028836252
1.4002048599 -0.41382774969
0 0 1 2.0 1.0
0.25943211957 1.0000000000
0 1 1 0.0 1.0
0.12000000000 1.0 1.0
0 2 5 6.0 1.0
179.83907373 0.61916656462E-02
41.907258846 0.43399431982E-01
12.955294367 0.15632019351
4.4383267393 0.29419996982
1.5462247904 0.23536823814
0 2 1 2.0 1.0
0.40981363585 1.0000000000
0 3 1 0.0 1.0
0.35000000000 1.0000000000
99 0
ENDBAS
DFT
PBE0
END
SHRINK
4 4
TOLINTEG
8 8 8 8 16
MAXCYCLE
60
FMIXING
80
BROYDEN
0.01 50 4
NOSHIFT
EXCHSIZE
30000000
BIPOSIZE
30000000

Binary file not shown.

Binary file not shown.

View File

@ -52,6 +52,8 @@ def create_phono3py_supercells(unitcell,
if displacement_distance is None:
if interface_mode == 'pwscf':
distance = 0.06
elif interface_mode == 'crystal':
distance = 0.03
else:
distance = 0.03
else:
@ -88,6 +90,14 @@ def create_phono3py_supercells(unitcell,
cells_with_disps,
pp_filenames,
width=5)
elif interface_mode == 'crystal':
conv_numbers = optional_structure_file_information[1]
write_supercells_with_displacements(supercell,
cells_with_disps,
conv_numbers,
supercell_matrix,
width=5,
template_file="TEMPLATE3")
else:
write_supercells_with_displacements(supercell,
cells_with_disps,
@ -120,6 +130,15 @@ def create_phono3py_supercells(unitcell,
pp_filenames,
pre_filename="supercell_fc2",
width=5)
elif interface_mode == 'crystal':
conv_numbers = optional_structure_file_information[1]
write_supercells_with_displacements(phonon_supercell,
cells_with_disps,
conv_numbers,
phonon_supercell_matrix,
pre_filename="supercell_fc2",
width=5,
template_file="TEMPLATE")
else:
write_supercells_with_displacements(phonon_supercell,
cells_with_disps,

View File

@ -41,6 +41,7 @@ def get_parser():
band_points=None,
cell_filename=None,
constant_averaged_pp_interaction=None,
crystal_mode=False,
cutoff_fc3_distance=None,
cutoff_frequency=None,
boundary_mfp=None,
@ -173,6 +174,11 @@ def get_parser():
dest="constant_averaged_pp_interaction",
type="float",
help="Set constant averaged ph-ph interaction (Pqj)")
parser.add_option(
"--crystal",
dest="crystal_mode",
action="store_true",
help="Invoke CRYSTAL mode")
parser.add_option(
"--cutoff_fc3", "--cutoff_fc3_distance",
dest="cutoff_fc3_distance", type="float",

View File

@ -265,11 +265,12 @@ class Phono3pyYaml(object):
# Abinit | au (bohr) AMU eV/Angstrom eV/Angstrom.au
# Siesta | au (bohr) AMU eV/Angstrom eV/Angstrom.au
# elk | au (bohr) AMU hartree/au hartree/au^2
# CRYSTAL | Angstrom AMU eV/Angstrom eV/Angstrom^2
lines = []
if self._calculator in ['wien2k', 'abinit', 'elk', 'pwscf', 'siesta']:
lines.append(" length: au")
elif self._calculator == 'vasp':
elif self._calculator in ['vasp', 'crystal']:
lines.append(" length: Angstrom")
if len(lines) > 0:

View File

@ -350,12 +350,16 @@ if __name__ == '__main__':
help='Use smearing method (only for scalar density)')
parser.add_argument('--pwscf', dest="pwscf_mode",
action="store_true", help="Invoke Pwscf mode")
parser.add_argument('--crystal', dest="crystal_mode",
action="store_true", help="Invoke CRYSTAL mode")
parser.add_argument('filenames', nargs='*')
args = parser.parse_args()
interface_mode = None
if args.pwscf_mode:
interface_mode = 'pwscf'
elif args.crystal_mode:
interface_mode = 'crystal'
if len(args.filenames) > 1:
cell, _ = read_crystal_structure(args.filenames[0],
interface_mode=interface_mode)

View File

@ -94,12 +94,18 @@ if options.log_level is not None:
# Physical units: energy, distance, atomic mass, force
# vasp : eV, Angstrom, AMU, eV/Angstrom
# pwscf : Ry, au, AMU, Ry/au
# CRYSTAL : eV, Angstrom, AMU, eV/Angstrom
#
if options.pwscf_mode:
interface_mode = 'pwscf'
from phonopy.interface.pwscf import write_supercells_with_displacements
energy_to_eV = Rydberg
distance_to_A = Bohr
if options.crystal_mode:
interface_mode = 'crystal'
from phonopy.interface.crystal import write_supercells_with_displacements
energy_to_eV = None
distance_to_A = None
else:
interface_mode = 'vasp'
from phonopy.interface.vasp import write_supercells_with_displacements