forked from skelton-group/Phonopy-Spectroscopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvasp-ir
More file actions
executable file
·90 lines (61 loc) · 2.25 KB
/
vasp-ir
File metadata and controls
executable file
·90 lines (61 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python
# -------
# Imports
# -------
from argparse import ArgumentParser;
from SpectroscoPy.Utilities import EigenvectorsToEigendisplacements;
from SpectroscoPy.Interfaces.VASP import ParseOUTCAR;
from SpectroscoPy.CLI.Parser import UpdateParser, PostProcessArgs;
from SpectroscoPy.CLI.Runtime import RunMode_IR;
# ----
# Main
# ----
if __name__ == "__main__":
# Parse command-line arguments.
parser = ArgumentParser(
description = "Simulate IR spectra from VASP phonon-frequency and Born-charge calculations"
);
# Add input-files argument group.
group = parser.add_argument_group("Input files");
group.add_argument(
"--outcar_freq",
metavar = "<file_path>",
type = str, dest = "OUTCARFreqPath",
default = "OUTCAR",
help = "OUTCAR file to read frequencies and eigenvectors from (default: OUTCAR)"
);
group.add_argument(
"--outcar_born",
metavar = "<file_path>",
type = str, dest = "OUTCARBornPath",
default = "OUTCAR",
help = "OUTCAR file to read Born charges from (default: OUTCAR)"
);
# Add standard arguments groups.
UpdateParser(parser, 'ir');
# Parse and process arguments.
args = parser.parse_args();
PostProcessArgs(args, 'ir');
# Read input files.
outcarData = None;
if args.OUTCARFreqPath == args.OUTCARBornPath:
outcarData = ParseOUTCAR(
args.OUTCARFreqPath, extractList = ['atomic_masses', 'phonon_modes', 'born_charges']
);
else:
outcarData = ParseOUTCAR(
args.OUTCARFreqPath, extractList = ['atomic_masses', 'phonon_modes']
);
outcarData2 = ParseOUTCAR(
args.OUTCARBornPath, extractList = ['born_charges']
);
outcarData['born_charges'] = outcarData2['born_charges'];
# Convert eigenvectors to eigendisplacements.
frequencySets, eigenvectors = outcarData['phonon_modes'];
eigendisplacements = EigenvectorsToEigendisplacements(
eigenvectors, outcarData['atomic_masses']
);
# Pass the input data to RunMode_IR() for processing.
RunMode_IR(
frequencySets[2], 'inv_cm', eigendisplacements, outcarData['born_charges'], args
);