Coverage for /builds/kinetik161/ase/ase/io/cmdft.py: 31.25%
16 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
1import numpy as np
3from ase.atom import Atom
4from ase.atoms import Atoms
5from ase.units import Bohr
8def read_cmdft(fileobj):
9 lines = fileobj.readlines()
10 del lines[0]
11 finished = False
12 s = Atoms()
13 while not finished:
14 w = lines.pop(0).split()
15 if w[0].startswith('"'):
16 position = Bohr * np.array([float(w[3]), float(w[4]), float(w[5])])
17 s.append(Atom(w[0].replace('"', ''), position))
18 else:
19 finished = True
21 yield s