Skip to content

Commit

Permalink
Merge pull request #20 from phonopy/Refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
atztogo authored Aug 31, 2024
2 parents ce0560a + 6ddf700 commit c31afad
Show file tree
Hide file tree
Showing 5 changed files with 323 additions and 135 deletions.
18 changes: 15 additions & 3 deletions src/phelel/velph/cli/init/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@
f"(phelel_nosym: bool, default={VelphInitParams.phelel_nosym})"
),
)
@click.option(
"--phonon-max-num-atoms",
"phonon_max_num_atoms",
nargs=1,
default=None,
type=int,
help=(
"Determine phonon supercell dimension so that number of atoms in supercell "
"for phonon is less than this number if different one from electron-phonon "
"(phelel) or phonon-phonon (phono3py) is expected. "
f"(phonon_max_num_atoms: int, default={VelphInitParams.phonon_max_num_atoms})"
),
)
@click.option(
"--plusminus/--auto",
"plusminus",
Expand Down Expand Up @@ -232,6 +245,7 @@ def cmd_init(
max_num_atoms: Optional[int],
phelel_dir_name: str,
phelel_nosym: Optional[bool],
phonon_max_num_atoms: Optional[int],
primitive_cell_choice: Optional[str],
project_folder: str,
symmetrize_cell: Optional[bool],
Expand Down Expand Up @@ -272,6 +286,7 @@ def cmd_init(
"magmom": magmom,
"max_num_atoms": max_num_atoms,
"phelel_nosym": phelel_nosym,
"phonon_max_num_atoms": phonon_max_num_atoms,
"primitive_cell_choice": primitive_cell_choice,
"symmetrize_cell": symmetrize_cell,
"tolerance": tolerance,
Expand All @@ -280,7 +295,6 @@ def cmd_init(

cell_filepath = pathlib.Path(cell_filename)
if cell_filepath.exists():
click.echo(f'Crystal structure file: "{cell_filepath}".')
vfp_dict = {"cell_filepath": cell_filepath}
else:
click.echo(f'"{cell_filename}" not found.', err=True)
Expand All @@ -297,7 +311,6 @@ def cmd_init(
if template_toml_filename is not None:
velph_tmpl_filepath = pathlib.Path(template_toml_filename)
if velph_tmpl_filepath.exists():
click.echo(f'Velph template file: "{template_toml_filename}".')
vfp_dict["velph_template_filepath"] = velph_tmpl_filepath
else:
click.echo(f'"{template_toml_filename}" not found.', err=True)
Expand All @@ -318,7 +331,6 @@ def cmd_init(
return

vfp = VelphFilePaths(**vfp_dict)

toml_lines = run_init(vip_cmd_options, vfp, phelel_dir_name=phelel_dir_name)

# Write velph.toml.
Expand Down
Loading

0 comments on commit c31afad

Please sign in to comment.