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

Basic sdf format input/output #107

Merged
merged 6 commits into from
May 22, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Suggested changes in sdf.py
  • Loading branch information
Esteban Vohringer-Martinez authored and Esteban Vohringer-Martinez committed May 21, 2019
commit 0becb82a42672c71f5b315252b302195f3b279ce
9 changes: 3 additions & 6 deletions iodata/formats/sdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,11 @@ def load_one(lit: LineIterator) -> dict:
atcoords[i, 0] = float(words[0]) * angstrom
atcoords[i, 1] = float(words[1]) * angstrom
atcoords[i, 2] = float(words[2]) * angstrom
try:
atnums[i] = sym2num[words[3].title()]
except KeyError:
atnums[i] = int(words[0])
atnums[i] = sym2num.get(words[3].title())
while True:
try:
words = next(lit)
except ValueError:
except StopIteration:
raise lit.error("Molecule specification did not end properly with $$$$")
if words == "$$$$\n":
break
Expand All @@ -78,7 +75,7 @@ def load_one(lit: LineIterator) -> dict:
@document_load_many("SDF", ['atcoords', 'atnums', 'title'])
def load_many(lit: LineIterator) -> Iterator[dict]:
"""Do not edit this docstring. It will be overwritten."""
# SDF files with more molecueles are a simple concatenation of individual SDF files,'
# SDF files with more molecules are a simple concatenation of individual SDF files,'
# making it travial to load many frames.
while True:
try:
Expand Down