Skip to content

Fix some problems while parsing qchem output#9

Open
yenchunlin024 wants to merge 8 commits into
shihchengli:masterfrom
yenchunlin024:master
Open

Fix some problems while parsing qchem output#9
yenchunlin024 wants to merge 8 commits into
shihchengli:masterfrom
yenchunlin024:master

Conversation

@yenchunlin024

Copy link
Copy Markdown
Contributor

While loading the conformer and frequency of Q-Chem outputfile with large force constants, some problems emerged in the previous version.

@shihchengli shihchengli left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for taking care of this and providing a quick fix. I leave some minor comments. I really appreciate your help.

Comment thread ape/qchem.py Outdated
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I've simplified the code in the new commit.

Comment thread ape/qchem.py
elif len(line.split()) == 2:
frequencies.extend([float(d) for d in line.split()[-1:]])
frequency = line.split()[1:]
if '********' in frequency:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@yenchunlin024 Can you take a look at this?

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.

2 participants