Merge produe fc routines in CUI

This commit is contained in:
Atsushi Togo 2025-06-23 15:04:08 +09:00
parent bb1012784d
commit 7f44ce3594
5 changed files with 260 additions and 485 deletions

View File

@ -37,191 +37,36 @@
from __future__ import annotations
import copy
import dataclasses
import os
import pathlib
import sys
from dataclasses import asdict
from typing import Literal, Optional, Union
from typing import Literal
import numpy as np
from phonopy.cui.phonopy_script import file_exists, print_error
from phonopy.file_IO import get_dataset_type2
from phonopy.harmonic.force_constants import (
show_drift_force_constants,
symmetrize_compact_force_constants,
symmetrize_force_constants,
)
from phonopy.interface.calculator import get_calculator_physical_units
from phonopy.interface.pypolymlp import PypolymlpParams, parse_mlp_params
from phono3py import Phono3py
from phono3py.cui.settings import Phono3pySettings
from phono3py.cui.show_log import show_phono3py_force_constants_settings
from phono3py.file_IO import (
get_length_of_first_line,
parse_FORCES_FC2,
parse_FORCES_FC3,
read_fc2_from_hdf5,
read_fc3_from_hdf5,
write_fc2_to_hdf5,
write_fc3_to_hdf5,
)
from phono3py.interface.fc_calculator import (
determine_cutoff_pair_distance,
extract_fc2_fc3_calculators,
get_fc_calculator_params,
)
from phono3py.interface.fc_calculator import determine_cutoff_pair_distance
from phono3py.interface.phono3py_yaml import Phono3pyYaml
from phono3py.phonon3.dataset import forces_in_dataset
from phono3py.phonon3.fc3 import (
set_permutation_symmetry_fc3,
set_translational_invariance_fc3,
show_drift_fc3,
)
def create_phono3py_force_constants(
phono3py: Phono3py,
settings: Phono3pySettings,
ph3py_yaml: Phono3pyYaml | None = None,
phono3py_yaml_filename: str | os.PathLike | None = None,
calculator: str | None = None,
input_filename: str | os.PathLike | None = None,
output_filename: str | os.PathLike | None = None,
log_level: int = 1,
):
"""Read or calculate force constants.
This function is for the 'phonopy' command only and not for the
'phonopy-load' command.
"""
# Only for built-in fc calculator.
# These are not applied to external fc calculators.
symmetrize_fc3r = settings.is_symmetrize_fc3_r or settings.fc_symmetry
symmetrize_fc2 = settings.is_symmetrize_fc2 or settings.fc_symmetry
if log_level:
show_phono3py_force_constants_settings(settings)
#######
# fc3 #
#######
if (
settings.is_joint_dos
or (settings.is_isotope and not (settings.is_bterta or settings.is_lbte))
or settings.read_gamma
or settings.read_pp
or (not settings.is_bterta and settings.write_phonon)
or settings.constant_averaged_pp_interaction is not None
):
pass
else:
(fc_calculator, fc_calculator_options) = get_fc_calculator_params(
settings.fc_calculator,
settings.fc_calculator_options,
settings.cutoff_pair_distance,
log_level=(not settings.read_fc3) * 1,
)
if settings.read_fc3:
_read_phono3py_fc3(phono3py, symmetrize_fc3r, input_filename, log_level)
else: # fc3 from FORCES_FC3 or ph3py_yaml
dataset = _read_dataset_fc3(
phono3py,
ph3py_yaml,
phono3py_yaml_filename,
settings.cutoff_pair_distance,
calculator,
log_level,
)
phono3py.dataset = dataset
phono3py.produce_fc3(
symmetrize_fc3r=symmetrize_fc3r,
is_compact_fc=settings.is_compact_fc,
fc_calculator=extract_fc2_fc3_calculators(fc_calculator, 3),
fc_calculator_options=extract_fc2_fc3_calculators(
fc_calculator_options, 3
),
)
assert phono3py.fc3 is not None, "fc3 is not set."
cutoff_distance = settings.cutoff_fc3_distance
if cutoff_distance is not None and cutoff_distance > 0:
if log_level:
print(
"Cutting-off fc3 by zero (cut-off distance: %f)" % cutoff_distance
)
phono3py.cutoff_fc3_by_zero(cutoff_distance)
if not settings.read_fc3:
if output_filename is None:
filename = "fc3.hdf5"
else:
filename = "fc3." + output_filename + ".hdf5"
if log_level:
print(f'Writing fc3 to "{filename}".')
write_fc3_to_hdf5(
phono3py.fc3,
fc3_nonzero_indices=phono3py.fc3_nonzero_indices,
filename=filename,
p2s_map=phono3py.primitive.p2s_map,
fc3_cutoff=phono3py.fc3_cutoff,
compression=settings.hdf5_compression,
)
if log_level:
show_drift_fc3(phono3py.fc3, primitive=phono3py.primitive)
#######
# fc2 #
#######
phonon_primitive = phono3py.phonon_primitive
p2s_map = phonon_primitive.p2s_map
if settings.read_fc2:
_read_phono3py_fc2(phono3py, symmetrize_fc2, input_filename, log_level)
else:
if phono3py.dataset is None or phono3py.phonon_supercell_matrix is not None:
_read_dataset_fc2(
phono3py,
ph3py_yaml,
calculator,
log_level,
)
phono3py.produce_fc2(
symmetrize_fc2=symmetrize_fc2,
is_compact_fc=settings.is_compact_fc,
fc_calculator=extract_fc2_fc3_calculators(fc_calculator, 2),
fc_calculator_options=extract_fc2_fc3_calculators(fc_calculator_options, 2),
)
if output_filename is None:
filename = "fc2.hdf5"
else:
filename = "fc2." + output_filename + ".hdf5"
if log_level:
print('Writing fc2 to "%s".' % filename)
write_fc2_to_hdf5(
phono3py.fc2,
filename=filename,
p2s_map=p2s_map,
physical_unit="eV/angstrom^2",
compression=settings.hdf5_compression,
)
if log_level:
show_drift_force_constants(phono3py.fc2, primitive=phonon_primitive, name="fc2")
def parse_forces(
phono3py: Phono3py,
ph3py_yaml: Optional[Phono3pyYaml] = None,
cutoff_pair_distance=None,
force_filename: str = "FORCES_FC3",
phono3py_yaml_filename: Optional[str] = None,
ph3py_yaml: Phono3pyYaml | None = None,
cutoff_pair_distance: float | None = None,
force_filename: str | os.PathLike = "FORCES_FC3",
phono3py_yaml_filename: str | os.PathLike | None = None,
fc_type: Literal["fc3", "phonon_fc2"] = "fc3",
calculator: Optional[str] = None,
log_level=0,
calculator: str | None = None,
log_level: int = 0,
) -> dict:
"""Read displacements and forces.
@ -232,7 +77,7 @@ def parse_forces(
without writing calculator name in it.
"""
filename_read_from: Optional[str] = None
filename_read_from: str | None = None
dataset = None
if phono3py.phonon_supercell is None or fc_type == "fc3":
@ -300,82 +145,13 @@ def parse_forces(
return dataset
def _read_phono3py_fc3(phono3py: Phono3py, symmetrize_fc3r, input_filename, log_level):
if input_filename is None:
filename = "fc3.hdf5"
else:
filename = "fc3." + input_filename + ".hdf5"
file_exists(filename, log_level=log_level)
if log_level:
print('Reading fc3 from "%s".' % filename)
p2s_map = phono3py.primitive.p2s_map
try:
fc3 = read_fc3_from_hdf5(filename=filename, p2s_map=p2s_map)
except RuntimeError:
import traceback
traceback.print_exc()
if log_level:
print_error()
sys.exit(1)
num_atom = len(phono3py.supercell)
if fc3.shape[1] != num_atom:
print("Matrix shape of fc3 doesn't agree with supercell size.")
if log_level:
print_error()
sys.exit(1)
if symmetrize_fc3r:
set_translational_invariance_fc3(fc3)
set_permutation_symmetry_fc3(fc3)
phono3py.fc3 = fc3
def _read_phono3py_fc2(phono3py, symmetrize_fc2, input_filename, log_level):
if input_filename is None:
filename = "fc2.hdf5"
else:
filename = "fc2." + input_filename + ".hdf5"
file_exists(filename, log_level=log_level)
if log_level:
print('Reading fc2 from "%s".' % filename)
num_atom = len(phono3py.phonon_supercell)
p2s_map = phono3py.phonon_primitive.p2s_map
try:
phonon_fc2 = read_fc2_from_hdf5(filename=filename, p2s_map=p2s_map)
except RuntimeError:
import traceback
traceback.print_exc()
if log_level:
print_error()
sys.exit(1)
if phonon_fc2.shape[1] != num_atom:
print("Matrix shape of fc2 doesn't agree with supercell size.")
if log_level:
print_error()
sys.exit(1)
if symmetrize_fc2:
if phonon_fc2.shape[0] == phonon_fc2.shape[1]:
symmetrize_force_constants(phonon_fc2)
else:
symmetrize_compact_force_constants(phonon_fc2, phono3py.phonon_primitive)
phono3py.fc2 = phonon_fc2
def _read_FORCES_FC3_or_FC2(
natom: int,
dataset: Optional[dict],
dataset: dict | None,
fc_type: str,
filename: str = "FORCES_FC3",
filename: str | os.PathLike = "FORCES_FC3",
log_level: int = 0,
) -> Optional[dict]:
) -> dict | None:
"""Read FORCES_FC3 or FORCES_FC2.
Read the first line of forces file to determine the type of the file.
@ -406,57 +182,11 @@ def _read_FORCES_FC3_or_FC2(
return dataset
def _read_dataset_fc3(
phono3py: Phono3py,
ph3py_yaml: Optional[Phono3pyYaml],
phono3py_yaml_filename: Optional[str],
cutoff_pair_distance: Optional[float],
calculator: Optional[str],
log_level: int,
) -> dict:
"""Read or calculate fc3.
Note
----
cutoff_pair_distance is the parameter to determine each displaced
supercell is included to the computation of fc3. It is assumed that
cutoff_pair_distance is stored in the step to create sets of
displacements and the value is stored n the displacement dataset and
also as the parameter 'included': True or False for each displacement.
The parameter cutoff_pair_distance here can be used in the step to
create fc3 by overwriting original cutoff_pair_distance value only
when the former value is smaller than the later.
"""
try:
dataset = parse_forces(
phono3py,
ph3py_yaml=ph3py_yaml,
cutoff_pair_distance=cutoff_pair_distance,
force_filename="FORCES_FC3",
phono3py_yaml_filename=phono3py_yaml_filename,
fc_type="fc3",
calculator=calculator,
log_level=log_level,
)
except RuntimeError as e:
# from _parse_forces_type1
if log_level:
print(str(e))
print_error()
sys.exit(1)
except FileNotFoundError as e:
# from _get_type2_dataset
file_exists(e.filename, log_level=log_level)
return dataset
def run_pypolymlp_to_compute_forces(
ph3py: Phono3py,
mlp_params: str | dict | PypolymlpParams | None = None,
displacement_distance: float | None = None,
number_of_snapshots: int | None = None,
number_of_snapshots: int | Literal["auto"] | None = None,
number_estimation_factor: int | None = None,
random_seed: int | None = None,
prepare_dataset: bool = False,
@ -464,7 +194,7 @@ def run_pypolymlp_to_compute_forces(
fc_calculator_options: str | None = None,
cutoff_pair_distance: float | None = None,
symfc_memory_size: float | None = None,
mlp_filename: str | None = None,
mlp_filename: str | os.PathLike | None = None,
log_level: int = 0,
):
"""Run pypolymlp to compute forces."""
@ -508,7 +238,7 @@ def run_pypolymlp_to_compute_forces(
else:
pmlp_params = parse_mlp_params(mlp_params)
print("Parameters:")
for k, v in asdict(pmlp_params).items():
for k, v in dataclasses.asdict(pmlp_params).items():
if v is not None:
print(f" {k}: {v}")
print("Developing MLPs by pypolymlp...", flush=True)
@ -578,10 +308,10 @@ def run_pypolymlp_to_compute_forces(
def run_pypolymlp_to_compute_phonon_forces(
ph3py: Phono3py,
mlp_params: Optional[Union[str, dict, PypolymlpParams]] = None,
displacement_distance: Optional[float] = None,
number_of_snapshots: Optional[int] = None,
random_seed: Optional[int] = None,
mlp_params: str | dict | PypolymlpParams | None = None,
displacement_distance: float | None = None,
number_of_snapshots: int | None = None,
random_seed: int | None = None,
log_level: int = 0,
):
"""Run pypolymlp to compute phonon forces."""
@ -596,7 +326,7 @@ def run_pypolymlp_to_compute_phonon_forces(
print("Pypolymlp is developed at https://github.com/sekocha/pypolymlp.")
if mlp_params:
print("Parameters:")
for k, v in asdict(parse_mlp_params(mlp_params)).items():
for k, v in dataclasses.asdict(parse_mlp_params(mlp_params)).items():
if v is not None:
print(f" {k}: {v}")
if log_level:
@ -633,61 +363,10 @@ def run_pypolymlp_to_compute_phonon_forces(
ph3py.evaluate_phonon_mlp()
def _read_dataset_fc2(
phono3py: Phono3py,
ph3py_yaml: Optional[Phono3pyYaml],
calculator,
log_level,
):
"""Read forces and produce fc2.
force_filename is either "FORCES_FC2" or "FORCES_FC3".
"""
# _ph3py_yaml = _get_default_ph3py_yaml(ph3py_yaml)
if phono3py.phonon_supercell_matrix is not None:
force_filename = "FORCES_FC2"
elif phono3py.dataset is None:
force_filename = "FORCES_FC3"
else:
raise RuntimeError("Force filename is not determined.")
try:
dataset = parse_forces(
phono3py,
ph3py_yaml=ph3py_yaml,
force_filename=force_filename,
fc_type="phonon_fc2",
calculator=calculator,
log_level=log_level,
)
except RuntimeError as e:
if log_level:
print(str(e))
print_error()
sys.exit(1)
except FileNotFoundError as e:
file_exists(e.filename, log_level=log_level)
if phono3py.phonon_supercell_matrix is not None:
phono3py.phonon_dataset = dataset
elif phono3py.dataset is None:
phono3py.dataset = dataset
def _get_default_ph3py_yaml(ph3py_yaml: Optional[Phono3pyYaml]):
_ph3py_yaml = ph3py_yaml
if _ph3py_yaml is None and pathlib.Path("phono3py_disp.yaml").exists():
_ph3py_yaml = Phono3pyYaml()
_ph3py_yaml.read("phono3py_disp.yaml")
return _ph3py_yaml
def _convert_unit_in_dataset(
dataset: dict,
distance_to_A: Optional[float] = None,
force_to_eVperA: Optional[float] = None,
distance_to_A: float | None = None,
force_to_eVperA: float | None = None,
) -> None:
"""Convert physical units of displacements and forces in dataset.
@ -726,9 +405,7 @@ def _to_ndarray(array, dtype="double"):
return array
def _extract_dataset_from_ph3py_yaml(
ph3py_yaml: Optional[Phono3pyYaml], fc_type
) -> Optional[dict]:
def _extract_dataset_from_ph3py_yaml(ph3py_yaml: Phono3pyYaml, fc_type) -> dict | None:
if ph3py_yaml.phonon_supercell is None or fc_type == "fc3":
if ph3py_yaml.dataset is not None:
return copy.deepcopy(ph3py_yaml.dataset)

View File

@ -389,13 +389,15 @@ def load_fc2_and_fc3(
ph3py: Phono3py,
fc3_filename: str | os.PathLike | None = None,
fc2_filename: str | os.PathLike | None = None,
read_fc3: bool = True,
read_fc2: bool = True,
log_level: int = 0,
):
"""Set force constants."""
if fc3_filename is not None or pathlib.Path("fc3.hdf5").exists():
if read_fc3 and (fc3_filename is not None or pathlib.Path("fc3.hdf5").exists()):
_load_fc3(ph3py, fc3_filename=fc3_filename, log_level=log_level)
if fc2_filename is not None or pathlib.Path("fc2.hdf5").exists():
if read_fc2 and (fc2_filename is not None or pathlib.Path("fc2.hdf5").exists()):
_load_fc2(ph3py, fc2_filename=fc2_filename, log_level=log_level)
@ -410,34 +412,40 @@ def load_dataset_and_phonon_dataset(
log_level: int = 0,
):
"""Set displacements, forces, and create force constants."""
dataset = _select_and_load_dataset(
ph3py,
ph3py_yaml=ph3py_yaml,
forces_fc3_filename=forces_fc3_filename,
phono3py_yaml_filename=phono3py_yaml_filename,
cutoff_pair_distance=cutoff_pair_distance,
calculator=calculator,
log_level=log_level,
)
if dataset is not None:
ph3py.dataset = dataset
if (
ph3py.fc3 is None
and ph3py.fc2 is None
and ph3py.phonon_supercell_matrix is None
):
dataset = _select_and_load_dataset(
ph3py,
ph3py_yaml=ph3py_yaml,
forces_fc3_filename=forces_fc3_filename,
phono3py_yaml_filename=phono3py_yaml_filename,
cutoff_pair_distance=cutoff_pair_distance,
calculator=calculator,
log_level=log_level,
)
if dataset is not None:
ph3py.dataset = dataset
phonon_dataset = _select_and_load_phonon_dataset(
ph3py,
ph3py_yaml=ph3py_yaml,
forces_fc2_filename=forces_fc2_filename,
calculator=calculator,
log_level=log_level,
)
if phonon_dataset is not None:
ph3py.phonon_dataset = phonon_dataset
if ph3py.fc2 is None:
phonon_dataset = _select_and_load_phonon_dataset(
ph3py,
ph3py_yaml=ph3py_yaml,
forces_fc2_filename=forces_fc2_filename,
calculator=calculator,
log_level=log_level,
)
if phonon_dataset is not None:
ph3py.phonon_dataset = phonon_dataset
def compute_force_constants_from_datasets(
ph3py: Phono3py,
fc_calculator: Optional[str] = None,
fc_calculator_options: Optional[Union[dict, str]] = None,
cutoff_pair_distance: Optional[float] = None,
fc_calculator: str | None = None,
fc_calculator_options: dict | str | None = None,
cutoff_pair_distance: float | None = None,
symmetrize_fc: bool = True,
is_compact_fc: bool = True,
log_level: int = 0,
@ -526,7 +534,7 @@ def _select_and_load_dataset(
calculator: str | None = None,
log_level: int = 0,
) -> dict | None:
dataset = None
# displacements and forces are in phono3py-yaml-like file
if (
ph3py_yaml is not None
and ph3py_yaml.dataset is not None
@ -541,7 +549,10 @@ def _select_and_load_dataset(
calculator,
log_level,
)
elif forces_fc3_filename is not None or pathlib.Path("FORCES_FC3").exists():
return dataset
# displacements and forces are in FORCES_FC3-like file
if forces_fc3_filename is not None or pathlib.Path("FORCES_FC3").exists():
if forces_fc3_filename is None:
force_filename = "FORCES_FC3"
else:
@ -555,7 +566,10 @@ def _select_and_load_dataset(
calculator,
log_level,
)
elif ph3py_yaml is not None and ph3py_yaml.dataset is not None:
return dataset
# dataset is in phono3py-yaml-like file
if ph3py_yaml is not None and ph3py_yaml.dataset is not None:
# not forces_in_dataset(ph3py_yaml.dataset)
# but want to read displacement dataset.
dataset = _get_dataset_for_fc3(
@ -567,8 +581,9 @@ def _select_and_load_dataset(
calculator,
log_level,
)
return dataset
return dataset
return None
def _load_fc2(
@ -639,7 +654,7 @@ def _select_and_load_phonon_dataset(
def _get_dataset_for_fc3(
ph3py: Phono3py,
ph3py_yaml: Optional[Phono3pyYaml],
ph3py_yaml: Phono3pyYaml | None,
force_filename,
phono3py_yaml_filename,
cutoff_pair_distance,

View File

@ -70,7 +70,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--ave-pp",
dest="use_ave_pp",
action="store_true",
default=False,
default=None,
help="Use averaged ph-ph interaction",
)
parser.add_argument(
@ -113,7 +113,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--bterta",
dest="is_bterta",
action="store_true",
default=False,
default=None,
help="Calculate thermal conductivity in BTE-RTA",
)
if not load_phono3py_yaml:
@ -155,7 +155,7 @@ def get_parser(load_phono3py_yaml: bool = False):
metavar="FILE",
dest="subtract_forces",
default=None,
help="Subtract recidual forces from supercell forces",
help="Subtract residual forces from supercell forces",
)
parser.add_argument(
"--cfz-fc2",
@ -163,15 +163,15 @@ def get_parser(load_phono3py_yaml: bool = False):
metavar="FILE",
dest="subtract_forces_fc2",
default=None,
help="Subtract recidual forces from supercell forces for fc2",
help="Subtract residual forces from supercell forces for fc2",
)
parser.add_argument(
"--cfc",
"--compact-fc",
dest="is_compact_fc",
action="store_true",
default=False,
help="Use compact force cosntants",
default=None,
help="Use compact force constants",
)
parser.add_argument(
"--cfs",
@ -241,7 +241,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--disp",
dest="is_displacement",
action="store_true",
default=False,
default=None,
help="As first stage, get least displacements",
)
if not load_phono3py_yaml:
@ -263,7 +263,7 @@ def get_parser(load_phono3py_yaml: bool = False):
# "--emulate-v2",
# dest="emulate_v2",
# action="store_true",
# default=False,
# default=None,
# help="Emulate v2.x behavior.",
# )
parser.add_argument(
@ -510,19 +510,34 @@ def get_parser(load_phono3py_yaml: bool = False):
default=None,
help="Do not symmetrize force constants",
)
parser.add_argument(
"--no-read-fc2",
dest="read_fc2",
action="store_false",
default=None,
help="Read second order force constants",
)
parser.add_argument(
"--no-read-fc3",
dest="read_fc3",
action="store_false",
default=None,
help="Read third order force constants",
)
parser.add_argument(
"--nodiag",
dest="is_nodiag",
action="store_true",
default=False,
default=None,
help="Set displacements parallel to axes",
)
parser.add_argument(
"--noks",
"--no-kappa-stars",
dest="no_kappa_stars",
action="store_true",
default=False,
dest="kappa_star",
action="store_false",
default=None,
help="Deactivate summation of partial kappa at q-stars",
)
parser.add_argument(
@ -544,14 +559,14 @@ def get_parser(load_phono3py_yaml: bool = False):
"--nosym",
dest="is_nosym",
action="store_true",
default=False,
default=None,
help="Symmetry is not imposed.",
)
parser.add_argument(
"--nu",
dest="is_N_U",
action="store_true",
default=False,
default=None,
help="Split Gamma into Normal and Umklapp processes",
)
parser.add_argument(
@ -616,14 +631,14 @@ def get_parser(load_phono3py_yaml: bool = False):
"--pm",
dest="is_plusminus_displacements",
action="store_true",
default=False,
default=None,
help="Set plus minus displacements",
)
parser.add_argument(
"--pm-fc2",
dest="is_plusminus_displacements_fc2",
action="store_true",
default=False,
default=None,
help="Set plus minus displacements for extra fc2",
)
parser.add_argument(
@ -637,7 +652,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--pypolymlp",
dest="use_pypolymlp",
action="store_true",
default=False,
default=None,
help="Use pypolymlp and symfc for generating force constants",
)
parser.add_argument(
@ -659,7 +674,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--quiet",
dest="quiet",
action="store_true",
default=False,
default=None,
help="Print out smallest information",
)
parser.add_argument(
@ -700,35 +715,35 @@ def get_parser(load_phono3py_yaml: bool = False):
"--read-gamma",
dest="read_gamma",
action="store_true",
default=False,
default=None,
help="Read Gammas from files",
)
parser.add_argument(
"--read-phonon",
dest="read_phonon",
action="store_true",
default=False,
default=None,
help="Read phonons from files",
)
parser.add_argument(
"--read-pp",
dest="read_pp",
action="store_true",
default=False,
default=None,
help="Read phonon-phonon interaction strength",
)
parser.add_argument(
"--reducible-colmat",
dest="is_reducible_collision_matrix",
action="store_true",
default=False,
default=None,
help="Solve reducible collision matrix",
)
parser.add_argument(
"--rse",
dest="is_real_self_energy",
action="store_true",
default=False,
default=None,
help="Calculate real part of self energy",
)
parser.add_argument(
@ -789,7 +804,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--spf",
dest="is_spectral_function",
action="store_true",
default=False,
default=None,
help="Calculate spectral function",
)
parser.add_argument(
@ -797,7 +812,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--show-num-triplets",
dest="show_num_triplets",
action="store_true",
default=False,
default=None,
help=(
"Show reduced number of triplets to be calculated at specified grid points"
),
@ -807,21 +822,21 @@ def get_parser(load_phono3py_yaml: bool = False):
"--sym-fc2",
dest="is_symmetrize_fc2",
action="store_true",
default=False,
default=None,
help="Symmetrize fc2 by index exchange",
)
parser.add_argument(
"--sym-fc3r",
dest="is_symmetrize_fc3_r",
action="store_true",
default=False,
default=None,
help="Symmetrize fc3 in real space by index exchange",
)
parser.add_argument(
"--sym-fc3q",
dest="is_symmetrize_fc3_q",
action="store_true",
default=False,
default=None,
help="Symmetrize fc3 in reciprocal space by index exchange",
)
parser.add_argument(
@ -829,7 +844,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--tetrahedron-method",
dest="is_tetrahedron_method",
action="store_true",
default=False,
default=None,
help="Use tetrahedron method.",
)
parser.add_argument(
@ -866,14 +881,14 @@ def get_parser(load_phono3py_yaml: bool = False):
"--verbose",
dest="verbose",
action="store_true",
default=False,
default=None,
help="Detailed run-time information is displayed",
)
parser.add_argument(
"--v2",
dest="is_fc3_r0_average",
action="store_false",
default=True,
default=None,
help="Take average in fc3-r2q transformation around three atoms",
)
parser.add_argument(
@ -881,7 +896,7 @@ def get_parser(load_phono3py_yaml: bool = False):
"--write-grid-points",
dest="write_grid_points",
action="store_true",
default=False,
default=None,
help=(
"Write grid address of irreducible grid points for specified "
"mesh numbers to ir_grid_address.yaml"
@ -891,21 +906,21 @@ def get_parser(load_phono3py_yaml: bool = False):
"--wigner",
dest="is_wigner_kappa",
action="store_true",
default=False,
default=None,
help="Choose Wigner lattice thermal conductivity.",
)
parser.add_argument(
"--write-collision",
dest="write_collision",
action="store_true",
default=False,
default=None,
help="Write collision matrix and Gammas to files",
)
parser.add_argument(
"--write-gamma",
dest="write_gamma",
action="store_true",
default=False,
default=None,
help="Write imag-part of self energy to files",
)
parser.add_argument(
@ -913,28 +928,28 @@ def get_parser(load_phono3py_yaml: bool = False):
"--write_detailed_gamma",
dest="write_gamma_detail",
action="store_true",
default=False,
default=None,
help="Write out detailed imag-part of self energy",
)
parser.add_argument(
"--write-phonon",
dest="write_phonon",
action="store_true",
default=False,
default=None,
help="Write all phonons on grid points to files",
)
parser.add_argument(
"--write-pp",
dest="write_pp",
action="store_true",
default=False,
default=None,
help="Write phonon-phonon interaction strength",
)
parser.add_argument(
"--write-lbte-solution",
dest="write_LBTE_solution",
action="store_true",
default=False,
default=None,
help="Write direct solution of LBTE to hdf5 files",
)
if load_phono3py_yaml:

View File

@ -70,10 +70,7 @@ from phonopy.physical_units import get_physical_units
from phonopy.structure.cells import isclose as cells_isclose
from phono3py import Phono3py, Phono3pyIsotope, Phono3pyJointDos
from phono3py.cui.create_force_constants import (
get_fc_calculator_params,
run_pypolymlp_to_compute_forces,
)
from phono3py.cui.create_force_constants import run_pypolymlp_to_compute_forces
from phono3py.cui.create_force_sets import (
create_FORCE_SETS_from_FORCES_FCx,
create_FORCES_FC2_from_FORCE_SETS,
@ -102,7 +99,10 @@ from phono3py.file_IO import (
write_fc3_to_hdf5,
write_phonon_to_hdf5,
)
from phono3py.interface.fc_calculator import determine_cutoff_pair_distance
from phono3py.interface.fc_calculator import (
determine_cutoff_pair_distance,
get_fc_calculator_params,
)
from phono3py.interface.phono3py_yaml import Phono3pyYaml
from phono3py.phonon.grid import BZGrid, get_grid_point_from_address, get_ir_grid_points
from phono3py.phonon3.dataset import forces_in_dataset
@ -136,7 +136,7 @@ def print_end_phono3py():
print_end()
def finalize_phono3py(
def _finalize_phono3py(
phono3py: Phono3py,
confs_dict: dict,
log_level: int,
@ -190,7 +190,7 @@ def finalize_phono3py(
sys.exit(0)
def get_run_mode(settings: Phono3pySettings):
def _get_run_mode(settings: Phono3pySettings):
"""Extract run mode from settings."""
run_mode = None
if settings.is_gruneisen:
@ -218,7 +218,7 @@ def get_run_mode(settings: Phono3pySettings):
return run_mode
def start_phono3py(**argparse_control) -> tuple[argparse.Namespace, int]:
def _start_phono3py(**argparse_control) -> tuple[argparse.Namespace, int]:
"""Parse arguments and set some basic parameters."""
parser, deprecated = get_parser(argparse_control.get("load_phono3py_yaml", False))
args = parser.parse_args()
@ -259,7 +259,7 @@ def start_phono3py(**argparse_control) -> tuple[argparse.Namespace, int]:
return args, log_level
def read_phono3py_settings(
def _read_phono3py_settings(
args: argparse.Namespace, argparse_control: dict, log_level: int
):
"""Read phono3py settings.
@ -313,7 +313,7 @@ def read_phono3py_settings(
return settings, confs_dict, cell_filename
def get_input_output_filenames_from_args(args: argparse.Namespace):
def _get_input_output_filenames_from_args(args: argparse.Namespace):
"""Return strings inserted to input and output filenames."""
if args.input_filename is not None:
warnings.warn(
@ -374,7 +374,7 @@ def _get_cell_info(
return cell_info
def get_default_values(settings: Phono3pySettings):
def _get_default_values(settings: Phono3pySettings):
"""Set default values."""
# Brillouin zone integration: Tetrahedron (default) or smearing method
sigma = settings.sigma
@ -488,7 +488,7 @@ def _check_supercell_in_yaml(
sys.exit(1)
def init_phono3py(
def _init_phono3py(
settings: Phono3pySettings,
cell_info: Phono3pyCellInfoResult,
interface_mode: str | None,
@ -511,7 +511,7 @@ def init_phono3py(
# 'frequency_factor_to_THz', 'num_frequency_points',
# 'frequency_step', 'frequency_scale_factor',
# 'cutoff_frequency')
updated_settings = get_default_values(settings)
updated_settings = _get_default_values(settings)
phono3py = Phono3py(
unitcell,
@ -537,10 +537,10 @@ def init_phono3py(
return phono3py, updated_settings
def settings_to_grid_points(settings: Phono3pySettings, bz_grid: BZGrid):
def _settings_to_grid_points(settings: Phono3pySettings, bz_grid: BZGrid):
"""Read or set grid point indices."""
if settings.grid_addresses is not None:
grid_points = grid_addresses_to_grid_points(settings.grid_addresses, bz_grid)
grid_points = _grid_addresses_to_grid_points(settings.grid_addresses, bz_grid)
elif settings.grid_points is not None:
grid_points = settings.grid_points
else:
@ -548,7 +548,7 @@ def settings_to_grid_points(settings: Phono3pySettings, bz_grid: BZGrid):
return grid_points
def grid_addresses_to_grid_points(grid_addresses: NDArray, bz_grid: BZGrid):
def _grid_addresses_to_grid_points(grid_addresses: NDArray, bz_grid: BZGrid):
"""Return grid point indices from grid addresses."""
grid_points = [
get_grid_point_from_address(ga, bz_grid.D_diag) for ga in grid_addresses
@ -598,7 +598,7 @@ def _create_supercells_with_displacements(
% len(phono3py.symmetry.symmetry_operations["rotations"])
)
finalize_phono3py(
_finalize_phono3py(
phono3py,
confs_dict,
log_level,
@ -607,13 +607,13 @@ def _create_supercells_with_displacements(
)
def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_level: int):
def _produce_force_constants(
ph3py: Phono3py, settings: Phono3pySettings, log_level: int
):
"""Calculate, read, and write force constants."""
if log_level:
print("-" * 29 + " Force constants " + "-" * 30)
load_fc2_and_fc3(ph3py, log_level=log_level)
read_fc3 = ph3py.fc3 is not None
read_fc2 = ph3py.fc2 is not None
@ -663,7 +663,6 @@ def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_leve
is_compact_fc=settings.is_compact_fc,
log_level=log_level,
)
# _show_fc_calculator_not_found(log_level)
if log_level:
if ph3py.fc3 is None:
@ -716,20 +715,7 @@ def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_leve
print('fc2 was written into "fc2.hdf5".')
def _show_fc_calculator_not_found(log_level: int):
if log_level:
print("")
print(
"Built-in force constants calculator doesn't support the "
"displacements-forces dataset. "
"An external force calculator, e.g., symfc (--symfc_ or ALM (--alm), "
"has to be used to compute force constants."
)
print_error()
sys.exit(1)
def run_gruneisen_then_exit(
def _run_gruneisen_then_exit(
phono3py: Phono3py, settings: Phono3pySettings, output_filename: str, log_level: int
):
"""Run mode Grueneisen parameter calculation from fc3."""
@ -783,7 +769,7 @@ def run_gruneisen_then_exit(
sys.exit(0)
def run_jdos_then_exit(
def _run_jdos_then_exit(
phono3py: Phono3py,
settings: Phono3pySettings,
updated_settings: dict,
@ -818,7 +804,7 @@ def run_jdos_then_exit(
if dm.is_nac() and dm.nac_method == "gonze":
dm.show_Gonze_nac_message()
grid_points = settings_to_grid_points(settings, joint_dos.grid)
grid_points = _settings_to_grid_points(settings, joint_dos.grid)
joint_dos.run(grid_points, write_jdos=True)
if log_level:
@ -826,7 +812,7 @@ def run_jdos_then_exit(
sys.exit(0)
def run_isotope_then_exit(
def _run_isotope_then_exit(
phono3py: Phono3py,
settings: Phono3pySettings,
updated_settings: dict,
@ -862,7 +848,7 @@ def run_isotope_then_exit(
if dm.is_nac() and dm.nac_method == "gonze":
dm.show_Gonze_nac_message()
grid_points = settings_to_grid_points(settings, iso.grid)
grid_points = _settings_to_grid_points(settings, iso.grid)
iso.run(grid_points)
if log_level:
@ -870,7 +856,7 @@ def run_isotope_then_exit(
sys.exit(0)
def init_phph_interaction(
def _init_phph_interaction(
phono3py: Phono3py,
settings: Phono3pySettings,
updated_settings: dict,
@ -971,17 +957,17 @@ def main(**argparse_control):
args = argparse_control["args"]
log_level = args.log_level
else:
args, log_level = start_phono3py(**argparse_control)
args, log_level = _start_phono3py(**argparse_control)
if load_phono3py_yaml:
input_filename = None
output_filename = None
output_yaml_filename = args.output_yaml_filename
else:
(input_filename, output_filename) = get_input_output_filenames_from_args(args)
(input_filename, output_filename) = _get_input_output_filenames_from_args(args)
output_yaml_filename = None
settings, confs_dict, cell_filename = read_phono3py_settings(
settings, confs_dict, cell_filename = _read_phono3py_settings(
args, argparse_control, log_level
)
@ -1035,7 +1021,7 @@ def main(**argparse_control):
# ph3py_yaml = cell_info.phonopy_yaml
if run_mode is None:
run_mode = get_run_mode(settings)
run_mode = _get_run_mode(settings)
######################################################
# Create supercells with displacements and then exit #
@ -1059,7 +1045,7 @@ def main(**argparse_control):
# 'frequency_factor_to_THz', 'num_frequency_points',
# 'frequency_step', 'frequency_scale_factor',
# 'cutoff_frequency')
ph3py, updated_settings = init_phono3py(
ph3py, updated_settings = _init_phono3py(
settings, cell_info, interface_mode, symprec, log_level
)
@ -1167,7 +1153,7 @@ def main(**argparse_control):
################################################################
if run_mode == "show_triplets_info":
ph3py.mesh_numbers = settings.mesh_numbers
grid_points = settings_to_grid_points(settings, ph3py.grid)
grid_points = _settings_to_grid_points(settings, ph3py.grid)
show_num_triplets(
ph3py.primitive,
ph3py.grid,
@ -1193,11 +1179,19 @@ def main(**argparse_control):
nac_factor=get_physical_units().Hartree * get_physical_units().Bohr,
)
########################
# Read force constants #
########################
load_fc2_and_fc3(
ph3py,
read_fc3=settings.read_fc3,
read_fc2=settings.read_fc2,
log_level=log_level,
)
############
# Datasets #
############
assert ph3py.dataset is None
assert ph3py.phonon_dataset is None
load_dataset_and_phonon_dataset(
ph3py,
ph3py_yaml=cast(Phono3pyYaml, cell_info.phonopy_yaml),
@ -1210,7 +1204,7 @@ def main(**argparse_control):
###################
# polynomial MLPs #
###################
if load_phono3py_yaml and settings.use_pypolymlp:
if settings.use_pypolymlp:
assert ph3py.mlp_dataset is None
if ph3py.dataset is not None:
ph3py.mlp_dataset = ph3py.dataset
@ -1249,22 +1243,20 @@ def main(**argparse_control):
"Generate displacements (--rd or -d) for proceeding to phonon "
"calculations."
)
finalize_phono3py(
_finalize_phono3py(
ph3py, confs_dict, log_level, filename=output_yaml_filename
)
###################
# Force constants #
###################
assert ph3py.fc2 is None
assert ph3py.fc3 is None
_store_force_constants(ph3py, settings, log_level)
###########################
# Produce force constants #
###########################
_produce_force_constants(ph3py, settings, log_level)
############################################
# Phonon Gruneisen parameter and then exit #
############################################
if settings.is_gruneisen:
run_gruneisen_then_exit(ph3py, settings, output_filename, log_level)
_run_gruneisen_then_exit(ph3py, settings, output_filename, log_level)
#################
# Show settings #
@ -1276,7 +1268,7 @@ def main(**argparse_control):
# Joint DOS and then exit #
###########################
if run_mode == "jdos":
run_jdos_then_exit(
_run_jdos_then_exit(
ph3py, settings, updated_settings, output_filename, log_level
)
@ -1303,13 +1295,13 @@ def main(**argparse_control):
# Phonon-isotope lifetime and then exit #
#########################################
if run_mode == "isotope":
run_isotope_then_exit(ph3py, settings, updated_settings, log_level)
_run_isotope_then_exit(ph3py, settings, updated_settings, log_level)
########################################
# Initialize phonon-phonon interaction #
########################################
if run_mode is not None:
init_phph_interaction(
_init_phph_interaction(
ph3py,
settings,
updated_settings,
@ -1323,7 +1315,7 @@ def main(**argparse_control):
#######################################################
if run_mode == "imag_self_energy":
ph3py.run_imag_self_energy(
settings_to_grid_points(settings, ph3py.grid),
_settings_to_grid_points(settings, ph3py.grid),
updated_settings["temperature_points"],
frequency_step=updated_settings["frequency_step"],
num_frequency_points=updated_settings["num_frequency_points"],
@ -1339,7 +1331,7 @@ def main(**argparse_control):
#####################################################
elif run_mode == "real_self_energy":
ph3py.run_real_self_energy(
settings_to_grid_points(settings, ph3py.grid),
_settings_to_grid_points(settings, ph3py.grid),
updated_settings["temperature_points"],
frequency_step=updated_settings["frequency_step"],
num_frequency_points=updated_settings["num_frequency_points"],
@ -1353,7 +1345,7 @@ def main(**argparse_control):
#######################################################
elif run_mode == "spectral_function":
ph3py.run_spectral_function(
settings_to_grid_points(settings, ph3py.grid),
_settings_to_grid_points(settings, ph3py.grid),
updated_settings["temperature_points"],
frequency_step=updated_settings["frequency_step"],
num_frequency_points=updated_settings["num_frequency_points"],
@ -1367,7 +1359,7 @@ def main(**argparse_control):
# Run lattice thermal conductivity #
####################################
elif run_mode == "conductivity-RTA" or run_mode == "conductivity-LBTE":
grid_points = settings_to_grid_points(settings, ph3py.grid)
grid_points = _settings_to_grid_points(settings, ph3py.grid)
ph3py.run_thermal_conductivity(
is_LBTE=settings.is_lbte,
temperatures=updated_settings["temperatures"],
@ -1407,4 +1399,4 @@ def main(**argparse_control):
+ "-" * 11
)
finalize_phono3py(ph3py, confs_dict, log_level, filename=output_yaml_filename)
_finalize_phono3py(ph3py, confs_dict, log_level, filename=output_yaml_filename)

View File

@ -86,8 +86,12 @@ class Phono3pySettings(Settings):
self.max_freepath = None
self.num_points_in_batch = None
self.read_collision = None
self.read_fc2 = False
self.read_fc3 = False
if load_phono3py_yaml:
self.read_fc2 = True
self.read_fc3 = True
else:
self.read_fc2 = False
self.read_fc3 = False
self.read_gamma = False
self.read_phonon = False
self.read_pp = False
@ -199,86 +203,128 @@ class Phono3pyConfParser(ConfParser):
if "ion_clamped" in args:
if args.ion_clamped:
self._confs["ion_clamped"] = ".true."
elif args.ion_clamped is False:
self._confs["ion_clamped"] = ".false."
if "is_bterta" in args:
if args.is_bterta:
self._confs["bterta"] = ".true."
elif args.is_bterta is False:
self._confs["bterta"] = ".false."
if "is_compact_fc" in args:
if args.is_compact_fc:
self._confs["compact_fc"] = ".true."
elif args.is_compact_fc is False:
self._confs["compact_fc"] = ".false."
if "emulate_v2" in args:
if args.emulate_v2:
self._confs["emulate_v2"] = ".true."
elif args.emulate_v2 is False:
self._confs["emulate_v2"] = ".false."
if "is_gruneisen" in args:
if args.is_gruneisen:
self._confs["gruneisen"] = ".true."
elif args.is_gruneisen is False:
self._confs["gruneisen"] = ".false."
if "is_fc3_r0_average" in args:
if args.is_fc3_r0_average:
self._confs["fc3_r0_average"] = ".true."
elif args.is_fc3_r0_average is False:
self._confs["fc3_r0_average"] = ".false."
if "is_full_pp" in args:
if args.is_full_pp:
self._confs["full_pp"] = ".true."
elif args.is_full_pp is False:
self._confs["full_pp"] = ".false."
if "is_imag_self_energy" in args:
if args.is_imag_self_energy:
self._confs["imag_self_energy"] = ".true."
elif args.is_imag_self_energy is False:
self._confs["imag_self_energy"] = ".false."
if "is_isotope" in args:
if args.is_isotope:
self._confs["isotope"] = ".true."
elif args.is_isotope is False:
self._confs["isotope"] = ".false."
if "is_joint_dos" in args:
if args.is_joint_dos:
self._confs["joint_dos"] = ".true."
elif args.is_joint_dos is False:
self._confs["joint_dos"] = ".false."
if "no_kappa_stars" in args:
if args.no_kappa_stars:
if "no_kappa_star" in args:
if args.kappa_star:
self._confs["kappa_star"] = ".true."
elif args.kappa_star is False:
self._confs["kappa_star"] = ".false."
if "is_lbte" in args:
if args.is_lbte:
self._confs["lbte"] = ".true."
elif args.is_lbte is False:
self._confs["lbte"] = ".false."
if "is_N_U" in args:
if args.is_N_U:
self._confs["N_U"] = ".true."
elif args.is_N_U is False:
self._confs["N_U"] = ".false."
if "is_plusminus_displacements_fc2" in args:
if args.is_plusminus_displacements_fc2:
self._confs["pm_fc2"] = ".true."
elif args.is_plusminus_displacements_fc2 is False:
self._confs["pm_fc2"] = ".false."
if "is_real_self_energy" in args:
if args.is_real_self_energy:
self._confs["real_self_energy"] = ".true."
elif args.is_real_self_energy is False:
self._confs["real_self_energy"] = ".false."
if "is_reducible_collision_matrix" in args:
if args.is_reducible_collision_matrix:
self._confs["reducible_collision_matrix"] = ".true."
elif args.is_reducible_collision_matrix is False:
self._confs["reducible_collision_matrix"] = ".false."
if "is_spectral_function" in args:
if args.is_spectral_function:
self._confs["spectral_function"] = ".true."
elif args.is_spectral_function is False:
self._confs["spectral_function"] = ".false."
if "is_symmetrize_fc2" in args:
if args.is_symmetrize_fc2:
self._confs["symmetrize_fc2"] = ".true."
elif args.is_symmetrize_fc2 is False:
self._confs["symmetrize_fc2"] = ".false."
if "is_symmetrize_fc3_q" in args:
if args.is_symmetrize_fc3_q:
self._confs["symmetrize_fc3_q"] = ".true."
elif args.is_symmetrize_fc3_q is False:
self._confs["symmetrize_fc3_q"] = ".false."
if "is_symmetrize_fc3_r" in args:
if args.is_symmetrize_fc3_r:
self._confs["symmetrize_fc3_r"] = ".true."
elif args.is_symmetrize_fc3_r is False:
self._confs["symmetrize_fc3_r"] = ".false."
if "is_tetrahedron_method" in args:
if args.is_tetrahedron_method:
self._confs["tetrahedron"] = ".true."
elif args.is_tetrahedron_method is False:
self._confs["tetrahedron"] = ".false."
if "is_wigner_kappa" in args:
if args.is_wigner_kappa:
@ -335,22 +381,32 @@ class Phono3pyConfParser(ConfParser):
if "read_fc2" in args:
if args.read_fc2:
self._confs["read_fc2"] = ".true."
elif args.read_fc2 is False:
self._confs["read_fc2"] = ".false."
if "read_fc3" in args:
if args.read_fc3:
self._confs["read_fc3"] = ".true."
elif args.read_fc3 is False:
self._confs["read_fc3"] = ".false."
if "read_gamma" in args:
if args.read_gamma:
self._confs["read_gamma"] = ".true."
elif args.read_gamma is False:
self._confs["read_gamma"] = ".false."
if "read_phonon" in args:
if args.read_phonon:
self._confs["read_phonon"] = ".true."
elif args.read_phonon is False:
self._confs["read_phonon"] = ".false."
if "read_pp" in args:
if args.read_pp:
self._confs["read_pp"] = ".true."
elif args.read_pp is False:
self._confs["read_pp"] = ".false."
if "read_collision" in args:
if args.read_collision is not None:
@ -368,10 +424,14 @@ class Phono3pyConfParser(ConfParser):
if "solve_collective_phonon" in args:
if args.solve_collective_phonon:
self._confs["collective_phonon"] = ".true."
elif args.solve_collective_phonon is False:
self._confs["collective_phonon"] = ".false."
if "show_symfc_memory_usage" in args:
if args.show_symfc_memory_usage:
self._confs["show_symfc_memory_usage"] = ".true."
elif args.show_symfc_memory_usage is False:
self._confs["show_symfc_memory_usage"] = ".false."
if "subtract_forces" in args:
if args.subtract_forces:
@ -392,34 +452,50 @@ class Phono3pyConfParser(ConfParser):
if "use_ave_pp" in args:
if args.use_ave_pp:
self._confs["use_ave_pp"] = ".true."
elif args.use_ave_pp is False:
self._confs["use_ave_pp"] = ".false."
if "use_grg" in args:
if args.use_grg:
self._confs["use_grg"] = ".true."
elif args.use_grg is False:
self._confs["use_grg"] = ".false."
if "write_gamma_detail" in args:
if args.write_gamma_detail:
self._confs["write_gamma_detail"] = ".true."
elif args.write_gamma_detail is False:
self._confs["write_gamma_detail"] = ".false."
if "write_gamma" in args:
if args.write_gamma:
self._confs["write_gamma"] = ".true."
elif args.write_gamma is False:
self._confs["write_gamma"] = ".false."
if "write_collision" in args:
if args.write_collision:
self._confs["write_collision"] = ".true."
elif args.write_collision is False:
self._confs["write_collision"] = ".false."
if "write_phonon" in args:
if args.write_phonon:
self._confs["write_phonon"] = ".true."
elif args.write_phonon is False:
self._confs["write_phonon"] = ".false."
if "write_pp" in args:
if args.write_pp:
self._confs["write_pp"] = ".true."
elif args.write_pp is False:
self._confs["write_pp"] = ".false."
if "write_LBTE_solution" in args:
if args.write_LBTE_solution:
self._confs["write_LBTE_solution"] = ".true."
elif args.write_LBTE_solution is False:
self._confs["write_LBTE_solution"] = ".false."
def _parse_conf(self):
super()._parse_conf()