Rolf,

Thank you!  I'm not sure this is exactly equivalent, but all of this looks 
useful in some way.  I can definitely use the perl scripts.

Thanks,

Jonathan
On Jan 23, 2012, at 4:06 PM, jmol-users-requ...@lists.sourceforge.net wrote:

> Message: 3
> Date: Mon, 23 Jan 2012 17:03:34 +0100
> From: Rolf Huehne <rhue...@fli-leibniz.de>
> Subject: Re: [Jmol-users] Need some advice on server side static image
>       processing with Jmol...
> To: jmol-users@lists.sourceforge.net
> Message-ID: <4f1d84d6.1020...@fli-leibniz.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 01/22/2012 12:46 AM, Jonathan Gutow wrote:
>> Dear Jmol Users:
>> 
>> I'm looking for somebody who has experience using Jmol on a server to 
>> generate .png images.  I am investigating whether this would be better for 
>> making static images in the SageMath package than Tachyon, which they 
>> presently use.
>> 
>> I've already tried passing some .jmol files of the kind the math software 
>> can generate to JmolData.jar, unfortunately they appear to contain some 
>> graphics entities that JmolData cannot handle.  Thus I believe I will have 
>> to run the full Jmol on the server to make this work.  My first question 
>> about this is,  do we have a script command that will cause Jmol to quit?  
>> It is important that the application exit when it is done with its job.  I 
>> can certainly add such a command, but have learned that we have so many 
>> things in Jmol that it is easy to overlook functionality that we already 
>> have.
>> 
> There is something else that you might have to consider if you want to 
> generate PNG images on a server with Jmol:
> 
> On Linux/Unix Jmol needs access to an 'X-Server' process which provides 
> one or more displays (graphical screens). Usually there is no X-Server 
> installed/available on compute servers or cluster nodes. But there 
> exists the virtual X-Server "Xvfb" which allows to provide a virtual 
> display on such a server.
> I added below a message I wrote a few years ago on the Jmol-developers 
> list that describes this in more detail.
> 
> Regards,
> Rolf
> 
> ---------------------------------------------------------------------------
> Juergen Haas wrote:
>> Dear Jmol community,
>> 
>> I am using Jmol to generate a png which is placed as a background picture
>> behind the jmol applet, such that when printing this picture would be 
> printed
>> instead.
>> 
>> on my workstation this command works beautifully:
>> 
>> java -jar ~/programs/jmol-11.6.13/Jmol.jar -on -s myJMOL.script
>> 
>> on the node of the cluster where the images will be generated (as a 
> dynamic
>> content of web pages beta.proteinmodelportal.org, after submitting two or
>> more structures to be analysed), however, I get:
>> 
>> Could not initialize class sun.awt.X11GraphicsEnvironment
>> 
>> why does Jmol need an X11 environment when started with -n ?
>> I found this thread (last message id shown here):
>> http://www.mail-archive.com/jmol-developers@li.../msg06975.html
>> 
>> since this was from 2006 I was wondering, if there now is a way to 
> circumvent
>> this problem.
>> 
> I couldn't access the 'www.mail-archive.com' server but I guess Juergen
> is refering to the thread "NO DISPLAY JMOL" from September 2006.
> 
> I finally managed to use Jmol to automatically create images for all
> PDB entries. I ended up in using the virtual X server 'Xvfb' to
> circumvent the problem.
> 
> Although my case is a bit different, because the server I use actually
> has an X server installed, 'Xvfb' might also be the solution in this
> case. (I never tried to run 'Xvfb' in such a case.)
> 
> Since I am running 30 Jmol processes in parallel I start a virtual X
> server for each Jmol. My procedure is the following:
> 
> 1) Distribute all PDB entries onto 30 ID lists
> 2) Start 30 perl scripts (1 for each list)
> 3) Each perl script starts a virtual X server
> 4) Each perl script starts Jmol for each ID (one at a time)
> 5) Each perl script stops the virtual X server at the end
> 
> I use 30 different virtual X servers for performance reasons.
> I don't use permanently running virtual X servers for these reasons:
> 
> 1) Image generation only once a week and usually only for
> new/updated PDB entries
> 2) Make sure that an accessible X server is available
> 3) Sometimes I observed a memory leak problem with a long
> running Xvfb server
> 
> Since every X server needs a unique display number you have to make sure
> that you start the virtual X server with an unused display number.
> To avoid collisions with possibly running real X servers I start with
> display number 100.
> 
> For starting the virtual X server I wrote a little perl script,
> available (temporarily) at:
> http://www.fli-leibniz.de/~rhuehne/jmol/start_xvfb.pl
> 
> The script starts the server and returns the process ID (to be able to
> stop it afterwards) and the display number on standart output.
> It also retries to start the server up to 60 times with increasing
> display number if the server couldn't be started.
> 
> In my perl script that starts Jmol it is invoked this way:
> 
> # start virtual X server 'Xvfb'
> $xvfb_start_message = `$xvfb_command $display_number`;
> if ($xvfb_start_message =~ /ERROR:(.*)$/i) {
> die "ERROR: could NOT START virtual X server - $1 - ABORTED $0\n";
> }
> if ($xvfb_start_message =~ /PID='(.*?)'/i) {
> $xvfb_pid = $1;
> } else {
> die "ERROR: could NOT DETERMINE PID of virtual X server 'Xvfb' -
> ABORTED $0\n";
> }
> if ($xvfb_start_message =~ /DISPLAY='(.*?)'/i) {
> $ENV{'DISPLAY'} = $1;
> } else {
> die "ERROR: could NOT DETERMINE display_number of virtual X server
> 'Xvfb' - ABORTED $0\n";
> }
> 
> ($xvfb_command = "start_xvfb.pl"; $display_number = 100;)
> 
> The command "ENV{'DISPLAY'} = $1;" in the code shown above sets the
> environment variable "DISPLAY" for any subsequently started programs
> like Jmol.
> 
> Regards,
> Rolf

                        Dr. Jonathan H. Gutow
Chemistry Department                                 gu...@uwosh.edu
UW-Oshkosh                                           Office:920-424-1326
800 Algoma Boulevard                                 FAX:920-424-2042
Oshkosh, WI 54901
                http://www.uwosh.edu/faculty_staff/gutow/


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to