mirror of
https://github.com/openbabel/openbabel.git
synced 2025-02-25 18:55:23 -06:00
Merge of svn commits r2707, 2711, 2713, 2717 from 2.2 release branch.
This commit is contained in:
@@ -90,7 +90,11 @@ public:
|
||||
int andfp = vec1[i] & p2[i];
|
||||
int orfp = vec1[i] | p2[i];
|
||||
// Count bits
|
||||
#ifdef __GNUC__
|
||||
/* GCC 3.4 supports a "population count" builtin, which on many targets is
|
||||
implemented with a single instruction. There is a fallback definition
|
||||
in libgcc in case a target does not have one, which should be just as
|
||||
good as the static function below. */
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
andbits += __builtin_popcount(andfp);
|
||||
orbits += __builtin_popcount(orfp);
|
||||
#else
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import org.openbabel.*
|
||||
|
||||
public class OBTest
|
||||
{
|
||||
public OBTest()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
Open Babel for Java (JNI) 0.9
|
||||
--------------------
|
||||
Open Babel for Java
|
||||
-------------------
|
||||
|
||||
This directory contains a set of SWIG-generated interface classes for
|
||||
using the Open Babel C++ library from Java. It is currently
|
||||
experimental and has not been thoroughly tested.
|
||||
using the Open Babel C++ library from Java.
|
||||
|
||||
The Open Babel wiki pages on Java give information on compiling and
|
||||
running Java programs with Open Babel:
|
||||
@@ -11,21 +10,27 @@ http://openbabel.sourceforge.net/wiki/Java
|
||||
|
||||
*** Linux Compilation
|
||||
|
||||
To compile on Debian 4.0, run the following steps:
|
||||
$ export JAVA=/home/noel/Tools/jdk1.5.0_15
|
||||
First of all, set some environment variables (remember to change the paths to correspond to your system):
|
||||
$ export JAVAHOME=/home/noel/Tools/jdk1.5.0_15
|
||||
$ export OB_JAVADIR=/home/noel/Tools/openbabel-2.2.0/scripts/java
|
||||
$ export OB_LIBDIR=/home/noel/tree/lib # The install location of libopenbabel.so
|
||||
|
||||
I installed OB into /home/noel/tree (/lib)
|
||||
$ export tree=/home/noel/tree
|
||||
Next, compile the Java bindings:
|
||||
$ cd $OB_JAVADIR
|
||||
$ g++ -c -fpic openbabel_java.cpp -I../../include -I$JAVAHOME/include -I$JAVAHOME/include/linux
|
||||
$ export LD_LIBRARY_PATH=$OB_LIBDIR
|
||||
$ g++ -shared -L$OB_LIBDIR openbabel_java.o -lopenbabel -o libopenbabel.so
|
||||
|
||||
$ cd /home/noel/Tools/openbabel/scripts/java
|
||||
$ $JAVA/bin/javac *.java
|
||||
$ g++ -c -fpic openbabel_java.cpp -I../../include -I$JAVA/include -I$JAVA/include/linux
|
||||
$ g++ -shared -L$tree/lib openbabel_java.o -lopenbabel -o libopenbabel.so
|
||||
$ export LD_LIBRARY_PATH=.:$tree/lib
|
||||
$ LD_PRELOAD=$tree/lib/libopenbabel.so $JAVA/bin/java OBTest
|
||||
Compile and run the test program:
|
||||
$ export CLASSPATH=.:$OB_JAVADIR/openbabel.jar
|
||||
$ $JAVAHOME/bin/javac OBTest.java
|
||||
$ export LD_LIBRARY_PATH=$OB_JAVADIR:$OB_LIBDIR
|
||||
$ $JAVAHOME/bin/java OBTest
|
||||
|
||||
If you get the output "Benzene has 0 atoms", you need to preload the OpenBabel library as follows:
|
||||
$ LD_PRELOAD=$OB_LIBDIR/libopenbabel.so $JAVAHOME/bin/java OBTest
|
||||
|
||||
*** Mac OS X Compliation
|
||||
*** Mac OS X Compilation
|
||||
|
||||
% javac *.java
|
||||
% g++ -c -I/System/Library/Frameworks/JavaVM.framework/Headers \
|
||||
@@ -33,9 +38,6 @@ openbabel_java.cpp
|
||||
% g++ -dynamiclib -o libopenbabel.jnilib openbabel_java.o \
|
||||
-framework JavaVM -L/usr/local/lib -lopenbabel
|
||||
|
||||
|
||||
*** Running Programs
|
||||
|
||||
To run the OBTest program:
|
||||
% java OBTest
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ OpenBabel::OBUnitCell *toUnitCell(OpenBabel::OBGenericData *data) {
|
||||
%rename(inc) *::operator++;
|
||||
%rename(good) *::operator bool;
|
||||
%rename(deref) *::operator->;
|
||||
%ignore *::DescribeBits;
|
||||
%import <openbabel/babelconfig.h>
|
||||
|
||||
%include <openbabel/data.h>
|
||||
@@ -93,7 +94,7 @@ OpenBabel::OBUnitCell *toUnitCell(OpenBabel::OBGenericData *data) {
|
||||
%include <openbabel/griddata.h>
|
||||
|
||||
%import <openbabel/chains.h>
|
||||
%import <openbabel/bitvec.h>
|
||||
//# %import <openbabel/bitvec.h>
|
||||
%import <openbabel/typer.h>
|
||||
|
||||
%include <openbabel/plugin.h>
|
||||
@@ -109,7 +110,7 @@ OpenBabel::OBUnitCell *toUnitCell(OpenBabel::OBGenericData *data) {
|
||||
%include <openbabel/ring.h>
|
||||
%include <openbabel/parsmart.h>
|
||||
|
||||
#%include <openbabel/fingerprint.h>
|
||||
%include <openbabel/fingerprint.h>
|
||||
%include <openbabel/descriptor.h>
|
||||
%include <openbabel/forcefield.h>
|
||||
|
||||
@@ -127,8 +128,8 @@ OpenBabel::OBUnitCell *toUnitCell(OpenBabel::OBGenericData *data) {
|
||||
%ignore OBAtomBondIter(OBAtom &);
|
||||
%ignore OBMolAngleIter(OBMol &);
|
||||
%ignore OBMolAtomIter(OBMol &);
|
||||
%ignore OBMolAtomBFSIter(OBMol &);
|
||||
%ignore OBMolAtomDFSIter(OBMol &);
|
||||
%ignore OBMolAtomBFSIter;
|
||||
%ignore OBMolAtomDFSIter;
|
||||
%ignore OBMolBondIter(OBMol &);
|
||||
%ignore OBMolPairIter(OBMol &);
|
||||
%ignore OBMolRingIter(OBMol &);
|
||||
|
||||
@@ -100,7 +100,11 @@ namespace OpenBabel
|
||||
int andfp = vec1[i] & vec2[i];
|
||||
int orfp = vec1[i] | vec2[i];
|
||||
//Count bits
|
||||
#ifdef __GNUC__
|
||||
/* GCC 3.4 supports a "population count" builtin, which on many targets is
|
||||
implemented with a single instruction. There is a fallback definition
|
||||
in libgcc in case a target does not have one, which should be just as
|
||||
good as the static function below. */
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
andbits += __builtin_popcount(andfp);
|
||||
orbits += __builtin_popcount(orfp);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user