3dmol / 3Dmol.js

WebGL accelerated JavaScript molecular graphics library
https://3dmol.org/
Other
785 stars 192 forks source link

Redraw Style per Frame #705

Closed duerrsimon closed 1 month ago

duerrsimon commented 1 year ago

Is your feature request related to a problem? Please describe. I have a PDB file that contains a trajectory of steps of optimization of a structure where amino acid identities change per frame. It looks like sphaggetti. presumeably because only the last frame is used to determine connectivity.

Describe the solution you'd like I'd like to determine connectivity per frame

Describe alternatives you've considered(Optional) Probably could load the files individually and then show/hide them but then I can't use the internal frame mechanism.

Additional context(Optional) last frame image first frame: image

Please close your issue when you feel it has been adequately resolved

dkoes commented 1 year ago

Can you provide your file and code? Frames containing different molecules are suppose to work.

duerrsimon commented 1 year ago

Can't share the file unfortunately. I confirm that loading multiple different molecules within one PDB file is working, it is just that the connectivity seems to be assigned based on the last frame and not per frame (makes sense given that is more expensive). Due to this if atoms move a lot one has these extremely long bonds as shown on the second picture.

Other viewers like VMD also have this problem (circumvented by plugins such as sscache). Basically one would just need a flag to call the connectivity determination each time the frame is changed instead of just once. I can try to prepare a synthetic file in case that helps understand the problem.

dkoes commented 1 year ago

I need more to go on here. I've constructed a multi-model pdb file (attached) with two very different structures and it animates just fine with this code:

    viewer.addModelsAsFrames(data,'pdb');
    viewer.setStyle({'stick':{'colorscheme':'greenCarbon'}});
    viewer.zoomTo();
    viewer.animate({'loop': "forward", reps: 1, interval: 1000, 'step': 1});
    viewer.render();

multi.pdb.gz

Can you please try to construct a reproducible test case that you can share?

dkoes commented 1 month ago

Closing due to lack of activity, but will reopen if a reproducible test case is provided.