Skip to content

Arkane: add check for iop(2/9=2000) in Gaussian load geometry #2758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion arkane/ess/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,23 @@ def load_force_constant_matrix(self):
only the last is returned. The units of the returned force constants
are J/m^2. If no force constant matrix can be found in the log file,
``None`` is returned.
Also checks that the force constant matrix was computed using the correct
(input orientation Cartesian) coordinates.
IOP(2/9=2000) must be specified for large cases (14+ atoms)
"""
force = None

iop2_9_equals_2000 = False

n_atoms = self.get_number_of_atoms()
n_rows = n_atoms * 3

with open(self.path, 'r') as f:
line = f.readline()
while line != '':
if '2/9=2000' in line:
iop2_9_equals_2000 = True

# Read force constant matrix
if 'Force constants in Cartesian coordinates:' in line:
force = np.zeros((n_rows, n_rows), float)
Expand All @@ -157,6 +165,11 @@ def load_force_constant_matrix(self):
force *= 4.35974417e-18 / 5.291772108e-11 ** 2
line = f.readline()

if n_atoms > 13 and not iop2_9_equals_2000:
raise LogError(f'Gaussian output file {self.path} contains more than 13 atoms. '
f'Please add the `iop(2/9=2000)` keyword to your input file '
f'so Gaussian will compute force matrix using the input orientation Cartesians.')

return force

def load_geometry(self):
Expand All @@ -166,7 +179,7 @@ def load_geometry(self):
last is returned.
"""
number, coord, mass = [], [], []

with open(self.path, 'r') as f:
line = f.readline()
while line != '':
Expand Down
Loading