Skip to content

Commit

Permalink
Fix g96 file reading
Browse files Browse the repository at this point in the history
  • Loading branch information
leeping committed Sep 5, 2023
1 parent 638f371 commit f449083
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/amberio.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
from forcebalance.molecule import Molecule
from collections import OrderedDict, defaultdict, namedtuple
# Rudimentary NetCDF file usage
from scipy.io.netcdf import netcdf_file
try:
from scipy.io import netcdf_file
except ImportError:
from scipy.io.netcdf import netcdf_file
import warnings
try:
# Some functions require the Python API to sander "pysander"
Expand Down
5 changes: 4 additions & 1 deletion src/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3432,7 +3432,10 @@ def read_g96(self, fnm, **kwargs):
if len(xyzs) != len(boxes):
raise IOError('in read_g96: xyzs and boxes should have the same length')
if len(xyzs) != len(comms):
raise IOError('in read_g96: xyzs and comms should have the same length')
if len(comms) < len(xyzs):
comms += [comms[-1] for i in range(len(comms), len(xyzs))]
else:
raise IOError('comms is longer than xyzs')
Answer = {'xyzs' : xyzs,
'boxes' : boxes,
'comms' : comms}
Expand Down

0 comments on commit f449083

Please sign in to comment.