Am 19.08.2013 23:55, schrieb Robert Hanson: > What's your algorithm for that, Rolf? > The idea is to bring the largest boundbox plane to the front. So first the x,y and z boundbox vector length is determined. Then for each possible case the required rotations are done.
Since I developed the algorithm more than five years ago there might be more elegant ways now available in Jmolscript to achieve the same result. The script below shows what is done in the Jena3D viewer. Since there is a slow 180 degree rotation after loading, the implementation takes this into account. The same is also done for image creation, but with zero delays. Water is excluded and for NMR structures only the first model is used for the boundbox. Biological units are placed in separate models in PDB biological unit files. In this case all models are used for the boundbox. ---------------------------------- move 180 0 0 0 0 0 0 0 3; # ### Determine boundbox vector ### if (experimental_method = "NMR"); if (filename_type = "biological"); boundbox_selection_expression = "NOT WATER"; else; boundbox_selection_expression = "NOT WATER AND */1"; end if; else; boundbox_selection_expression = "NOT WATER"; end if; boundbox (@{boundbox_selection_expression}); bound_box = getProperty("boundboxInfo", "vector"); vector_x = bound_box.x; vector_y = bound_box.y; vector_z = bound_box.z; # ### Orientation ### # case 1 if ((vector_x > vector_z) AND (vector_z > vector_y)); move 90 0 0 0 0 0 0 0 0.2; move 0 0 90 0 0 0 0 0 0.2; end if; # case 2 if ((vector_x > vector_y) AND (vector_y > vector_z)); move 0 0 90 0 0 0 0 0 0.2; end if; # case 3 if ((vector_y > vector_x) AND (vector_x > vector_z)); # don't do anything end if; # case 4 if ((vector_y > vector_z) AND (vector_z > vector_x)); move 0 90 0 0 0 0 0 0 0.2; end if; # case 5 if ((vector_z > vector_y) AND (vector_y > vector_x)); move 90 0 0 0 0 0 0 0 0.2; move 0 90 0 0 0 0 0 0 0.2; end if; # case 6 if ((vector_z > vector_x) AND (vector_x > vector_y)); move 90 0 0 0 0 0 0 0 0.2; end if; # case 7 if ((vector_x = vector_y) AND (vector_y > vector_z)); # don't do anything end if; # case 8 if ((vector_z > vector_x) AND (vector_x = vector_y)); move 90 0 0 0 0 0 0 0 0.2; end if; # case 9 if ((vector_x = vector_z) AND (vector_z > vector_y)); move 90 0 0 0 0 0 0 0 0.2; end if; # case 10 if ((vector_y > vector_x) AND (vector_x = vector_z)); # don't do anything end if; # case 11 if ((vector_x > vector_y) AND (vector_y = vector_z)); move 0 0 90 0 0 0 0 0 0.2; end if; # # case 12 if ((vector_x < vector_y) AND (vector_y = vector_z)); move 90 0 0 0 0 0 0 0 0.2; end if; # case 13 if ((vector_x = vector_z) AND (vector_z < vector_y)); # don't do anything end if; # case 14 if ((vector_x = vector_y) AND (vector_y < vector_z)); move 90 0 0 0 0 0 0 0 0.2; end if; # case 15 if ((vector_x = vector_y) AND (vector_y = vector_z)); # don't do anything end if; # # ### Zoom ### zoomto 0.2 (@{boundbox_selection_expression}) 0; echo "View is ready now."; echo "All Atoms are selected."; set echo waitmessage off; frame all; select all; ------------------------------------------ Regards, Rolf -- Rolf Huehne Postdoc Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI) Beutenbergstrasse 11 07745 Jena, Germany Phone: +49 3641 65 6205 Fax: +49 3641 65 6210 E-Mail: rhue...@fli-leibniz.de Website: http://www.fli-leibniz.de Scientific Director: Prof. Dr. K. Lenhard Rudolph Head of Administration: Dr. Daniele Barthel Chairman of Board of Trustees: Dennys Klein VAT No: DE 153 925 464 Register of Associations: No. 296, Amtsgericht Jena Tax Number: 162/141/08228 ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users