Jmol

Dear Avogadro developers,

Angel Herraez suggested I contact you.

I’m looking into the possibility of introducing basic MM calculations as
an option for Jmol, primarily for rough clean-up of structures, and
possibly for 2D->3D conversion capability. Jmol is Java, and it’s under
the GNU LESSER Public License.

I’d appreciate your thoughts on this idea. What my options would be for
developing a Java-based MM package, what code might be available, who
else might be interested in this, etc.

Bob Hanson


Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr

If nature does not answer first what we want,
it is better to take what answer we get.

– Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900

Hi,

On Mon, Mar 17, 2008 at 4:32 PM, Bob Hanson hansonr@stolaf.edu wrote:

Dear Avogadro developers,

Angel Herraez suggested I contact you.

I’m looking into the possibility of introducing basic MM calculations as
an option for Jmol, primarily for rough clean-up of structures, and
possibly for 2D->3D conversion capability.

Avogadro relies on openbabel (openbabel.org) for MM calculations.
Openbabel has 3 force fields at the moment (ghemical, UFF and MMFF94).
The code is in C++ and I recommend you to look at the code in svn
trunk: Open Babel download | SourceForge.net
(forcefield.cpp and directory forcefields/)

Jmol is Java, and it’s under the GNU LESSER Public License.

Openbabel has a java interface (http://openbabel.org/wiki/Java) but I
don’t know if this already includes the force field code.

There’s also an interesting article on how to compile openbabel with nestedVM:
http://depth-first.com/articles/2007/12/10/run-babel-anywhere-java-runs-with-jbabel
(this was oriented towards the file converting capabilities of OB, but
perhaps the same could be done for OB’s MM)

Altough some portions of OB are GPL v2 only, the force field code was
added by Geoff and me, If needed I’m willing to change the license for
my code.

I’d appreciate your thoughts on this idea. What my options would be for
developing a Java-based MM package, what code might be available, who
else might be interested in this, etc.

There’s also CDK (written in Java), but I suggest you contact the CDK
developers directly to get their ideas if you haven’t allready.

Kind regards,
Tim

Bob Hanson


Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
Robert M. Hanson, chemistry

If nature does not answer first what we want,
it is better to take what answer we get.

– Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

Openbabel has 3 force fields at the moment (ghemical, UFF and MMFF94).
The code is in C++ and I recommend you to look at the code in svn

My particular suggestion for Jmol is to implement UFF. While it’s
probably not as widely used as MMFF94 or Amber or CHARMM, it’s a much
simpler force field to implement and works pretty well across the
periodic table. Some have also used it for crystal structures.

As Tim mentioned, if Jmol is interested in the molecular mechanics
code, I’m certainly happy to change the license, e.g. to LGPL.

Cheers,
-Geoff

Hi,

Following the same technique as described for the babel program
(http://depth-first.com/articles/2007/12/10/run-babel-anywhere-java-runs-with-jbabel),
I successfully compiled obminimize. The end result is a jar file which
contains everything needed to do energy minimization. I’m not a java
export so I don’t know how useful this is in it’s current state.
Getting it to work on files or standard input/output should be simple.

You can download the jar file here: http://home.scarlet.be/timvdm/obminimize.jar

To test it: java -jar obminimize.jar -ff MMFF94 test.mol2

Tim

Very interesting, Tim. So how large is your Jar file? Can it be compiled
as an applet as opposed to an application? If so, can it be set up to
have a live-connect JavaScript interface?

Bob

Tim Vandermeersch wrote:

Hi,

Following the same technique as described for the babel program
(Run Babel Anywhere Java Runs with JBabel | Depth-First),
I successfully compiled obminimize. The end result is a jar file which
contains everything needed to do energy minimization. I’m not a java
export so I don’t know how useful this is in it’s current state.
Getting it to work on files or standard input/output should be simple.

You can download the jar file here: http://home.scarlet.be/timvdm/obminimize.jar

To test it: java -jar obminimize.jar -ff MMFF94 test.mol2

Tim


Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr

If nature does not answer first what we want,
it is better to take what answer we get.

– Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900

Tim, this is really the idea I’m looking for – extracting out the
essentials of minimization. I realize that the VM idea is a possible
solution, but it’s not very practical, and a Java port should not be
that bad. I’d like to do it (next week if possible). It looks to me like
embedded in that 2Mb jar file is about 8300K of code and 200K of
parameters. That’s substantial, but not so bad, really. No need to have
the 1998K of VM tagging along.

The interesting thing is that we already have Jmol set up as an applet
that can accept optional packages. The packages are only downloaded to
the client if they are needed, almost like JPEG images on a page.

Can you point me to the source code for OBMinimize.class? I’d like to
see what it is about and how difficult it would be to do a Java port of
it. I believe we could have minimization in Jmol without too much
trouble. Then the world would have an outstanding molecular
visualization applet with the option for minimization. That would be
something to talk about!

Thanks,

Bob

Tim Vandermeersch wrote:

Hi,

Following the same technique as described for the babel program
(Run Babel Anywhere Java Runs with JBabel | Depth-First),
I successfully compiled obminimize. The end result is a jar file which
contains everything needed to do energy minimization. I’m not a java
export so I don’t know how useful this is in it’s current state.
Getting it to work on files or standard input/output should be simple.

You can download the jar file here: http://home.scarlet.be/timvdm/obminimize.jar

To test it: java -jar obminimize.jar -ff MMFF94 test.mol2

Tim


Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr

If nature does not answer first what we want,
it is better to take what answer we get.

– Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900

Hi,

On Wed, Mar 19, 2008 at 1:32 PM, Bob Hanson hansonr@stolaf.edu wrote:

Tim, this is really the idea I’m looking for – extracting out the
essentials of minimization. I realize that the VM idea is a possible
solution, but it’s not very practical, and a Java port should not be
that bad. I’d like to do it (next week if possible). It looks to me like
embedded in that 2Mb jar file is about 8300K of code and 200K of
parameters. That’s substantial, but not so bad, really. No need to have
the 1998K of VM tagging along.

The interesting thing is that we already have Jmol set up as an applet
that can accept optional packages. The packages are only downloaded to
the client if they are needed, almost like JPEG images on a page.

Can you point me to the source code for OBMinimize.class? I’d like to
see what it is about and how difficult it would be to do a Java port of
it. I believe we could have minimization in Jmol without too much
trouble. Then the world would have an outstanding molecular
visualization applet with the option for minimization. That would be
something to talk about!

The OBMinimize.class is the openbabel program obminimize. The source
can be found in tools/obminimize.cpp but it is just a small program to
access the OBForceField class. Below I’ll try to make a summary of
things you need to port to java to get basic MM features.

source can be found at:

The main class with general methods is the OBForceField class
(include/openbabel/forcefield.h, src/forcefield.cpp). Specific force
fields derived from this class and can be found in src/forcefields/.
As Geoff mentioned, MMFF94 is widely used but more complex to
implement compared to UFF. If you only intend to implement a single
FF, you could make a single java class with methods from OBForceField
and OBForceFieldUFF combined.

Essential methods from OBForceField for minimization:
double LineSearch(double *currentCoords, double *direction);
- Needed for steepest descent and/or conjugate gradients

void SteepestDescentInitialize(int steps = 1000, double econv = 1e-6f,
int method = OBFF_ANALYTICAL_GRADIENT);
bool SteepestDescentTakeNSteps(int n);
- Steepest descent: simple but works (this is probably what you
want for a rough minimization in an applet.
- There are similar methods for conjugate gradients

static double VectorBondDerivative(double *pos_i, double *pos_j,
double *force_i, double *force_j);
static double VectorAngleDerivative(double *pos_i, double *pos_j,
double *pos_k, double *force_i, double *force_j, double *force_k);
static double VectorOOPDerivative(double *pos_i, double *pos_j, double
*pos_k, double *pos_l, double *force_i, double *force_j, double
*force_k, double *force_l);
static double VectorTorsionDerivative(double *pos_i, double *pos_j,
double *pos_k, double *pos_l, double *force_i, double *force_j, double
*force_k, double *force_l);
- These functions help you calculate analytical gradients (If your
time is limited, you could also use numerical gradients, but
performance will be lower)

Here are the virtual methods that are reimplemented in specific force fields:

virtual bool ParseParamFile() { return false; }
- Load the parameters from the parameter file into a
vector (note: UFF has only one parameter file)
bool Setup(OBMol &mol);
- Make a copy of the molecule
- call the functions below…
virtual bool SetTypes() { return false; }
- Set the atom types used in the force field…
virtual bool SetFormalCharges() { return false; }
- Set the formal charges as specified by the force field… (note:
these are not used directly)
virtual bool SetPartialCharges() { return false; }
- Set the partial charges as specified by the force field…
virtual bool SetupCalculations() { return false; }
- Setup a vector for each energy term
(bond-stretching, angle bending, …)
- Again, OBFFCalculation is a general class, specific force fields
derive their own OBFFBondCalculationUFF for example.
(src/forcefields/forcefielduff.h)

  • This function uses the atom type, partial charge, … to fill in
    the values for each OBFFCalculation

virtual double Energy(bool = true) { return 0.0f; }
- call the functions below…
virtual double E_Bond(bool = true) { return 0.0f; }
- iterate over the bond vector, call
OBFFCalculation::Compute() and return the sum of the individual
interaction energies.
virtual double E_Angle(bool = true) { return 0.0f; }
- same…
virtual double E_StrBnd(bool = true) { return 0.0f; }
virtual double E_Torsion(bool = true) { return 0.0f; }
virtual double E_OOP(bool = true) { return 0.0f; }
virtual double E_VDW(bool = true) { return 0.0f; }
virtual double E_Electrostatic(bool = true) { return 0.0f; }

That’s about it I think. There are some very general things like
VectorCross, GetGradient, … but those names should speak for
themselves. If you have more specific questions, do not hesitate to
ask.

Tim