From c525f4539b98512e0d7ef94cf254cd79098d9054 Mon Sep 17 00:00:00 2001 From: Pierre Beaujean Date: Thu, 14 Mar 2024 16:26:29 +0100 Subject: [PATCH] add command line option --- phonopy_vibspec/scripts/__init__.py | 2 ++ phonopy_vibspec/scripts/prepare_raman.py | 1 + phonopy_vibspec/scripts/spectrum_ir.py | 3 ++- phonopy_vibspec/scripts/vesta_modes.py | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phonopy_vibspec/scripts/__init__.py b/phonopy_vibspec/scripts/__init__.py index 377dd53..873f3ca 100644 --- a/phonopy_vibspec/scripts/__init__.py +++ b/phonopy_vibspec/scripts/__init__.py @@ -17,6 +17,8 @@ def add_common_args(parser: argparse.ArgumentParser): parser.add_argument('-m', '--modes', type=list_of_modes, help='List of modes (1-based)', default='') + parser.add_argument('-O', '--only', type=str, help='only consider certain atoms', default='') + def interval(s_interval: str) -> Tuple[float, float]: """get interval diff --git a/phonopy_vibspec/scripts/prepare_raman.py b/phonopy_vibspec/scripts/prepare_raman.py index 796c070..00c801d 100644 --- a/phonopy_vibspec/scripts/prepare_raman.py +++ b/phonopy_vibspec/scripts/prepare_raman.py @@ -23,6 +23,7 @@ def main(): phonons = PhononsAnalyzer.from_phonopy( phonopy_yaml=args.phonopy, force_constants_filename=args.fc, + only=args.only if args.only != '' else None ) raman_spectrum = phonons.prepare_raman( diff --git a/phonopy_vibspec/scripts/spectrum_ir.py b/phonopy_vibspec/scripts/spectrum_ir.py index 83ca134..b2a4df0 100644 --- a/phonopy_vibspec/scripts/spectrum_ir.py +++ b/phonopy_vibspec/scripts/spectrum_ir.py @@ -21,7 +21,8 @@ def main(): phonons = PhononsAnalyzer.from_phonopy( phonopy_yaml=args.phonopy, force_constants_filename=args.fc, - born_filename=args.born + born_filename=args.born, + only=args.only if args.only != '' else None ) ir_spectrum = phonons.infrared_spectrum(modes=args.modes if len(args.modes) > 0 else None) diff --git a/phonopy_vibspec/scripts/vesta_modes.py b/phonopy_vibspec/scripts/vesta_modes.py index fccdc9c..90cdaea 100644 --- a/phonopy_vibspec/scripts/vesta_modes.py +++ b/phonopy_vibspec/scripts/vesta_modes.py @@ -47,6 +47,7 @@ def main(): phonons = PhononsAnalyzer.from_phonopy( phonopy_yaml=args.phonopy, force_constants_filename=args.fc, + only=args.only if args.only != '' else None ) phonons.make_vesta_for_modes(