Skip to content

Commit

Permalink
formatting and conversion simplifications in mwfn.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BradenDKelly committed Aug 31, 2020
1 parent df6df62 commit b51453f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions iodata/formats/mwfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def _load_helper_atoms(lit: LineIterator, natom: int) -> dict:

for atom in range(natom):
words = next(lit).split()
data["atnums"][atom] = int(words[2].strip())
data["atcorenums"][atom] = float(words[3].strip())
data["atnums"][atom] = words[2]
data["atcorenums"][atom] = words[3]
data["atcoords"][atom, :] = words[4:7]
# coordinates are in angstrom in MWFN, so they are converted to atomic units
data["atcoords"] *= angstrom
Expand Down Expand Up @@ -174,7 +174,7 @@ def _load_helper_section(lit: LineIterator, nprim: int, start: str, skip: int,
if not line.startswith(start):
lit.error(f"Expected line to start with {start}! Got line={line}")
section.extend(line.split()[skip:])
return np.array(section).astype(dtype)
return np.array(section, dtype)


def _load_helper_mo(lit: LineIterator, n_basis: int, n_mo: int) -> dict:
Expand All @@ -193,11 +193,11 @@ def _load_helper_mo(lit: LineIterator, n_basis: int, n_mo: int) -> dict:
while 'Index' not in line:
line = next(lit)
assert line.startswith('Index')
data["mo_numbers"][index] = int(line.split()[1])
data["mo_type"][index] = int(next(lit).split()[1])
data["mo_energies"][index] = float(next(lit).split()[1])
data["mo_occs"][index] = float(next(lit).split()[1])
data["mo_sym"][index] = str(next(lit).split()[1])
data["mo_numbers"][index] = line.split()[1]
data["mo_type"][index] = next(lit).split()[1]
data["mo_energies"][index] = next(lit).split()[1]
data["mo_occs"][index] = next(lit).split()[1]
data["mo_sym"][index] = next(lit).split()[1]
# skip "$Coeff line
next(lit)
data["mo_coeffs"][:, index] = _load_helper_section(lit, n_basis, '', 0, float)
Expand Down

0 comments on commit b51453f

Please sign in to comment.