Skip to content

Commit

Permalink
update wfn file parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
m-julian committed Jun 19, 2024
1 parent 812cfcb commit 9978015
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ichor_core/ichor/core/files/gaussian/wfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ichor.core.atoms import Atom, Atoms
from ichor.core.common.float import from_scientific_double
from ichor.core.common.itertools import chunker
from ichor.core.common.str import split_by
from ichor.core.common.units import AtomicDistance
from ichor.core.files.file import FileContents, ReadFile, WriteFile
from ichor.core.files.file_data import HasAtoms, HasData
Expand Down Expand Up @@ -97,11 +98,17 @@ def _read_file(self):

line = next(f)
while not line.startswith(r"CENTRE ASSIGNMENTS"):
record = line.split()
# have to split like this because
# if any coordinate is above -10
# there is no whitespace between the coordinates
# so cannot split directly by whitespace
record = split_by(
line, [4, 4, 16, 12, 12, 12, 10], return_remainder=True
)
atom_type = record[0]
x = float(record[-6])
y = float(record[-5])
z = float(record[-4])
x = float(record[3])
y = float(record[4])
z = float(record[5])
# _ = float(record[-1]) # nuclear charge, not used
atoms.add(
Atom(
Expand Down

0 comments on commit 9978015

Please sign in to comment.