Fix some problems while parsing qchem output#9
Open
yenchunlin024 wants to merge 8 commits into
Open
Conversation
shihchengli
reviewed
Jan 9, 2023
shihchengli
left a comment
Owner
There was a problem hiding this comment.
Thanks for taking care of this and providing a quick fix. I leave some minor comments. I really appreciate your help.
Comment on lines
+300
to
+311
| temp = [] | ||
| for j in range(len(data)): | ||
| if (j == 0 and '-' in data[j]) or (j>0 and len(data[j]) > 12): | ||
| idx1 = 0 | ||
| for idx2, k in enumerate(data[j]): | ||
| if k == '-' and idx2 != 0: | ||
| temp += [data[j][idx1:idx2],] | ||
| idx1 = idx2 | ||
| temp += [data[j][idx1:],] | ||
| else: | ||
| temp += [data[j],] | ||
| data = temp |
Owner
There was a problem hiding this comment.
Suggested change
| temp = [] | |
| for j in range(len(data)): | |
| if (j == 0 and '-' in data[j]) or (j>0 and len(data[j]) > 12): | |
| idx1 = 0 | |
| for idx2, k in enumerate(data[j]): | |
| if k == '-' and idx2 != 0: | |
| temp += [data[j][idx1:idx2],] | |
| idx1 = idx2 | |
| temp += [data[j][idx1:],] | |
| else: | |
| temp += [data[j],] | |
| data = temp | |
| data = f.readline().replace("-", " -").split() |
I think using ".replace()" would be more clear and simple.
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion! I've simplified the code in the new commit.
| elif len(line.split()) == 2: | ||
| frequencies.extend([float(d) for d in line.split()[-1:]]) | ||
| frequency = line.split()[1:] | ||
| if '********' in frequency: |
Owner
There was a problem hiding this comment.
Can you please add an example in the comment?
Is it possible for both '********' and float numbers to appear in the same line? If this is the case, the current code will discard the whole line.
I'm not sure what '********' means or if it is okay to leave it out. It would be helpful to have more context about the code you are working with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While loading the conformer and frequency of Q-Chem outputfile with large force constants, some problems emerged in the previous version.