User Tools

Site Tools


media:jymolcodeupdates1.1

Transition Guide/Changes in JyMol 1.1 Interface

We have made some small changes in JyMol 1.1 for those who are upgrading from JyMol 1.0. The basic API is the same, so it will be easy to upgrade with little changes to your code. In this page, we have outlined the changes you will need to do for the upgrade.

Moved com.delsci.jymol to com.schrodinger.jymol

All imports and references to com.delsci.jymol need to be changed to com.schrodinger.jymol. This is as easy as replacing the string, and in an IDE (e.g., Eclipse) can be done in one action. Nevertheless, this needs to be done. For example:

import com.delsci.jymol.JyMol;

should now be:

import com.schrodinger.jymol.JyMol;

Simplified commands

There were a few commands in the Cmd object that had arrays as arguments and required the length of the array to be passed in the next argument. Since JAVA keeps the length of arrays inside the array variable (i.e., array.length), this is not necessary. We have taken this second argument out of the functions loadRaw(), rampNew(), selectList(), and setView()). This is an important change to note, especially for selectList(), since the next argument (i.e., state) is also and Integer, and might not give a compilation error. For example:

int[] a = { 1,2,10 };        
jymol.cmd.selectList("mysele","demo", a, a.length);

will now be:

int[] a = { 1,2,10 };        
jymol.cmd.selectList("mysele","demo", a);

This should be changed for these functions: loadRaw(), rampNew(), selectList(), and setView().

Functions that changed names

Some functions' names were changed to coincide with JAVA language practices.

* bg_rgb() → bgRgb() : Sets background color.

JAR file names have changed, classpath needs to be updated

The classpath to run JyMol has changed, and we have provided you with two sets of jar files to run your JyMol program. Here are the two ways to run your program:

java -classpath yourClassPath:/path/to/jymol-1.1.jar: 
  /path/to/jogl-core-2.002.jar: 
  /path/to/jogl-awt-2.002.jar: 
  /path/to/jogl-gldesktop-2.002.jar: 
  /path/to/jogl-{osx,win,x11}-2.002.jar: 
  /path/to/gluegen-rt-2.002.jar: 
  /path/to/nativewindow-core-2.002.jar: 
  /path/to/nativewindow-awt-2.002.jar: 
  /path/to/nativewindow-{win,x11}-2.002.jar: 
  /path/to/jymol-1.1-natives-$ARCH.jar: 
  /path/to/jogl-2.002-natives-$ARCH.jar: 
  /path/to/gluegen-rt-2.002-natives-$ARCH.jar: 
  /path/to/nativewindow-2.002-natives-$ARCH.jar 
          your.java.srcClass

or

java -classpath yourClassPath:/path/to/jymol-1.1.jar: 
  /path/to/jogl-2.002.jar: 
  /path/to/gluegen-rt-2.002.jar: 
  /path/to/nativewindow-2.002.jar: 
  /path/to/jymol-1.1-natives-$ARCH.jar: 
  /path/to/jogl-2.002-natives-$ARCH.jar: 
  /path/to/gluegen-rt-2.002-natives-$ARCH.jar: 
  /path/to/nativewindow-2.002-natives-$ARCH.jar 
          your.java.srcClass

Where $ARCH is set to the platform needed:

mac MacOS
linux-x86Linux 32 bit
linux-x64Linux 64 bit
win-x86 Windows 32 bit
win-x64 Windows 64 bit
{osx,win,x11} use string for platform {MacOS, Windows, or Linux}
{win,x11} use string for platform {Windows or Linux }, for MacOS, this library is not needed

This first command line is similar JyMol 1.0, except the nativewindow libraries are added. The second command line is longer, but the jar files (in total) are smaller. Thus, if you use the second longer command line, your program will need to load in less code, startup quicker, and have a smaller memory fingerprint.

Note: It is also possible to unzip the native libraries from these jar files so that your application can have direct access to them. To do this, you set the -Djava.library.path= argument to the necessary directory these libraries have been unzipped.

media/jymolcodeupdates1.1.txt · Last modified: 2013/08/19 21:00 (external edit)