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
|
|
|
|
|
2014-01-31 17:40:19 +08:00
|
|
|
from phonopy.interface.vasp import read_vasp, write_vasp
|
2014-01-29 15:45:11 +08:00
|
|
|
from phonopy.structure.cells import print_cell
|
|
|
|
from phonopy.harmonic.force_constants import show_drift_force_constants
|
2014-10-01 13:27:53 +08:00
|
|
|
from phonopy.file_IO import parse_BORN, write_FORCE_SETS, parse_FORCE_SETS
|
2014-07-07 17:20:23 +08:00
|
|
|
from phonopy.structure.spglib import get_grid_point_from_address
|
2013-07-19 21:34:25 +08:00
|
|
|
from phonopy.units import VaspToTHz
|
2014-01-29 15:45:11 +08:00
|
|
|
from anharmonic.phonon3.fc3 import show_drift_fc3
|
|
|
|
from anharmonic.file_IO import parse_disp_fc2_yaml, parse_disp_fc3_yaml, \
|
2014-02-23 21:22:43 +08:00
|
|
|
parse_FORCES_FC2, parse_FORCES_FC3, \
|
2014-10-01 13:27:53 +08:00
|
|
|
write_FORCES_FC3_vasp, write_FORCES_FC2_vasp, write_FORCES_FC2, \
|
2014-01-29 15:45:11 +08:00
|
|
|
write_fc3_to_hdf5, write_fc2_to_hdf5, read_fc3_from_hdf5, \
|
|
|
|
read_fc2_from_hdf5, write_ir_grid_points, write_grid_address, \
|
2014-02-22 23:37:48 +08:00
|
|
|
write_disp_fc3_yaml, write_disp_fc2_yaml
|
2013-08-06 17:49:28 +08:00
|
|
|
from anharmonic.phonon3.triplets import get_coarse_ir_grid_points
|
2012-12-11 16:19:23 +08:00
|
|
|
from anharmonic.settings import Phono3pyConfParser
|
2014-02-11 14:26:25 +08:00
|
|
|
from anharmonic.phonon3 import Phono3py, Phono3pyJointDos, Phono3pyIsotope, \
|
2014-01-29 15:45:11 +08:00
|
|
|
get_gruneisen_parameters
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2014-12-04 17:31:52 +08:00
|
|
|
phono3py_version = "0.9.4"
|
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,
|
2014-06-15 23:21:57 +08:00
|
|
|
cutoff_frequency=None,
|
2014-12-04 17:31:27 +08:00
|
|
|
boundary_mfp=None,
|
2013-11-11 11:46:10 +08:00
|
|
|
cutoff_pair_distance=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
delta_fc2=False,
|
2014-06-15 23:21:57 +08:00
|
|
|
displacement_distance=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
delta_fc2_sets_mode=False,
|
2013-12-17 21:51:19 +08:00
|
|
|
factor=None,
|
2014-10-01 13:27:53 +08:00
|
|
|
force_sets_to_forces_fc2_mode=None,
|
2014-02-16 03:48:21 +08:00
|
|
|
forces_fc3_mode=False,
|
2014-10-01 23:01:59 +08:00
|
|
|
forces_fc3_file_mode=False,
|
2014-02-23 21:22:43 +08:00
|
|
|
forces_fc2_mode=False,
|
2014-02-16 03:48:21 +08:00
|
|
|
force_sets_mode=False,
|
2014-07-07 23:36:08 +08:00
|
|
|
frequency_pitch=None,
|
|
|
|
frequency_points=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
freq_scale=None,
|
2014-07-07 00:09:47 +08:00
|
|
|
grid_addresses=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
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,
|
2014-04-17 17:04:04 +08:00
|
|
|
is_bterta=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,
|
2014-04-17 17:04:04 +08:00
|
|
|
is_lbte=False,
|
2013-09-03 20:42:00 +08:00
|
|
|
is_frequency_shift=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
is_nac=False,
|
|
|
|
is_plusminus_displacements=False,
|
2014-05-18 22:12:57 +08:00
|
|
|
is_reducible_collision_matrix=False,
|
2012-12-11 16:19:23 +08:00
|
|
|
is_translational_symmetry=False,
|
|
|
|
is_symmetrize_fc2=False,
|
|
|
|
is_symmetrize_fc3_r=False,
|
|
|
|
is_symmetrize_fc3_q=False,
|
2014-01-16 15:53:55 +08:00
|
|
|
is_tetrahedron_method=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
|
|
|
no_kappa_stars=False,
|
2014-07-07 23:36:08 +08:00
|
|
|
phonon_supercell_dimension=None,
|
2014-10-14 14:36:18 +08:00
|
|
|
pinv_cutoff=1.0e-8,
|
2012-12-11 16:19:23 +08:00
|
|
|
primitive_axis=None,
|
2014-06-15 23:01:52 +08:00
|
|
|
q_direction=None,
|
2013-04-04 21:19:30 +08:00
|
|
|
read_amplitude=False,
|
2014-05-04 11:36:13 +08:00
|
|
|
read_collision=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
read_fc2=False,
|
|
|
|
read_fc3=False,
|
2013-04-04 21:19:30 +08:00
|
|
|
read_gamma=False,
|
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,
|
2014-07-31 16:50:06 +08:00
|
|
|
scattering_event_class=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
sigma=None,
|
|
|
|
supercell_dimension=None,
|
|
|
|
symprec=1e-5,
|
2014-06-15 23:01:52 +08:00
|
|
|
temperatures=None,
|
2012-12-11 16:19:23 +08:00
|
|
|
tmax=None,
|
|
|
|
tmin=None,
|
|
|
|
tstep=None,
|
2014-06-15 23:01:52 +08:00
|
|
|
tsym_type=None,
|
2013-05-02 18:04:19 +08:00
|
|
|
uplo='L',
|
2014-09-02 15:16:58 +08:00
|
|
|
use_Peierls_model=False,
|
2014-07-07 23:36:08 +08:00
|
|
|
verbose=False,
|
2013-04-04 21:19:30 +08:00
|
|
|
write_amplitude=False,
|
2014-05-04 11:36:13 +08:00
|
|
|
write_collision=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")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--bi", "--band_indices", dest="band_indices", type="string",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Band indices where life time is calculated")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--band", dest="band_paths", action="store", type="string",
|
2013-05-26 21:14:12 +08:00
|
|
|
help="Band structure paths calculated for Gruneisen parameter")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--band_points", dest="band_points", type="int",
|
2013-05-26 21:14:12 +08:00
|
|
|
help="Number of points calculated on a band segment in the band structure Gruneisen parameter calculation")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--br", "--bterta", dest="is_bterta", action="store_true",
|
2013-02-18 14:05:15 +08:00
|
|
|
help="Calculate thermal conductivity in BTE-RTA")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("-c", "--cell", dest="cell_poscar", action="store",
|
|
|
|
type="string", help="Read unit cell", metavar="FILE")
|
2014-06-15 23:21:57 +08:00
|
|
|
parser.add_option("--cutoff_fc3", "--cutoff_fc3_distance",
|
2014-01-31 17:40:19 +08:00
|
|
|
dest="cutoff_fc3_distance", type="float",
|
2013-11-30 21:50:31 +08:00
|
|
|
help="Cutoff distance of third-order force constants. Elements where any pair of atoms has larger distance than cut-off distance are set zero.")
|
2014-06-15 23:21:57 +08:00
|
|
|
parser.add_option("--cutoff_freq", "--cutoff_frequency", dest="cutoff_frequency",
|
2013-09-13 14:14:36 +08:00
|
|
|
type="float",
|
|
|
|
help="Phonon modes below this frequency are ignored.")
|
2014-12-04 17:31:27 +08:00
|
|
|
parser.add_option("--boundary_mfp", dest="boundary_mfp",
|
2013-09-07 14:05:10 +08:00
|
|
|
type="float",
|
2014-06-10 17:27:51 +08:00
|
|
|
help="Boundary mean free path in micrometre for thermal conductivity calculation")
|
2014-06-15 23:21:57 +08:00
|
|
|
parser.add_option("--cutoff_pair", "--cutoff_pair_distance",
|
2014-01-31 17:40:19 +08:00
|
|
|
dest="cutoff_pair_distance", type="float",
|
2013-11-11 11:46:10 +08:00
|
|
|
help="Cutoff distance between pairs of displaced atoms used for supercell creation with displacements and making third-order force constants")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("-d", "--disp", dest="is_displacement", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="As first stage, get least displacements")
|
2014-02-16 03:48:21 +08:00
|
|
|
# parser.add_option("--decay", dest="is_decay_channel",
|
|
|
|
# action="store_true", help="Calculate decay channels")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--dim", dest="supercell_dimension", type="string",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Supercell dimension")
|
2014-06-16 10:57:48 +08:00
|
|
|
parser.add_option("--dim_fc2", dest="phonon_supercell_dimension",
|
2014-01-31 17:40:19 +08:00
|
|
|
type="string", help="Supercell dimension for extra fc2")
|
2014-02-16 03:48:21 +08:00
|
|
|
parser.add_option("--cf3", "--create_f3", dest="forces_fc3_mode",
|
|
|
|
action="store_true", help="Create FORCES_FC3")
|
2014-10-01 23:01:59 +08:00
|
|
|
parser.add_option("--cf3_file", "--create_f3_from_file", dest="forces_fc3_file_mode",
|
|
|
|
action="store_true", help="Create FORCES_FC3 from file name list")
|
2014-02-23 21:22:43 +08:00
|
|
|
parser.add_option("--cf2", "--create_f2", dest="forces_fc2_mode",
|
|
|
|
action="store_true", help="Create FORCES_FC2")
|
2014-02-16 03:48:21 +08:00
|
|
|
parser.add_option("--cfs", "--create_force_sets", dest="force_sets_mode",
|
2014-10-01 13:27:53 +08:00
|
|
|
action="store_true", help="Create phonopy FORCE_SETS from FORCES_FC2")
|
2014-02-16 03:48:21 +08:00
|
|
|
# parser.add_option("--cdfc2", "--create_delta_fc2", dest="delta_fc2_sets_mode",
|
|
|
|
# action="store_true", help="Create DELTA_FC2_SETS")
|
|
|
|
# parser.add_option("--dfc2", "--delta_fc2", 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")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--fc2", dest="read_fc2", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Read second order force constants")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--fc3", dest="read_fc3", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Read third order force constants")
|
2014-10-01 13:27:53 +08:00
|
|
|
parser.add_option("--fs2f2", "--force_sets_to_forces_fc2", dest="force_sets_to_forces_fc2_mode",
|
|
|
|
action="store_true", help="Create FORCES_FC2 from FORCE_SETS")
|
2014-02-16 03:48:21 +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")
|
2014-01-14 22:40:52 +08:00
|
|
|
parser.add_option("--freq_pitch", dest="frequency_pitch", type="float",
|
|
|
|
help="Pitch in frequency for spectrum")
|
2014-07-07 23:36:08 +08:00
|
|
|
parser.add_option("--freq_points", dest="frequency_points", type="int",
|
|
|
|
help="Number of sampling points for spectrum")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--gp", "--grid_points", dest="grid_points", type="string",
|
2014-07-07 00:09:47 +08:00
|
|
|
help="Fixed grid points where anharmonic properties are calculated")
|
|
|
|
parser.add_option("--ga", "--grid_addresses", dest="grid_addresses", type="string",
|
|
|
|
help="Fixed grid addresses where anharmonic properties are calculated")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--gruneisen", dest="is_gruneisen", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
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")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("-i", dest="input_filename", type="string",
|
2013-12-12 17:28:34 +08:00
|
|
|
help="Input filename extension")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--io", dest="input_output_filename", type="string",
|
2013-12-17 21:51:19 +08:00
|
|
|
help="Input and output filename extension")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--ion_clamped", dest="ion_clamped", action="store_true",
|
2013-06-18 16:01:31 +08:00
|
|
|
help="Atoms are clamped under applied strain in Gruneisen parameter calculation")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--isotope", dest="is_isotope", action="store_true",
|
2013-10-09 18:35:27 +08:00
|
|
|
help="Isotope scattering lifetime")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--jdos", dest="is_joint_dos", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Calculate joint density of states")
|
2014-04-17 17:04:04 +08:00
|
|
|
parser.add_option("--lbte", dest="is_lbte", action="store_true",
|
|
|
|
help="Calculate thermal conductivity LBTE with Chaput's method")
|
2014-09-02 15:16:58 +08:00
|
|
|
parser.add_option("--loglevel", dest="log_level", type="int", help="Log level")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--lw", "--linewidth", dest="is_linewidth",
|
|
|
|
action="store_true", help="Calculate linewidths")
|
|
|
|
parser.add_option("--fst", "--frequency_shift", dest="is_frequency_shift",
|
|
|
|
action="store_true", help="Calculate frequency shifts")
|
|
|
|
parser.add_option("--md", "--mesh_divisors", dest="mesh_divisors", type="string",
|
2013-02-25 13:42:34 +08:00
|
|
|
help="Divisors for mesh numbers")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--mesh", dest="mesh_numbers", type="string",
|
2013-03-28 16:18:02 +08:00
|
|
|
help="Mesh numbers")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--sigma", dest="sigma", type="string",
|
|
|
|
help="A sigma value or multiple sigma values (separated by space) 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")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--nac", dest="is_nac", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Non-analytical term correction")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--nodiag", dest="is_nodiag", action="store_true",
|
2013-03-28 16:18:02 +08:00
|
|
|
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"),
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--nosym", dest="is_nosym", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="No symmetrization of triplets")
|
2014-01-31 17:40:19 +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")
|
2014-10-14 14:36:18 +08:00
|
|
|
parser.add_option("--pinv_cutoff", dest="pinv_cutoff", type="float",
|
|
|
|
help="Cutoff frequency (THz) for pseudo inversion of collision matrix")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--pm", dest="is_plusminus_displacements", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
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")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--q_direction", dest="q_direction", type="string",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="q-vector direction at q->0 for non-analytical term correction")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("-q", "--quiet", dest="quiet", action="store_true",
|
2013-07-20 11:48:28 +08:00
|
|
|
help="Print out smallest information")
|
2014-02-16 03:48:21 +08:00
|
|
|
# parser.add_option("--read_amplitude", dest="read_amplitude", action="store_true",
|
|
|
|
# help="Read phonon-phonon interaction amplitudes")
|
2014-05-04 11:36:13 +08:00
|
|
|
parser.add_option("--read_collision", dest="read_collision", type="string",
|
|
|
|
help="Read collision matrix and Gammas from files")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--read_gamma", dest="read_gamma", action="store_true",
|
2013-03-12 02:27:13 +08:00
|
|
|
help="Read Gammas from files")
|
2014-05-18 22:12:57 +08:00
|
|
|
parser.add_option("--reducible_colmat", dest="is_reducible_collision_matrix",
|
|
|
|
action="store_true", help="Solve reducible collision matrix")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--sym_fc2", dest="is_symmetrize_fc2", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Symmetrize fc2 by index exchange")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--sym_fc3r", dest="is_symmetrize_fc3_r", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Symmetrize fc3 in real space by index exchange")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--sym_fc3q", dest="is_symmetrize_fc3_q", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Symmetrize fc3 in reciprocal space by index exchange")
|
2014-09-02 15:16:58 +08:00
|
|
|
parser.add_option("--thm", "--tetrahedron_method", dest="is_tetrahedron_method",
|
|
|
|
action="store_true", help="Use tetrahedron method")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--tmax", dest="tmax", type="string",
|
|
|
|
help="Maximum calculated temperature")
|
|
|
|
parser.add_option("--tmin", dest="tmin", type="string",
|
|
|
|
help="Minimum calculated temperature")
|
2014-09-02 15:16:58 +08:00
|
|
|
parser.add_option("--ts", dest="temperatures", type="string",
|
|
|
|
help="Temperatures for damping functions")
|
2012-12-11 16:19:23 +08:00
|
|
|
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")
|
2014-06-15 23:01:52 +08:00
|
|
|
parser.add_option("--tsym_type", dest="tsym_type", type="int",
|
|
|
|
help="Imposing type of translational invariance")
|
2012-12-11 16:19:23 +08:00
|
|
|
parser.add_option("--tolerance", dest="symprec", type="float",
|
|
|
|
help="Symmetry tolerance to search")
|
2014-07-31 16:50:06 +08:00
|
|
|
parser.add_option("--scattering_event_class", dest="scattering_event_class",
|
|
|
|
type="int",
|
|
|
|
help=("Scattering event class 1 or 2 to draw "
|
|
|
|
"imaginary part of self energy"))
|
2014-09-02 15:16:58 +08:00
|
|
|
parser.add_option("--uplo", dest="uplo", type="string", help="Lapack zheev UPLO")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
|
2012-12-11 16:19:23 +08:00
|
|
|
help="Detailed run-time information is displayed")
|
2014-09-02 15:16:58 +08:00
|
|
|
parser.add_option("--peierls", dest="use_Peierls_model", action="store_true",
|
|
|
|
help="Use Peierls model for ph-ph interaction strength")
|
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")
|
2014-06-15 23:01:52 +08:00
|
|
|
# parser.add_option("--write_amplitude", dest="write_amplitude",
|
|
|
|
# action="store_true",
|
|
|
|
# help="Write phonon-phonon interaction amplitudes")
|
2014-05-04 11:36:13 +08:00
|
|
|
parser.add_option("--write_collision", dest="write_collision", action="store_true",
|
|
|
|
help="Write collision matrix and Gammas to files")
|
2014-01-31 17:40:19 +08:00
|
|
|
parser.add_option("--write_gamma", dest="write_gamma", action="store_true",
|
2014-05-04 11:36:13 +08:00
|
|
|
help="Write Gammas to files")
|
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
|
2014-10-17 13:03:53 +08:00
|
|
|
if options.log_level is not None:
|
2013-07-20 11:48:28 +08:00
|
|
|
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
|
|
|
|
2014-02-03 17:16:59 +08:00
|
|
|
#####################
|
|
|
|
# Create FORCES_FC3 #
|
|
|
|
#####################
|
2014-10-01 23:01:59 +08:00
|
|
|
if options.forces_fc3_mode or options.forces_fc3_file_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()
|
2014-10-01 23:01:59 +08:00
|
|
|
|
|
|
|
if options.forces_fc3_file_mode:
|
|
|
|
file_exists(args[0], log_level)
|
|
|
|
filenames = [x.strip() for x in open(args[0])]
|
|
|
|
else:
|
|
|
|
filenames = args
|
|
|
|
write_FORCES_FC3_vasp(filenames, disp_dataset)
|
2014-02-23 21:22:43 +08:00
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print "FORCES_FC3 has been created."
|
|
|
|
print_end()
|
2012-12-11 16:19:23 +08:00
|
|
|
exit(0)
|
|
|
|
|
2014-02-23 21:22:43 +08:00
|
|
|
#####################
|
|
|
|
# Create FORCES_FC2 #
|
|
|
|
#####################
|
|
|
|
if options.forces_fc2_mode:
|
|
|
|
if input_filename is None:
|
|
|
|
filename = 'disp_fc2.yaml'
|
|
|
|
else:
|
|
|
|
filename = 'disp_fc2.' + input_filename + '.yaml'
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
|
|
|
disp_dataset = parse_disp_fc2_yaml()
|
|
|
|
write_FORCES_FC2_vasp(args, disp_dataset)
|
2014-06-16 10:57:48 +08:00
|
|
|
|
2014-02-23 21:22:43 +08:00
|
|
|
if log_level:
|
|
|
|
print "FORCES_FC2 has been created."
|
|
|
|
print_end()
|
|
|
|
exit(0)
|
2014-10-01 13:27:53 +08:00
|
|
|
|
|
|
|
if options.force_sets_to_forces_fc2_mode:
|
|
|
|
filename = 'FORCE_SETS'
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
disp_dataset = parse_FORCE_SETS(filename=filename)
|
|
|
|
write_FORCES_FC2(disp_dataset)
|
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print "FORCES_FC2 has been created from FORCE_SETS."
|
|
|
|
print_end()
|
|
|
|
exit(0)
|
2014-02-23 21:22:43 +08:00
|
|
|
|
2014-06-16 10:57:48 +08:00
|
|
|
#####################################
|
|
|
|
# Create FORCE_SETS from FORCES_FC* #
|
|
|
|
#####################################
|
2014-02-16 03:48:21 +08:00
|
|
|
if options.force_sets_mode:
|
2014-06-16 10:57:48 +08:00
|
|
|
if options.phonon_supercell_dimension is not None:
|
|
|
|
if input_filename is None:
|
|
|
|
filename = 'disp_fc2.yaml'
|
|
|
|
else:
|
|
|
|
filename = 'disp_fc2.' + input_filename + '.yaml'
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
disp_dataset = parse_disp_fc2_yaml()
|
|
|
|
forces = parse_FORCES_FC2(disp_dataset)
|
2014-02-16 03:48:21 +08:00
|
|
|
else:
|
2014-06-16 10:57:48 +08:00
|
|
|
if input_filename is None:
|
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
|
|
|
filename = 'disp_fc3.' + input_filename + '.yaml'
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
disp_dataset = parse_disp_fc3_yaml()
|
|
|
|
forces = parse_FORCES_FC3(disp_dataset)
|
|
|
|
|
2014-02-16 03:48:21 +08:00
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
2014-06-16 10:57:48 +08:00
|
|
|
|
|
|
|
for force_set, disp1 in zip(forces, disp_dataset['first_atoms']):
|
|
|
|
disp1['forces'] = force_set
|
|
|
|
write_FORCE_SETS(disp_dataset)
|
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print "FORCE_SETS has been created."
|
|
|
|
print_end()
|
2014-02-16 03:48:21 +08:00
|
|
|
exit(0)
|
|
|
|
|
2014-01-28 22:46:02 +08:00
|
|
|
##################
|
|
|
|
# Parse settings #
|
|
|
|
##################
|
2012-12-11 16:19:23 +08:00
|
|
|
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()
|
2014-07-07 23:36:08 +08:00
|
|
|
|
2014-01-28 22:46:02 +08:00
|
|
|
###################################
|
|
|
|
# Read crystal structure (POSCAR) #
|
|
|
|
###################################
|
2014-10-17 13:03:53 +08:00
|
|
|
if options.cell_poscar is 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
|
2014-01-27 18:21:31 +08:00
|
|
|
unitcell = read_vasp(unitcell_filename, settings.get_chemical_symbols())
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2014-01-27 22:57:46 +08:00
|
|
|
#################################################
|
|
|
|
# Create supercells with displacements and exit #
|
|
|
|
#################################################
|
2012-12-11 16:19:23 +08:00
|
|
|
if options.is_displacement:
|
2014-06-15 23:21:57 +08:00
|
|
|
if settings.get_displacement_distance() is None:
|
|
|
|
displacement_distance = 0.03
|
|
|
|
else:
|
|
|
|
displacement_distance = settings.get_displacement_distance()
|
2014-01-27 18:21:31 +08:00
|
|
|
cutoff_pair_distance = settings.get_cutoff_pair_distance()
|
2014-02-22 23:37:48 +08:00
|
|
|
phono3py = Phono3py(
|
|
|
|
unitcell,
|
|
|
|
settings.get_supercell_matrix(),
|
|
|
|
phonon_supercell_matrix=settings.get_phonon_supercell_matrix(),
|
|
|
|
symprec=options.symprec)
|
2014-01-27 18:21:31 +08:00
|
|
|
supercell = phono3py.get_supercell()
|
|
|
|
phono3py.generate_displacements(
|
2014-06-15 23:21:57 +08:00
|
|
|
distance=displacement_distance,
|
2014-01-27 18:21:31 +08:00
|
|
|
cutoff_pair_distance=cutoff_pair_distance,
|
2012-12-11 16:19:23 +08:00
|
|
|
is_plusminus=settings.get_is_plusminus_displacement(),
|
|
|
|
is_diagonal=settings.get_is_diagonal_displacement())
|
2014-01-27 18:21:31 +08:00
|
|
|
dds = phono3py.get_displacement_dataset()
|
|
|
|
|
2013-11-11 11:46:10 +08:00
|
|
|
if log_level:
|
|
|
|
print
|
2014-06-15 23:21:57 +08:00
|
|
|
print "Displacement distance:", displacement_distance
|
2013-11-11 11:46:10 +08:00
|
|
|
|
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'
|
2014-01-27 18:21:31 +08:00
|
|
|
|
2014-02-01 23:29:00 +08:00
|
|
|
num_disps, num_disp_files = write_disp_fc3_yaml(dds, supercell,
|
2014-01-31 17:40:19 +08:00
|
|
|
filename=filename)
|
|
|
|
for i, dcell in enumerate(phono3py.get_supercells_with_displacements()):
|
|
|
|
if dcell is not None:
|
|
|
|
write_vasp('POSCAR-%05d' % (i + 1), dcell, direct=True)
|
2014-02-22 23:37:48 +08:00
|
|
|
|
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
|
2014-01-27 18:21:31 +08:00
|
|
|
if cutoff_pair_distance is not None:
|
|
|
|
print "Cutoff distance for displacements:",
|
|
|
|
print cutoff_pair_distance
|
|
|
|
print "Number of displacement supercell files created:",
|
|
|
|
print num_disp_files
|
2014-02-22 23:37:48 +08:00
|
|
|
|
|
|
|
if settings.get_phonon_supercell_matrix() is not None:
|
|
|
|
phonon_dds = phono3py.get_phonon_displacement_dataset()
|
|
|
|
phonon_supercell = phono3py.get_phonon_supercell()
|
|
|
|
if output_filename is None:
|
|
|
|
filename = 'disp_fc2.yaml'
|
|
|
|
else:
|
|
|
|
filename = 'disp_fc2.' + output_filename + '.yaml'
|
|
|
|
|
|
|
|
num_disps = write_disp_fc2_yaml(phonon_dds,
|
|
|
|
phonon_supercell,
|
|
|
|
filename=filename)
|
|
|
|
for i, dcell in enumerate(
|
|
|
|
phono3py.get_phonon_supercells_with_displacements()):
|
|
|
|
write_vasp('POSCAR_FC2-%05d' % (i + 1), dcell, direct=True)
|
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print "Number of displacements for special fc2:", num_disps
|
|
|
|
|
|
|
|
if log_level:
|
2013-11-10 17:38:36 +08:00
|
|
|
print_end()
|
|
|
|
sys.exit(0)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2014-01-27 22:57:46 +08:00
|
|
|
##############
|
|
|
|
# Initialize #
|
|
|
|
##############
|
2014-01-29 15:45:11 +08:00
|
|
|
mesh = settings.get_mesh_numbers()
|
|
|
|
mesh_divs = settings.get_mesh_divisors()
|
|
|
|
grid_points = settings.get_grid_points()
|
2014-07-07 17:20:23 +08:00
|
|
|
grid_addresses = settings.get_grid_addresses()
|
|
|
|
if grid_addresses is not None:
|
|
|
|
grid_points = [get_grid_point_from_address(ga, mesh)
|
|
|
|
for ga in grid_addresses]
|
2014-01-29 15:45:11 +08:00
|
|
|
band_indices = settings.get_band_indices()
|
2014-01-31 17:40:19 +08:00
|
|
|
sigma = settings.get_sigma()
|
|
|
|
if sigma is None:
|
|
|
|
sigmas = []
|
|
|
|
elif isinstance(sigma, float):
|
|
|
|
sigmas = [sigma]
|
2014-01-29 15:45:11 +08:00
|
|
|
else:
|
2014-01-31 17:40:19 +08:00
|
|
|
sigmas = sigma
|
2014-01-29 15:45:11 +08:00
|
|
|
if settings.get_is_tetrahedron_method():
|
|
|
|
sigmas = [None] + sigmas
|
|
|
|
if settings.get_temperatures() is None:
|
2014-08-19 15:22:47 +08:00
|
|
|
if options.is_joint_dos:
|
|
|
|
temperature_points = None
|
|
|
|
else:
|
|
|
|
t_max=settings.get_max_temperature()
|
|
|
|
t_min=settings.get_min_temperature()
|
|
|
|
t_step=settings.get_temperature_step()
|
|
|
|
temperature_points = [0.0, 300.0] # For spectra
|
|
|
|
temperatures = np.arange(t_min, t_max + float(t_step) / 10, t_step)
|
2014-01-29 15:45:11 +08:00
|
|
|
else:
|
|
|
|
temperature_points = settings.get_temperatures() # For spectra
|
|
|
|
temperatures = settings.get_temperatures() # For others
|
|
|
|
if options.factor is None:
|
|
|
|
frequency_factor_to_THz = VaspToTHz
|
|
|
|
else:
|
|
|
|
frequency_factor_to_THz = options.factor
|
2014-07-07 23:36:08 +08:00
|
|
|
if settings.get_frequency_points() is None:
|
|
|
|
if settings.get_frequency_pitch() is None:
|
2014-07-07 23:40:14 +08:00
|
|
|
num_frequency_points = 201
|
2014-07-07 23:36:08 +08:00
|
|
|
frequency_step = None
|
|
|
|
else:
|
|
|
|
num_frequency_points = None
|
|
|
|
frequency_step = settings.get_frequency_pitch()
|
2014-01-29 15:45:11 +08:00
|
|
|
else:
|
2014-07-07 23:36:08 +08:00
|
|
|
num_frequency_points = settings.get_frequency_points()
|
|
|
|
frequency_step = None
|
2014-01-29 15:45:11 +08:00
|
|
|
if options.freq_scale is None:
|
|
|
|
frequency_scale_factor = 1.0
|
|
|
|
else:
|
|
|
|
frequency_scale_factor = options.freq_scale
|
2014-06-15 23:21:57 +08:00
|
|
|
if settings.get_cutoff_frequency() is None:
|
|
|
|
cutoff_frequency = 1e-2
|
|
|
|
else:
|
|
|
|
cutoff_frequency = settings.get_cutoff_frequency()
|
2014-06-16 16:39:15 +08:00
|
|
|
if settings.get_is_translational_symmetry():
|
|
|
|
tsym_type = 1
|
|
|
|
elif settings.get_tsym_type() > 0:
|
|
|
|
tsym_type = settings.get_tsym_type()
|
|
|
|
else:
|
|
|
|
tsym_type = 0
|
2014-06-15 23:21:57 +08:00
|
|
|
|
2014-01-27 22:57:46 +08:00
|
|
|
phono3py = Phono3py(
|
|
|
|
unitcell,
|
|
|
|
settings.get_supercell_matrix(),
|
|
|
|
primitive_matrix=settings.get_primitive_matrix(),
|
|
|
|
phonon_supercell_matrix=settings.get_phonon_supercell_matrix(),
|
2014-01-29 15:45:11 +08:00
|
|
|
mesh=mesh,
|
|
|
|
band_indices=band_indices,
|
|
|
|
sigmas=sigmas,
|
|
|
|
cutoff_frequency=cutoff_frequency,
|
|
|
|
frequency_factor_to_THz=frequency_factor_to_THz,
|
|
|
|
is_symmetry=True,
|
|
|
|
is_nosym=options.is_nosym,
|
|
|
|
symmetrize_fc3_q=options.is_symmetrize_fc3_q,
|
|
|
|
symprec=options.symprec,
|
|
|
|
log_level=log_level,
|
|
|
|
lapack_zheev_uplo=options.uplo)
|
2014-01-27 22:57:46 +08:00
|
|
|
|
|
|
|
supercell = phono3py.get_supercell()
|
|
|
|
primitive = phono3py.get_primitive()
|
|
|
|
phonon_supercell = phono3py.get_phonon_supercell()
|
|
|
|
phonon_primitive = phono3py.get_phonon_primitive()
|
|
|
|
symmetry = phono3py.get_symmetry()
|
|
|
|
|
|
|
|
#################
|
|
|
|
# Show settings #
|
|
|
|
#################
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
2014-01-27 18:21:31 +08:00
|
|
|
print "Spacegroup: ", symmetry.get_international_table()
|
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)
|
2014-01-27 22:57:46 +08:00
|
|
|
if settings.get_phonon_supercell_matrix() is not None:
|
|
|
|
print "-------------------- primitive cell for harmonic phonon ---------------------"
|
|
|
|
print_cell(phonon_primitive)
|
|
|
|
print "---------------------- supercell for harmonic phonon ------------------------"
|
|
|
|
print_cell(phonon_supercell, mapping=phonon_primitive.get_supercell_to_primitive_map())
|
|
|
|
print "--------------- ratio (phonon supercell)/(phonon primitive) -----------------"
|
|
|
|
for vec in np.dot(phonon_supercell.get_cell(),
|
|
|
|
np.linalg.inv(phonon_primitive.get_cell())):
|
|
|
|
print "%5.2f"*3 % tuple(vec)
|
|
|
|
|
|
|
|
#####################################################
|
|
|
|
# Write ir-grid points and grid addresses, and exit #
|
|
|
|
#####################################################
|
2013-11-10 17:38:36 +08:00
|
|
|
if options.write_grid_points:
|
2014-02-23 21:22:43 +08:00
|
|
|
print "-----------------------------------------------------------------------------"
|
2013-11-10 17:38:36 +08:00
|
|
|
if mesh is None:
|
2014-01-27 22:57:46 +08:00
|
|
|
print "To write grid points, mesh numbers have to be specified."
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
2014-01-29 15:45:11 +08:00
|
|
|
(ir_grid_points,
|
2013-11-10 17:38:36 +08:00
|
|
|
coarse_grid_weights,
|
|
|
|
grid_address) = get_coarse_ir_grid_points(
|
2014-01-25 23:22:43 +08:00
|
|
|
primitive,
|
|
|
|
mesh,
|
|
|
|
mesh_divs,
|
|
|
|
settings.get_coarse_mesh_shifts(),
|
|
|
|
is_nosym=options.no_kappa_stars,
|
|
|
|
symprec=options.symprec)
|
2013-11-10 17:38:36 +08:00
|
|
|
write_ir_grid_points(mesh,
|
|
|
|
mesh_divs,
|
2014-01-29 15:45:11 +08:00
|
|
|
ir_grid_points,
|
2013-11-10 17:38:36 +08:00
|
|
|
coarse_grid_weights,
|
|
|
|
grid_address,
|
|
|
|
np.linalg.inv(primitive.get_cell()))
|
2014-01-24 17:05:21 +08:00
|
|
|
gadrs_fname = write_grid_address(grid_address, mesh)
|
|
|
|
|
|
|
|
print "Ir-grid points are written into \"ir_grid_points.yaml\"."
|
|
|
|
print "Grid address are written into \"%s\"." % gadrs_fname
|
2013-11-10 17:38:36 +08:00
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print_end()
|
|
|
|
sys.exit(0)
|
2014-01-27 22:57:46 +08:00
|
|
|
|
2014-07-08 16:44:26 +08:00
|
|
|
|
|
|
|
###################
|
|
|
|
# Force constants #
|
|
|
|
###################
|
|
|
|
if log_level:
|
|
|
|
print "----------------------------- Force constants -------------------------------"
|
|
|
|
if not options.read_fc2:
|
|
|
|
print "Imposing translational symmetry to fc2:",
|
|
|
|
print (tsym_type > 0)
|
|
|
|
print "Imposing symmetry of index exchange to fc2:",
|
|
|
|
print options.is_symmetrize_fc2
|
|
|
|
|
2014-07-14 10:48:28 +08:00
|
|
|
if not (options.read_fc3 or settings.get_is_isotope() or options.is_joint_dos):
|
2014-07-08 16:44:26 +08:00
|
|
|
print "Imposing translational symmetry to fc3:",
|
|
|
|
print (tsym_type > 0)
|
|
|
|
print "Imposing symmetry of index exchange to fc3 in real space:",
|
|
|
|
print options.is_symmetrize_fc3_r
|
|
|
|
print "Imposing symmetry of index exchange to fc3 in reciprocal space:",
|
|
|
|
print options.is_symmetrize_fc3_q
|
|
|
|
|
|
|
|
if settings.get_cutoff_fc3_distance() is not None:
|
|
|
|
print "FC3 cutoff distance:",
|
|
|
|
print settings.get_cutoff_fc3_distance()
|
|
|
|
|
2014-01-28 22:46:02 +08:00
|
|
|
#######
|
|
|
|
# fc3 #
|
|
|
|
#######
|
2013-11-10 17:38:36 +08:00
|
|
|
if (options.is_joint_dos or
|
2014-05-24 16:39:47 +08:00
|
|
|
(settings.get_is_isotope() and
|
|
|
|
not (settings.get_is_bterta() or settings.get_is_lbte())) or
|
2013-11-10 17:38:36 +08:00
|
|
|
settings.get_read_gamma() or
|
|
|
|
settings.get_read_amplitude()):
|
2014-01-29 15:45:11 +08:00
|
|
|
pass
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
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:
|
2014-02-23 21:22:43 +08:00
|
|
|
print "Reading fc3 from %s" % filename
|
2013-12-12 17:28:34 +08:00
|
|
|
fc3 = read_fc3_from_hdf5(filename=filename)
|
2014-01-29 15:45:11 +08:00
|
|
|
phono3py.set_fc3(fc3)
|
2013-11-10 17:38:36 +08:00
|
|
|
else: # fc3 from FORCES_THIRD and FORCES_SECOND
|
2014-02-23 21:22:43 +08:00
|
|
|
if log_level:
|
|
|
|
print "Solving fc3"
|
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-12-12 17:28:34 +08:00
|
|
|
disp_dataset = parse_disp_fc3_yaml(filename=filename)
|
2014-02-23 21:22:43 +08:00
|
|
|
file_exists("FORCES_FC3", log_level)
|
|
|
|
if log_level:
|
|
|
|
print "Sets of supercell forces are read from %s." % "FORCES_FC3"
|
2014-01-29 15:45:11 +08:00
|
|
|
forces_fc3 = parse_FORCES_FC3(disp_dataset)
|
|
|
|
phono3py.produce_fc3(
|
|
|
|
forces_fc3,
|
2014-02-02 23:04:37 +08:00
|
|
|
displacement_dataset=disp_dataset,
|
2014-01-29 15:45:11 +08:00
|
|
|
cutoff_distance=settings.get_cutoff_fc3_distance(),
|
2014-06-16 16:39:15 +08:00
|
|
|
translational_symmetry_type=tsym_type,
|
2014-01-29 15:45:11 +08:00
|
|
|
is_permutation_symmetry=options.is_symmetrize_fc3_r)
|
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
|
2014-01-29 15:45:11 +08:00
|
|
|
write_fc3_to_hdf5(phono3py.get_fc3(), filename=filename)
|
|
|
|
|
2014-07-08 16:44:26 +08:00
|
|
|
if log_level:
|
|
|
|
show_drift_fc3(phono3py.get_fc3())
|
2013-11-10 17:38:36 +08:00
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
##############
|
|
|
|
# phonon fc2 #
|
|
|
|
##############
|
|
|
|
if options.read_fc2:
|
|
|
|
if input_filename is None:
|
|
|
|
filename = 'fc2.hdf5'
|
|
|
|
else:
|
|
|
|
filename = 'fc2.' + input_filename + '.hdf5'
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
if log_level:
|
2014-02-23 21:22:43 +08:00
|
|
|
print "Reading fc2 from %s" % filename
|
2014-01-29 15:45:11 +08:00
|
|
|
phonon_fc2 = read_fc2_from_hdf5(filename=filename)
|
2014-02-23 21:22:43 +08:00
|
|
|
if phonon_fc2.shape[0] != phonon_supercell.get_number_of_atoms():
|
|
|
|
print_error_message("Matrix shape of fc2 doesn't agree with supercell.")
|
|
|
|
if log_level:
|
|
|
|
print_error()
|
|
|
|
sys.exit(1)
|
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
phono3py.set_fc2(phonon_fc2)
|
|
|
|
else:
|
2014-02-23 21:22:43 +08:00
|
|
|
if log_level:
|
|
|
|
print "Solving fc2"
|
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
if settings.get_phonon_supercell_matrix() is None:
|
|
|
|
if phono3py.get_fc2() is None:
|
|
|
|
if input_filename is None:
|
|
|
|
filename = 'disp_fc3.yaml'
|
|
|
|
else:
|
|
|
|
filename = 'disp_fc3.' + input_filename + '.yaml'
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
disp_dataset = parse_disp_fc3_yaml(filename=filename)
|
2014-02-23 21:22:43 +08:00
|
|
|
if log_level:
|
|
|
|
print "Sets of supercell forces are read from %s." % "FORCES_FC3"
|
|
|
|
file_exists("FORCES_FC3", log_level)
|
2014-01-29 15:45:11 +08:00
|
|
|
forces_fc3 = parse_FORCES_FC3(disp_dataset)
|
2014-02-23 21:22:43 +08:00
|
|
|
phono3py.produce_fc2(
|
|
|
|
forces_fc3,
|
|
|
|
displacement_dataset=disp_dataset,
|
2014-06-16 16:39:15 +08:00
|
|
|
translational_symmetry_type=tsym_type,
|
2014-02-23 21:22:43 +08:00
|
|
|
is_permutation_symmetry=options.is_symmetrize_fc2)
|
2014-01-29 15:45:11 +08:00
|
|
|
else:
|
|
|
|
if input_filename is None:
|
|
|
|
filename = 'disp_fc2.yaml'
|
|
|
|
else:
|
|
|
|
filename = 'disp_fc2.' + input_filename + '.yaml'
|
|
|
|
if log_level:
|
|
|
|
print "Displacement dataset is read from %s." % filename
|
|
|
|
file_exists(filename, log_level)
|
|
|
|
disp_dataset = parse_disp_fc2_yaml(filename=filename)
|
2014-02-23 21:22:43 +08:00
|
|
|
if log_level:
|
|
|
|
print "Sets of supercell forces are read from %s." % "FORCES_FC2"
|
|
|
|
file_exists("FORCES_FC2", log_level)
|
2014-01-29 15:45:11 +08:00
|
|
|
forces_fc2 = parse_FORCES_FC2(disp_dataset)
|
2014-02-23 21:22:43 +08:00
|
|
|
phono3py.produce_fc2(
|
|
|
|
forces_fc2,
|
|
|
|
displacement_dataset=disp_dataset,
|
2014-06-16 16:39:15 +08:00
|
|
|
translational_symmetry_type=tsym_type,
|
2014-02-23 21:22:43 +08:00
|
|
|
is_permutation_symmetry=options.is_symmetrize_fc2)
|
2014-01-29 15:45:11 +08:00
|
|
|
|
|
|
|
if output_filename is None:
|
|
|
|
filename = 'fc2.hdf5'
|
|
|
|
else:
|
|
|
|
filename = 'fc2.' + output_filename + '.hdf5'
|
|
|
|
if log_level:
|
2014-02-23 21:22:43 +08:00
|
|
|
print "Writing fc2 to %s" % filename
|
2014-01-29 15:45:11 +08:00
|
|
|
write_fc2_to_hdf5(phono3py.get_fc2(), filename=filename)
|
2014-07-08 16:44:26 +08:00
|
|
|
|
|
|
|
if log_level:
|
|
|
|
show_drift_force_constants(phono3py.get_fc2(), name='fc2')
|
2014-01-29 15:45:11 +08:00
|
|
|
|
|
|
|
if settings.get_is_nac():
|
|
|
|
file_exists('BORN', log_level)
|
|
|
|
nac_params = parse_BORN(phonon_primitive)
|
|
|
|
nac_q_direction = settings.get_nac_q_direction()
|
|
|
|
else:
|
|
|
|
nac_params = None
|
|
|
|
nac_q_direction = None
|
|
|
|
|
2014-02-13 16:41:00 +08:00
|
|
|
if mesh is None:
|
|
|
|
if log_level:
|
|
|
|
print_end()
|
|
|
|
sys.exit(0)
|
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
##############################
|
|
|
|
# Phonon Gruneisen parameter #
|
|
|
|
##############################
|
2013-11-10 17:38:36 +08:00
|
|
|
if options.is_gruneisen:
|
2014-01-29 15:45:11 +08:00
|
|
|
fc2 = phono3py.get_fc2()
|
|
|
|
fc3 = phono3py.get_fc3()
|
|
|
|
if len(fc2) != len(fc3):
|
|
|
|
print_error_message("Supercells used for fc2 and fc3 have to be same.")
|
|
|
|
if log_level:
|
|
|
|
print_error()
|
|
|
|
sys.exit(1)
|
|
|
|
|
2013-11-10 17:38:36 +08:00
|
|
|
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):
|
2014-01-29 15:45:11 +08:00
|
|
|
|
|
|
|
print_error_message("An option of --mesh, --band, or --qpoints "
|
|
|
|
"has to be specified.")
|
2013-11-10 17:38:36 +08:00
|
|
|
if log_level:
|
2014-01-29 15:45:11 +08:00
|
|
|
print_error()
|
|
|
|
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:
|
2013-12-23 21:37:57 +08:00
|
|
|
gr.set_sampling_mesh(mesh, is_gamma_center=True)
|
2013-11-10 17:38:36 +08:00
|
|
|
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
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
if log_level:
|
|
|
|
print_end()
|
2014-01-29 17:55:19 +08:00
|
|
|
sys.exit(0)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
2014-07-08 16:44:26 +08:00
|
|
|
#################
|
|
|
|
# Show settings #
|
|
|
|
#################
|
2014-01-29 15:45:11 +08:00
|
|
|
if log_level:
|
2014-07-08 16:44:26 +08:00
|
|
|
print "---------------------------------- Settings ----------------------------------"
|
|
|
|
if settings.get_is_nac():
|
|
|
|
print "Non-analytical term correction:", settings.get_is_nac()
|
2014-02-13 16:41:00 +08:00
|
|
|
if mesh is not None:
|
|
|
|
print "Mesh sampling: [ %d %d %d ]" % tuple(mesh)
|
2014-01-29 15:45:11 +08:00
|
|
|
if mesh_divs is not None and settings.get_is_bterta():
|
|
|
|
print "Mesh divisors: [ %d %d %d ]" % tuple(mesh_divs)
|
|
|
|
if band_indices is not None and not settings.get_is_bterta():
|
2014-02-03 17:16:59 +08:00
|
|
|
print "Band indices: [",
|
2014-07-30 15:41:47 +08:00
|
|
|
for bi in [np.array(bi) + 1 for bi in band_indices]:
|
2014-02-03 17:16:59 +08:00
|
|
|
print bi,
|
|
|
|
print "]"
|
2014-01-29 15:45:11 +08:00
|
|
|
if sigmas:
|
|
|
|
print "Sigma:",
|
|
|
|
for sigma in sigmas:
|
|
|
|
if sigma:
|
|
|
|
print sigma,
|
|
|
|
else:
|
|
|
|
print "Tetrahedron-method",
|
|
|
|
print
|
2014-09-02 15:16:58 +08:00
|
|
|
|
|
|
|
if settings.get_is_isotope():
|
|
|
|
pass
|
|
|
|
elif (settings.get_is_linewidth() or
|
2014-01-29 15:45:11 +08:00
|
|
|
settings.get_is_frequency_shift() or
|
2014-05-24 16:39:47 +08:00
|
|
|
settings.get_is_bterta() or
|
|
|
|
settings.get_is_lbte()):
|
2014-01-29 15:45:11 +08:00
|
|
|
print "Temperature:",
|
|
|
|
if len(temperatures) > 5:
|
|
|
|
print ((" %.1f " * 5) % tuple(temperatures[:5])), "...",
|
|
|
|
print " %.1f" % temperatures[-1]
|
2014-01-17 15:17:00 +08:00
|
|
|
else:
|
2014-01-29 15:45:11 +08:00
|
|
|
print ("%.1f " * len(temperatures)) % tuple(temperatures)
|
2014-08-19 15:22:47 +08:00
|
|
|
elif temperature_points is not None:
|
2014-01-29 15:45:11 +08:00
|
|
|
print "Temperatures:",
|
|
|
|
print ("%.1f " * len(temperature_points)) % tuple(temperature_points)
|
2014-07-31 16:50:06 +08:00
|
|
|
if settings.get_scattering_event_class() is not None:
|
|
|
|
print "Scattering event class:",
|
|
|
|
print settings.get_scattering_event_class()
|
2014-09-02 15:16:58 +08:00
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
if grid_points is not None:
|
|
|
|
print "Grid point to be calculated:",
|
|
|
|
if len(grid_points) > 8:
|
|
|
|
for i, gp in enumerate(grid_points):
|
|
|
|
if i % 10 == 0:
|
|
|
|
print
|
|
|
|
print " ",
|
|
|
|
print gp,
|
|
|
|
print
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
2014-01-29 15:45:11 +08:00
|
|
|
for gp in grid_points:
|
|
|
|
print gp,
|
|
|
|
print
|
2014-09-02 15:16:58 +08:00
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
if cutoff_frequency:
|
|
|
|
print "Cutoff frequency:", cutoff_frequency
|
2014-09-02 15:16:58 +08:00
|
|
|
|
|
|
|
if not (settings.get_is_isotope() or options.is_joint_dos):
|
|
|
|
if settings.get_use_Peierls_model():
|
|
|
|
print "Use Peierls mode for ph-ph interaction"
|
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
if log_level > 1:
|
|
|
|
print "Frequency factor to THz:", frequency_factor_to_THz
|
2014-07-07 23:36:08 +08:00
|
|
|
if frequency_step is not None:
|
|
|
|
print "Frequency step for spectrum:", frequency_step
|
|
|
|
if num_frequency_points is not None:
|
|
|
|
print "Number of frequency sampling points:", num_frequency_points
|
2014-01-29 15:45:11 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
|
|
|
#############
|
|
|
|
# Joint DOS #
|
|
|
|
#############
|
|
|
|
if options.is_joint_dos:
|
|
|
|
joint_dos = Phono3pyJointDos(
|
2014-01-29 17:55:19 +08:00
|
|
|
phonon_supercell,
|
|
|
|
phonon_primitive,
|
2014-01-29 15:45:11 +08:00
|
|
|
mesh,
|
2014-01-29 17:55:19 +08:00
|
|
|
phono3py.get_fc2(),
|
2014-01-29 15:45:11 +08:00
|
|
|
nac_params=nac_params,
|
2014-06-27 11:59:00 +08:00
|
|
|
nac_q_direction=nac_q_direction,
|
2014-01-29 15:45:11 +08:00
|
|
|
sigmas=sigmas,
|
2014-08-19 15:22:47 +08:00
|
|
|
cutoff_frequency=cutoff_frequency,
|
2014-01-29 15:45:11 +08:00
|
|
|
frequency_step=frequency_step,
|
2014-07-07 23:36:08 +08:00
|
|
|
num_frequency_points=num_frequency_points,
|
2014-08-19 15:22:47 +08:00
|
|
|
temperatures=temperature_points,
|
2014-01-29 15:45:11 +08:00
|
|
|
frequency_factor_to_THz=frequency_factor_to_THz,
|
|
|
|
frequency_scale_factor=frequency_scale_factor,
|
|
|
|
is_nosym=options.is_nosym,
|
|
|
|
symprec=options.symprec,
|
|
|
|
output_filename=output_filename,
|
|
|
|
log_level=log_level)
|
|
|
|
joint_dos.run(grid_points)
|
|
|
|
if log_level:
|
|
|
|
print_end()
|
2014-01-29 17:55:19 +08:00
|
|
|
sys.exit(0)
|
2014-01-29 15:45:11 +08:00
|
|
|
|
|
|
|
######################
|
|
|
|
# Isotope scattering #
|
|
|
|
######################
|
2014-05-24 16:39:47 +08:00
|
|
|
if settings.get_is_isotope() and settings.get_mass_variances() is None:
|
|
|
|
from phonopy.structure.atoms import isotope_data
|
|
|
|
symbols = phonon_primitive.get_chemical_symbols()
|
|
|
|
in_database = True
|
|
|
|
for s in set(symbols):
|
|
|
|
if not s in isotope_data:
|
|
|
|
print "%s is not in the list of isotope databese" % s,
|
|
|
|
print "(not implemented)."
|
|
|
|
print "Use --mass_variances option."
|
|
|
|
in_database = False
|
|
|
|
if not in_database:
|
|
|
|
if log_level:
|
|
|
|
print_end()
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
if (settings.get_is_isotope() and
|
|
|
|
not (settings.get_is_bterta() or settings.get_is_lbte())):
|
2014-01-29 15:45:11 +08:00
|
|
|
mass_variances = settings.get_mass_variances()
|
2014-01-29 17:55:19 +08:00
|
|
|
if band_indices is not None:
|
|
|
|
band_indices = np.hstack(band_indices).astype('intc')
|
2014-02-11 14:26:25 +08:00
|
|
|
iso = Phono3pyIsotope(
|
2014-01-29 15:45:11 +08:00
|
|
|
mesh,
|
2014-05-24 16:39:47 +08:00
|
|
|
phonon_primitive,
|
|
|
|
mass_variances=mass_variances,
|
2014-01-29 17:55:19 +08:00
|
|
|
band_indices=band_indices,
|
2014-02-11 14:26:25 +08:00
|
|
|
sigmas=sigmas,
|
2014-01-29 15:45:11 +08:00
|
|
|
frequency_factor_to_THz=frequency_factor_to_THz,
|
|
|
|
symprec=options.symprec,
|
|
|
|
cutoff_frequency=settings.get_cutoff_frequency(),
|
|
|
|
lapack_zheev_uplo=options.uplo)
|
2014-01-29 17:55:19 +08:00
|
|
|
iso.set_dynamical_matrix(phono3py.get_fc2(),
|
|
|
|
phonon_supercell,
|
|
|
|
phonon_primitive,
|
2014-01-29 15:45:11 +08:00
|
|
|
nac_params=nac_params,
|
|
|
|
frequency_scale_factor=frequency_scale_factor)
|
2014-02-11 14:26:25 +08:00
|
|
|
iso.run(grid_points)
|
2014-01-29 15:45:11 +08:00
|
|
|
if log_level:
|
|
|
|
print_end()
|
2014-01-29 17:55:19 +08:00
|
|
|
sys.exit(0)
|
2014-01-16 15:53:55 +08:00
|
|
|
|
2014-01-29 15:45:11 +08:00
|
|
|
#########
|
|
|
|
# Ph-ph #
|
|
|
|
#########
|
2014-09-02 15:16:58 +08:00
|
|
|
phono3py.set_phph_interaction(
|
|
|
|
nac_params=nac_params,
|
|
|
|
nac_q_direction=nac_q_direction,
|
|
|
|
use_Peierls_model=settings.get_use_Peierls_model(),
|
|
|
|
frequency_scale_factor=frequency_scale_factor)
|
2014-01-29 15:45:11 +08:00
|
|
|
|
|
|
|
if settings.get_is_linewidth():
|
|
|
|
phono3py.run_linewidth(
|
|
|
|
grid_points,
|
|
|
|
temperatures=temperatures)
|
|
|
|
phono3py.write_linewidth(filename=output_filename)
|
|
|
|
elif settings.get_is_frequency_shift():
|
|
|
|
phono3py.get_frequency_shift(
|
|
|
|
grid_points,
|
|
|
|
epsilon=sigma,
|
|
|
|
temperatures=temperatures,
|
|
|
|
output_filename=output_filename)
|
2014-04-17 17:04:04 +08:00
|
|
|
elif settings.get_is_bterta() or settings.get_is_lbte():
|
2014-01-29 15:45:11 +08:00
|
|
|
phono3py.run_thermal_conductivity(
|
2014-04-17 17:04:04 +08:00
|
|
|
is_LBTE=settings.get_is_lbte(),
|
2014-01-29 15:45:11 +08:00
|
|
|
temperatures=temperatures,
|
|
|
|
sigmas=sigmas,
|
2014-05-24 16:39:47 +08:00
|
|
|
is_isotope=settings.get_is_isotope(),
|
2014-01-29 15:45:11 +08:00
|
|
|
mass_variances=settings.get_mass_variances(),
|
|
|
|
grid_points=grid_points,
|
|
|
|
mesh_divisors=mesh_divs,
|
|
|
|
coarse_mesh_shifts=settings.get_coarse_mesh_shifts(),
|
2014-12-04 17:31:27 +08:00
|
|
|
boundary_mfp=settings.get_boundary_mfp(),
|
2014-05-18 22:12:57 +08:00
|
|
|
is_reducible_collision_matrix=options.is_reducible_collision_matrix,
|
2014-01-29 15:45:11 +08:00
|
|
|
no_kappa_stars=settings.get_no_kappa_stars(),
|
|
|
|
gv_delta_q=settings.get_group_velocity_delta_q(),
|
2014-10-14 14:36:18 +08:00
|
|
|
pinv_cutoff=settings.get_pinv_cutoff(),
|
2014-01-29 15:45:11 +08:00
|
|
|
write_gamma=settings.get_write_gamma(),
|
|
|
|
read_gamma=settings.get_read_gamma(),
|
2014-05-04 11:36:13 +08:00
|
|
|
write_collision=settings.get_write_collision(),
|
|
|
|
read_collision=settings.get_read_collision(),
|
2014-01-29 15:45:11 +08:00
|
|
|
input_filename=input_filename,
|
|
|
|
output_filename=output_filename)
|
2013-11-10 17:38:36 +08:00
|
|
|
else:
|
2014-01-29 15:45:11 +08:00
|
|
|
phono3py.run_imag_self_energy(
|
|
|
|
grid_points,
|
|
|
|
frequency_step=frequency_step,
|
2014-07-07 23:36:08 +08:00
|
|
|
num_frequency_points=num_frequency_points,
|
2014-07-31 16:50:06 +08:00
|
|
|
temperatures=temperature_points,
|
|
|
|
scattering_event_class=settings.get_scattering_event_class())
|
2014-01-29 15:45:11 +08:00
|
|
|
phono3py.write_imag_self_energy(filename=output_filename)
|
2012-12-11 16:19:23 +08:00
|
|
|
|
|
|
|
if log_level:
|
|
|
|
print_end()
|