Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RBVI/ChimeraX into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
elainecmeng committed Nov 5, 2024
2 parents 454e9ab + 59183c0 commit 7be67d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bundles/md_crds/bundle_info.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<BundleInfo name="ChimeraX-MDcrds" version="2.7.1"
<BundleInfo name="ChimeraX-MDcrds" version="2.7.2"
package="chimerax.md_crds"
minSessionVersion="1" maxSessionVersion="1">

Expand Down
13 changes: 10 additions & 3 deletions src/bundles/md_crds/src/read_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,28 @@
# copies, of the software or any revisions or derivations thereof.
# === UCSF ChimeraX Copyright ===

from chimerax.core.errors import UserError
from chimerax.core.errors import UserError, LimitationError

def read_coords(session, file_name, model, format_name, *, replace=True, start=1, step=1, end=None):
from numpy import array, float64
def read_gromacs_file(read_func, file_name):
try:
return read_func(file_name)
except ValueError as e:
if "allocate enough memory" in str(e):
raise LimitationError(e)
raise
if format_name == "xtc":
from ._gromacs import read_xtc_file
session.logger.status("Reading Gromacs xtc coordinates", blank_after=0)
num_atoms, coords_list = read_xtc_file(file_name)
num_atoms, coords_list = read_gromacs_file(read_xtc_file, file_name)
coords = array(coords_list, dtype=float64)
coords *= 10.0
session.logger.status("Finished reading Gromacs xtc coordinates")
elif format_name == "trr":
from ._gromacs import read_trr_file
session.logger.status("Reading Gromacs trr coordinates", blank_after=0)
num_atoms, coords_list = read_trr_file(file_name)
num_atoms, coords_list = read_gromacs_file(read_trr_file, file_name)
coords = array(coords_list, dtype=float64)
coords *= 10.0
session.logger.status("Finished reading Gromacs trr coordinates")
Expand Down

0 comments on commit 7be67d4

Please sign in to comment.