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/[email protected]/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
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers