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

Bug in the parser #1

Open
litman90 opened this issue Feb 22, 2017 · 0 comments
Open

Bug in the parser #1

litman90 opened this issue Feb 22, 2017 · 0 comments

Comments

@litman90
Copy link

I found a bug in the "read_aims_output" function inside aimsio.py file.
When the mixer is restarted the energy and forces, which are not the final ones, are printed
This case is not consider in the function.
Please find below a possible solution. (The new lines are marked with "#" )

Yair

def read_aims_output(filename):
"""
Read the aims output file
Will return the total energy corrected, and the forces
Only suitable for single calculations (i.e. no relaxations etc)
May read more stuff with little modification, if desired
"""
import numpy as np
output = open(filename, 'r')
n_atoms = 0
ener = 0
forces = []
iflag = False #
while True:
line = output.readline()
if not line:
break
if "| Number of atoms :" in line:
inp = line.split()
n_atoms = int(inp[5])
if "Self-consistency cycle converged." in line: #
iflag = True #
if "| Total energy corrected :" in line:
if iflag: #
ener = float(line.split()[5])
if "Total atomic forces (unitary forces cleaned)" in line:
if iflag: #
for i in range(n_atoms):
inp = output.readline().split()
forces.append([float(inp[2]), float(inp[3]), float(inp[4])])
output.close()
return ener, np.array(forces)

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

No branches or pull requests

1 participant