Opened 7 years ago

Closed 6 years ago

#1486 closed defect (fixed)

Ribbon slowing graphics enormously for large models

Reported by: Tristan Croll Owned by: Greg Couch
Priority: critical Milestone: 0.9
Component: Graphics Version:
Keywords: Cc: Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

There is a bug in the ribbon code of structure.py causing the number of tethers to blow out geometrically with the number of chains. Using 5wsg as an example, it slows down the "Spotlight mode" (which changes atom visibility, but doesn't directly change the ribbon drawing) in Clipper to around 0.5 fps under normal lighting (and framerate is under 30fps even doing nothing to the model in a freshly-opened session). If m is the AtomicStructure:

sum([len(t[3]) for t in m._ribbon_tether if t[3] is not None])
Out: 2437552

If I edit _create_ribbon_graphics() in structure.py:

            from numpy.linalg import norm
            from .molarray import Atoms
            tether_atoms = Atoms(list(self._ribbon_spline_backbone.keys()))
            spline_coords = array(list(self._ribbon_spline_backbone.values()))
>            mask = tether_atoms.indices(atoms)
>            tether_atoms = tether_atoms[mask]
>            spline_coords = spline_coords[mask]
            if len(spline_coords) == 0:
                spline_coords = spline_coords.reshape((0,3))

... then performance returns to more expected levels (55 fps when standing still, ~12fps when scrolling around in Clipper spotlight mode vs. 30fps with ribbon turned off entirely). Ribbon tethers appear correct. Also:

sum([len(t[3]) for t in m._ribbon_tether if t[3] is not None])
Out: 1364

Change History (10)

comment:1 by Conrad Huang, 7 years ago

Resolution: fixed
Status: assignedclosed

Added change in 028ed3a4e.

comment:2 by Tom Goddard, 7 years ago

Perhaps this is the same problem as #1327

comment:3 by Greg Couch, 6 years ago

Resolution: fixed
Status: closedreopened

This change broke tethers to nucleotides.

Last edited 6 years ago by Greg Couch (previous) (diff)

comment:4 by Greg Couch, 6 years ago

Milestone: 0.9

comment:5 by Conrad Huang, 6 years ago

How did you arrive at this conclusion?

Last edited 6 years ago by Conrad Huang (previous) (diff)

comment:6 by Conrad Huang, 6 years ago

Owner: changed from Conrad Huang to Greg Couch
Status: reopenedassigned

comment:7 by Greg Couch, 6 years ago

Status: assignedfeedback

I found this by looking in the log for changes that referred to tethers. I removed the patch, and then the nucleotide tethers started working again.

The intent of the patch to reduce the spline computations is good. So I've revised the patch to only do the computation for "visible" atoms.

Tristan, does the revised fix work for you?

comment:8 by Conrad Huang, 6 years ago

Tristan, can you please confirm whether this change is acceptable for release 0.9?

in reply to:  9 ; comment:9 by tic20@…, 6 years ago

Seems to be working fine - I haven’t noticed any problems since the change.
 

 


comment:10 by Greg Couch, 6 years ago

Resolution: fixed
Status: feedbackclosed

Excellent!

Note: See TracTickets for help on using tickets.