From 40bcf81a60a4a54b6169436856650015f85029e0 Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Sun, 5 Jan 2025 09:01:56 +0900 Subject: [PATCH 01/10] Update documentation --- doc/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.md b/doc/changelog.md index 0219934..d4881f4 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,7 +2,7 @@ # Change Log -## Jan-5-2024: Version 0.8.0 +## Jan-5-2025: Version 0.8.0 - Refactoring of `Phelel` class - Major update of documentation From a0c745d8fcf80d46c43ffceff3402485d6de810b Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Sun, 5 Jan 2025 15:15:41 +0900 Subject: [PATCH 02/10] Update documentation --- doc/install.md | 44 ++++++++++++++++ doc/phelel-command.md | 2 +- doc/velph-command.md | 118 +++++++++++++++++++++--------------------- 3 files changed, 103 insertions(+), 61 deletions(-) diff --git a/doc/install.md b/doc/install.md index 1d2669b..ccdf701 100644 --- a/doc/install.md +++ b/doc/install.md @@ -32,3 +32,47 @@ From source code of phelel, ``` The pypi package is also available. + +## `phelel` and `velph` commands + +Installing the phelel package makes the `phelel` and `velph` commands available. +Their usage is described in {ref}`phelel_command` and {ref}`velph_command`, +respectively. Additionally, the `velph` command supports shell completion, which +requires further configuration as described in the next section. + +### Shell completion of `velph` command + +Velph relies on [click](https://click.palletsprojects.com), and shell completion +is provided for popular shell implementations, see +[shell-completion](https://click.palletsprojects.com/en/stable/shell-completion/). + +For example using bash (zsh) in conda environment, write the following line + +``` +eval "$(_VELPH_COMPLETE=bash_source velph)" # BASH +``` + +``` +eval "$(_VELPH_COMPLETE=zsh_source velph)" # ZSH +``` + +in `~/.bashrc` (`~/.zshrc`), or in a conda environment in +`$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh`. + +After setting and reloading the configuration file (e.g., `~/.bashrc`), +sub-commands are listed by pushing tab key: + +```bash +% velph [PUSH-TAB-KEY] +el_bands -- Choose electronic band structure options. +generate -- Write POSCAR-unitcell and POSCAR-primitive. +hints -- Show velph command hints. +init -- Initialize an electron phonon calculation... +nac -- Choose nac options. +ph_bands -- Choose phonon band structure options. +phelel -- Choose supercell options. +phono3py -- Choose phono3py options. +relax -- Choose relax options. +selfenergy -- Choose selfenergy options. +transport -- Choose transport options. +``` diff --git a/doc/phelel-command.md b/doc/phelel-command.md index 1fd39da..567342c 100644 --- a/doc/phelel-command.md +++ b/doc/phelel-command.md @@ -1,5 +1,5 @@ (phelel_command)= -# phelel command +# `phelel` command Command-line tools perform steps 1 and 3 in {ref}`the el-ph calculation workflow `. Their usage parallels that of the `phonopy` diff --git a/doc/velph-command.md b/doc/velph-command.md index 746a60b..679f956 100644 --- a/doc/velph-command.md +++ b/doc/velph-command.md @@ -1,62 +1,55 @@ (velph_command)= -# velph command +# `velph` command -The `velph` command is a convenient tool to systematically perform -electron-phonon interaction calculations with VASP code and analyze the results. -Velph works in combination of command options. The `velph` command is installed -along with the installation of phelel. +The `velph` command is a convenient tool for systematically performing +electron-phonon interaction calculations using the VASP code and for analyzing +the resulting data. -The `velph` command orchestrates el-ph calculation {ref}`workflow ` by -running its sub-commands in a specific sequence. These `velph` sub-commands can -perform the following operations: +## What does the `velph` command do? -- Execute `phelel`. -- Generate VASP input files for the following calculations (required for the - subsequent electron-phonon interaction calculation): - - Dielectric constant - - Born effective charges - - Electronic band structure and density of states -- Generate VASP input files for phonon and lattice thermal conductivity - calculations using phonopy and phono3py. +The `velph` command orchestrates the electron-phonon (el-ph) calculation +workflow {ref}`workflow ` by running a series of subcommands in a +specific sequence. These subcommands can: -## Shell completion +- Execute `phelel`. +- Generate VASP input files for: + - Dielectric constant calculations + - Born effective charge calculations + - Electronic band structure and density of states calculations + (all of which are required for subsequent electron-phonon interaction calculations) +- Generate VASP input files for phonon and lattice thermal conductivity calculations using phonopy and phono3py. -Velph relies on [click](https://click.palletsprojects.com), and shell completion -is provided for popular shell implementations, see -[shell-completion](https://click.palletsprojects.com/en/stable/shell-completion/). +## Listing `velph` subcommands -For example using bash (zsh) in conda environment, write the following line +You can see a list of supported subcommands by simply typing: ``` -eval "$(_VELPH_COMPLETE=bash_source velph)" # BASH -``` +% velph +Usage: velph [OPTIONS] COMMAND [ARGS]... -``` -eval "$(_VELPH_COMPLETE=zsh_source velph)" # ZSH -``` + Command-line utility to help VASP el-ph calculation. -in `~/.bashrc` (`~/.zshrc`), or in a conda environment in -`$CONDA_PREFIX/etc/conda/activate.d/env_vars.sh`. +Options: + -h, --help Show this message and exit. -After setting and reloading the configuration file (e.g., `~/.bashrc`), -sub-commands are listed by pushing tab key: - -```bash -% velph [PUSH-TAB-KEY] -el_bands -- Choose electronic band structure options. -generate -- Write POSCAR-unitcell and POSCAR-primitive. -hints -- Show velph command hints. -init -- Initialize an electron phonon calculation... -nac -- Choose nac options. -ph_bands -- Choose phonon band structure options. -phelel -- Choose supercell options. -phono3py -- Choose phono3py options. -relax -- Choose relax options. -selfenergy -- Choose selfenergy options. -transport -- Choose transport options. +Commands: + el_bands Choose electronic band structure options. + generate Write POSCAR-unitcell and POSCAR-primitive. + hints Show velph command hints. + init Initialize an electron phonon calculation project. + nac Choose nac options. + ph_bands Choose phonon band structure options. + phelel Choose supercell options. + phono3py Choose phono3py options. + phonopy Choose phonopy options. + relax Choose relax options. + selfenergy Choose selfenergy options. + transport Choose transport options. ``` -## `velph-hints` +## `velph` command operations + +### `velph hints` This command provides a quick reference of calculation steps. @@ -64,7 +57,7 @@ This command provides a quick reference of calculation steps. % velph hints ``` -## `velph init` +### `velph init` `velph init` with command options will generate modified `velph.toml` from the template. @@ -79,61 +72,66 @@ options can be specified in `[init.options]` section of the velph-toml template file (see {ref}`velph-init-template`). -### `--template-toml` +#### `--template-toml` Using this option, `velph.toml` like file is read as the template instead of the template hard coded in velph code. -### `--tolerance` +#### `--tolerance` This is used for the symmetry check tolerance in Angstrom. Symmetry is searched always even without `--symmetrize`. -### `--symmetrize` +#### `--symmetrize` By default (no-symmetrize), the input POSCAR-type structure is simply used as the unit cell. With `--symmetrize`, input POSCAR-type structure is symmetrized and standardized conventional unit cell and primitive cell ("unitcell" and "primitive_cell", respectively) are written in `velph.toml`. -### `--no-find-primitive` +#### `--no-find-primitive` By this option, the input POSCAR-type structure is used as the primitive cell even if it is not a primitive cell. -### `--kspacing` and `--kspacing-dense` +#### `--kspacing` and `--kspacing-dense` Sampling k-point meshes are calculated from these values in the similar way to VASP `KSPACING` definition by overwriting the template. -### `--max-num-atoms` +#### `--max-num-atoms` Supercell shape is determined so that its number of atoms is equal or less than this number respecting the crystallographic point group. -### `--cell-for-relax` +#### `--phonopy-max-num-atoms` and `--phono3py-max-num-atoms` + +Supercell shapes for phonopy and phono3py are determined in the same manner as +`--max-num-atoms`. + +#### `--cell-for-relax` This chooses unit cell or primitive cell for structure optimization (`relax`). The default is `unitcell`. Specify `primitive` to use primitive cell. -### `--cell-for-nac` +#### `--cell-for-nac` This chooses unit cell or primitive cell for NAC calculation (`nac`). The default is `primitive`. Specify `primitive` to use primitive cell. -### `--primitive-cell-choice` +#### `--primitive-cell-choice` Primitive cell choice, "standardized" (default) or "reduced". -### `--use-grg` +#### `--use-grg` Use generalized regular grid. -### `--amplitude` +#### `--amplitude` Distance of displacements in Angstrom. -### `--magmom` +#### `--magmom` String corresponding to INCAR MAGMOM tag value for unit cell, e.g., "24*1" or "0 0 1". This is similar to `MAGMOM` tag in phonopy, see @@ -141,9 +139,9 @@ https://phonopy.github.io/phonopy/setting-tags.html#magmom. In velph, the asterisk symbol (`*`) is supported. (velph-init-template)= -## velph-init template +## `velph init` template -`velph-init` is the command to prepare `velph.toml`. Without specifying a +`velph init` is the command to prepare `velph.toml`. Without specifying a velph-toml-template, the default template is used. Custom template can be specified as follows: From 5bae3d7e3569d0f47f89848f0d67eb07c6a5e4ac Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Sun, 5 Jan 2025 20:38:45 +0900 Subject: [PATCH 03/10] Update documentation --- doc/index.md | 3 + doc/velph-command.md | 658 +-------------------------------------- doc/velph-example.md | 468 ++++++++++++++++++++++++++++ doc/velph-init.md | 187 +++++++++++ doc/velph-subcommands.md | 52 ++++ 5 files changed, 711 insertions(+), 657 deletions(-) create mode 100644 doc/velph-example.md create mode 100644 doc/velph-init.md create mode 100644 doc/velph-subcommands.md diff --git a/doc/index.md b/doc/index.md index bf425dd..26ba15c 100644 --- a/doc/index.md +++ b/doc/index.md @@ -31,5 +31,8 @@ install workflow phelel-command velph-command +velph-init +velph-subcommands +velph-example changelog ``` diff --git a/doc/velph-command.md b/doc/velph-command.md index 679f956..00c619d 100644 --- a/doc/velph-command.md +++ b/doc/velph-command.md @@ -47,666 +47,10 @@ Commands: transport Choose transport options. ``` -## `velph` command operations - -### `velph hints` +## `velph hints` This command provides a quick reference of calculation steps. ``` % velph hints ``` - -### `velph init` - -`velph init` with command options will generate modified `velph.toml` from the -template. -``` -% velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER -``` - -`velph init --help` shows short documents of the options. Two arguments have to -be specified, POSCAR-format crystal structure and directory name that is created -where `velph.toml` is stored. The available options are explained below. Some -options can be specified in `[init.options]` section of the velph-toml template -file (see {ref}`velph-init-template`). - - -#### `--template-toml` - -Using this option, `velph.toml` like file is read as the template instead of the -template hard coded in velph code. - -#### `--tolerance` - -This is used for the symmetry check tolerance in Angstrom. Symmetry is searched -always even without `--symmetrize`. - -#### `--symmetrize` - -By default (no-symmetrize), the input POSCAR-type structure is simply used as -the unit cell. With `--symmetrize`, input POSCAR-type structure is symmetrized -and standardized conventional unit cell and primitive cell ("unitcell" and -"primitive_cell", respectively) are written in `velph.toml`. - -#### `--no-find-primitive` - -By this option, the input POSCAR-type structure is used as the primitive cell -even if it is not a primitive cell. - -#### `--kspacing` and `--kspacing-dense` - -Sampling k-point meshes are calculated from these values in the similar way to -VASP `KSPACING` definition by overwriting the template. - -#### `--max-num-atoms` - -Supercell shape is determined so that its number of atoms is equal or less than -this number respecting the crystallographic point group. - -#### `--phonopy-max-num-atoms` and `--phono3py-max-num-atoms` - -Supercell shapes for phonopy and phono3py are determined in the same manner as -`--max-num-atoms`. - -#### `--cell-for-relax` - -This chooses unit cell or primitive cell for structure optimization (`relax`). -The default is `unitcell`. Specify `primitive` to use primitive cell. - -#### `--cell-for-nac` - -This chooses unit cell or primitive cell for NAC calculation (`nac`). The -default is `primitive`. Specify `primitive` to use primitive cell. - -#### `--primitive-cell-choice` - -Primitive cell choice, "standardized" (default) or "reduced". - -#### `--use-grg` - -Use generalized regular grid. - -#### `--amplitude` - -Distance of displacements in Angstrom. - -#### `--magmom` - -String corresponding to INCAR MAGMOM tag value for unit cell, e.g., "24*1" or "0 -0 1". This is similar to `MAGMOM` tag in phonopy, see -https://phonopy.github.io/phonopy/setting-tags.html#magmom. In velph, the -asterisk symbol (`*`) is supported. - -(velph-init-template)= -## `velph init` template - -`velph init` is the command to prepare `velph.toml`. Without specifying a -velph-toml-template, the default template is used. Custom template can be -specified as follows: - -``` -% velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER --template-toml velph-tmpl.toml -``` - -The `velph-tmpl.toml` (arbitrary file name) is almost like the `velph.toml` -file. It means that the `velph-tmpl.toml` may be created modifying -`velph.toml`. The sections that exist only in the `velph-tmpl.toml` but not in -`velph.toml` is `[init.options]`. This can be used as alternatives of command -options of `velph-init`, e.g., - -```toml -[init.options] -kspacing = 0.2 -kspacing_dense = 0.1 -max_num_atoms = 120 -``` - -These `[init.options]` keywords can be found along with the list of the command -options by - -``` -% velph init --help -``` - -## Settings in sections of `velph.toml` - -Note that the same can be applied to `velph-tmpl.toml`. - -### Default INCAR settings - -The default INCAR settins are written in `[vasp.incar]`. These settings are -overwritten by `[vasp.CALC_TYPE.incar]` (`CALC_TYPE` can be `phelel`, `relax`, -`nac`, `transport`, `phono3py`, `phono3py.phonon`, etc). - -### Scheduler settings - -The parameters used for generating the job submission script are specified as -strings in `[scheduler]`. If `[vasp.CALC_TYPE.scheduler]` is -specified, `[scheduler]` settings are overwritten by the settings for -`[vasp.CALC_TYPE]`. The content in this section operates through [Python string -formatting](https://docs.python.org/3/library/stdtypes.html#str.format), using -replacement fields named after keyword arguments. Each parameter line in the -`[scheduler]` section is treated as a keyword argument, which is then inserted -into the string format. - -In the `[scheduler]` section, the parameters `scheduler_name` and -`scheduler_template` have special roles: - -- `scheduler_name`: Specifies the template type, with options `slurm`, `sge`, or - `custom`. For `slurm` and `sge`, the template string (i.e., - `scheduler_template`) is - [hard-coded](https://github.com/phonopy/phelel/blob/develop/src/phelel/velph/utils/scheduler.py). - If `custom` is selected, the string provided by `scheduler_template` is used, - into which the parameters are inserted. -- `scheduler_template`: The string template where parameters defined in this - section are inserted. - -An example is shown below. - -```toml -[scheduler] -scheduler_name = "sge" -job_name = "PbTe" -mpirun_command = "mpirun" -vasp_binary = "/usr/local/cluster-1/bin/vasp_std" -pe = "vienna 32" -prepend_text = ''' -source /opt/intel/oneapi/setvars.sh --config="/home/togo/.oneapi-config" -''' - -... -[vasp.phelel.scheduler] -pe = "paris 24" - -... -[vasp.phonopy.scheduler] -scheduler_template = '''#!/bin/bash -#QSUB2 core 192 -#QSUB2 mpi 192 -#QSUB2 smp 1 -#QSUB2 wtime 48:00:00 -#PBS -N {job_name} -cd $PBS_O_WORKDIR - -{prepend_text} -{mpirun_command} {vasp_binary} | tee vasp_output -{append_text} -''' -job_name = "PbTe" -mpirun_command = "mpijob" -vasp_binary = "/usr/local/cluster-2/bin/vasp_std" -prepend_text = ''' -. /etc/profile.d/modules.sh -module load inteloneapi22u3 -''' -append_text = "" -``` - - -## Example (NiTiSn) - -`POSCAR-unitcell`, `POTCAR`, and `velph-tmpl.toml` are located in the current directory. - -Initial `POSCAR-unitcell`, -``` -Ti4Sn4Ni4 -1.0 -5.906882041566931 0.000000000000000 0.000000000000000 -0.000000000000000 5.906882041566931 0.000000000000000 -0.000000000000000 0.000000000000000 5.906882041566931 -Ti Sn Ni -4 4 4 -Direct -0.000000000000000 0.000000000000000 0.000000000000000 -0.000000000000000 0.500000000000000 0.500000000000000 -0.500000000000000 0.000000000000000 0.500000000000000 -0.500000000000000 0.500000000000000 0.000000000000000 -0.500000000000000 0.500000000000000 0.500000000000000 -0.500000000000000 0.000000000000000 0.000000000000000 -0.000000000000000 0.500000000000000 0.000000000000000 -0.000000000000000 0.000000000000000 0.500000000000000 -0.250000000000000 0.250000000000000 0.250000000000000 -0.250000000000000 0.750000000000000 0.750000000000000 -0.750000000000000 0.250000000000000 0.750000000000000 -0.750000000000000 0.750000000000000 0.250000000000000 -``` - -`velph-tmpl.toml`, -```toml -[init.options] -kspacing = 0.1 -kspacing_dense = 0.2 -max_num_atoms = 100 - -[vasp.incar] -encut = 520 -ncore = 4 - -[vasp.phelel.incar] -kpar = 2 -[vasp.phelel.scheduler] -pe = "mpi* 48" - -[vasp.transport.scheduler] -pe = "mpi* 144" - -[scheduler] -scheduler_name = "sge" -job_name = "TiNiSn" -mpirun_command = "mpirun" -vasp_binary = "/usr/local/vasp/bin/vasp_std" -pe = "vienna 32" -prepend_text = ''' -source /opt/intel/oneapi/setvars.sh intel64 --config="/home/togo/.oneapi-config" -''' -append_text = "" -``` - -`POTCAR` choice, -``` - PAW_PBE Ti_sv 26Sep2005 - PAW_PBE Sn_d 06Sep2000 - PAW_PBE Ni 02Aug2007 -``` - -``` -% velph init POSCAR_Ti4Sn4Ni4 relax --template-toml velph-tmpl.toml -Crystal structure file: "POSCAR_Ti4Sn4Ni4". -Velph template file: "velph-tmpl.toml". -Read crystal structure file "POSCAR_Ti4Sn4Ni4". -Read velph template file "velph-tmpl.toml". -Following options were found in "velph-tmpl.toml": - kspacing = "0.1" - kspacing_dense = "0.2" - max_num_atoms = "100" -The command options were prefered to [init.options] in "velph-tmpl.toml". -Found a primitive cell whose transformation matrix is - [ 0.000 0.500 0.500] - [ 0.500 0.000 0.500] - [ 0.500 0.500 0.000] -Supercell is generated with respect to the cell below. --------------------------------------------------------------------------------- -lattice: -- [ 5.906882041566931, 0.000000000000000, 0.000000000000000 ] # a -- [ 0.000000000000000, 5.906882041566931, 0.000000000000000 ] # b -- [ 0.000000000000000, 0.000000000000000, 5.906882041566931 ] # c -points: -- symbol: Ti # 1 - coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] - mass: 47.867000 -- symbol: Ti # 2 - coordinates: [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] - mass: 47.867000 -- symbol: Ti # 3 - coordinates: [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] - mass: 47.867000 -- symbol: Ti # 4 - coordinates: [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] - mass: 47.867000 -- symbol: Sn # 5 - coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] - mass: 118.710000 -- symbol: Sn # 6 - coordinates: [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] - mass: 118.710000 -- symbol: Sn # 7 - coordinates: [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] - mass: 118.710000 -- symbol: Sn # 8 - coordinates: [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] - mass: 118.710000 -- symbol: Ni # 9 - coordinates: [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] - mass: 58.693400 -- symbol: Ni # 10 - coordinates: [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] - mass: 58.693400 -- symbol: Ni # 11 - coordinates: [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] - mass: 58.693400 -- symbol: Ni # 12 - coordinates: [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] - mass: 58.693400 --------------------------------------------------------------------------------- -[vasp.incar] (basic INCAR settings) - ismear = 0 - sigma = 0.01 - ediff = 1e-08 - encut = 520 - prec = accurate - lreal = False - lwave = False - lcharg = False - ncore = 4 -[phelel] - supercell_dimension: [2 2 2] -[vasp.*.kpoints.mesh] (*kspacing=0.1) - selfenergy: [18 18 18]* - el_bands: [18 18 18]* - phelel: [5 5 5]* - relax: [11 11 11]* - nac: [18 18 18]* -[vasp.*.kpoints_dense.mesh] (*kspacing_dense=0.2) - selfenergy: [9 9 9]* - el_bands: [9 9 9]* -Created new folder "relax". -Initial settings were written to "relax/velph.toml". -Found "POTCAR". - PAW_PBE Ti_sv 26Sep2005 - PAW_PBE Sn_d 06Sep2000 - PAW_PBE Ni 02Aug2007 - Max ENMAX in "POTCAR" is 274.61. -"POTCAR" was copied to "relax/POTCAR". -``` - - -A directory `relax` is created and `velph.toml` is stored in it. - -`relax/velph.toml`, -```toml -[phelel] -version = "0.6.0" -supercell_dimension = [2, 2, 2] -amplitude = 0.03 -diagonal = true -plusminus = true -fft_mesh = [32, 32, 32] - -# ... - -[vasp.relax] -cell = "unitcell" -[vasp.relax.incar] -ediffg = -1e-06 -ibrion = 2 -isif = 3 -nsw = 10 -ismear = 0 -sigma = 0.01 -ediff = 1e-08 -encut = 520 -prec = "accurate" -lreal = false -lwave = false -lcharg = false -ncore = 4 -[vasp.relax.kpoints] -mesh = [11, 11, 11] - -# ... - -[scheduler] -scheduler_name = "sge" -job_name = "TiNiSn" -mpirun_command = "mpirun" -vasp_binary = "/usr/local/vasp/bin/vasp_std" -pe = "vienna 32" -prepend_text = "source /opt/intel/oneapi/setvars.sh intel64 --config=\"/home/togo/.oneapi-config\"\n" -append_text = "" - -[symmetry] -spacegroup_type = "F-43m" -tolerance = 1e-05 -primitive_matrix = [ - [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ], - [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ], - [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ], -] - -[unitcell] -lattice = [ - [ 5.906882041566931, 0.000000000000000, 0.000000000000000 ], # a - [ 0.000000000000000, 5.906882041566931, 0.000000000000000 ], # b - [ 0.000000000000000, 0.000000000000000, 5.906882041566931 ], # c -] -[[unitcell.points]] # 1 -symbol = "Ti" -coordinates = [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] -[[unitcell.points]] # 2 -symbol = "Ti" -coordinates = [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] -[[unitcell.points]] # 3 -symbol = "Ti" -coordinates = [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] -[[unitcell.points]] # 4 -symbol = "Ti" -coordinates = [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] -[[unitcell.points]] # 5 -symbol = "Sn" -coordinates = [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] -[[unitcell.points]] # 6 -symbol = "Sn" -coordinates = [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] -[[unitcell.points]] # 7 -symbol = "Sn" -coordinates = [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] -[[unitcell.points]] # 8 -symbol = "Sn" -coordinates = [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] -[[unitcell.points]] # 9 -symbol = "Ni" -coordinates = [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] -[[unitcell.points]] # 10 -symbol = "Ni" -coordinates = [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] -[[unitcell.points]] # 11 -symbol = "Ni" -coordinates = [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] -[[unitcell.points]] # 12 -symbol = "Ni" -coordinates = [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] -[primitive_cell] -lattice = [ - [ 0.000000000000000, 2.953441020783465, 2.953441020783465 ], # a - [ 2.953441020783465, 0.000000000000000, 2.953441020783465 ], # b - [ 2.953441020783465, 2.953441020783465, 0.000000000000000 ], # c -] -[[primitive_cell.points]] # 1 -symbol = "Ti" -coordinates = [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] -[[primitive_cell.points]] # 2 -symbol = "Sn" -coordinates = [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] -[[primitive_cell.points]] # 3 -symbol = "Ni" -coordinates = [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] -``` - -`fft_mesh` is calculated from `encut` value in the `[vasp.selfenergy.incar]` section. - -Change directory to `relax`. -``` -% velph relax generate -% cd relax/iter1 -% qsub _job.sh -``` -Structure optimization is done until stress becomes less than 0.1kB (0.01GPa). -Go back to the top directory and start supercell calculation. - -``` -% velph init --template-toml velph-tmpl.toml `ls relax/relax/iter*/CONTCAR|tail -n 1` calc -Crystal structure file: "relax/relax/iter2/CONTCAR". -Velph template file: "velph-tmpl.toml". -Read crystal structure file "relax/relax/iter2/CONTCAR". -Read velph template file "velph-tmpl.toml". -Following options were found in "velph-tmpl.toml": - kspacing = "0.1" - kspacing_dense = "0.2" - max_num_atoms = "100" -The command options were prefered to [init.options] in "velph-tmpl.toml". -Found a primitive cell whose transformation matrix is - [ 0.000 0.500 0.500] - [ 0.500 0.000 0.500] - [ 0.500 0.500 0.000] -Supercell is generated with respect to the cell below. --------------------------------------------------------------------------------- -lattice: -- [ 5.949975748250650, 0.000000000000000, 0.000000000000000 ] # a -- [ 0.000000000000000, 5.949975748250650, -0.000000000000000 ] # b -- [ 0.000000000000000, 0.000000000000000, 5.949975748250650 ] # c -points: -- symbol: Ti # 1 - coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] - mass: 47.867000 -- symbol: Ti # 2 - coordinates: [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] - mass: 47.867000 -- symbol: Ti # 3 - coordinates: [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] - mass: 47.867000 -- symbol: Ti # 4 - coordinates: [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] - mass: 47.867000 -- symbol: Sn # 5 - coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] - mass: 118.710000 -- symbol: Sn # 6 - coordinates: [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] - mass: 118.710000 -- symbol: Sn # 7 - coordinates: [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] - mass: 118.710000 -- symbol: Sn # 8 - coordinates: [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] - mass: 118.710000 -- symbol: Ni # 9 - coordinates: [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] - mass: 58.693400 -- symbol: Ni # 10 - coordinates: [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] - mass: 58.693400 -- symbol: Ni # 11 - coordinates: [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] - mass: 58.693400 -- symbol: Ni # 12 - coordinates: [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] - mass: 58.693400 --------------------------------------------------------------------------------- -[vasp.incar] (basic INCAR settings) - ismear = 0 - sigma = 0.01 - ediff = 1e-08 - encut = 520 - prec = accurate - lreal = False - lwave = False - lcharg = False - ncore = 4 -[phelel] - supercell_dimension: [2 2 2] -[vasp.*.kpoints.mesh] (*kspacing=0.1) - selfenergy: [18 18 18]* - el_bands: [18 18 18]* - phelel: [5 5 5]* - relax: [11 11 11]* - nac: [18 18 18]* -[vasp.*.kpoints_dense.mesh] (*kspacing_dense=0.2) - selfenergy: [9 9 9]* - el_bands: [9 9 9]* -Created new folder "calc". -Initial settings were written to "calc/velph.toml". -Found "POTCAR". - PAW_PBE Ti_sv 26Sep2005 - PAW_PBE Sn_d 06Sep2000 - PAW_PBE Ni 02Aug2007 - Max ENMAX in "POTCAR" is 274.61. -"POTCAR" was copied to "calc/POTCAR". -``` - -Change directory to `calc`. -``` -% cd calc -``` - -`velph.toml`, -``` -[phelel] -version = "0.6.0" -supercell_dimension = [2, 2, 2] -amplitude = 0.03 -diagonal = true -plusminus = true -fft_mesh = [32, 32, 32] - -[vasp.phelel.incar] -lwap = true -isym = 0 -kpar = 2 -ismear = 0 -sigma = 0.01 -ediff = 1e-08 -encut = 520 -prec = "accurate" -lreal = false -lwave = false -lcharg = false -ncore = 4 -[vasp.phelel.kpoints] -mesh = [5, 5, 5] -[vasp.phelel.scheduler] -pe = "mpi* 48" - -# ... - -[vasp.nac] -cell = "primitive" -[vasp.nac.incar] -lepsilon = true -ismear = 0 -sigma = 0.01 -ediff = 1e-08 -encut = 520 -prec = "accurate" -lreal = false -lwave = false -lcharg = false -[vasp.nac.kpoints] -mesh = [18, 18, 18] - -# ... -``` - -NAC and supercell calculations, -``` -% velph nac generate -% cd nac; qsub _job.sh; cd .. -% velph phelel init -Found "nac" directory. Read NAC params. -"phelel/phelel_disp.yaml" was generated by phelel. -VASP input files will be generated by "velph phelel generate". -% velph supercell generate -VASP input files were generated in "supercell/disp-000". -VASP input files were generated in "supercell/disp-001". -VASP input files were generated in "supercell/disp-002". -VASP input files were generated in "supercell/disp-003". -VASP input files were generated in "supercell/disp-004". -VASP input files were generated in "supercell/disp-005". -VASP input files were generated in "supercell/disp-006". -% for i in {000..006};do cd phelel/disp-$i; qsub _job.sh; cd ../..;done -``` - -Using the VASP results of the supercell calculations, derivatives of properties -are computed using the phelel code. The results are stored in a newly created -file `phelel/phelel_params.hdf5`. This process creates only -`phelel/phelel_params.hdf5` and is invoked by the following velph command: -``` -% velph phelel differentiate -Running finufft (eps=1.000e-06)... -Running finufft (eps=1.000e-06)... -Running finufft (eps=1.000e-06)... -"phelel/phelel_params.hdf5" has been made. -``` - -NAC parameters in `phelel/phelel_params.hdf5` comes from -`phelel/phelel_disp.yaml`, i.e., - -1. NAC parameters are stored in `phelel/phelel_disp.yaml` when - `phelel/phelel_disp.yaml` is created by `velph phelel init`. -2. NAC data in `phelel/phelel_disp.yaml` are transfered to - `phelel/phelel_params.hdf5` by `velph phelel differentiate`. - -Therefore, `nac` calculation has to exist in the initial step `velph phelel -init`. If the `nac` calculation is performed after the supercell calculation, -`velph phelel init` and `velph phelel differentiate` have to be re-executed to -store the NAC parameters in `phelel/phelel_params.hdf5`. diff --git a/doc/velph-example.md b/doc/velph-example.md new file mode 100644 index 0000000..eb9885e --- /dev/null +++ b/doc/velph-example.md @@ -0,0 +1,468 @@ +# `velph` example + +## NiTiSn + +`POSCAR-unitcell`, `POTCAR`, and `velph-tmpl.toml` are located in the current directory. + +Initial `POSCAR-unitcell`, +``` +Ti4Sn4Ni4 +1.0 +5.906882041566931 0.000000000000000 0.000000000000000 +0.000000000000000 5.906882041566931 0.000000000000000 +0.000000000000000 0.000000000000000 5.906882041566931 +Ti Sn Ni +4 4 4 +Direct +0.000000000000000 0.000000000000000 0.000000000000000 +0.000000000000000 0.500000000000000 0.500000000000000 +0.500000000000000 0.000000000000000 0.500000000000000 +0.500000000000000 0.500000000000000 0.000000000000000 +0.500000000000000 0.500000000000000 0.500000000000000 +0.500000000000000 0.000000000000000 0.000000000000000 +0.000000000000000 0.500000000000000 0.000000000000000 +0.000000000000000 0.000000000000000 0.500000000000000 +0.250000000000000 0.250000000000000 0.250000000000000 +0.250000000000000 0.750000000000000 0.750000000000000 +0.750000000000000 0.250000000000000 0.750000000000000 +0.750000000000000 0.750000000000000 0.250000000000000 +``` + +`velph-tmpl.toml`, +```toml +[init.options] +kspacing = 0.1 +kspacing_dense = 0.2 +max_num_atoms = 100 + +[vasp.incar] +encut = 520 +ncore = 4 + +[vasp.phelel.incar] +kpar = 2 +[vasp.phelel.scheduler] +pe = "mpi* 48" + +[vasp.transport.scheduler] +pe = "mpi* 144" + +[scheduler] +scheduler_name = "sge" +job_name = "TiNiSn" +mpirun_command = "mpirun" +vasp_binary = "/usr/local/vasp/bin/vasp_std" +pe = "vienna 32" +prepend_text = ''' +source /opt/intel/oneapi/setvars.sh intel64 --config="/home/togo/.oneapi-config" +''' +append_text = "" +``` + +`POTCAR` choice, +``` + PAW_PBE Ti_sv 26Sep2005 + PAW_PBE Sn_d 06Sep2000 + PAW_PBE Ni 02Aug2007 +``` + +``` +% velph init POSCAR_Ti4Sn4Ni4 relax --template-toml velph-tmpl.toml +Crystal structure file: "POSCAR_Ti4Sn4Ni4". +Velph template file: "velph-tmpl.toml". +Read crystal structure file "POSCAR_Ti4Sn4Ni4". +Read velph template file "velph-tmpl.toml". +Following options were found in "velph-tmpl.toml": + kspacing = "0.1" + kspacing_dense = "0.2" + max_num_atoms = "100" +The command options were prefered to [init.options] in "velph-tmpl.toml". +Found a primitive cell whose transformation matrix is + [ 0.000 0.500 0.500] + [ 0.500 0.000 0.500] + [ 0.500 0.500 0.000] +Supercell is generated with respect to the cell below. +-------------------------------------------------------------------------------- +lattice: +- [ 5.906882041566931, 0.000000000000000, 0.000000000000000 ] # a +- [ 0.000000000000000, 5.906882041566931, 0.000000000000000 ] # b +- [ 0.000000000000000, 0.000000000000000, 5.906882041566931 ] # c +points: +- symbol: Ti # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 47.867000 +- symbol: Ti # 2 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 47.867000 +- symbol: Ti # 3 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 47.867000 +- symbol: Ti # 4 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 47.867000 +- symbol: Sn # 5 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 118.710000 +- symbol: Sn # 6 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 118.710000 +- symbol: Sn # 7 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 118.710000 +- symbol: Sn # 8 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 118.710000 +- symbol: Ni # 9 + coordinates: [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] + mass: 58.693400 +- symbol: Ni # 10 + coordinates: [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] + mass: 58.693400 +- symbol: Ni # 11 + coordinates: [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] + mass: 58.693400 +- symbol: Ni # 12 + coordinates: [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] + mass: 58.693400 +-------------------------------------------------------------------------------- +[vasp.incar] (basic INCAR settings) + ismear = 0 + sigma = 0.01 + ediff = 1e-08 + encut = 520 + prec = accurate + lreal = False + lwave = False + lcharg = False + ncore = 4 +[phelel] + supercell_dimension: [2 2 2] +[vasp.*.kpoints.mesh] (*kspacing=0.1) + selfenergy: [18 18 18]* + el_bands: [18 18 18]* + phelel: [5 5 5]* + relax: [11 11 11]* + nac: [18 18 18]* +[vasp.*.kpoints_dense.mesh] (*kspacing_dense=0.2) + selfenergy: [9 9 9]* + el_bands: [9 9 9]* +Created new folder "relax". +Initial settings were written to "relax/velph.toml". +Found "POTCAR". + PAW_PBE Ti_sv 26Sep2005 + PAW_PBE Sn_d 06Sep2000 + PAW_PBE Ni 02Aug2007 + Max ENMAX in "POTCAR" is 274.61. +"POTCAR" was copied to "relax/POTCAR". +``` + + +A directory `relax` is created and `velph.toml` is stored in it. + +`relax/velph.toml`, +```toml +[phelel] +version = "0.6.0" +supercell_dimension = [2, 2, 2] +amplitude = 0.03 +diagonal = true +plusminus = true +fft_mesh = [32, 32, 32] + +# ... + +[vasp.relax] +cell = "unitcell" +[vasp.relax.incar] +ediffg = -1e-06 +ibrion = 2 +isif = 3 +nsw = 10 +ismear = 0 +sigma = 0.01 +ediff = 1e-08 +encut = 520 +prec = "accurate" +lreal = false +lwave = false +lcharg = false +ncore = 4 +[vasp.relax.kpoints] +mesh = [11, 11, 11] + +# ... + +[scheduler] +scheduler_name = "sge" +job_name = "TiNiSn" +mpirun_command = "mpirun" +vasp_binary = "/usr/local/vasp/bin/vasp_std" +pe = "vienna 32" +prepend_text = "source /opt/intel/oneapi/setvars.sh intel64 --config=\"/home/togo/.oneapi-config\"\n" +append_text = "" + +[symmetry] +spacegroup_type = "F-43m" +tolerance = 1e-05 +primitive_matrix = [ + [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ], + [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ], + [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ], +] + +[unitcell] +lattice = [ + [ 5.906882041566931, 0.000000000000000, 0.000000000000000 ], # a + [ 0.000000000000000, 5.906882041566931, 0.000000000000000 ], # b + [ 0.000000000000000, 0.000000000000000, 5.906882041566931 ], # c +] +[[unitcell.points]] # 1 +symbol = "Ti" +coordinates = [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] +[[unitcell.points]] # 2 +symbol = "Ti" +coordinates = [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] +[[unitcell.points]] # 3 +symbol = "Ti" +coordinates = [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] +[[unitcell.points]] # 4 +symbol = "Ti" +coordinates = [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] +[[unitcell.points]] # 5 +symbol = "Sn" +coordinates = [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] +[[unitcell.points]] # 6 +symbol = "Sn" +coordinates = [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] +[[unitcell.points]] # 7 +symbol = "Sn" +coordinates = [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] +[[unitcell.points]] # 8 +symbol = "Sn" +coordinates = [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] +[[unitcell.points]] # 9 +symbol = "Ni" +coordinates = [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] +[[unitcell.points]] # 10 +symbol = "Ni" +coordinates = [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] +[[unitcell.points]] # 11 +symbol = "Ni" +coordinates = [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] +[[unitcell.points]] # 12 +symbol = "Ni" +coordinates = [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] +[primitive_cell] +lattice = [ + [ 0.000000000000000, 2.953441020783465, 2.953441020783465 ], # a + [ 2.953441020783465, 0.000000000000000, 2.953441020783465 ], # b + [ 2.953441020783465, 2.953441020783465, 0.000000000000000 ], # c +] +[[primitive_cell.points]] # 1 +symbol = "Ti" +coordinates = [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] +[[primitive_cell.points]] # 2 +symbol = "Sn" +coordinates = [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] +[[primitive_cell.points]] # 3 +symbol = "Ni" +coordinates = [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] +``` + +`fft_mesh` is calculated from `encut` value in the `[vasp.selfenergy.incar]` section. + +Change directory to `relax`. +``` +% velph relax generate +% cd relax/iter1 +% qsub _job.sh +``` +Structure optimization is done until stress becomes less than 0.1kB (0.01GPa). +Go back to the top directory and start supercell calculation. + +``` +% velph init --template-toml velph-tmpl.toml `ls relax/relax/iter*/CONTCAR|tail -n 1` calc +Crystal structure file: "relax/relax/iter2/CONTCAR". +Velph template file: "velph-tmpl.toml". +Read crystal structure file "relax/relax/iter2/CONTCAR". +Read velph template file "velph-tmpl.toml". +Following options were found in "velph-tmpl.toml": + kspacing = "0.1" + kspacing_dense = "0.2" + max_num_atoms = "100" +The command options were prefered to [init.options] in "velph-tmpl.toml". +Found a primitive cell whose transformation matrix is + [ 0.000 0.500 0.500] + [ 0.500 0.000 0.500] + [ 0.500 0.500 0.000] +Supercell is generated with respect to the cell below. +-------------------------------------------------------------------------------- +lattice: +- [ 5.949975748250650, 0.000000000000000, 0.000000000000000 ] # a +- [ 0.000000000000000, 5.949975748250650, -0.000000000000000 ] # b +- [ 0.000000000000000, 0.000000000000000, 5.949975748250650 ] # c +points: +- symbol: Ti # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 47.867000 +- symbol: Ti # 2 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 47.867000 +- symbol: Ti # 3 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 47.867000 +- symbol: Ti # 4 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 47.867000 +- symbol: Sn # 5 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 118.710000 +- symbol: Sn # 6 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 118.710000 +- symbol: Sn # 7 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 118.710000 +- symbol: Sn # 8 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 118.710000 +- symbol: Ni # 9 + coordinates: [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] + mass: 58.693400 +- symbol: Ni # 10 + coordinates: [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] + mass: 58.693400 +- symbol: Ni # 11 + coordinates: [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] + mass: 58.693400 +- symbol: Ni # 12 + coordinates: [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] + mass: 58.693400 +-------------------------------------------------------------------------------- +[vasp.incar] (basic INCAR settings) + ismear = 0 + sigma = 0.01 + ediff = 1e-08 + encut = 520 + prec = accurate + lreal = False + lwave = False + lcharg = False + ncore = 4 +[phelel] + supercell_dimension: [2 2 2] +[vasp.*.kpoints.mesh] (*kspacing=0.1) + selfenergy: [18 18 18]* + el_bands: [18 18 18]* + phelel: [5 5 5]* + relax: [11 11 11]* + nac: [18 18 18]* +[vasp.*.kpoints_dense.mesh] (*kspacing_dense=0.2) + selfenergy: [9 9 9]* + el_bands: [9 9 9]* +Created new folder "calc". +Initial settings were written to "calc/velph.toml". +Found "POTCAR". + PAW_PBE Ti_sv 26Sep2005 + PAW_PBE Sn_d 06Sep2000 + PAW_PBE Ni 02Aug2007 + Max ENMAX in "POTCAR" is 274.61. +"POTCAR" was copied to "calc/POTCAR". +``` + +Change directory to `calc`. +``` +% cd calc +``` + +`velph.toml`, +``` +[phelel] +version = "0.6.0" +supercell_dimension = [2, 2, 2] +amplitude = 0.03 +diagonal = true +plusminus = true +fft_mesh = [32, 32, 32] + +[vasp.phelel.incar] +lwap = true +isym = 0 +kpar = 2 +ismear = 0 +sigma = 0.01 +ediff = 1e-08 +encut = 520 +prec = "accurate" +lreal = false +lwave = false +lcharg = false +ncore = 4 +[vasp.phelel.kpoints] +mesh = [5, 5, 5] +[vasp.phelel.scheduler] +pe = "mpi* 48" + +# ... + +[vasp.nac] +cell = "primitive" +[vasp.nac.incar] +lepsilon = true +ismear = 0 +sigma = 0.01 +ediff = 1e-08 +encut = 520 +prec = "accurate" +lreal = false +lwave = false +lcharg = false +[vasp.nac.kpoints] +mesh = [18, 18, 18] + +# ... +``` + +NAC and supercell calculations, +``` +% velph nac generate +% cd nac; qsub _job.sh; cd .. +% velph phelel init +Found "nac" directory. Read NAC params. +"phelel/phelel_disp.yaml" was generated by phelel. +VASP input files will be generated by "velph phelel generate". +% velph supercell generate +VASP input files were generated in "supercell/disp-000". +VASP input files were generated in "supercell/disp-001". +VASP input files were generated in "supercell/disp-002". +VASP input files were generated in "supercell/disp-003". +VASP input files were generated in "supercell/disp-004". +VASP input files were generated in "supercell/disp-005". +VASP input files were generated in "supercell/disp-006". +% for i in {000..006};do cd phelel/disp-$i; qsub _job.sh; cd ../..;done +``` + +Using the VASP results of the supercell calculations, derivatives of properties +are computed using the phelel code. The results are stored in a newly created +file `phelel/phelel_params.hdf5`. This process creates only +`phelel/phelel_params.hdf5` and is invoked by the following velph command: +``` +% velph phelel differentiate +Running finufft (eps=1.000e-06)... +Running finufft (eps=1.000e-06)... +Running finufft (eps=1.000e-06)... +"phelel/phelel_params.hdf5" has been made. +``` + +NAC parameters in `phelel/phelel_params.hdf5` comes from +`phelel/phelel_disp.yaml`, i.e., + +1. NAC parameters are stored in `phelel/phelel_disp.yaml` when + `phelel/phelel_disp.yaml` is created by `velph phelel init`. +2. NAC data in `phelel/phelel_disp.yaml` are transfered to + `phelel/phelel_params.hdf5` by `velph phelel differentiate`. + +Therefore, `nac` calculation has to exist in the initial step `velph phelel +init`. If the `nac` calculation is performed after the supercell calculation, +`velph phelel init` and `velph phelel differentiate` have to be re-executed to +store the NAC parameters in `phelel/phelel_params.hdf5`. diff --git a/doc/velph-init.md b/doc/velph-init.md new file mode 100644 index 0000000..96a2a99 --- /dev/null +++ b/doc/velph-init.md @@ -0,0 +1,187 @@ +# `velph init` + +`velph init` with command options will generate modified `velph.toml` from the +template. +``` +% velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER +``` + +`velph init --help` shows short documents of the options. Two arguments have to +be specified, POSCAR-format crystal structure and directory name that is created +where `velph.toml` is stored. The available options are explained below. Some +options can be specified in `[init.options]` section of the velph-toml template +file (see {ref}`velph-init-template`). + +## `velph init` options + +### `--template-toml` + +Using this option, `velph.toml` like file is read as the template instead of the +template hard coded in velph code. + +### `--tolerance` + +This is used for the symmetry check tolerance in Angstrom. Symmetry is searched +always even without `--symmetrize`. + +### `--symmetrize` + +By default (no-symmetrize), the input POSCAR-type structure is simply used as +the unit cell. With `--symmetrize`, input POSCAR-type structure is symmetrized +and standardized conventional unit cell and primitive cell ("unitcell" and +"primitive_cell", respectively) are written in `velph.toml`. + +### `--no-find-primitive` + +By this option, the input POSCAR-type structure is used as the primitive cell +even if it is not a primitive cell. + +### `--kspacing` and `--kspacing-dense` + +Sampling k-point meshes are calculated from these values in the similar way to +VASP `KSPACING` definition by overwriting the template. + +### `--max-num-atoms` + +Supercell shape is determined so that its number of atoms is equal or less than +this number respecting the crystallographic point group. + +### `--phonopy-max-num-atoms` and `--phono3py-max-num-atoms` + +Supercell shapes for phonopy and phono3py are determined in the same manner as +`--max-num-atoms`. + +### `--cell-for-relax` + +This chooses unit cell or primitive cell for structure optimization (`relax`). +The default is `unitcell`. Specify `primitive` to use primitive cell. + +### `--cell-for-nac` + +This chooses unit cell or primitive cell for NAC calculation (`nac`). The +default is `primitive`. Specify `primitive` to use primitive cell. + +### `--primitive-cell-choice` + +Primitive cell choice, "standardized" (default) or "reduced". + +### `--use-grg` + +Use generalized regular grid. + +### `--amplitude` + +Distance of displacements in Angstrom. + +### `--magmom` + +String corresponding to INCAR MAGMOM tag value for unit cell, e.g., "24*1" or "0 +0 1". This is similar to `MAGMOM` tag in phonopy, see +https://phonopy.github.io/phonopy/setting-tags.html#magmom. In velph, the +asterisk symbol (`*`) is supported. + + +(velph-init-template)= +## `velph init` template + +`velph init` is the command to prepare `velph.toml`. Without specifying a +velph-toml-template, the default template is used. Custom template can be +specified as follows: + +``` +% velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER --template-toml velph-tmpl.toml +``` + +The `velph-tmpl.toml` (arbitrary file name) is almost like the `velph.toml` +file. It means that the `velph-tmpl.toml` may be created modifying +`velph.toml`. The sections that exist only in the `velph-tmpl.toml` but not in +`velph.toml` is `[init.options]`. This can be used as alternatives of command +options of `velph-init`, e.g., + +```toml +[init.options] +kspacing = 0.2 +kspacing_dense = 0.1 +max_num_atoms = 120 +``` + +These `[init.options]` keywords can be found along with the list of the command +options by + +``` +% velph init --help +``` + +## Settings in sections of `velph.toml` + +Note that the same can be applied to `velph-tmpl.toml`. + +### Default INCAR settings + +The default INCAR settins are written in `[vasp.incar]`. These settings are +overwritten by `[vasp.CALC_TYPE.incar]` (`CALC_TYPE` can be `phelel`, `relax`, +`nac`, `transport`, `phono3py`, `phono3py.phonon`, etc). + +### Scheduler settings + +The parameters used for generating the job submission script are specified as +strings in `[scheduler]`. If `[vasp.CALC_TYPE.scheduler]` is +specified, `[scheduler]` settings are overwritten by the settings for +`[vasp.CALC_TYPE]`. The content in this section operates through [Python string +formatting](https://docs.python.org/3/library/stdtypes.html#str.format), using +replacement fields named after keyword arguments. Each parameter line in the +`[scheduler]` section is treated as a keyword argument, which is then inserted +into the string format. + +In the `[scheduler]` section, the parameters `scheduler_name` and +`scheduler_template` have special roles: + +- `scheduler_name`: Specifies the template type, with options `slurm`, `sge`, or + `custom`. For `slurm` and `sge`, the template string (i.e., + `scheduler_template`) is + [hard-coded](https://github.com/phonopy/phelel/blob/develop/src/phelel/velph/utils/scheduler.py). + If `custom` is selected, the string provided by `scheduler_template` is used, + into which the parameters are inserted. +- `scheduler_template`: The string template where parameters defined in this + section are inserted. + +An example is shown below. + +```toml +[scheduler] +scheduler_name = "sge" +job_name = "PbTe" +mpirun_command = "mpirun" +vasp_binary = "/usr/local/cluster-1/bin/vasp_std" +pe = "vienna 32" +prepend_text = ''' +source /opt/intel/oneapi/setvars.sh --config="/home/togo/.oneapi-config" +''' + +... +[vasp.phelel.scheduler] +pe = "paris 24" + +... +[vasp.phonopy.scheduler] +scheduler_template = '''#!/bin/bash +#QSUB2 core 192 +#QSUB2 mpi 192 +#QSUB2 smp 1 +#QSUB2 wtime 48:00:00 +#PBS -N {job_name} +cd $PBS_O_WORKDIR + +{prepend_text} +{mpirun_command} {vasp_binary} | tee vasp_output +{append_text} +''' +job_name = "PbTe" +mpirun_command = "mpijob" +vasp_binary = "/usr/local/cluster-2/bin/vasp_std" +prepend_text = ''' +. /etc/profile.d/modules.sh +module load inteloneapi22u3 +''' +append_text = "" +``` diff --git a/doc/velph-subcommands.md b/doc/velph-subcommands.md new file mode 100644 index 0000000..1287cd4 --- /dev/null +++ b/doc/velph-subcommands.md @@ -0,0 +1,52 @@ +# `velph` subcommands + +## `velph phelel` + +This command calculates the derivatives of local potentials and PAW strengths +with respect to displacement, performing similar operations as steps 1 and 3 +carried out by the `phelel` command in the {ref}`workflow `. + +### `velph phelel init` + +### `velph phelel generate` + +### `velph phelel differentiate` + +### `velph phelel phonopy` + +## `velph transport` + +### `velph transport generate` + +### `velph transport plot` + +## `velph relax` + +### `velph relax generate` + +## `velph nac` + +### `velph nac generate` + +## `velph el_bands` + +### `velph el_bands generate` +### `velph el_bands plot` + +## `velph ph_bands` + +### `velph ph_bands generate` + +### `velph ph_bands plot` + +## `velph phono3py` + +### `velph phono3py init` + +### `velph phono3py generate` + +## `velph phonopy` + +### `velph phonopy init` + +### `velph phonopy generate` From 42693c47d28944703fc510f7e734182510614c8d Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Sun, 5 Jan 2025 21:02:40 +0900 Subject: [PATCH 04/10] Update documentation --- doc/index.md | 1 + doc/velph-command.md | 23 ++++---- doc/velph-init-template.md | 104 +++++++++++++++++++++++++++++++++++ doc/velph-init.md | 109 +------------------------------------ doc/velph-subcommands.md | 3 + 5 files changed, 121 insertions(+), 119 deletions(-) create mode 100644 doc/velph-init-template.md diff --git a/doc/index.md b/doc/index.md index 26ba15c..f5bb90d 100644 --- a/doc/index.md +++ b/doc/index.md @@ -32,6 +32,7 @@ workflow phelel-command velph-command velph-init +velph-init-template velph-subcommands velph-example changelog diff --git a/doc/velph-command.md b/doc/velph-command.md index 00c619d..09f4df7 100644 --- a/doc/velph-command.md +++ b/doc/velph-command.md @@ -5,23 +5,22 @@ The `velph` command is a convenient tool for systematically performing electron-phonon interaction calculations using the VASP code and for analyzing the resulting data. -## What does the `velph` command do? - The `velph` command orchestrates the electron-phonon (el-ph) calculation workflow {ref}`workflow ` by running a series of subcommands in a -specific sequence. These subcommands can: +specific sequence. -- Execute `phelel`. -- Generate VASP input files for: - - Dielectric constant calculations - - Born effective charge calculations - - Electronic band structure and density of states calculations - (all of which are required for subsequent electron-phonon interaction calculations) -- Generate VASP input files for phonon and lattice thermal conductivity calculations using phonopy and phono3py. +## `velph` subcommands -## Listing `velph` subcommands +The `velph` command includes a variety of subcommands. To initiate an +electron–phonon (el-ph) calculation, run `velph init` to generate the +`velph.toml` file. Command options for `velph init` are detailed in +{ref}`velph_init`. Once the `velph.toml` file is prepared, other `velph` +subcommands generate VASP input files, post-process VASP calculation results, +and calculate derivatives of the local potential and PAW strengths with respect +to atomic displacement, resulting in the `phelel_params.hdf5` file. Most of the +`velph` subcommands are explained in {ref}`velph_subcommands`. -You can see a list of supported subcommands by simply typing: +A list of supported subcommands is displayed by typing: ``` % velph diff --git a/doc/velph-init-template.md b/doc/velph-init-template.md new file mode 100644 index 0000000..ea81b7a --- /dev/null +++ b/doc/velph-init-template.md @@ -0,0 +1,104 @@ +(velph_init_template)= +# `velph init` template + +`velph init` is the command to prepare `velph.toml`. Without specifying a +velph-toml-template, the default template is used. Custom template can be +specified as follows: + +``` +% velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER --template-toml velph-tmpl.toml +``` + +The `velph-tmpl.toml` (arbitrary file name) is almost like the `velph.toml` +file. It means that the `velph-tmpl.toml` may be created modifying +`velph.toml`. The sections that exist only in the `velph-tmpl.toml` but not in +`velph.toml` is `[init.options]`. This can be used as alternatives of command +options of `velph-init`, e.g., + +```toml +[init.options] +kspacing = 0.2 +kspacing_dense = 0.1 +max_num_atoms = 120 +``` + +These `[init.options]` keywords can be found along with the list of the command +options by + +``` +% velph init --help +``` + +## Settings in sections of `velph.toml` + +Note that the same can be applied to `velph-tmpl.toml`. + +### Default INCAR settings + +The default INCAR settins are written in `[vasp.incar]`. These settings are +overwritten by `[vasp.CALC_TYPE.incar]` (`CALC_TYPE` can be `phelel`, `relax`, +`nac`, `transport`, `phono3py`, `phono3py.phonon`, etc). + +### Scheduler settings + +The parameters used for generating the job submission script are specified as +strings in `[scheduler]`. If `[vasp.CALC_TYPE.scheduler]` is +specified, `[scheduler]` settings are overwritten by the settings for +`[vasp.CALC_TYPE]`. The content in this section operates through [Python string +formatting](https://docs.python.org/3/library/stdtypes.html#str.format), using +replacement fields named after keyword arguments. Each parameter line in the +`[scheduler]` section is treated as a keyword argument, which is then inserted +into the string format. + +In the `[scheduler]` section, the parameters `scheduler_name` and +`scheduler_template` have special roles: + +- `scheduler_name`: Specifies the template type, with options `slurm`, `sge`, or + `custom`. For `slurm` and `sge`, the template string (i.e., + `scheduler_template`) is + [hard-coded](https://github.com/phonopy/phelel/blob/develop/src/phelel/velph/utils/scheduler.py). + If `custom` is selected, the string provided by `scheduler_template` is used, + into which the parameters are inserted. +- `scheduler_template`: The string template where parameters defined in this + section are inserted. + +An example is shown below. + +```toml +[scheduler] +scheduler_name = "sge" +job_name = "PbTe" +mpirun_command = "mpirun" +vasp_binary = "/usr/local/cluster-1/bin/vasp_std" +pe = "vienna 32" +prepend_text = ''' +source /opt/intel/oneapi/setvars.sh --config="/home/togo/.oneapi-config" +''' + +... +[vasp.phelel.scheduler] +pe = "paris 24" + +... +[vasp.phonopy.scheduler] +scheduler_template = '''#!/bin/bash +#QSUB2 core 192 +#QSUB2 mpi 192 +#QSUB2 smp 1 +#QSUB2 wtime 48:00:00 +#PBS -N {job_name} +cd $PBS_O_WORKDIR + +{prepend_text} +{mpirun_command} {vasp_binary} | tee vasp_output +{append_text} +''' +job_name = "PbTe" +mpirun_command = "mpijob" +vasp_binary = "/usr/local/cluster-2/bin/vasp_std" +prepend_text = ''' +. /etc/profile.d/modules.sh +module load inteloneapi22u3 +''' +append_text = "" +``` diff --git a/doc/velph-init.md b/doc/velph-init.md index 96a2a99..59ee801 100644 --- a/doc/velph-init.md +++ b/doc/velph-init.md @@ -1,3 +1,4 @@ +(velph_init)= # `velph init` `velph init` with command options will generate modified `velph.toml` from the @@ -10,7 +11,7 @@ template. be specified, POSCAR-format crystal structure and directory name that is created where `velph.toml` is stored. The available options are explained below. Some options can be specified in `[init.options]` section of the velph-toml template -file (see {ref}`velph-init-template`). +file (see {ref}`velph_init_template`). ## `velph init` options @@ -79,109 +80,3 @@ String corresponding to INCAR MAGMOM tag value for unit cell, e.g., "24*1" or "0 0 1". This is similar to `MAGMOM` tag in phonopy, see https://phonopy.github.io/phonopy/setting-tags.html#magmom. In velph, the asterisk symbol (`*`) is supported. - - -(velph-init-template)= -## `velph init` template - -`velph init` is the command to prepare `velph.toml`. Without specifying a -velph-toml-template, the default template is used. Custom template can be -specified as follows: - -``` -% velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER --template-toml velph-tmpl.toml -``` - -The `velph-tmpl.toml` (arbitrary file name) is almost like the `velph.toml` -file. It means that the `velph-tmpl.toml` may be created modifying -`velph.toml`. The sections that exist only in the `velph-tmpl.toml` but not in -`velph.toml` is `[init.options]`. This can be used as alternatives of command -options of `velph-init`, e.g., - -```toml -[init.options] -kspacing = 0.2 -kspacing_dense = 0.1 -max_num_atoms = 120 -``` - -These `[init.options]` keywords can be found along with the list of the command -options by - -``` -% velph init --help -``` - -## Settings in sections of `velph.toml` - -Note that the same can be applied to `velph-tmpl.toml`. - -### Default INCAR settings - -The default INCAR settins are written in `[vasp.incar]`. These settings are -overwritten by `[vasp.CALC_TYPE.incar]` (`CALC_TYPE` can be `phelel`, `relax`, -`nac`, `transport`, `phono3py`, `phono3py.phonon`, etc). - -### Scheduler settings - -The parameters used for generating the job submission script are specified as -strings in `[scheduler]`. If `[vasp.CALC_TYPE.scheduler]` is -specified, `[scheduler]` settings are overwritten by the settings for -`[vasp.CALC_TYPE]`. The content in this section operates through [Python string -formatting](https://docs.python.org/3/library/stdtypes.html#str.format), using -replacement fields named after keyword arguments. Each parameter line in the -`[scheduler]` section is treated as a keyword argument, which is then inserted -into the string format. - -In the `[scheduler]` section, the parameters `scheduler_name` and -`scheduler_template` have special roles: - -- `scheduler_name`: Specifies the template type, with options `slurm`, `sge`, or - `custom`. For `slurm` and `sge`, the template string (i.e., - `scheduler_template`) is - [hard-coded](https://github.com/phonopy/phelel/blob/develop/src/phelel/velph/utils/scheduler.py). - If `custom` is selected, the string provided by `scheduler_template` is used, - into which the parameters are inserted. -- `scheduler_template`: The string template where parameters defined in this - section are inserted. - -An example is shown below. - -```toml -[scheduler] -scheduler_name = "sge" -job_name = "PbTe" -mpirun_command = "mpirun" -vasp_binary = "/usr/local/cluster-1/bin/vasp_std" -pe = "vienna 32" -prepend_text = ''' -source /opt/intel/oneapi/setvars.sh --config="/home/togo/.oneapi-config" -''' - -... -[vasp.phelel.scheduler] -pe = "paris 24" - -... -[vasp.phonopy.scheduler] -scheduler_template = '''#!/bin/bash -#QSUB2 core 192 -#QSUB2 mpi 192 -#QSUB2 smp 1 -#QSUB2 wtime 48:00:00 -#PBS -N {job_name} -cd $PBS_O_WORKDIR - -{prepend_text} -{mpirun_command} {vasp_binary} | tee vasp_output -{append_text} -''' -job_name = "PbTe" -mpirun_command = "mpijob" -vasp_binary = "/usr/local/cluster-2/bin/vasp_std" -prepend_text = ''' -. /etc/profile.d/modules.sh -module load inteloneapi22u3 -''' -append_text = "" -``` diff --git a/doc/velph-subcommands.md b/doc/velph-subcommands.md index 1287cd4..f32e917 100644 --- a/doc/velph-subcommands.md +++ b/doc/velph-subcommands.md @@ -1,5 +1,8 @@ +(velph_subcommands)= # `velph` subcommands +`velph init` is + ## `velph phelel` This command calculates the derivatives of local potentials and PAW strengths From 7abc3047c459f6bf0af78afe129cf327b7a7aefc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 01:25:15 +0000 Subject: [PATCH 05/10] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.8.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.4...v0.8.6) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2b7a43..67e7a2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.4 + rev: v0.8.6 hooks: - id: ruff args: [ "--fix", "--show-fixes" ] From d90751d3a4c440907b67ed3de022cca3eefc0214 Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Tue, 7 Jan 2025 16:15:15 +0900 Subject: [PATCH 06/10] Update documentation of velph --- doc/velph-command.md | 1 + doc/velph-subcommands.md | 102 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 2 deletions(-) diff --git a/doc/velph-command.md b/doc/velph-command.md index 09f4df7..b43e888 100644 --- a/doc/velph-command.md +++ b/doc/velph-command.md @@ -46,6 +46,7 @@ Commands: transport Choose transport options. ``` +(velph_hints)= ## `velph hints` This command provides a quick reference of calculation steps. diff --git a/doc/velph-subcommands.md b/doc/velph-subcommands.md index f32e917..4ee53b5 100644 --- a/doc/velph-subcommands.md +++ b/doc/velph-subcommands.md @@ -1,11 +1,68 @@ (velph_subcommands)= # `velph` subcommands -`velph init` is +The `velph` subcommands, except for {ref}`velph_init` and {ref}`velph_hints`, +are explained on this page. + +The following subcommands must be executed in the directory containing the +`velph.toml` file. This ensures that the directories and files generated are +properly organized relative to the current directory where `velph.toml` is +located. + +In the following example, two `velph init` command operations generate two +different directories. The first operation performs crystal structure relaxation +in the `relax` directory. The second operation, using the relaxed crystal +structure, carries out additional calculations required for electron-phonon +interactions in the `calc` directory. Details about `velph-tmpl.toml` are +described in {ref}`velph_init_template`. + +``` +% ls +POSCAR-unitcell POTCAR velph-tmpl.toml +% velph init --template-toml velph-tmpl.toml POSCAR-unitcell relax +... +% cd relax +% velph relax generate +... +# Run VASP relaxation calculation +... +% cd .. +% ls +POSCAR-unitcell POTCAR relax/ velph-tmpl.toml +% velph init --template-toml velph-tmpl.toml `ls relax/relax/iter*/CONTCAR|tail -n 1` calc +... +% cd calc +% ls +POTCAR velph.toml +% velph nac generate +VASP input files were made in "nac". +% ls +POTCAR nac/ velph.toml +... +# Run NAC calculation +... +% velph phelel init +Found "nac" directory. Read NAC params. +"phelel/phelel_disp.yaml" was generated. +VASP input files will be generated by "velph phelel generate". +% velph phelel generate +VASP input files were generated in "phelel/disp-000". +VASP input files were generated in "phelel/disp-001". +VASP input files were generated in "phelel/disp-002". +VASP input files were generated in "phelel/disp-003". +VASP input files were generated in "phelel/disp-004". +% ls +POTCAR nac/ phelel/ velph.toml +% velph phelel init +Found "nac" directory. Read NAC params. +"phelel/phelel_disp.yaml" was generated. +VASP input files will be generated by "velph phelel generate". +... +``` ## `velph phelel` -This command calculates the derivatives of local potentials and PAW strengths +This subcommand calculates the derivatives of local potentials and PAW strengths with respect to displacement, performing similar operations as steps 1 and 3 carried out by the `phelel` command in the {ref}`workflow `. @@ -25,10 +82,51 @@ carried out by the `phelel` command in the {ref}`workflow `. ## `velph relax` +It is recommended to create a project directory secific for relaxation +calculation, e.g., by + +``` +% ls +POSCAR-unitcell POTCAR velph-tmpl.toml +% velph init --template-toml velph-tmpl.toml POSCAR-unitcell relax +... +% cd relax +% ls +POTCAR velph.toml +% velph relax generate +... +``` + ### `velph relax generate` +This subcommand prepares VASP input files and a job script for crystal structure +relaxation. Multiple relaxation calculations can be performed. In such cases, +the `CONTCAR` from the previous calculation is used as the `POSCAR` for the next +calculation to generate a new set of VASP input files. + +``` +% ls +POTCAR velph.toml +% velph relax generate +VASP input files were made in "relax/iter1". +... +# Run VASP calculation in relax/iter1 +... +% ls +POTCAR relax/ velph.toml +% velph relax generate +"relax/iter1" exists. +"relax/iter1/CONTCAR" will be as new "POSCAR". +VASP input files were made in "relax/iter2". +... +``` + ## `velph nac` +This subcommand is used to calculate dielectric constant and Born effective +charges that are used for non-analytical term correction of phonon calculation +and treatment of long range term of electron phonon interaction. + ### `velph nac generate` ## `velph el_bands` From a5492ab77199ce20c801d3aca47025772821f1d5 Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Wed, 8 Jan 2025 14:15:46 +0900 Subject: [PATCH 07/10] Update documentation --- doc/index.md | 1 + doc/install.md | 2 +- doc/phelel-command.md | 14 +++++----- doc/velph-command.md | 4 +-- doc/velph-init.md | 2 +- doc/velph-subcommands.md | 56 +++++++++++++++++++++++++++++++++------- 6 files changed, 58 insertions(+), 21 deletions(-) diff --git a/doc/index.md b/doc/index.md index f5bb90d..2c271c7 100644 --- a/doc/index.md +++ b/doc/index.md @@ -35,5 +35,6 @@ velph-init velph-init-template velph-subcommands velph-example +reference changelog ``` diff --git a/doc/install.md b/doc/install.md index ccdf701..369d3e5 100644 --- a/doc/install.md +++ b/doc/install.md @@ -5,7 +5,7 @@ * phonopy * phono3py * spglib -* finufft +* {ref}`reference_finufft` * click * tomli * tomli-w diff --git a/doc/phelel-command.md b/doc/phelel-command.md index 567342c..d1d3928 100644 --- a/doc/phelel-command.md +++ b/doc/phelel-command.md @@ -8,7 +8,7 @@ phonon calculations. The following example demonstrates operations using the `phelel` command: -``` +```bash % phelel -d --dim 2 2 2 -c POSCAR-unitcell --pa auto --pm # After running VASP calculations in directories corresponding to displacements: @@ -21,7 +21,7 @@ The following example demonstrates operations using the `phelel` command: Supercells with displacements can be generated by combining the following command options. For example: -``` +```bash % phelel -d --dim 2 2 2 -c POSCAR-unitcell --pa auto --pm ``` @@ -46,11 +46,11 @@ three values are given, they represent the diagonal elements of the supercell matrix, meaning each axis of the input unit cell is simply extended by the corresponding integer factor. -``` +```bash % phelel --dim 2 2 2 [OPTIONS] ``` -``` +```bash % phelel --dim 0 1 1 1 0 1 1 1 0 [OPTIONS] ``` @@ -59,7 +59,7 @@ corresponding integer factor. Unit cell structure is specified. -``` +```bash % phelel -c POSCAR-unitcell [OPTIONS] ``` @@ -70,7 +70,7 @@ symmetrically equivalent displacements in the opposite direction. With this option specified, both directions are included in the generated supercells with dispacements. Use of this option is recommended. -``` +```bash % phelel --pm [OPTIONS] ``` @@ -81,7 +81,7 @@ under the configurations of displacements in supercells, those data are stored in cetain files. Those are read and then the derivatives are computed by the following command option, e.g., -``` +```bash % phelel --cd disp-000 disp-001 disp-002 disp-003 disp-004 ``` diff --git a/doc/velph-command.md b/doc/velph-command.md index b43e888..bea594b 100644 --- a/doc/velph-command.md +++ b/doc/velph-command.md @@ -22,7 +22,7 @@ to atomic displacement, resulting in the `phelel_params.hdf5` file. Most of the A list of supported subcommands is displayed by typing: -``` +```bash % velph Usage: velph [OPTIONS] COMMAND [ARGS]... @@ -51,6 +51,6 @@ Commands: This command provides a quick reference of calculation steps. -``` +```bash % velph hints ``` diff --git a/doc/velph-init.md b/doc/velph-init.md index 59ee801..5cf9951 100644 --- a/doc/velph-init.md +++ b/doc/velph-init.md @@ -3,7 +3,7 @@ `velph init` with command options will generate modified `velph.toml` from the template. -``` +```bash % velph init [OPTIONS] CELL_FILENAME PROJECT_FOLDER ``` diff --git a/doc/velph-subcommands.md b/doc/velph-subcommands.md index 4ee53b5..6161068 100644 --- a/doc/velph-subcommands.md +++ b/doc/velph-subcommands.md @@ -16,7 +16,7 @@ structure, carries out additional calculations required for electron-phonon interactions in the `calc` directory. Details about `velph-tmpl.toml` are described in {ref}`velph_init_template`. -``` +```bash % ls POSCAR-unitcell POTCAR velph-tmpl.toml % velph init --template-toml velph-tmpl.toml POSCAR-unitcell relax @@ -68,8 +68,31 @@ carried out by the `phelel` command in the {ref}`workflow `. ### `velph phelel init` +This subcommand generates the `phelel_disp.yaml` file, which contains +information about the supercell structure and displacements. It is recommended +to generate `phelel_disp.yaml` after performing the NAC calculation (see +{ref}`velph_nac_subcommand`). At this stage, the dielectric constant and Born +effective charges are written to `phelel_disp.yaml`, and these values are +ultimately stored in `phelel_params.hdf5` through the `phelel_disp.yaml` file. + +```bash +% velph phelel init +Found "nac" directory. Read NAC params. +"phelel/phelel_disp.yaml" was generated. +VASP input files will be generated by "velph phelel generate". +``` + ### `velph phelel generate` +```bash +% velph phelel generate +VASP input files were generated in "phelel/disp-000". +VASP input files were generated in "phelel/disp-001". +VASP input files were generated in "phelel/disp-002". +VASP input files were generated in "phelel/disp-003". +VASP input files were generated in "phelel/disp-004". +``` + ### `velph phelel differentiate` ### `velph phelel phonopy` @@ -83,9 +106,9 @@ carried out by the `phelel` command in the {ref}`workflow `. ## `velph relax` It is recommended to create a project directory secific for relaxation -calculation, e.g., by +calculation, e.g., as -``` +```bash % ls POSCAR-unitcell POTCAR velph-tmpl.toml % velph init --template-toml velph-tmpl.toml POSCAR-unitcell relax @@ -96,15 +119,16 @@ POTCAR velph.toml % velph relax generate ... ``` - ### `velph relax generate` -This subcommand prepares VASP input files and a job script for crystal structure -relaxation. Multiple relaxation calculations can be performed. In such cases, -the `CONTCAR` from the previous calculation is used as the `POSCAR` for the next -calculation to generate a new set of VASP input files. +This subcommand generates VASP input files and a job script for crystal +structure relaxation. Initially, these files are created in the `iter1` +directory. The process supports multiple relaxation steps, where the `CONTCAR` +file from the previous iteration is used as the `POSCAR` for the next step once +the preceding VASP calculation is complete. Each subsequent set of input files +is generated in directories named `iter2`, `iter3`, and so on. -``` +```bash % ls POTCAR velph.toml % velph relax generate @@ -121,14 +145,26 @@ VASP input files were made in "relax/iter2". ... ``` +(velph_nac_subcommand)= ## `velph nac` This subcommand is used to calculate dielectric constant and Born effective charges that are used for non-analytical term correction of phonon calculation -and treatment of long range term of electron phonon interaction. +and treatment of long range term of electron-phonon interaction calculation. ### `velph nac generate` +After the VASP calculation is complete, the dielectric constant and Born +effective charges are extracted from the `vasprun.xml` file during the execution +of `velph phelel init`, `velph phono3py init`, or `velph phonopy init`. The +extracted values are then written to `phelel_disp.yaml`, `phono3py_disp.yaml`, +or `phonopy_disp.yaml`, respectively. + +```bash +% velph nac generate +VASP input files were made in "nac". +``` + ## `velph el_bands` ### `velph el_bands generate` From a484d5674ceddc29cb6380bf78420a8248e187b1 Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Wed, 8 Jan 2025 15:04:47 +0900 Subject: [PATCH 08/10] Update documentation --- doc/reference.md | 12 ++++++++++++ doc/velph-subcommands.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 doc/reference.md diff --git a/doc/reference.md b/doc/reference.md new file mode 100644 index 0000000..56607bd --- /dev/null +++ b/doc/reference.md @@ -0,0 +1,12 @@ +(references)= +# References + +This page presents the methodologies and software packages that the phelel code relies on. + +(reference_finufft)= +## finufft + +The local potentials from VASP calculation results are interpolated using +[finufft](https://finufft.readthedocs.io/). For more information and references +on finufft, visit +[https://finufft.readthedocs.io/en/latest/refs.html](https://finufft.readthedocs.io/en/latest/refs.html). diff --git a/doc/velph-subcommands.md b/doc/velph-subcommands.md index 6161068..416971f 100644 --- a/doc/velph-subcommands.md +++ b/doc/velph-subcommands.md @@ -66,6 +66,14 @@ This subcommand calculates the derivatives of local potentials and PAW strengths with respect to displacement, performing similar operations as steps 1 and 3 carried out by the `phelel` command in the {ref}`workflow `. +The subcommands below should be executed in the following order: + +1. {ref}`velph_phelel_init_subcommand` +2. {ref}`velph_phelel_generate_subcommand` +3. {ref}`velph_phelel_differentiate_subcommand` +4. {ref}`velph_phelel_phonopy_subcommand` (optional) + +(velph_phelel_init_subcommand)= ### `velph phelel init` This subcommand generates the `phelel_disp.yaml` file, which contains @@ -82,8 +90,11 @@ Found "nac" directory. Read NAC params. VASP input files will be generated by "velph phelel generate". ``` +(velph_phelel_generate_subcommand)= ### `velph phelel generate` +VASP input files and job scripts are generated. + ```bash % velph phelel generate VASP input files were generated in "phelel/disp-000". @@ -93,10 +104,33 @@ VASP input files were generated in "phelel/disp-003". VASP input files were generated in "phelel/disp-004". ``` +(velph_phelel_differentiate_subcommand)= ### `velph phelel differentiate` +The derivatives of local potentials and PAW strengths with respect to +displacement are calculated and stored in `phelel_params.hdf5`. + +```bash +% velph phelel differentiate +FFT mesh: [30 30 30]. +Running finufft (eps=1.000e-06)... +Running finufft (eps=1.000e-06)... +"phelel/phelel_params.hdf5" has been made. +``` + +(velph_phelel_phonopy_subcommand)= ### `velph phelel phonopy` +`phonopy_params.yaml` that contains information necessary for phonon calculation +by the phonopy code is generated from `phelel_disp.yaml` and the results of the +VASP inputs generated by `velph phelel generate`. + +```bash +% velph phelel phonopy +"phelel/phonopy_params.yaml" has been made. +% phonopy-load phelel/phonopy_params.yaml --band auto -p +``` + ## `velph transport` ### `velph transport generate` From b5465efa6816898fc13f8de53d3109d78fa4cd66 Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Wed, 8 Jan 2025 15:05:23 +0900 Subject: [PATCH 09/10] Fix extra supercell related bugs --- src/phelel/api_phelel.py | 40 ++++++++++++++++++++---- src/phelel/cui/create_supercells.py | 14 ++++----- src/phelel/cui/phelel_script.py | 2 +- src/phelel/interface/vasp/derivatives.py | 5 +-- src/phelel/velph/cli/phelel/phonopy.py | 10 ++++-- 5 files changed, 50 insertions(+), 21 deletions(-) diff --git a/src/phelel/api_phelel.py b/src/phelel/api_phelel.py index a531146..6ffe030 100644 --- a/src/phelel/api_phelel.py +++ b/src/phelel/api_phelel.py @@ -349,11 +349,6 @@ def unit_conversion_factor(self) -> float: else: return self._phonon.unit_conversion_factor - @property - def phonon(self) -> Optional[Phonopy]: - """Return Phonopy class instance.""" - return self._phonon - @property def fft_mesh(self) -> np.ndarray: """Setter and getter of FFT mesh numbers.""" @@ -427,6 +422,20 @@ def generate_displacements( distance=distance, is_plusminus=is_plusminus, is_diagonal=is_diagonal ) + def generate_phonon_displacements( + self, + distance=0.01, + is_plusminus="auto", + is_diagonal=True, + ): + """Generate displacement dataset.""" + if self._phonon is None: + msg = "Phonon instance has to be initialized." + raise RuntimeError(msg) + self._phonon.generate_displacements( + distance=distance, is_plusminus=is_plusminus, is_diagonal=is_diagonal + ) + def run_derivatives(self, phe_input: PhelelDataset): """Run displacement derivatives calculations from temporary raw data. @@ -488,6 +497,7 @@ def save_hdf5( "atom_indices_in_derivatives": self._atom_indices_in_derivatives, "disp_dataset": self._phelel_phonon.dataset, "nac_params": self._phelel_phonon.nac_params, + "filename": filename, } if self._phonon is not None: params.update( @@ -497,11 +507,29 @@ def save_hdf5( "phonon_primitive": self._phonon.primitive, "phonon_supercell": self._phonon.supercell, "symmetry_dataset": self._phonon.primitive_symmetry.dataset, - "filename": filename, } ) write_phelel_params_hdf5(**params) + def save_phonon( + self, + filename="phonopy_params.yaml", + settings=None, + hdf5_settings=None, + compression: Union[str, bool] = False, + ): + """Save phonon in yaml format.""" + if self._phonon is None: + ph = self._phelel_phonon + else: + ph = self._phonon + ph.save( + filename=filename, + settings=settings, + hdf5_settings=hdf5_settings, + compression=compression, + ) + def _prepare_phonon( self, dataset: Optional[dict] = None, diff --git a/src/phelel/cui/create_supercells.py b/src/phelel/cui/create_supercells.py index 919bc81..0e43364 100644 --- a/src/phelel/cui/create_supercells.py +++ b/src/phelel/cui/create_supercells.py @@ -78,14 +78,14 @@ def create_phelel_supercells( additional_info=additional_info, ) - if phelel.phonon is not None: + if phelel.phonon_supercell_matrix is not None: additional_info = get_additional_info_to_write_fc2_supercells( interface_mode, phelel.phonon_supercell_matrix, suffix="PH" ) write_supercells_with_displacements( - phelel.phonon.calculator, - phelel.phonon.supercell, - phelel.phonon.supercells_with_displacements, + phelel.calculator, + phelel.phonon_supercell, + phelel.phonon_supercells_with_displacements, optional_structure_info=optional_structure_info, additional_info=additional_info, ) @@ -115,12 +115,12 @@ def generate_phelel_supercells( print("Displacement distance: %s" % _distance) print("Number of displacements: %d" % len(phelel.supercells_with_displacements)) - if phelel.phonon is not None: - phelel.phonon.generate_displacements( + if phelel.phonon_supercell_matrix is not None: + phelel.generate_phonon_displacements( distance=distance, is_plusminus=is_plusminus, is_diagonal=is_diagonal ) if log_level: print( "Number of displacements for phonon: %d" - % len(phelel.phonon.supercells_with_displacements) + % len(phelel.phonon_supercells_with_displacements) ) diff --git a/src/phelel/cui/phelel_script.py b/src/phelel/cui/phelel_script.py index 9958686..6513efa 100644 --- a/src/phelel/cui/phelel_script.py +++ b/src/phelel/cui/phelel_script.py @@ -219,7 +219,7 @@ def main(**argparse_control): print_cell(phelel.supercell) if phelel.phonon_supercell_matrix is not None: print("-" * 28 + " phonon super cell " + "-" * 29) - print_cell(phelel.phonon.supercell) + print_cell(phelel.phonon_supercell) print("-" * 76) ################################## diff --git a/src/phelel/interface/vasp/derivatives.py b/src/phelel/interface/vasp/derivatives.py index 1151062..be7db87 100644 --- a/src/phelel/interface/vasp/derivatives.py +++ b/src/phelel/interface/vasp/derivatives.py @@ -78,10 +78,7 @@ def read_files( "atoms in the vasprun.xml file." ) - if phelel.phonon_supercell_matrix is None: - phelel.forces = forces - else: - phelel.phonon.forces = forces + phelel.forces = forces nac_params = _read_born( phelel.primitive, phelel.primitive_symmetry, log_level=log_level diff --git a/src/phelel/velph/cli/phelel/phonopy.py b/src/phelel/velph/cli/phelel/phonopy.py index 8df51c0..12908ea 100644 --- a/src/phelel/velph/cli/phelel/phonopy.py +++ b/src/phelel/velph/cli/phelel/phonopy.py @@ -63,12 +63,16 @@ def create_phonopy_yaml( # NAC params should be contained phelel_disp.yaml. # Therefore nac_params is not set to phe here. + if phe.phonon_supercell_matrix is None: + supercell = phe.supercell + else: + supercell = phe.phonon_supercell forces = read_forces_from_vasprunxmls( [d / "vasprun.xml" for d in dir_names], - phe.phonon, + supercell, subtract_rfs=subtract_residual_forces, log_level=0, ) - phe.phonon.forces = forces - phe.phonon.save(filename=phonopy_yaml_filename) + phe.forces = forces + phe.save_phonon(filename=phonopy_yaml_filename) click.echo(f'"{phonopy_yaml_filename}" has been made.') From 4698cd6172e252acf1d809cfeb8745a111d4999a Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Wed, 8 Jan 2025 15:12:17 +0900 Subject: [PATCH 10/10] Set version 0.8.1 --- doc/changelog.md | 4 ++++ doc/conf.py | 2 +- src/phelel/version.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index d4881f4..0b7dee4 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,6 +2,10 @@ # Change Log +## Jan-8-2025: Version 0.8.1 + +- Fix minor bugs in velph command + ## Jan-5-2025: Version 0.8.0 - Refactoring of `Phelel` class diff --git a/doc/conf.py b/doc/conf.py index df6716a..5943517 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,7 +11,7 @@ author = "Atsushi Togo" version = "0.8" -release = "0.8.0" +release = "0.8.1" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/src/phelel/version.py b/src/phelel/version.py index eae0dee..2468b95 100644 --- a/src/phelel/version.py +++ b/src/phelel/version.py @@ -1,3 +1,3 @@ """Version number.""" -__version__ = "0.8.0" +__version__ = "0.8.1"