mirror of https://github.com/phonopy/phono3py.git
Display interface mode in CLI
This commit is contained in:
parent
dd4c43ab10
commit
3eaa76fa2c
|
@ -86,8 +86,7 @@ These options have no respective configuration file tags.
|
|||
|
||||
This is used to create `FORCES_FC3` from `phono3py_disp.yaml` and force
|
||||
calculator outputs containing forces in supercells. `phono3py_disp.yaml` has to
|
||||
be located at the current directory. Calculator interface has to be specified
|
||||
except for VASP (default) case.
|
||||
be located at the current directory.
|
||||
|
||||
```bash
|
||||
% phono3py --cf3 disp-{00001..00755}/vasprun.xml
|
||||
|
@ -97,14 +96,26 @@ except for VASP (default) case.
|
|||
% phono3py --cf3 supercell_out/disp-{00001..00111}/Si.out
|
||||
```
|
||||
|
||||
````{note}
|
||||
The calculator interface should be stored in `phono3py_disp.yaml`, so it is not
|
||||
needed to set it manually. Command-line-options like `--qe` will be ignored. If
|
||||
the calculator interface is missing from `phono3py_disp.yaml` but needed, please
|
||||
update the `phono3py` section in the file as follows:
|
||||
|
||||
```yaml
|
||||
phono3py:
|
||||
calculator: qe
|
||||
```
|
||||
````
|
||||
|
||||
(cf3_file_option)=
|
||||
|
||||
### `--cf3-file` (command option only)
|
||||
|
||||
This is used to create `FORCES_FC3` from a text file containing a list of
|
||||
calculator output file names. `phono3py_disp.yaml` has to be located at the
|
||||
current directory. Calculator interface has to be specified except for VASP
|
||||
(default) case.
|
||||
current directory. The calculator interface is unnecessary to specify, see the
|
||||
note at {ref}`--cf3 <cf3_option>`.
|
||||
|
||||
```bash
|
||||
% phono3py --cf3-file file_list.dat
|
||||
|
@ -130,8 +141,9 @@ together with `--cutoff-pair` option.
|
|||
|
||||
This is used to create `FORCES_FC2` similarly to `--cf3` option.
|
||||
`phono3py_disp.yaml` has to be located at the current directory. This is
|
||||
optional. Calculator interface has to be specified except for VASP (default)
|
||||
case. `FORCES_FC2` is necessary to run with `--dim-fc2` option.
|
||||
optional. `FORCES_FC2` is necessary to run with `--dim-fc2` option. The
|
||||
calculator interface is unnecessary to specify, see the note at {ref}`--cf3
|
||||
<cf3_option>`.
|
||||
|
||||
```bash
|
||||
% phono3py --cf2 disp_fc2-{00001..00002}/vasprun.xml
|
||||
|
@ -142,8 +154,8 @@ case. `FORCES_FC2` is necessary to run with `--dim-fc2` option.
|
|||
### `--cfz` (command option only)
|
||||
|
||||
This is used to create `FORCES_FC3` and `FORCES_FC2` subtracting residual forces
|
||||
combined with `--cf3` and `--cf2`, respectively. Calculator interface has to be
|
||||
specified except for VASP (default) case.
|
||||
combined with `--cf3` and `--cf2`, respectively. The calculator interface is
|
||||
unnecessary to specify, see the note at {ref}`--cf3 <cf3_option>`.
|
||||
|
||||
In the following example, it is supposed that `disp3-00000/vasprun.xml` and
|
||||
`disp2-00000/vasprun.xml` contain the forces of the perfect supercells. In ideal
|
||||
|
@ -204,7 +216,6 @@ When using with `--cf2`, `--cf3` has to be specified simultaneously as below,
|
|||
% phono3py --cf3 disp-{00001..00755}/vasprun.xml --cf2 disp_fc2-{00001..00002}/vasprun.xml --sp
|
||||
```
|
||||
|
||||
|
||||
## Supercell, primitive cell, masses, magnetic moments
|
||||
|
||||
(dim_option)=
|
||||
|
@ -299,6 +310,7 @@ web page](https://phonopy.github.io/phonopy/setting-tags.html#magmom).
|
|||
## Displacement creation
|
||||
|
||||
(create_displacements_option)=
|
||||
|
||||
### `-d` (`CREATE_DISPLACEMENTS = .TRUE.`)
|
||||
|
||||
**`phono3py-load` doesn't have this option.**
|
||||
|
@ -317,6 +329,7 @@ information about primitive cell (`primitive_matrix` key) in
|
|||
```
|
||||
|
||||
(random_displacements_option)=
|
||||
|
||||
### `--rd` (`RANDOM_DISPLACEMENTS`), `--rd-fc2` (`RANDOM_DISPLACEMENTS_FC2`) and `--random-seed` (`RANDOM_SEED`)
|
||||
|
||||
**`phono3py-load` doesn't have this option.**
|
||||
|
@ -336,6 +349,7 @@ and/or `--rd-fc2`,
|
|||
```
|
||||
|
||||
(amplitude_option)=
|
||||
|
||||
### `--amplitude` (`DISPLACEMENT_DISTANCE`)
|
||||
|
||||
**`phono3py-load` doesn't have this option.**
|
||||
|
@ -348,6 +362,7 @@ The default value depends on calculator. See
|
|||
{ref}`default_displacement_distance_for_calculator`.
|
||||
|
||||
(fc_calculator_option)=
|
||||
|
||||
### `--fc-calc`, `--fc-calculator` (`FC_CALCULATOR`)
|
||||
|
||||
Choice of force constants calculator.
|
||||
|
@ -357,14 +372,17 @@ Choice of force constants calculator.
|
|||
```
|
||||
|
||||
To use different force constants calculators for fc2 and fc3
|
||||
|
||||
```bash
|
||||
% phono3py-load --fc-calc "symfc|" ...
|
||||
```
|
||||
|
||||
Those for fc2 and fc3 are seprated by `|` such as `symfc|` . Blank means to
|
||||
employ the finite difference method for systematic displacements generated by
|
||||
the option `-d`.
|
||||
|
||||
(fc_calculator_options_option)=
|
||||
|
||||
### `--fc-calc-opt`, `--fc-calculator-options` (`FC_CALCULATOR_OPTIONS`)
|
||||
|
||||
Special options for force constants calculators.
|
||||
|
@ -608,9 +626,9 @@ $$
|
|||
\bigl|\Phi_{-\lambda\lambda'\lambda''}\bigl|^2
|
||||
\left\{(n_{\lambda'}+ n_{\lambda''}+1)
|
||||
\delta(\omega-\omega_{\lambda'}-\omega_{\lambda''}) \right.
|
||||
+ (n_{\lambda'}-n_{\lambda''})
|
||||
* (n_{\lambda'}-n_{\lambda''})
|
||||
\left[\delta(\omega+\omega_{\lambda'}-\omega_{\lambda''})
|
||||
+ \left. \delta(\omega-\omega_{\lambda'}+\omega_{\lambda''})
|
||||
* \left. \delta(\omega-\omega_{\lambda'}+\omega_{\lambda''})
|
||||
\right]\right\}.
|
||||
$$
|
||||
|
||||
|
@ -840,7 +858,7 @@ $$
|
|||
\bigl|\Phi_{-\lambda\lambda_1\lambda_2}\bigl|^2
|
||||
(n_{\lambda_1}-n_{\lambda_2})
|
||||
\left[\delta(\omega+\omega_{\lambda_1}-\omega_{\lambda_2})
|
||||
+ \delta(\omega-\omega_{\lambda_1}+\omega_{\lambda_2})
|
||||
* \delta(\omega-\omega_{\lambda_1}+\omega_{\lambda_2})
|
||||
\right]
|
||||
\end{align*}
|
||||
$$
|
||||
|
@ -854,7 +872,7 @@ $$
|
|||
\bigl|\Phi_{-\lambda\lambda_1\lambda_2}\bigl|^2
|
||||
(n_{\lambda_1}+ n_{\lambda_2}+1)
|
||||
\left[ \delta(\omega-\omega_{\lambda_1}-\omega_{\lambda_2})
|
||||
+ \delta(\omega + \omega_{\lambda_1} + \omega_{\lambda_2}) \right]
|
||||
* \delta(\omega + \omega_{\lambda_1} + \omega_{\lambda_2}) \right]
|
||||
\end{align*},
|
||||
$$
|
||||
|
||||
|
@ -922,11 +940,11 @@ $$
|
|||
\bigl|\Phi_{-\lambda\lambda_1\lambda_2}\bigl|^2 &
|
||||
\left\{(n_{\lambda_1}+ n_{\lambda_2}+1)
|
||||
\left[ \delta(\omega-\omega_{\lambda_1}-\omega_{\lambda_2})
|
||||
+ \delta(\omega+\omega_{\lambda_1}+\omega_{\lambda_2}) \right] \right.
|
||||
* \delta(\omega+\omega_{\lambda_1}+\omega_{\lambda_2}) \right] \right.
|
||||
\\
|
||||
& + (n_{\lambda_1}-n_{\lambda_2})
|
||||
\left[\delta(\omega+\omega_{\lambda_1}-\omega_{\lambda_2})
|
||||
+ \left. \delta(\omega-\omega_{\lambda_1}+\omega_{\lambda_2})
|
||||
* \left. \delta(\omega-\omega_{\lambda_1}+\omega_{\lambda_2})
|
||||
\right]\right\},
|
||||
\end{align*}
|
||||
$$
|
||||
|
@ -941,14 +959,14 @@ $$
|
|||
\left\{
|
||||
\left[ \frac{(n_{\lambda_1}+ n_{\lambda_2}+1)}{
|
||||
(\omega-\omega_{\lambda_1}-\omega_{\lambda_2})_\mathrm{p}}
|
||||
+ \frac{(n_{\lambda_1}+ n_{\lambda_2}+1)}{
|
||||
* \frac{(n_{\lambda_1}+ n_{\lambda_2}+1)}{
|
||||
(\omega+\omega_{\lambda_1}+\omega_{\lambda_2})_\mathrm{p}}
|
||||
\right]
|
||||
\right. \\
|
||||
& + \left[
|
||||
\frac{(n_{\lambda_1}-n_{\lambda_2})}{(\omega +
|
||||
\omega_{\lambda_1} - \omega_{\lambda_2})_\mathrm{p}}
|
||||
+ \left. \frac{(n_{\lambda_1}-n_{\lambda_2})}{(\omega -
|
||||
* \left. \frac{(n_{\lambda_1}-n_{\lambda_2})}{(\omega -
|
||||
\omega_{\lambda_1} + \omega_{\lambda_2})_\mathrm{p}}
|
||||
\right]\right\},
|
||||
\end{align*}
|
||||
|
@ -1012,7 +1030,7 @@ A_\lambda(\omega) = \frac{1}{\pi} \frac{4\Omega^2_\lambda
|
|||
\Gamma_\lambda(\omega)}
|
||||
{\left[\omega^2 - \Omega^2_\lambda -
|
||||
2\Omega_\lambda \Delta_\lambda(\omega) \right]^2
|
||||
+ \left[ 2\Omega_\lambda
|
||||
* \left[ 2\Omega_\lambda
|
||||
\Gamma_\lambda(\omega) \right]^2},
|
||||
$$
|
||||
|
||||
|
@ -1348,12 +1366,12 @@ Using this option, output file names are slightly modified. For example, with
|
|||
|
||||
This rule is applied to
|
||||
|
||||
+ `fc3.hdf5`
|
||||
+ `fc2.hdf5`
|
||||
+ `kappa-xxx.hdf5`
|
||||
+ `phonon-xxx.hdf5`
|
||||
+ `pp-xxx.hdf5`
|
||||
+ `gamma_detail-xxx.hdf5` (write only)
|
||||
* `fc3.hdf5`
|
||||
* `fc2.hdf5`
|
||||
* `kappa-xxx.hdf5`
|
||||
* `phonon-xxx.hdf5`
|
||||
* `pp-xxx.hdf5`
|
||||
* `gamma_detail-xxx.hdf5` (write only)
|
||||
|
||||
(input_filename_option)=
|
||||
|
||||
|
@ -1367,11 +1385,11 @@ specifying `-i iso --fc3`, a file name `fc3.iso.hdf5` is read instead of
|
|||
|
||||
This rule is applied to
|
||||
|
||||
+ `fc3.hdf5`
|
||||
+ `fc2.hdf5`
|
||||
+ `kappa-xxx.hdf5`
|
||||
+ `phonon-xxx.hdf5`
|
||||
+ `pp-xxx.hdf5`
|
||||
* `fc3.hdf5`
|
||||
* `fc2.hdf5`
|
||||
* `kappa-xxx.hdf5`
|
||||
* `phonon-xxx.hdf5`
|
||||
* `pp-xxx.hdf5`
|
||||
|
||||
### `--io` (command option only)
|
||||
|
||||
|
|
|
@ -259,7 +259,6 @@ def parse_forces(
|
|||
distance_to_A=physical_units["distance_to_A"],
|
||||
force_to_eVperA=physical_units["force_to_eVperA"],
|
||||
)
|
||||
|
||||
assert dataset is not None
|
||||
|
||||
if "natom" in dataset and dataset["natom"] != natom:
|
||||
|
@ -273,6 +272,12 @@ def parse_forces(
|
|||
f'Displacement dataset for {fc_type} was read from "{filename_read_from}".'
|
||||
)
|
||||
|
||||
if calculator is not None and log_level:
|
||||
print(
|
||||
f"Displacements and forces were converted from {calculator} "
|
||||
"unit to A and eV/A."
|
||||
)
|
||||
|
||||
# Overwrite dataset['cutoff_distance'] when necessary.
|
||||
if fc_type == "fc3" and cutoff_pair_distance:
|
||||
if "cutoff_distance" not in dataset or (
|
||||
|
|
|
@ -44,7 +44,7 @@ import numpy as np
|
|||
from phonopy.cui.create_force_sets import check_number_of_force_files
|
||||
from phonopy.cui.load_helper import get_nac_params
|
||||
from phonopy.cui.phonopy_script import file_exists, files_exist, print_error
|
||||
from phonopy.file_IO import parse_FORCE_SETS, write_FORCE_SETS
|
||||
from phonopy.file_IO import is_file_phonopy_yaml, parse_FORCE_SETS, write_FORCE_SETS
|
||||
from phonopy.interface.calculator import get_calc_dataset
|
||||
|
||||
from phono3py.file_IO import (
|
||||
|
@ -72,10 +72,24 @@ def create_FORCES_FC3_and_FORCES_FC2(
|
|||
|
||||
"""
|
||||
interface_mode = settings.calculator
|
||||
|
||||
disp_filename_candidates = [
|
||||
"phono3py_disp.yaml",
|
||||
]
|
||||
if cell_filename is not None:
|
||||
|
||||
if log_level:
|
||||
print("")
|
||||
|
||||
if (
|
||||
log_level
|
||||
and cell_filename is not None
|
||||
and not is_file_phonopy_yaml(cell_filename, keyword="phono3py")
|
||||
):
|
||||
print(f'*Unnecessary to specify "{cell_filename}".')
|
||||
|
||||
if cell_filename is not None and is_file_phonopy_yaml(
|
||||
cell_filename, keyword="phono3py"
|
||||
):
|
||||
disp_filename_candidates.insert(0, cell_filename)
|
||||
disp_filenames = files_exist(
|
||||
disp_filename_candidates, log_level=log_level, is_any=True
|
||||
|
@ -86,6 +100,10 @@ def create_FORCES_FC3_and_FORCES_FC2(
|
|||
if ph3py_yaml.calculator is not None:
|
||||
interface_mode = ph3py_yaml.calculator # overwrite
|
||||
|
||||
if interface_mode is not None:
|
||||
if log_level:
|
||||
print(f"Calculator interface: {interface_mode}")
|
||||
|
||||
if settings.create_forces_fc3 or settings.create_forces_fc3_file:
|
||||
calc_dataset_fc3 = _get_force_sets_fc3(
|
||||
settings, ph3py_yaml.dataset, disp_filename, interface_mode, log_level
|
||||
|
@ -172,7 +190,9 @@ def create_FORCE_SETS_from_FORCES_FCx(
|
|||
phonon_smat, input_filename: Optional[str], cell_filename: Optional[str], log_level
|
||||
):
|
||||
"""Convert FORCES_FC3 or FORCES_FC2 to FORCE_SETS."""
|
||||
if cell_filename is not None:
|
||||
if cell_filename is not None and is_file_phonopy_yaml(
|
||||
cell_filename, keyword="phono3py"
|
||||
):
|
||||
disp_filename = cell_filename
|
||||
elif input_filename is None:
|
||||
disp_filename = "phono3py_disp.yaml"
|
||||
|
@ -286,7 +306,6 @@ def _get_force_sets_fc3(
|
|||
settings, disp_dataset, disp_filename, interface_mode, log_level
|
||||
) -> dict:
|
||||
if log_level:
|
||||
print("")
|
||||
print(f'FC3 Displacement dataset was read from "{disp_filename}".')
|
||||
|
||||
if "first_atoms" in disp_dataset: # type-1
|
||||
|
|
|
@ -281,7 +281,7 @@ def read_phono3py_settings(args, argparse_control, log_level):
|
|||
args=args, default_settings=argparse_control
|
||||
)
|
||||
cell_filename = args.filename[0]
|
||||
else:
|
||||
else: # args.filename[0] is assumed to be phono3py-conf file.
|
||||
phono3py_conf_parser = Phono3pyConfParser(
|
||||
filename=args.filename[0],
|
||||
args=args,
|
||||
|
@ -1033,6 +1033,7 @@ def main(**argparse_control):
|
|||
unitcell_filename,
|
||||
input_filename,
|
||||
output_filename,
|
||||
interface_mode,
|
||||
)
|
||||
|
||||
if phono3py.supercell.magnetic_moments is None:
|
||||
|
|
|
@ -46,7 +46,13 @@ from phono3py.cui.settings import Phono3pySettings
|
|||
|
||||
|
||||
def show_general_settings(
|
||||
settings, run_mode, phono3py, cell_filename, input_filename, output_filename
|
||||
settings,
|
||||
run_mode,
|
||||
phono3py,
|
||||
cell_filename,
|
||||
input_filename,
|
||||
output_filename,
|
||||
interface_mode,
|
||||
):
|
||||
"""Show general setting information."""
|
||||
is_primitive_axes_auto = (
|
||||
|
@ -58,28 +64,32 @@ def show_general_settings(
|
|||
phonon_supercell_matrix = phono3py.phonon_supercell_matrix
|
||||
|
||||
print("-" * 29 + " General settings " + "-" * 29)
|
||||
print("Run mode: %s" % run_mode)
|
||||
if run_mode:
|
||||
print("Run mode: {run_mode}")
|
||||
if output_filename:
|
||||
print("Output filename is modified by %s." % output_filename)
|
||||
print(f"Output filename is modified by {output_filename}.")
|
||||
if input_filename:
|
||||
print("Input filename is modified by %s." % input_filename)
|
||||
print(f"Input filename is modified by {input_filename}.")
|
||||
if settings.hdf5_compression:
|
||||
print("HDF5 data compression filter: %s" % settings.hdf5_compression)
|
||||
|
||||
if phono3py.calculator:
|
||||
print("Calculator interface: %s" % phono3py.calculator)
|
||||
print('Crystal structure was read from "%s".' % cell_filename)
|
||||
print(f"HDF5 data compression filter: {settings.hdf5_compression}")
|
||||
if interface_mode:
|
||||
print(
|
||||
f'Crystal structure was read from "{cell_filename}" '
|
||||
f"in {interface_mode} unit."
|
||||
)
|
||||
else:
|
||||
print(f'Crystal structure was read from "{cell_filename}".')
|
||||
|
||||
print_supercell_matrix(supercell_matrix, phonon_supercell_matrix)
|
||||
|
||||
if is_primitive_axes_auto:
|
||||
print("Primitive matrix (Auto):")
|
||||
for v in primitive_matrix:
|
||||
print(" %s" % v)
|
||||
print(f" {v}")
|
||||
elif primitive_matrix is not None:
|
||||
print("Primitive matrix:")
|
||||
for v in primitive_matrix:
|
||||
print(" %s" % v)
|
||||
print(f" {v}")
|
||||
|
||||
|
||||
def print_supercell_matrix(
|
||||
|
|
Loading…
Reference in New Issue