8000 added attribute nfrozenatom and altered disps loop to only loop over … by hklem · Pull Request #1286 · cclib/cclib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

added attribute nfrozenatom and altered disps loop to only loop over … #1286

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 6 commits into
base: master
Choose a base branch
from

Conversation

hklem
Copy link
@hklem hklem commented Oct 10, 2023

…atoms that have frequency information.

When using the '-1' atom flags in the molecule specification to freeze atoms during gaussian calculation the gaussian output file does not list those atoms in the vibrational frequency section. This causes issue with gaussianparser.py which loops over self.nqmf (or natoms) to store 'numbers' into self.vibdisps. The error will appear because natoms > the number of lines with that data, so the loop will run over into the next lines. I changed this behavior by setting a self.nfrozenatom attribute that is defined at the same time as self.natoms. Now the loop in question goes over the range self.nqmf-self.nfrozen atoms.

@ghutchis
Copy link
Contributor

Do you have an example file? I'm pretty sure this would also break a lot of other parsers. I'm thinking of Open Babel at the moment, but adding a test file would be important.

@hklem
Copy link
Author
hklem commented Oct 11, 2023 via email

Copy link
Member
@berquist berquist 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 fix. My concerns are, since I'm not familiar with the frozen atom feature,

  1. Keeping track of which atoms are frozen. We should store their indices (or at least have the Gaussian input file kept) in metadata. This way we don't have to worry about if the indices are contiguous, etc.
  2. I agree about testing other things that consume ccdata objects, like the Open Babel bridge, in part because it isn't clear which atoms are frozen, but also just general consistency. A test for this can be added to https://github.com/cclib/cclib/blob/master/test/regression_io.py (making a new regression_bridge.py may be better, not sure).
  3. The actual location of this output should go in https://github.com/cclib/cclib-data/ and a test for vibdisps length in https://github.com/cclib/cclib/blob/master/test/regression.py.

while line.split() and not "Variables" in line and not "Leave Link" in line:
natom += 1
if line.split()[1] == '-1':
Copy link
Member

Choose a reason for hiding this comment

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

This is causing failures in other files (water_ccsd.log) where there aren't at least two tokens in a line.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not very familiar with Open Babel. Maybe you can give me more information about how that program interfaces with ccdata and how we should go about making sure the nfrozenatom and frozenatoms attributes don't cause issues.

@berquist
Copy link
Member

@hklem poke.

@hklem
Copy link
Author
hklem commented Nov 30, 2023

Thanks for the poke. I have revised to fix the failures and set two new attributes, 'nfrozenatom' and 'frozenatoms' in gaussianparser.py. self.frozenatoms is a list of atom indices with the '-1' frozen flag (this is 1 indexed to be consistent with Gaussian since it begins numbering atoms at 1). The definitions have been added to data.py.

I have changed the way frozen atoms are accounted for in a way that I believe is more intuitive, but this is based on my assumption of what the 'nqmf' attribute is. I'm not familiar with what this term means in a Gaussian output. I see it gets defined in water_ccsd.log. My best guess is number of atoms with QM forces? I looked at all the Gaussian16 files from cclib/data and cclib-data/ and in the files where NQMF is in the output it is always =0. I'm not sure what the situation would be if nqmf is defined and is >0, but the way I edited the code if that does occur it should have exactly the same behavior as without my changes, and the frozen atom attributes won't even be set.

I added code to regression.py perform two tests: one on the frozen_atom_flags.log (needs to be added to cclib-data) to ensure they are properly parsed and one on water.log to ensure the frozen atom attributes aren't stored and that the vibdisps are parsed properly.

Copy link
Author
@hklem hklem left a comment

Choose a reason for hiding this comment

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

The "frozen atom indices" will be easier to parse and the previous "atom indices" key was already being used for the frags attribute.

@berquist
Copy link
Member
berquist commented Oct 5, 2024

This PR is almost a year old. I will revisit it soon to try and figure out what the path forward should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0