Skip to content
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

added orca parser to arkane #1749

Merged
merged 3 commits into from
Nov 6, 2019
Merged

added orca parser to arkane #1749

merged 3 commits into from
Nov 6, 2019

Conversation

dranasinghe
Copy link
Contributor

add OrcaLog and orca test to Arkane. currently limited to parsing energy, geometry, number of atoms, t1 diagnostic. Freq, spin multiplicity, scan, conformers are not implemented

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding Orca into Arkane!!
I added a bunch of comments, most of them are minor. Let me know what you think.

arkane/orca.py Outdated

class OrcaLog(Log):
"""
Represent an output file from QChem. The attribute `path` refers to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change QChem to Orca

arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Outdated
def load_force_constant_matrix(self):
# Orca print the hessian to .hess file. you need to provide .hess instead of .log

raise LogError('Could not find a successfully load Orca hessian:Parser is not inpemented')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you replace this with a more specific NotImplementedError error?
Something like: NotImplementedError('The load_force_constant_matrix method is not implemented for Orca Logs')

arkane/orca.py Outdated
CAUTION: The rotational entropy is not quite correctly treated here
because it includes a symmetry number that is not yet correctly
implemented in ORCA. Orca does not provide Rotational temperatures. Only E(rot) and E(trans) energies
Run gaussian to get E0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the last line to `Consider using another supported software (such as Gaussian or QChem) to calculate the frequencies and derive E0.

arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
@dranasinghe
Copy link
Contributor Author

Thank you for the comments I have addressed all the issues.

@alongd
Copy link
Member

alongd commented Oct 17, 2019

@dranasinghe, the tests did not pass, giving the following trace:

======================================================================
ERROR: test_arkane_examples (arkane.mainTest.TestArkaneExamples)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/ReactionMechanismGenerator/RMG-Py/arkane/mainTest.py", line 70, in test_arkane_examples
    arkane.execute()
  File "/home/travis/build/ReactionMechanismGenerator/RMG-Py/arkane/main.py", line 208, in execute
    job.execute(output_directory=self.output_directory, plot=self.plot, pdep=is_pdep(self.job_list))
  File "/home/travis/build/ReactionMechanismGenerator/RMG-Py/arkane/statmech.py", line 207, in execute
    self.load(pdep, plot)
  File "/home/travis/build/ReactionMechanismGenerator/RMG-Py/arkane/statmech.py", line 331, in load
    energy_log = determine_qm_software(energy.path)
  File "/home/travis/build/ReactionMechanismGenerator/RMG-Py/arkane/util.py", line 67, in determine_qm_software
    line = f.readline()
ValueError: I/O operation on closed file.

Let's talk and see how to resolve it.

@codecov
Copy link

codecov bot commented Oct 21, 2019

Codecov Report

Merging #1749 into master will increase coverage by 0.18%.
The diff coverage is 79.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1749      +/-   ##
==========================================
+ Coverage   42.74%   42.92%   +0.18%     
==========================================
  Files          81       82       +1     
  Lines       21078    21182     +104     
  Branches     5491     5519      +28     
==========================================
+ Hits         9010     9093      +83     
+ Misses      11067    11061       -6     
- Partials     1001     1028      +27
Impacted Files Coverage Δ
arkane/orca.py 79.8% <79.8%> (ø)
arkane/kinetics.py 12.14% <0%> (ø) ⬆️
rmgpy/data/statmech.py 42.2% <0%> (ø) ⬆️
rmgpy/rmg/pdep.py 12.21% <0%> (ø) ⬆️
rmgpy/data/kinetics/database.py 50.61% <0%> (ø) ⬆️
rmgpy/data/kinetics/family.py 48.35% <0%> (ø) ⬆️
rmgpy/statmech/ndTorsions.py 59.78% <0%> (ø) ⬆️
rmgpy/yml.py 15.71% <0%> (ø) ⬆️
arkane/sensitivity.py 10% <0%> (ø) ⬆️
rmgpy/rmg/input.py 34% <0%> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d4c5cc...8ddfb09. Read the comment docs.

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw several previous comments that were not addressed, please take a look, add a short explanation if you think the current state of the code is better that the suggestion.

arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Outdated
atom, coord, number, mass = [], [], [], []

with open(self.path) as f:
log = f.read().splitlines()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you agree with the above comment? I didn't see a respective fix

arkane/orca.py Show resolved Hide resolved
arkane/orca.py Outdated
for i in reversed(range(len(log))):
line = log[i]
if 'CARTESIAN COORDINATES (ANGSTROEM)' in line:
for line in log[(i + 3):]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above comment was not addressed

arkane/orca.py Outdated
Run gaussian to get E0
"""

raise LogError('Could not find a successfully load Orca scan:Parser is not inpemented')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above comment was not addressed

arkane/orca.py Outdated

def load_energy(self, zpe_scale_factor=1.):
"""
Load the energy in J/ml from a Orca log file. Only the last energy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above comment was not addressed

arkane/orca.py Outdated
zpe = float(line.split()[-4]) * constants.E_h * constants.Na
if zpe is not None:
return zpe
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above comment was not addressed

arkane/orca.py Outdated

def load_scan_energies(self):

raise LogError('Could not find a successfully load Orca scan:Parser is not inpemented')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above comment was not addressed

arkane/orca.py Outdated
if 'T1 diagnostic ' in line:
items = line.split()
return float(items[-1])
raise ValueError('Unable to find T1 diagnostic in energy file: {}'.format(self.path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above comment was not addressed

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I added some comments, there were few comments from the original review that were not addressed

arkane/orca.py Outdated
atom, coord, number, mass = [], [], [], []

with open(self.path) as f:
log = f.read().splitlines()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see any response to this comment. Could you take a look?

arkane/orca.py Outdated
@@ -115,30 +115,30 @@ def load_geometry(self):
for i in reversed(range(len(log))):
line = log[i]
if 'CARTESIAN COORDINATES (ANGSTROEM)' in line:
for line in log[(i + 3):]:
if not line.strip():
for coordinates in log[(i + 2):]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should remain line - otherwise it'll be confusing for someone else to read this code, they would expect coordinates to contain actual coordinates (list or tuple), and not a string with additional info

arkane/orca.py Outdated

def load_energy(self, zpe_scale_factor=1.):
"""
Load the energy in J/ml from a Orca log file. Only the last energy
Load the energy in J/ml from an Orca log file. Only the last energy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the extra space after Orca?

arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Show resolved Hide resolved
arkane/orca.py Outdated
zpe = float(line.split()[-4]) * constants.E_h * constants.Na
if zpe is not None:
return zpe
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this part to:

if zpe is None:
    raise LogError('Unable to find zero-point energy in Orca output file.')
return zpe

@dranasinghe
Copy link
Contributor Author

Thank you for the comments. I addressed all the comments. I left the comments on the original thread.

@alongd
Copy link
Member

alongd commented Oct 30, 2019

@dranasinghe, take a look at the Codacy report for this branch, it suggests to add some spaces in = assignments in orcaTest.py

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one comment which I think wasn't addressed. Feel free to squash all fixups

arkane/orca.py Outdated
atom, coord, number, mass = [], [], [], []

with open(self.path) as f:
log = f.read().splitlines()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still shows f.read().splitlines(), not f.readlines(). Am I missing something?

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!
I added minor comments. Let's also squash all fixup comments. I think the final commits should be something like:

  • Added Orca to Arkane
  • Added Orca to statmech
  • Added tests

arkane/orca.py Outdated
atom, coord, number, mass = [], [], [], []

with open(self.path) as f:
log = f.read().splitlines()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean when you replaced it with lines = f.readlines()? Strange, we use this format frequently. What problem did you have? Would you like us to look at it together?

arkane/statmech.py Show resolved Hide resolved
arkane/util.py Show resolved Hide resolved
Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added just minor comments.
BTW, why don't we parse frequencies from Orca? I saw that one of the test files is opt-freq, but only used to parse the energy.

arkane/orca.py Outdated
raise LogError('The load_force_constant_matrix method is not implemented for Orca Logs')

def load_geometry(self):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra line

arkane/orca.py Show resolved Hide resolved
Copy link
Contributor Author

@dranasinghe dranasinghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comments. Once @alongd code for the translation and rotational modes get implemented I will include frequencies and rotor scans.

arkane/orca.py Show resolved Hide resolved
@alongd
Copy link
Member

alongd commented Nov 5, 2019

@dranasinghe, I think we're all set. Squash and rebase?

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this awesome contribution!!

@mliu49 mliu49 mentioned this pull request Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants