Sorry,
there is an error in the provided subroutine. I changed the variable
name "model_number" afterwards to "frame_number" and forgot to change
the name in one line.
So "model_number = 2;" should be "frame_number = 2;".
Regards,
Rolf
Rolf Huehne wrote:
> 张增明( Zengming Zhang ) wrote:
>> Hi, rhuehne:
>>
>> Sorry for late replaying, thanks for your advice, I've successfully
>> loaded several structures in one viewer, but there is still a problem, for
>> this script:
>> <script>
>> jmolInitialize("applet", "JmolApplet.jar");
>> jmolApplet(500, "load 1dwd.pdb;load append 1cyn.pdb;frame all");
>> </script>
>> The structure of 1dwd and 1cyn can be loaded in the viewer, and both of
>> them are visible, but the peoblem is that the mess center of them are not
>> the same one, and Jmol display the atoms just according to their coordinates
>> in pdb files. Is their any method that can make Jmol display all the
>> structures at the same mess center? Or is this only can be solved by users
>> of Jmol from modifying pdb files to change the coordinates by amending them
>> to fit to one mess center?
>
> If you just want to align the centers it is no problem.
> (Jmol is no structural alignment program, so for more sophisticated
> alignments you should do the alignment with another program, store the
> new coordinates and then load them into Jmol.)
>
> There is the 'translateSelected' command that enables to move selected
> atoms around. The little subroutine below automatically aligns the
> geometrical centers of all loaded files:
>
> #
> # ### align geometrical centers of all loaded structures ###
> #
> function center_frames;
> var last_frame = "false";
> var model_number = 2;
> var stored_selection = {selected};
> while (last_frame = "false");
> var selection_expression = "*/" + frame_number;
> select @selection_expression;
> var frame_atom_count = {selected}.size;
> if (frame_atom_count > 0);
> var offset = {*/1}.xyz - {selected}.xyz;
> translateSelected @offset;
> else;
> last_frame = "true";
> end if;
> frame_number = frame_number + 1;
> end while;
> center */1;
> zoomto (*) 0;
> select @stored_selection;
> end function;
>
> You can either write the subroutine into a file (e.g.: my_stuff.scr) and
> load it with the command "script my_stuff.scr". Or you can join all
> lines into a single line and add it to your applet initialization
> script. (The joining is possible because all lines contain a semicolon
> at the end.)
> You can call the subroutine by finally adding "center_frames;".
> (If you use a script file you could also add "center_frames;" after the
> end of the subroutine definition. Then it would be called automatically
> when you load the script file.)
>
> This is how it works:
>
> 1) Store the current selection.
> 2) Select all atoms of the second frame.
> 3) If any atoms are selected (= frame exists and has atoms) then
> determine the offset between the center of the first frame and the
> second frame. Move the second frame by the determined offset.
> 4) Increment the frame number and repeat step 2-4 until no atoms are
> selected in the frame.
> 5) Center the display at the center of frame 1.
> 6) Zoom the view so that everything fits into the applet window.
> 7) Restore the stored selection.
>
> Regards,
> Rolf
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users