2012-12-11 16:19:23 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
# Copyright (C) 2011 Atsushi Togo
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of phonopy.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
#
|
|
|
|
# * Neither the name of the phonopy project nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived
|
|
|
|
# from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import numpy as np
|
|
|
|
from optparse import OptionParser
|
|
|
|
|
|
|
|
from phonopy.interface.vasp import read_vasp
|
2013-12-04 17:20:42 +08:00
|
|
|
from phonopy.structure.cells import get_supercell, get_primitive, print_cell
|
2012-12-11 16:19:23 +08:00
|
|
|
from phonopy.structure.symmetry import Symmetry
|
2013-12-16 22:17:20 +08:00
|
|
|
from phonopy.harmonic.force_constants import get_fc2, get_force_constants, \
|
2013-07-19 21:34:25 +08:00
|
|
|
set_permutation_symmetry, symmetrize_force_constants, \
|
2013-09-13 14:14:36 +08:00
|
|
|
set_translational_invariance, show_drift_force_constants
|
2013-12-16 22:17:20 +08:00
|
|
|
from phonopy.file_IO import parse_BORN, parse_FORCE_SETS
|
2013-07-19 21:34:25 +08:00
|
|
|
from phonopy.units import VaspToTHz
|
2013-07-30 16:07:21 +08:00
|
|
|
from anharmonic.phonon3.fc3 import get_fc3, set_permutation_symmetry_fc3, \
|
2013-11-21 15:39:52 +08:00
|
|
|
set_translational_invariance_fc3, show_drift_fc3, cutoff_fc3, \
|
|
|
|
cutoff_fc3_by_zero
|
2012-12-11 16:19:23 +08:00
|
|
|
from anharmonic.file_IO import write_fc2_dat, write_fc3_dat,\
|
2013-07-25 18:23:25 +08:00
|
|
|
parse_disp_fc3_yaml, write_FORCES_THIRD,\
|
2012-12-11 16:19:23 +08:00
|
|
|
parse_DELTA_FORCES, write_supercells_with_displacements,\
|
2013-07-26 15:03:20 +08:00
|
|
|
write_DELTA_FC2_SETS, parse_DELTA_FC2_SETS, parse_FORCES_SECOND, \
|
2013-04-05 16:18:17 +08:00
|
|
|
write_fc3_to_hdf5, write_fc2_to_hdf5,\
|
2013-07-19 16:13:21 +08:00
|
|
|
read_fc3_from_hdf5, read_fc2_from_hdf5, write_ir_grid_points
|
2013-08-06 17:49:28 +08:00
|
|
|
from anharmonic.phonon3.triplets import get_coarse_ir_grid_points
|
2013-07-18 17:57:58 +08:00
|
|
|
from anharmonic.phonon3.displacement_fc3 import get_third_order_displacements
|
2012-12-11 16:19:23 +08:00
|
|
|
from anharmonic.settings import Phono3pyConfParser
|
2013-10-10 15:42:32 +08:00
|
|
|
from anharmonic.phonon3 import Phono3py, JointDOS, IsotopeScattering, get_gruneisen_parameters
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-12-12 15:46:12 +08:00
|
|
|
phono3py_version = "0.7.7"
|
2013-09-03 14:57:18 +08:00
|
|
|
|
2012-12-11 16:19:23 +08:00
|
|
|
# AA is created at http://www.network-science.de/ascii/.
|
|
|
|
def print_phono3py():
|
|
|
|
print """ _ _____
|
|
|
|
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
|
|
|
|
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
|
|
|
|
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
|
|
|
|
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|
2013-09-03 14:59:32 +08:00
|
|
|
|_| |_| |___/ """
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-09-03 14:57:18 +08:00
|
|
|
def print_version(version):
|
2013-09-03 14:59:32 +08:00
|
|
|
print " " * 42, version
|
2013-09-03 14:57:18 +08:00
|
|
|
print ""
|
|
|
|
|
2012-12-11 16:19:23 +08:00
|
|
|
def print_end():
|
|
|
|
print """ _
|
|
|
|
___ _ __ __| |
|
|
|
|
/ _ \ '_ \ / _` |
|
|
|
|
| __/ | | | (_| |
|
|
|
|
\___|_| |_|\__,_|
|
|
|
|
"""
|
|
|
|
|
2013-12-16 22:17:20 +08:00
|
|
|
def print_error():
|
|
|
|
print """ ___ _ __ _ __ ___ _ __
|
|
|
|
/ _ \ '__| '__/ _ \| '__|
|
|
|
|
| __/ | | | | (_) | |
|
|
|
|
\___|_| |_| \___/|_|
|
|
|
|
"""
|
|
|
|
|
|
|
|
def print_error_message(message):
|
2012-12-11 16:19:23 +08:00
|
|
|
print message
|
|
|
|
|
2013-12-13 11:34:25 +08:00
|
|
|
def file_exists(filename, log_level):
|
|
|
|
if os.path.exists(filename):
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
error_text = "%s not found." % filename
|
|
|
|
print_error_message(error_text)
|
|
|
|
if log_level > 0:
|
|
|
|
print_error()
|
|
|
|
sys.exit(1)
|
|
|
|
|
2012-12-11 16:19:23 +08:00
|
|
|
# Parse options
|
|
|
|
parser = OptionParser()
|
2013-11-08 17:15:45 +08:00
|
|
|
parser.set_defaults(band_indices=None,
|
2013-05-26 21:14:12 +08:00
|
|
|
band_paths=None,
|
|
|
|
band_points=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
cell_poscar=None,
|
2013-11-30 21:50:31 +08:00
|
|
|
cutoff_fc3_distance=None,
|
2013-09-13 14:14:36 +08:00
|
|
|
cutoff_frequency=1e-2,
|
2013-09-07 14:05:10 +08:00
|
|
|
cutoff_lifetime=1e-4,
|
2013-11-11 11:46:10 +08:00
|
|
|
cutoff_pair_distance=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
delta_fc2=False,
|
2013-11-11 11:46:10 +08:00
|
|
|
displacement_distance=0.03,
|
2012-12-11 16:19:23 +08:00
|
|
|
delta_fc2_sets_mode=False,
|
2013-12-17 21:51:19 +08:00
|
|
|
factor=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
freq_scale=None,
|
|
|
|
gamma_option=0,
|
|
|
|
grid_points=None,
|
2013-07-14 15:32:34 +08:00
|
|
|
gv_delta_q=None,
|
2013-12-12 17:28:34 +08:00
|
|
|
input_filename=None,
|
2013-12-17 21:51:19 +08:00
|
|
|
input_output_filename=None,
|
2013-06-18 16:01:31 +08:00
|
|
|
ion_clamped=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
is_decay_channel=False,
|
|
|
|
is_nodiag=False,
|
|
|
|
is_displacement=False,
|
|
|
|
is_nosym=False,
|
|
|
|
is_gruneisen=False,
|
2013-10-09 18:35:27 +08:00
|
|
|
is_isotope=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
is_joint_dos=False,
|
2013-02-08 17:34:46 +08:00
|
|
|
is_linewidth=False,
|
2013-09-03 20:42:00 +08:00
|
|
|
is_frequency_shift=False,
|
2013-02-18 14:05:15 +08:00
|
|
|
is_bterta=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
is_nac=False,
|
|
|
|
is_plusminus_displacements=False,
|
|
|
|
is_translational_symmetry=False,
|
|
|
|
is_symmetrize_fc2=False,
|
|
|
|
is_symmetrize_fc3_r=False,
|
|
|
|
is_symmetrize_fc3_q=False,
|
2013-03-27 14:01:05 +08:00
|
|
|
log_level=None,
|
2013-03-28 16:18:02 +08:00
|
|
|
max_freepath=None,
|
2013-10-09 23:22:56 +08:00
|
|
|
mass_variances=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
mesh_numbers=None,
|
2013-02-25 13:42:34 +08:00
|
|
|
mesh_divisors=None,
|
2013-02-20 11:28:32 +08:00
|
|
|
multiple_sigmas=None,
|
|
|
|
no_kappa_stars=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
q_direction=None,
|
|
|
|
primitive_axis=None,
|
2013-04-04 21:19:30 +08:00
|
|
|
read_amplitude=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
read_fc2=False,
|
|
|
|
read_fc2_extra=False,
|
|
|
|
read_fc3=False,
|
2013-04-04 21:19:30 +08:00
|
|
|
read_gamma=False,
|
2013-02-20 17:21:35 +08:00
|
|
|
freq_step=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
output_filename=None,
|
2013-02-05 17:00:25 +08:00
|
|
|
qpoints=None,
|
2013-07-20 11:48:28 +08:00
|
|
|
quiet=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
sigma=None,
|
|
|
|
supercell_dimension=None,
|
|
|
|
supercell_dimension_extra=None,
|
|
|
|
symprec=1e-5,
|
|
|
|
tmax=None,
|
|
|
|
tmin=None,
|
|
|
|
tstep=None,
|
2013-02-20 17:21:35 +08:00
|
|
|
temperatures=None,
|
2013-07-20 11:48:28 +08:00
|
|
|
verbose=False,
|
2013-05-02 18:04:19 +08:00
|
|
|
uplo='L',
|
2013-04-04 21:19:30 +08:00
|
|
|
write_amplitude=False,
|
2013-04-05 16:18:17 +08:00
|
|
|
write_gamma=False,
|
|
|
|
write_grid_points=False)
|
2013-11-08 17:15:45 +08:00
|
|
|
parser.add_option("--amplitude", dest="displacement_distance", type="float",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Distance of displacements")
|
|
|
|
parser.add_option("--bi", "--band_indices", dest="band_indices",
|
|
|
|
type="string",
|
|
|
|
help="Band indices where life time is calculated")
|
2013-05-26 21:14:12 +08:00
|
|
|
parser.add_option("--band", dest="band_paths",
|
|
|
|
action="store", type="string",
|
|
|
|
help="Band structure paths calculated for Gruneisen parameter")
|
|
|
|
parser.add_option("--band_points", dest="band_points",
|
|
|
|
type="int",
|
|
|
|
help="Number of points calculated on a band segment in the band structure Gruneisen parameter calculation")
|
2013-02-18 14:05:15 +08:00
|
|
|
parser.add_option("--br", "--bterta", dest="is_bterta",
|
|
|
|
action="store_true",
|
|
|
|
help="Calculate thermal conductivity in BTE-RTA")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("-c", "--cell", dest="cell_poscar",
|
|
|
|
action="store", type="string",
|
|
|
|
help="Read unit cell", metavar="FILE")
|
2013-11-30 21:50:31 +08:00
|
|
|
parser.add_option("--cutfc3", "--cutoff_fc3_distance",
|
|
|
|
dest="cutoff_fc3_distance",
|
|
|
|
type="float",
|
|
|
|
help="Cutoff distance of third-order force constants. Elements where any pair of atoms has larger distance than cut-off distance are set zero.")
|
2013-09-13 14:14:36 +08:00
|
|
|
parser.add_option("--cutfreq", "--cutoff_frequency", dest="cutoff_frequency",
|
|
|
|
type="float",
|
|
|
|
help="Phonon modes below this frequency are ignored.")
|
|
|
|
parser.add_option("--cutlt", "--cutoff_lifetime", dest="cutoff_lifetime",
|
2013-09-07 14:05:10 +08:00
|
|
|
type="float",
|
|
|
|
help="Cutoff lifetime in second used for thermal conductivity calculation")
|
2013-11-29 18:33:40 +08:00
|
|
|
parser.add_option("--cutpair", "--cutoff_pair_distance",
|
|
|
|
dest="cutoff_pair_distance",
|
2013-11-11 11:46:10 +08:00
|
|
|
type="float",
|
|
|
|
help="Cutoff distance between pairs of displaced atoms used for supercell creation with displacements and making third-order force constants")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("-d", "--disp", dest="is_displacement",
|
|
|
|
action="store_true",
|
|
|
|
help="As first stage, get least displacements")
|
|
|
|
parser.add_option("--decay", dest="is_decay_channel",
|
|
|
|
action="store_true", help="Calculate decay channels")
|
|
|
|
parser.add_option("--dim",
|
|
|
|
dest="supercell_dimension",
|
|
|
|
type="string",
|
|
|
|
help="Supercell dimension")
|
|
|
|
parser.add_option("--dim2",
|
|
|
|
dest="supercell_dimension_extra",
|
|
|
|
type="string",
|
|
|
|
help="Supercell dimension for extra fc2")
|
|
|
|
parser.add_option("--cf3", "--create_f3",
|
|
|
|
dest="forces_third_mode",
|
|
|
|
action="store_true",
|
|
|
|
help="Create FORCES_THIRD")
|
|
|
|
parser.add_option("--cdfc2", "--create_delta_fc2",
|
|
|
|
dest="delta_fc2_sets_mode",
|
|
|
|
action="store_true",
|
|
|
|
help="Create DELTA_FC2_SETS")
|
2013-07-23 16:44:20 +08:00
|
|
|
parser.add_option("--dfc2", "--delta_fc2",
|
2013-03-28 16:18:02 +08:00
|
|
|
dest="read_delta_fc2",
|
|
|
|
action="store_true",
|
|
|
|
help="Read DELTA_FC2_SETS")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--factor", dest="factor", type="float",
|
|
|
|
help="Conversion factor to favorite frequency unit")
|
|
|
|
parser.add_option("--fc2",
|
|
|
|
dest="read_fc2",
|
|
|
|
action="store_true",
|
|
|
|
help="Read second order force constants")
|
|
|
|
parser.add_option("--fc2_extra",
|
|
|
|
dest="read_fc2_extra",
|
|
|
|
action="store_true",
|
|
|
|
help="Read extra second order force constants")
|
|
|
|
parser.add_option("--fc3",
|
|
|
|
dest="read_fc3",
|
|
|
|
action="store_true",
|
|
|
|
help="Read third order force constants")
|
2013-03-28 16:18:02 +08:00
|
|
|
parser.add_option("--freepath", dest="max_freepath", type="float",
|
|
|
|
help="Maximum mean free path of phonon in meter")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--freq_scale", dest="freq_scale", type="float",
|
2013-02-06 23:29:22 +08:00
|
|
|
help="Scale factor is multiplied to frequencies only, i.e., changes frequencies but assumed not to change the physical unit")
|
2013-03-28 16:18:02 +08:00
|
|
|
parser.add_option("--freq_step", dest="freq_step", type="float",
|
|
|
|
help="Pitch of frequency calculated")
|
2013-02-18 14:05:15 +08:00
|
|
|
parser.add_option("--gamma_option", dest="gamma_option", type="int",
|
|
|
|
help="Option for the test of imaginary part of self energy")
|
|
|
|
parser.add_option("--gp", "--grid_points",
|
2013-12-14 14:51:41 +08:00
|
|
|
dest="grid_points", type="string",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Fixed grid points where damping functions are calculated ")
|
|
|
|
parser.add_option("--gruneisen", dest="is_gruneisen",
|
|
|
|
action="store_true",
|
|
|
|
help="Calculate phonon Gruneisen parameter")
|
2013-07-14 15:32:34 +08:00
|
|
|
parser.add_option("--gv_delta_q", dest="gv_delta_q", type="float",
|
|
|
|
help="Delta-q distance used for group velocity calculation")
|
2013-12-12 17:28:34 +08:00
|
|
|
parser.add_option("-i", dest="input_filename",
|
|
|
|
type="string",
|
|
|
|
help="Input filename extension")
|
2013-12-17 21:51:19 +08:00
|
|
|
parser.add_option("--io", dest="input_output_filename",
|
|
|
|
type="string",
|
|
|
|
help="Input and output filename extension")
|
2013-06-18 16:01:31 +08:00
|
|
|
parser.add_option("--ion_clamped", dest="ion_clamped",
|
|
|
|
action="store_true",
|
|
|
|
help="Atoms are clamped under applied strain in Gruneisen parameter calculation")
|
2013-10-09 18:35:27 +08:00
|
|
|
parser.add_option("--isotope", dest="is_isotope",
|
|
|
|
action="store_true",
|
|
|
|
help="Isotope scattering lifetime")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--jdos",
|
|
|
|
dest="is_joint_dos",
|
|
|
|
action="store_true",
|
|
|
|
help="Calculate joint density of states")
|
2013-02-25 13:42:34 +08:00
|
|
|
parser.add_option("--lw", "--linewidth",
|
|
|
|
dest="is_linewidth",
|
2013-02-08 17:34:46 +08:00
|
|
|
action="store_true",
|
|
|
|
help="Calculate linewidths")
|
2013-09-03 20:42:00 +08:00
|
|
|
parser.add_option("--fst", "--frequency_shift",
|
|
|
|
dest="is_frequency_shift",
|
|
|
|
action="store_true",
|
|
|
|
help="Calculate frequency shifts")
|
2013-02-25 13:42:34 +08:00
|
|
|
parser.add_option("--md", "--mesh_divisors",
|
|
|
|
dest="mesh_divisors",
|
|
|
|
type="string",
|
|
|
|
help="Divisors for mesh numbers")
|
2013-03-28 16:18:02 +08:00
|
|
|
parser.add_option("--mesh",
|
|
|
|
dest="mesh_numbers",
|
|
|
|
type="string",
|
|
|
|
help="Mesh numbers")
|
2013-03-12 02:27:13 +08:00
|
|
|
parser.add_option("--multiple_sigmas", dest="multiple_sigmas",
|
|
|
|
type="string",
|
|
|
|
help="Multiple sigmas for smearing width used for limited functions")
|
2013-10-09 23:22:56 +08:00
|
|
|
parser.add_option("--mv", "--mass_variances", dest="mass_variances",
|
|
|
|
type="string",
|
|
|
|
help="Mass variance parameters for isotope scattering")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--nac", dest="is_nac",
|
|
|
|
action="store_true",
|
|
|
|
help="Non-analytical term correction")
|
2013-03-28 16:18:02 +08:00
|
|
|
parser.add_option("--nodiag", dest="is_nodiag",
|
|
|
|
action="store_true",
|
|
|
|
help="Set displacements parallel to axes")
|
2013-02-18 14:05:15 +08:00
|
|
|
parser.add_option("--noks", "--no_kappa_stars", dest="no_kappa_stars",
|
|
|
|
action="store_true",
|
|
|
|
help="Deactivate summation of partial kappa at q-stars"),
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--nosym", dest="is_nosym",
|
|
|
|
action="store_true",
|
|
|
|
help="No symmetrization of triplets")
|
2013-03-28 16:18:02 +08:00
|
|
|
parser.add_option("-o", dest="output_filename",
|
|
|
|
type="string",
|
2013-12-12 17:28:34 +08:00
|
|
|
help="Output filename extension")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--pa", "--primitive_axis", dest="primitive_axis",
|
|
|
|
action="store", type="string",
|
|
|
|
help="Same as PRIMITIVE_AXIS tags")
|
|
|
|
parser.add_option("--pm", dest="is_plusminus_displacements",
|
|
|
|
action="store_true",
|
|
|
|
help="Set plus minus displacements")
|
2013-02-05 17:00:25 +08:00
|
|
|
parser.add_option("--qpoints", dest="qpoints", type="string",
|
|
|
|
help="Calculate at specified q-points")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--q_direction",
|
|
|
|
dest="q_direction",
|
|
|
|
type="string",
|
|
|
|
help="q-vector direction at q->0 for non-analytical term correction")
|
2013-07-20 11:48:28 +08:00
|
|
|
parser.add_option("-q", "--quiet", dest="quiet",
|
|
|
|
action="store_true",
|
|
|
|
help="Print out smallest information")
|
2013-04-04 21:19:30 +08:00
|
|
|
parser.add_option("--read_amplitude", dest="read_amplitude",
|
|
|
|
action="store_true",
|
|
|
|
help="Read phonon-phonon interaction amplitudes")
|
|
|
|
parser.add_option("--read_gamma", dest="read_gamma",
|
2013-03-12 02:27:13 +08:00
|
|
|
action="store_true",
|
|
|
|
help="Read Gammas from files")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--sigma", dest="sigma", type="float",
|
|
|
|
help="Smearing width for DOS")
|
|
|
|
parser.add_option("--sym_fc2", dest="is_symmetrize_fc2",
|
|
|
|
action="store_true",
|
|
|
|
help="Symmetrize fc2 by index exchange")
|
|
|
|
parser.add_option("--sym_fc3r", dest="is_symmetrize_fc3_r",
|
|
|
|
action="store_true",
|
|
|
|
help="Symmetrize fc3 in real space by index exchange")
|
|
|
|
parser.add_option("--sym_fc3q", dest="is_symmetrize_fc3_q",
|
|
|
|
action="store_true",
|
|
|
|
help="Symmetrize fc3 in reciprocal space by index exchange")
|
|
|
|
parser.add_option("--tmax", dest="tmax", type="string",
|
|
|
|
help="Maximum calculated temperature")
|
|
|
|
parser.add_option("--tmin", dest="tmin", type="string",
|
|
|
|
help="Minimum calculated temperature")
|
|
|
|
parser.add_option("--tstep", dest="tstep", type="string",
|
|
|
|
help="Calculated temperature step")
|
2013-05-26 11:34:04 +08:00
|
|
|
parser.add_option("--tsym", dest="is_translational_symmetry",
|
|
|
|
action="store_true",
|
|
|
|
help="Impose translational invariance condition")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--tolerance", dest="symprec", type="float",
|
|
|
|
help="Symmetry tolerance to search")
|
|
|
|
parser.add_option("-v", "--verbose", dest="verbose",
|
|
|
|
action="store_true",
|
|
|
|
help="Detailed run-time information is displayed")
|
2013-02-18 14:05:15 +08:00
|
|
|
parser.add_option("--loglevel", dest="log_level", type="int",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Log level")
|
2013-02-20 17:21:35 +08:00
|
|
|
parser.add_option("--ts", dest="temperatures",
|
|
|
|
type="string", help="Temperatures for damping functions")
|
2013-05-02 18:04:19 +08:00
|
|
|
parser.add_option("--uplo",
|
|
|
|
dest="uplo",
|
|
|
|
type="string",
|
|
|
|
help="Lapack zheev UPLO")
|
2013-04-05 16:18:17 +08:00
|
|
|
parser.add_option("--wgp", "--write_grid_points", dest="write_grid_points",
|
|
|
|
action="store_true",
|
|
|
|
help="Write grid address of irreducible grid points for specified mesh numbers to ir_grid_address.yaml")
|
2013-04-04 21:19:30 +08:00
|
|
|
parser.add_option("--write_amplitude", dest="write_amplitude",
|
|
|
|
action="store_true",
|
|
|
|
help="Write phonon-phonon interaction amplitudes")
|
2013-04-05 16:18:17 +08:00
|
|
|
parser.add_option("--write_gamma", dest="write_gamma",
|
2013-02-18 14:05:15 +08:00
|
|
|
action="store_true",
|
2013-04-05 16:18:17 +08:00
|
|
|
help="Write gamma")
|
2012-12-11 16:19:23 +08:00
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
option_list = parser.option_list
|
|
|
|
|
|
|
|
# Log level
|
2013-07-20 11:48:28 +08:00
|
|
|
log_level = 1
|
|
|
|
if options.verbose:
|
|
|
|
log_level = 2
|
|
|
|
if options.quiet:
|
|
|
|
log_level = 0
|
|
|
|
if not options.log_level==None:
|
|
|
|
log_level=options.log_level
|
2013-12-17 21:51:19 +08:00
|
|
|
|
|
|
|
# Input and output filename extension
|
|
|
|
input_filename = options.input_filename
|
|
|
|
output_filename = options.output_filename
|
|
|
|
if options.input_output_filename is not None:
|
|
|
|
input_filename = options.input_output_filename
|
|
|
|
output_filename = options.input_output_filename
|
|
|
|
|
2012-12-11 16:19:23 +08:00
|
|
|
# Title
|
|
|
|
if log_level:
|
|
|
|
print_phono3py()
|
2013-09-03 14:57:18 +08:00
|
|
|
print_version(phono3py_version)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
|
|
|
# Create FORCES_THIRD
|
|
|
|
if options.forces_third_mode:
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'disp_fc3.' + input_filename + '.yaml'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
2013-07-26 15:03:20 +08:00
|
|
|
disp_dataset = parse_disp_fc3_yaml()
|
|
|
|
write_FORCES_THIRD(args, disp_dataset)
|
2012-12-11 16:19:23 +08:00
|
|
|
print_end()
|
|
|
|
exit(0)
|
|
|
|
|
|
|
|
# Create DELTA_FC2_SETS
|
|
|
|
if options.delta_fc2_sets_mode:
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'disp_fc3.' + input_filename + '.yaml'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
2013-07-26 15:03:20 +08:00
|
|
|
disp_dataset = parse_disp_fc3_yaml()
|
|
|
|
write_DELTA_FC2_SETS(args, disp_dataset)
|
2012-12-11 16:19:23 +08:00
|
|
|
print_end()
|
|
|
|
exit(0)
|
|
|
|
|
|
|
|
# Import input files
|
|
|
|
if len(args) > 0:
|
|
|
|
phono3py_conf = Phono3pyConfParser(filename=args[0],
|
|
|
|
options=options,
|
|
|
|
option_list=option_list)
|
|
|
|
settings = phono3py_conf.get_settings()
|
|
|
|
|
|
|
|
else:
|
|
|
|
phono3py_conf = Phono3pyConfParser(options=options,
|
|
|
|
option_list=option_list)
|
|
|
|
settings = phono3py_conf.get_settings()
|
|
|
|
|
|
|
|
# Read POSCAR
|
|
|
|
if options.cell_poscar == None:
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists('POSCAR', log_level)
|
|
|
|
unitcell_filename = 'POSCAR'
|
2012-12-11 16:19:23 +08:00
|
|
|
else:
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(options.cell_poscar, log_level)
|
|
|
|
unitcell_filename = options.cell_poscar
|
2012-12-11 16:19:23 +08:00
|
|
|
|
|
|
|
unitcell = read_vasp(unitcell_filename,
|
|
|
|
settings.get_chemical_symbols())
|
|
|
|
|
|
|
|
# Supercell and Symmetry
|
|
|
|
supercell = get_supercell(unitcell, settings.get_supercell_matrix())
|
|
|
|
symmetry = Symmetry(supercell, options.symprec)
|
|
|
|
|
2013-07-19 21:34:25 +08:00
|
|
|
if settings.get_supercell_matrix_extra() is not None:
|
2012-12-11 16:19:23 +08:00
|
|
|
supercell_extra = get_supercell(unitcell, settings.get_supercell_matrix_extra())
|
|
|
|
symmetry_extra = Symmetry(supercell_extra, options.symprec)
|
|
|
|
|
|
|
|
# Log
|
|
|
|
if log_level:
|
|
|
|
if options.is_translational_symmetry:
|
|
|
|
print "Translational symmetry:", options.is_translational_symmetry
|
|
|
|
if options.is_symmetrize_fc2:
|
|
|
|
print "FC2 symmetry of index exchange:", options.is_symmetrize_fc2
|
|
|
|
if options.is_symmetrize_fc3_r:
|
|
|
|
print "FC3 symmetry of index exchange in real space:", options.is_symmetrize_fc3_r
|
2013-07-21 13:29:29 +08:00
|
|
|
if options.is_symmetrize_fc3_q:
|
|
|
|
print "FC3 symmetry of index exchange in reciprocal space:", options.is_symmetrize_fc3_q
|
2013-11-30 21:50:31 +08:00
|
|
|
if settings.get_cutoff_fc3_distance() is not None:
|
|
|
|
print "FC3 cutoff distance:",
|
|
|
|
print settings.get_cutoff_fc3_distance()
|
2012-12-11 16:19:23 +08:00
|
|
|
if not options.supercell_dimension_extra == None:
|
|
|
|
print "Extra supercell for fc2 is supplied."
|
2013-04-13 22:39:29 +08:00
|
|
|
if settings.get_is_nac():
|
|
|
|
print "Non-analytical term correction:", settings.get_is_nac()
|
2012-12-11 16:19:23 +08:00
|
|
|
print "Spacegroup: ", symmetry.get_international_table()
|
|
|
|
|
|
|
|
###############################################################
|
|
|
|
# Create supercells with displacements and exit (pre-process) #
|
|
|
|
###############################################################
|
|
|
|
if options.is_displacement:
|
|
|
|
dds = get_third_order_displacements(
|
|
|
|
supercell,
|
|
|
|
symmetry,
|
|
|
|
is_plusminus=settings.get_is_plusminus_displacement(),
|
|
|
|
is_diagonal=settings.get_is_diagonal_displacement())
|
2013-11-08 17:15:45 +08:00
|
|
|
disp_distance = settings.get_displacement_distance()
|
2013-11-11 11:46:10 +08:00
|
|
|
cutoff_distance = settings.get_cutoff_pair_distance()
|
|
|
|
if log_level:
|
|
|
|
print
|
|
|
|
print "Displacement distance:", disp_distance
|
|
|
|
|
2013-12-17 21:51:19 +08:00
|
|
|
if output_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'disp_fc3.' + output_filename + '.yaml'
|
2013-11-11 11:46:10 +08:00
|
|
|
num_disps, num_disp_files = write_supercells_with_displacements(
|
|
|
|
supercell,
|
|
|
|
dds,
|
|
|
|
distance=disp_distance,
|
|
|
|
cutoff_distance=cutoff_distance,
|
2013-12-12 17:28:34 +08:00
|
|
|
filename=filename,
|
2013-11-11 11:46:10 +08:00
|
|
|
log_level=log_level)
|
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
2013-11-11 11:46:10 +08:00
|
|
|
print "Total number of displacements:", num_disps
|
|
|
|
if cutoff_distance is not None:
|
|
|
|
print "Cutoff distance for displacements:", cutoff_distance
|
|
|
|
print "Number of displacement supercell",
|
|
|
|
print "files created:", num_disp_files
|
2013-11-10 17:38:36 +08:00
|
|
|
print_end()
|
|
|
|
sys.exit(0)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
|
|
|
#########################################
|
|
|
|
# Calculate third-order force constants #
|
|
|
|
#########################################
|
2013-12-12 00:05:39 +08:00
|
|
|
if settings.get_primitive_matrix() is None:
|
|
|
|
primitive_matrix = np.eye(3, dtype='double')
|
|
|
|
else:
|
|
|
|
primitive_matrix = np.array(settings.get_primitive_matrix(), dtype='double')
|
|
|
|
|
2013-12-04 17:20:42 +08:00
|
|
|
primitive = get_primitive(
|
2013-11-10 17:38:36 +08:00
|
|
|
supercell,
|
2013-12-12 00:05:39 +08:00
|
|
|
np.dot(np.linalg.inv(settings.get_supercell_matrix()), primitive_matrix),
|
2013-11-10 17:38:36 +08:00
|
|
|
options.symprec)
|
|
|
|
|
2013-12-12 00:05:39 +08:00
|
|
|
if settings.get_supercell_matrix_extra() is not None:
|
2013-12-04 17:20:42 +08:00
|
|
|
primitive_extra = get_primitive(
|
2013-11-10 17:38:36 +08:00
|
|
|
supercell_extra,
|
|
|
|
np.dot(np.linalg.inv(settings.get_supercell_matrix_extra()),
|
2013-12-12 00:05:39 +08:00
|
|
|
primitive_matrix),
|
2012-12-11 16:19:23 +08:00
|
|
|
options.symprec)
|
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "---------------------------- primitive cell --------------------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
print_cell(primitive)
|
2013-12-13 11:34:25 +08:00
|
|
|
print "------------------------------- supercell ----------------------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
print_cell(supercell, mapping=primitive.get_supercell_to_primitive_map())
|
2013-12-13 11:34:25 +08:00
|
|
|
print "------------------ ratio (supercell for fc)/(primitive) --------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
for vec in np.dot(supercell.get_cell(), np.linalg.inv(primitive.get_cell())):
|
|
|
|
print "%5.2f"*3 % tuple(vec)
|
2013-12-12 00:05:39 +08:00
|
|
|
if log_level and (settings.get_supercell_matrix_extra() is not None):
|
2013-12-13 11:34:25 +08:00
|
|
|
print "-------------------------- primitive cell extra -----------------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
print_cell(primitive_extra)
|
2013-12-13 11:34:25 +08:00
|
|
|
print "---------------------------- supercell extra --------------------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
print_cell(supercell_extra, mapping=primitive_extra.get_supercell_to_primitive_map())
|
2013-12-13 11:34:25 +08:00
|
|
|
print "---------------- ratio (supercell extra)/(primitive extra) -----------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
for vec in np.dot(supercell_extra.get_cell(),
|
|
|
|
np.linalg.inv(primitive_extra.get_cell())):
|
|
|
|
print "%5.2f"*3 % tuple(vec)
|
|
|
|
|
|
|
|
# Write ir-grid points
|
|
|
|
if options.write_grid_points:
|
|
|
|
print "---------------------------------------------------------------------------"
|
|
|
|
mesh = settings.get_mesh_numbers()
|
|
|
|
if mesh is None:
|
|
|
|
print "To write grid points, mesh numbers have to be specified."
|
|
|
|
else:
|
|
|
|
print "Ir-grid points are written into ir_grid_points.yaml."
|
|
|
|
mesh_divs = settings.get_mesh_divisors()
|
|
|
|
(grid_points,
|
|
|
|
coarse_grid_weights,
|
|
|
|
grid_address) = get_coarse_ir_grid_points(
|
|
|
|
primitive,
|
|
|
|
mesh,
|
|
|
|
mesh_divs,
|
|
|
|
settings.get_coarse_mesh_shifts(),
|
|
|
|
is_nosym=options.no_kappa_stars)
|
|
|
|
write_ir_grid_points(mesh,
|
|
|
|
mesh_divs,
|
|
|
|
grid_points,
|
|
|
|
coarse_grid_weights,
|
|
|
|
grid_address,
|
|
|
|
np.linalg.inv(primitive.get_cell()))
|
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print_end()
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
# fc2
|
2013-12-13 11:34:25 +08:00
|
|
|
if log_level:
|
|
|
|
print "------------------------------ fc2 ------------------------------"
|
|
|
|
sys.stdout.flush()
|
2013-11-10 17:38:36 +08:00
|
|
|
if options.read_fc2 or options.read_delta_fc2:
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'fc2.hdf5'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'fc2.' + input_filename + '.hdf5'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "Reading fc2 from %s..." % filename
|
|
|
|
fc2_with_dim = read_fc2_from_hdf5(filename=filename)
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'disp_fc3.' + input_filename + '.yaml'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
|
|
|
print "Solving fc2..."
|
2013-12-12 17:28:34 +08:00
|
|
|
disp_dataset = parse_disp_fc3_yaml(filename=filename)
|
2013-12-16 22:17:20 +08:00
|
|
|
parse_FORCES_SECOND(disp_dataset)
|
|
|
|
fc2_with_dim = get_fc2(supercell, symmetry, disp_dataset)
|
2013-11-10 17:38:36 +08:00
|
|
|
|
|
|
|
if options.is_symmetrize_fc2:
|
|
|
|
set_permutation_symmetry(fc2_with_dim)
|
|
|
|
if options.is_translational_symmetry:
|
|
|
|
set_translational_invariance(fc2_with_dim)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
show_drift_force_constants(fc2_with_dim, name='fc2')
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if not options.read_fc2:
|
2013-12-17 21:51:19 +08:00
|
|
|
if output_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'fc2.hdf5'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'fc2.' + output_filename + '.hdf5'
|
2013-12-13 11:34:25 +08:00
|
|
|
if log_level:
|
|
|
|
print "Writing fc2 to %s..." % filename
|
2013-12-12 17:28:34 +08:00
|
|
|
write_fc2_to_hdf5(fc2_with_dim, filename=filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
|
|
|
|
if settings.get_supercell_matrix_extra()==None:
|
|
|
|
fc2 = fc2_with_dim
|
|
|
|
else:
|
2013-12-13 11:34:25 +08:00
|
|
|
if log_level:
|
|
|
|
print "--------------------------- fc2 extra ---------------------------"
|
|
|
|
sys.stdout.flush()
|
2013-11-10 17:38:36 +08:00
|
|
|
# fc2 extra (FORCE_SETS_EXTRA)
|
|
|
|
if options.read_fc2_extra:
|
|
|
|
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'fc2_extra.hdf5'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'fc2_extra.' + input_filename + '.hdf5'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Reading fc2-extra from %s..." % filename
|
2013-12-12 17:28:34 +08:00
|
|
|
fc2 = read_fc2_from_hdf5(filename=filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
2012-12-11 16:19:23 +08:00
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "Solving fc2 extra..."
|
2013-11-10 17:38:36 +08:00
|
|
|
forces_second_extra = parse_FORCE_SETS(
|
|
|
|
supercell_extra.get_number_of_atoms(),
|
|
|
|
filename="FORCE_SETS_EXTRA")
|
|
|
|
fc2 = get_force_constants(forces_second_extra,
|
|
|
|
symmetry_extra,
|
|
|
|
supercell_extra)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-09-03 15:26:48 +08:00
|
|
|
if options.is_symmetrize_fc2:
|
2013-11-10 17:38:36 +08:00
|
|
|
set_permutation_symmetry(fc2)
|
2013-09-03 15:26:48 +08:00
|
|
|
|
|
|
|
if options.is_translational_symmetry:
|
2013-11-10 17:38:36 +08:00
|
|
|
set_translational_invariance(fc2)
|
2013-09-03 15:26:48 +08:00
|
|
|
|
2013-12-13 11:34:25 +08:00
|
|
|
show_drift_force_constants(fc2, 'fc2-extra')
|
2013-11-10 17:38:36 +08:00
|
|
|
|
|
|
|
if not options.read_fc2_extra:
|
2013-12-17 21:51:19 +08:00
|
|
|
if output_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'fc2_extra.hdf5'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'fc2_extra.' + output_filename + '.hdf5'
|
2013-12-13 11:34:25 +08:00
|
|
|
if log_level:
|
|
|
|
print "Writing fc2-extra to %s..." % filename
|
2013-12-12 17:28:34 +08:00
|
|
|
write_fc2_to_hdf5(fc2, filename=filename)
|
2013-09-03 15:26:48 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if settings.get_is_nac():
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists('BORN', log_level)
|
|
|
|
if settings.get_supercell_matrix_extra()==None:
|
|
|
|
nac_params = parse_BORN(primitive)
|
2012-12-11 16:19:23 +08:00
|
|
|
else:
|
2013-12-13 11:34:25 +08:00
|
|
|
nac_params = parse_BORN(primitive_extra)
|
|
|
|
nac_q_direction = settings.get_q_direction()
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
|
|
|
nac_params = None
|
|
|
|
nac_q_direction = None
|
|
|
|
|
|
|
|
# fc3
|
|
|
|
if (options.is_joint_dos or
|
|
|
|
options.is_isotope or
|
|
|
|
settings.get_read_gamma() or
|
|
|
|
settings.get_read_amplitude()):
|
|
|
|
fc3 = None
|
|
|
|
else:
|
2013-12-13 11:34:25 +08:00
|
|
|
if log_level:
|
|
|
|
print "------------------------------ fc3 ------------------------------"
|
|
|
|
sys.stdout.flush()
|
2013-12-12 17:28:34 +08:00
|
|
|
|
2013-12-13 11:34:25 +08:00
|
|
|
if options.read_fc3: # Read fc3.hdf5
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'fc3.hdf5'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'fc3.' + input_filename + '.hdf5'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Reading fc3 from %s..." % filename
|
2013-12-12 17:28:34 +08:00
|
|
|
fc3 = read_fc3_from_hdf5(filename=filename)
|
2013-09-03 15:26:48 +08:00
|
|
|
if options.is_translational_symmetry:
|
2013-11-10 17:38:36 +08:00
|
|
|
set_translational_invariance_fc3(fc3)
|
|
|
|
else: # fc3 from FORCES_THIRD and FORCES_SECOND
|
2013-12-17 21:51:19 +08:00
|
|
|
if input_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'disp_fc3.' + input_filename + '.yaml'
|
2013-12-13 11:34:25 +08:00
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
|
|
|
print "Solving fc3:"
|
2013-12-12 17:28:34 +08:00
|
|
|
disp_dataset = parse_disp_fc3_yaml(filename=filename)
|
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if options.read_delta_fc2:
|
|
|
|
parse_DELTA_FC2_SETS(disp_dataset)
|
2012-12-11 16:19:23 +08:00
|
|
|
else:
|
2013-11-10 17:38:36 +08:00
|
|
|
parse_DELTA_FORCES(disp_dataset)
|
|
|
|
|
2013-11-21 15:39:52 +08:00
|
|
|
if 'cutoff_distance' in disp_dataset:
|
2013-12-12 14:54:12 +08:00
|
|
|
fc3 = get_fc3(
|
|
|
|
supercell,
|
|
|
|
disp_dataset,
|
|
|
|
fc2_with_dim,
|
|
|
|
symmetry,
|
|
|
|
verbose=log_level)
|
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "Cutting-off fc3 (cut-off distance: %f)" % disp_dataset['cutoff_distance']
|
2013-12-12 14:54:12 +08:00
|
|
|
cutoff_fc3(fc3,
|
|
|
|
supercell,
|
|
|
|
disp_dataset,
|
|
|
|
symmetry,
|
|
|
|
verbose=log_level)
|
|
|
|
else:
|
|
|
|
fc3 = get_fc3(
|
|
|
|
supercell,
|
|
|
|
disp_dataset,
|
|
|
|
fc2_with_dim,
|
|
|
|
symmetry,
|
|
|
|
is_translational_symmetry=options.is_translational_symmetry,
|
|
|
|
is_permutation_symmetry=options.is_symmetrize_fc3_r,
|
|
|
|
verbose=log_level)
|
|
|
|
|
|
|
|
# fc3 is cut-off by the distances among atoms and replaced by zero.
|
2013-11-30 21:50:31 +08:00
|
|
|
if settings.get_cutoff_fc3_distance() is not None:
|
|
|
|
cutoff_distance = settings.get_cutoff_fc3_distance()
|
2013-11-21 15:39:52 +08:00
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "Cutting-off fc3 by zero (cut-off distance: %f)" % cutoff_distance
|
2013-11-21 15:39:52 +08:00
|
|
|
cutoff_fc3_by_zero(fc3, supercell, cutoff_distance, options.symprec)
|
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
# Symmetrize fc3_r
|
|
|
|
if options.is_symmetrize_fc3_r:
|
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "Symmetrizing fc3 in real space index exchange..."
|
2013-11-10 17:38:36 +08:00
|
|
|
set_permutation_symmetry_fc3(fc3)
|
2013-02-06 16:48:58 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
show_drift_fc3(fc3)
|
2013-11-14 13:28:38 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
# Write fc3
|
|
|
|
if not options.read_fc3:
|
2013-12-17 21:51:19 +08:00
|
|
|
if output_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'fc3.hdf5'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'fc3.' + output_filename + '.hdf5'
|
2013-12-13 11:34:25 +08:00
|
|
|
if log_level:
|
|
|
|
print "Writing fc3 to %s" % filename
|
2013-12-12 22:53:27 +08:00
|
|
|
write_fc3_to_hdf5(fc3, filename=filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
|
|
|
|
#============================
|
|
|
|
# Phonon Gruneisen parameter
|
|
|
|
#============================
|
|
|
|
if options.is_gruneisen:
|
|
|
|
mesh = settings.get_mesh_numbers()
|
|
|
|
band_paths = settings.get_bands()
|
|
|
|
qpoints = settings.get_qpoints()
|
|
|
|
ion_clamped = settings.get_ion_clamped()
|
|
|
|
|
|
|
|
if (mesh is None and
|
|
|
|
band_paths is None and
|
|
|
|
qpoints is None):
|
|
|
|
if log_level:
|
|
|
|
print "An option of --mesh, --band, or --qpoints has to be specified."
|
|
|
|
print_end()
|
|
|
|
sys.exit(1)
|
2013-02-06 16:48:58 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
|
|
|
print "------ Phonon Gruneisen parameter ------"
|
2013-02-06 16:48:58 +08:00
|
|
|
if mesh is not None:
|
2013-11-10 17:38:36 +08:00
|
|
|
print "Mesh:", mesh
|
2013-05-27 10:31:10 +08:00
|
|
|
elif band_paths is not None:
|
2013-11-10 17:38:36 +08:00
|
|
|
print "Paths in reciprocal reduced coordinates:"
|
|
|
|
for path in band_paths:
|
|
|
|
print ("[%5.2f %5.2f %5.2f] --> [%5.2f %5.2f %5.2f]" %
|
|
|
|
(tuple(path[0]) + tuple(path[-1])))
|
|
|
|
if ion_clamped:
|
|
|
|
print "To be calculated with ion clamped."
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
|
|
|
gr = get_gruneisen_parameters(fc2,
|
|
|
|
fc3,
|
|
|
|
supercell,
|
|
|
|
primitive,
|
|
|
|
nac_params=nac_params,
|
|
|
|
nac_q_direction=nac_q_direction,
|
|
|
|
ion_clamped=ion_clamped,
|
|
|
|
factor=VaspToTHz,
|
|
|
|
symprec=options.symprec)
|
|
|
|
if mesh is not None:
|
|
|
|
gr.set_sampling_mesh(mesh,
|
|
|
|
is_gamma_center=True)
|
|
|
|
elif band_paths is not None:
|
|
|
|
gr.set_band_structure(band_paths)
|
|
|
|
elif qpoints is not None:
|
|
|
|
gr.set_qpoints(qpoints)
|
|
|
|
gr.run()
|
2013-12-12 17:28:34 +08:00
|
|
|
|
2013-12-17 21:51:19 +08:00
|
|
|
if output_filename is None:
|
2013-12-12 17:28:34 +08:00
|
|
|
filename = 'gruneisen3.yaml'
|
|
|
|
else:
|
2013-12-17 21:51:19 +08:00
|
|
|
filename = 'gruneisen3.' + output_filename + '.yaml'
|
2013-12-12 17:28:34 +08:00
|
|
|
gr.write_yaml(filename=filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
|
|
|
|
#===========================
|
|
|
|
# phonon-phonon interaction
|
|
|
|
#===========================
|
|
|
|
elif settings.get_mesh_numbers() is not None:
|
|
|
|
mesh = settings.get_mesh_numbers()
|
2013-12-14 14:51:41 +08:00
|
|
|
grid_points = settings.get_grid_points()
|
|
|
|
if grid_points is not None:
|
|
|
|
grid_points = np.array(grid_points)
|
2013-11-10 17:38:36 +08:00
|
|
|
if options.factor is None:
|
|
|
|
factor = VaspToTHz
|
|
|
|
else:
|
|
|
|
factor = options.factor
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
freq_factor = 1.0
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if settings.get_sigma() is None:
|
|
|
|
sigma = 0.2 * freq_factor
|
|
|
|
else:
|
|
|
|
sigma = settings.get_sigma()
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if settings.get_multiple_sigmas() is None:
|
|
|
|
multiple_sigmas = [sigma]
|
|
|
|
else:
|
|
|
|
multiple_sigmas = settings.get_multiple_sigmas()
|
2013-02-20 11:28:32 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if settings.get_omega_step() is None:
|
|
|
|
freq_step = 0.1 * freq_factor
|
|
|
|
else:
|
|
|
|
freq_step = settings.get_omega_step()
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if options.freq_scale is None:
|
|
|
|
freq_scale = 1.0
|
|
|
|
else:
|
|
|
|
freq_scale = options.freq_scale
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if settings.get_supercell_matrix_extra() is None:
|
|
|
|
supercell_dm = supercell
|
|
|
|
primitive_dm = primitive
|
|
|
|
else:
|
|
|
|
supercell_dm = supercell_extra
|
|
|
|
primitive_dm = primitive_extra
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if settings.get_temperatures() is None:
|
|
|
|
temperatures = [None]
|
|
|
|
else:
|
|
|
|
temperatures = settings.get_temperatures()
|
2013-02-20 17:21:35 +08:00
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
2013-12-13 11:34:25 +08:00
|
|
|
print "--------------------------- Settings ----------------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
print "Mesh sampling: [ %d %d %d ]" % tuple(mesh)
|
|
|
|
if grid_points is not None:
|
2013-12-14 14:51:41 +08:00
|
|
|
print "Grid points to be calculated:",
|
|
|
|
if len(grid_points) > 8:
|
|
|
|
for i, gp in enumerate(grid_points):
|
|
|
|
if i % 10 == 0:
|
|
|
|
print
|
|
|
|
print " ",
|
|
|
|
print gp,
|
|
|
|
print
|
|
|
|
else:
|
|
|
|
for gp in grid_points:
|
|
|
|
print gp,
|
|
|
|
print
|
2013-11-10 17:38:36 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
|
|
|
if options.is_joint_dos:
|
|
|
|
jdos = JointDOS(supercell_dm,
|
|
|
|
primitive_dm,
|
|
|
|
mesh,
|
|
|
|
fc2,
|
|
|
|
nac_params=nac_params,
|
|
|
|
sigma=sigma,
|
|
|
|
frequency_step=freq_step,
|
|
|
|
factor=factor,
|
|
|
|
frequency_factor=freq_factor,
|
|
|
|
frequency_scale_factor=freq_scale,
|
|
|
|
is_nosym=options.is_nosym,
|
|
|
|
symprec=options.symprec,
|
|
|
|
log_level=log_level)
|
|
|
|
jdos.get_jointDOS(grid_points,
|
2013-12-17 21:51:19 +08:00
|
|
|
output_filename=output_filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
elif options.is_isotope:
|
2013-04-27 16:10:50 +08:00
|
|
|
if log_level:
|
2013-11-10 17:38:36 +08:00
|
|
|
print "Cutoff frequency:", settings.get_cutoff_frequency()
|
|
|
|
mass_variances = settings.get_mass_variances()
|
|
|
|
iso = IsotopeScattering(
|
|
|
|
mesh,
|
|
|
|
mass_variances,
|
|
|
|
frequency_factor_to_THz=factor,
|
|
|
|
symprec=options.symprec,
|
|
|
|
cutoff_frequency=settings.get_cutoff_frequency(),
|
|
|
|
lapack_zheev_uplo=options.uplo)
|
|
|
|
iso.set_dynamical_matrix(fc2,
|
|
|
|
supercell_dm,
|
|
|
|
primitive_dm,
|
|
|
|
nac_params=nac_params,
|
|
|
|
frequency_scale_factor=freq_scale)
|
|
|
|
if settings.get_band_indices() is None:
|
|
|
|
band_indices = None
|
|
|
|
else:
|
|
|
|
band_indices = np.intc([x for bi in settings.get_band_indices()
|
|
|
|
for x in bi])
|
|
|
|
for gp in grid_points:
|
|
|
|
for sigma in multiple_sigmas:
|
|
|
|
if log_level:
|
|
|
|
print "Sigma:", sigma
|
|
|
|
iso.set_sigma(sigma)
|
|
|
|
print iso.run(gp, band_indices)
|
|
|
|
else:
|
|
|
|
if log_level:
|
|
|
|
print "Cutoff frequency:", settings.get_cutoff_frequency()
|
|
|
|
|
|
|
|
phono3py = Phono3py(fc3,
|
|
|
|
supercell,
|
|
|
|
primitive,
|
2013-02-08 17:34:46 +08:00
|
|
|
mesh,
|
2013-11-10 17:38:36 +08:00
|
|
|
band_indices=settings.get_band_indices(),
|
|
|
|
cutoff_frequency=settings.get_cutoff_frequency(),
|
|
|
|
frequency_factor_to_THz=factor,
|
2013-06-26 14:13:03 +08:00
|
|
|
is_nosym=options.is_nosym,
|
2013-11-10 17:38:36 +08:00
|
|
|
symmetrize_fc3_q=options.is_symmetrize_fc3_q,
|
2013-06-26 14:13:03 +08:00
|
|
|
symprec=options.symprec,
|
2013-11-10 17:38:36 +08:00
|
|
|
log_level=log_level,
|
|
|
|
lapack_zheev_uplo=options.uplo)
|
|
|
|
|
|
|
|
phono3py.set_dynamical_matrix(fc2,
|
|
|
|
supercell_dm,
|
|
|
|
primitive_dm,
|
|
|
|
nac_params=nac_params,
|
|
|
|
nac_q_direction=nac_q_direction,
|
|
|
|
frequency_scale_factor=freq_scale)
|
|
|
|
|
|
|
|
if settings.get_is_linewidth():
|
|
|
|
phono3py.get_linewidth(
|
|
|
|
grid_points,
|
|
|
|
sigmas=multiple_sigmas,
|
|
|
|
t_max=settings.get_max_temperature(),
|
|
|
|
t_min=settings.get_min_temperature(),
|
|
|
|
t_step=settings.get_temperature_step(),
|
2013-12-17 21:51:19 +08:00
|
|
|
output_filename=output_filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
elif settings.get_is_frequency_shift():
|
|
|
|
phono3py.get_frequency_shift(
|
|
|
|
grid_points,
|
|
|
|
epsilon=sigma,
|
|
|
|
t_max=settings.get_max_temperature(),
|
|
|
|
t_min=settings.get_min_temperature(),
|
|
|
|
t_step=settings.get_temperature_step(),
|
2013-12-17 21:51:19 +08:00
|
|
|
output_filename=output_filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
elif settings.get_is_bterta():
|
|
|
|
phono3py.get_thermal_conductivity(
|
|
|
|
sigmas=multiple_sigmas,
|
|
|
|
t_max=settings.get_max_temperature(),
|
|
|
|
t_min=settings.get_min_temperature(),
|
|
|
|
t_step=settings.get_temperature_step(),
|
|
|
|
mass_variances=settings.get_mass_variances(),
|
|
|
|
grid_points=grid_points,
|
|
|
|
mesh_divisors=settings.get_mesh_divisors(),
|
|
|
|
coarse_mesh_shifts=settings.get_coarse_mesh_shifts(),
|
|
|
|
cutoff_lifetime=settings.get_cutoff_lifetime(),
|
|
|
|
no_kappa_stars=settings.get_no_kappa_stars(),
|
|
|
|
gv_delta_q=settings.get_group_velocity_delta_q(),
|
|
|
|
write_gamma=settings.get_write_gamma(),
|
|
|
|
read_gamma=settings.get_read_gamma(),
|
|
|
|
write_amplitude=settings.get_write_amplitude(),
|
|
|
|
read_amplitude=settings.get_read_amplitude(),
|
2013-12-17 21:51:19 +08:00
|
|
|
output_filename=output_filename,
|
|
|
|
input_filename=input_filename)
|
2012-12-11 16:19:23 +08:00
|
|
|
else:
|
2013-11-10 17:38:36 +08:00
|
|
|
phono3py.get_imag_self_energy(
|
|
|
|
grid_points,
|
|
|
|
frequency_step=freq_step,
|
|
|
|
sigmas=multiple_sigmas,
|
|
|
|
temperatures=temperatures,
|
2013-12-17 21:51:19 +08:00
|
|
|
output_filename=output_filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
|
|
|
pass
|
2012-12-11 16:19:23 +08:00
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print_end()
|