summaryrefslogtreecommitdiff
path: root/extra/avogadro
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-12-03 23:14:41 +0000
committerroot <root@rshg054.dnsready.net>2011-12-03 23:14:41 +0000
commit851376cd7720e1f9b35e0a7c26bfd66399f0c4d3 (patch)
treef8579d1c934aa5c28308372bedc321628555a424 /extra/avogadro
parent8eed59114cbcf729b65f87d3f73530f6c8363d20 (diff)
Sat Dec 3 23:14:41 UTC 2011
Diffstat (limited to 'extra/avogadro')
-rw-r--r--extra/avogadro/PKGBUILD32
-rw-r--r--extra/avogadro/avogadro.install11
-rw-r--r--extra/avogadro/fix-boost.patch33
-rw-r--r--extra/avogadro/replace-qt4_automoc-with-qt4_wrap_cpp.patch778
4 files changed, 844 insertions, 10 deletions
diff --git a/extra/avogadro/PKGBUILD b/extra/avogadro/PKGBUILD
index f85ad30cd..e73bdd8f0 100644
--- a/extra/avogadro/PKGBUILD
+++ b/extra/avogadro/PKGBUILD
@@ -1,30 +1,42 @@
-# $Id: PKGBUILD 132785 2011-07-26 07:29:20Z andrea $
-# Maintainer: Andrea Scarpino <andrea@archlinux.org>
+# $Id: PKGBUILD 144043 2011-12-02 20:54:10Z ibiru $
+# Maintainer:
+# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Nick B <Shirakawasuna at gmail _dot_com>
pkgname=avogadro
pkgver=1.0.3
-pkgrel=3
+pkgrel=4
pkgdesc="An advanced molecular editor based on Qt"
arch=('i686' 'x86_64')
url="http://avogadro.openmolecules.net/wiki/Main_Page"
license=('GPL2')
-depends=('eigen' 'openbabel' 'python2-pyqt' 'boost-libs' 'glew' 'python2-numpy')
+depends=('eigen2' 'openbabel' 'python2-pyqt' 'boost-libs' 'glew' 'python2-numpy')
makedepends=('cmake' 'boost')
-source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2")
-md5sums=('92c2702c1980f70fb6d87a1a58147911')
+install=avogadro.install
+source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2"
+ 'replace-qt4_automoc-with-qt4_wrap_cpp.patch'
+ 'fix-boost.patch')
+md5sums=('92c2702c1980f70fb6d87a1a58147911'
+ 'aec516daab066c15326a9681f8f15abc'
+ '46282e4709429447e44a0a54d51ad2ec')
build() {
- cd ${srcdir}
+ cd "${srcdir}"/${pkgname}-${pkgver}
+ patch -p1 -i "${srcdir}"/replace-qt4_automoc-with-qt4_wrap_cpp.patch
+ patch -p1 -i "${srcdir}"/fix-boost.patch
+
+ cd "${srcdir}"
mkdir build
cd build
cmake ../${pkgname}-${pkgver} \
-DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DPYTHON_EXECUTABLE=/usr/bin/python2 \
+ -DQT_MKSPECS_RELATIVE=share/qt/mkspecs
make
}
package() {
- cd ${srcdir}/build
- make DESTDIR=${pkgdir} install
+ cd "${srcdir}/build"
+ make DESTDIR="${pkgdir}" install
}
diff --git a/extra/avogadro/avogadro.install b/extra/avogadro/avogadro.install
new file mode 100644
index 000000000..2eaa60550
--- /dev/null
+++ b/extra/avogadro/avogadro.install
@@ -0,0 +1,11 @@
+post_install() {
+ update-desktop-database -q
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ post_install $1
+}
diff --git a/extra/avogadro/fix-boost.patch b/extra/avogadro/fix-boost.patch
new file mode 100644
index 000000000..8fb53ef12
--- /dev/null
+++ b/extra/avogadro/fix-boost.patch
@@ -0,0 +1,33 @@
+--- avogadro-1.0.3/libavogadro/src/CMakeLists.txt~ 2011-11-29 18:33:01.777291627 +0000
++++ avogadro-1.0.3/libavogadro/src/CMakeLists.txt 2011-11-29 18:33:23.480814612 +0000
+@@ -149,7 +149,7 @@
+ endforeach(P_ITEM ${PYTHON_SRCS})
+ endif(NOT ENABLE_PYTHON OR NOT ALL_PYTHON_FOUND)
+
+-QT4_WRAP_CPP(libavogadro_MOC_SRCS ${libavogadro_MOC_HDRS})
++QT4_WRAP_CPP(libavogadro_MOC_SRCS ${libavogadro_MOC_HDRS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+
+ # you have to add link_directories before you add the target
+ if(ENABLE_PYTHON AND ALL_PYTHON_FOUND)
+--- avogadro-1.0.3/libavogadro/src/python/CMakeLists.txt~ 2011-11-29 18:37:15.449506548 +0000
++++ avogadro-1.0.3/libavogadro/src/python/CMakeLists.txt 2011-11-29 18:37:52.729831744 +0000
+@@ -11,7 +11,7 @@
+ # use all cpp files in this directory
+ FILE(GLOB wrapper_SRCS "*.cpp")
+
+-QT4_WRAP_CPP(MOC_SRCS moleculelist.h)
++QT4_WRAP_CPP(MOC_SRCS moleculelist.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+
+ ADD_LIBRARY(python-module MODULE ${wrapper_SRCS} ${MOC_SRCS})
+ SET_TARGET_PROPERTIES(python-module PROPERTIES OUTPUT_NAME Avogadro)
+--- avogadro-1.0.3/libavogadro/CMakeLists.txt~ 2011-11-29 19:41:34.066938217 +0000
++++ avogadro-1.0.3/libavogadro/CMakeLists.txt 2011-11-29 19:42:53.084320315 +0000
+@@ -18,7 +18,7 @@
+ # Assume all MOC stuff is in the headers, replace .cpp and use qt4_wrap_cpp
+ # We should probably scan the header to verify the Q_OBJECT macro is used
+ string(REPLACE ".cpp" ".h" hdr_list "${src_list}")
+- qt4_wrap_cpp(moc_files ${hdr_list})
++ qt4_wrap_cpp(moc_files ${hdr_list} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+ # Now sort out the ui and qrc files, process them as appropriate
+ set(ui_plugin_files)
+ set(qrc_plugin_files)
diff --git a/extra/avogadro/replace-qt4_automoc-with-qt4_wrap_cpp.patch b/extra/avogadro/replace-qt4_automoc-with-qt4_wrap_cpp.patch
new file mode 100644
index 000000000..11f58a505
--- /dev/null
+++ b/extra/avogadro/replace-qt4_automoc-with-qt4_wrap_cpp.patch
@@ -0,0 +1,778 @@
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/CMakeLists.txt avogadro-1.0.3-edit/libavogadro/src/CMakeLists.txt
+--- avogadro-1.0.3/libavogadro/src/CMakeLists.txt 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/CMakeLists.txt 2011-11-29 18:49:58.520790652 +0100
+@@ -75,6 +75,42 @@
+ zmatrix.h
+ )
+
++SET(libavogadro_MOC_HDRS
++ animation.h
++ atom.h
++ bond.h
++ color.h
++ colorbutton.h
++ colors/elementcolor.h
++ cube.h
++ elementdetail_p.h
++ elementtranslator.h
++ engine.h
++ engines/bsdyengine.h
++ extension.h
++ fragment.h
++ glwidget.h
++ mesh.h
++ molecule.h
++ moleculefile.h
++ moleculefile_p.h
++ periodictablescene_p.h
++ periodictableview.h
++ plotwidget.h
++ plugin.h
++ pluginmanager.h
++ primitive.h
++ protein.h
++ pythonengine_p.h
++ pythonerror.h
++ pythonextension_p.h
++ pythontool_p.h
++ residue.h
++ tool.h
++ toolgroup.h
++ zmatrix.h
++)
++
+ set(libavogadro_SRCS ${libavogadro_SRCS} ${libavogadro_UIS})
+ # Also add in the qtiocompressor class
+ #set(libavogadro_SRCS ${libavogadro_SRCS} ../qtiocompressor/qtiocompressor.cpp)
+@@ -113,7 +148,7 @@
+ endforeach(P_ITEM ${PYTHON_SRCS})
+ endif(NOT ENABLE_PYTHON OR NOT ALL_PYTHON_FOUND)
+
+-qt4_automoc(${libavogadro_SRCS})
++QT4_WRAP_CPP(libavogadro_MOC_SRCS ${libavogadro_MOC_HDRS})
+
+ # you have to add link_directories before you add the target
+ if(ENABLE_PYTHON AND ALL_PYTHON_FOUND)
+@@ -149,7 +184,7 @@
+ COMMAND ${CMAKE_COMMAND} -E ${header_cmd} "${from}" "${to}")
+ endforeach(headerFile ${libavogadro_HDRS})
+
+-add_library(avogadro SHARED ${libavogadro_SRCS} ${libavogadro_QM} ${pythontool_RC_SRCS})
++add_library(avogadro SHARED ${libavogadro_SRCS} ${libavogadro_MOC_SRCS} ${libavogadro_QM} ${pythontool_RC_SRCS})
+ set_target_properties(avogadro
+ PROPERTIES VERSION ${Avogadro_VERSION_FULL} SOVERSION 1 )
+ target_link_libraries(avogadro ${AVO_LINK_LIBRARIES})
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/animation.cpp avogadro-1.0.3-edit/libavogadro/src/animation.cpp
+--- avogadro-1.0.3/libavogadro/src/animation.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/animation.cpp 2011-11-29 18:48:47.967839537 +0100
+@@ -224,5 +224,3 @@
+ }
+
+ } // end namespace Avogadro
+-
+-#include "animation.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/atom.cpp avogadro-1.0.3-edit/libavogadro/src/atom.cpp
+--- avogadro-1.0.3/libavogadro/src/atom.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/atom.cpp 2011-11-29 18:48:39.561218412 +0100
+@@ -293,5 +293,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "atom.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/bond.cpp avogadro-1.0.3-edit/libavogadro/src/bond.cpp
+--- avogadro-1.0.3/libavogadro/src/bond.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/bond.cpp 2011-11-29 18:49:00.067773985 +0100
+@@ -166,5 +166,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "bond.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/color.cpp avogadro-1.0.3-edit/libavogadro/src/color.cpp
+--- avogadro-1.0.3/libavogadro/src/color.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/color.cpp 2011-11-29 18:49:05.207746140 +0100
+@@ -152,5 +152,3 @@
+ return "Generic Color";
+ }
+ }
+-
+-#include "color.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/colorbutton.cpp avogadro-1.0.3-edit/libavogadro/src/colorbutton.cpp
+--- avogadro-1.0.3/libavogadro/src/colorbutton.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/colorbutton.cpp 2011-11-29 18:49:11.987709410 +0100
+@@ -94,5 +94,3 @@
+ }
+
+ } // end namespace
+-
+-#include "colorbutton.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/colors/elementcolor.cpp avogadro-1.0.3-edit/libavogadro/src/colors/elementcolor.cpp
+--- avogadro-1.0.3/libavogadro/src/colors/elementcolor.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/colors/elementcolor.cpp 2011-11-29 18:50:11.077389292 +0100
+@@ -63,7 +63,5 @@
+
+ }
+
+-#include "elementcolor.moc"
+ //this is a static color plugin...
+ //Q_EXPORT_PLUGIN2(elementcolor, Avogadro::ElementColorFactory)
+-
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/cube.cpp avogadro-1.0.3-edit/libavogadro/src/cube.cpp
+--- avogadro-1.0.3/libavogadro/src/cube.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/cube.cpp 2011-11-29 18:50:26.357306516 +0100
+@@ -322,5 +322,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "cube.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/elementdetail_p.cpp avogadro-1.0.3-edit/libavogadro/src/elementdetail_p.cpp
+--- avogadro-1.0.3/libavogadro/src/elementdetail_p.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/elementdetail_p.cpp 2011-11-29 18:50:37.680578505 +0100
+@@ -132,5 +132,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "elementdetail_p.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/elementtranslator.cpp avogadro-1.0.3-edit/libavogadro/src/elementtranslator.cpp
+--- avogadro-1.0.3/libavogadro/src/elementtranslator.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/elementtranslator.cpp 2011-11-29 18:50:48.160521729 +0100
+@@ -401,5 +401,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "elementtranslator.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/engine.cpp avogadro-1.0.3-edit/libavogadro/src/engine.cpp
+--- avogadro-1.0.3/libavogadro/src/engine.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/engine.cpp 2011-11-29 18:50:54.397154610 +0100
+@@ -377,5 +377,3 @@
+ return m_molecule->bonds();
+ }
+ }
+-
+-#include "engine.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/engines/bsdyengine.cpp avogadro-1.0.3-edit/libavogadro/src/engines/bsdyengine.cpp
+--- avogadro-1.0.3/libavogadro/src/engines/bsdyengine.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/engines/bsdyengine.cpp 2011-11-29 18:51:18.733689435 +0100
+@@ -442,7 +442,5 @@
+ }
+
+ }
+-
+-#include "bsdyengine.moc"
+ // This is a static engine...
+ // Q_EXPORT_PLUGIN2( bsdyengine, Avogadro::BSDYEngineFactory )
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/extension.cpp avogadro-1.0.3-edit/libavogadro/src/extension.cpp
+--- avogadro-1.0.3/libavogadro/src/extension.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/extension.cpp 2011-11-29 18:51:56.360152261 +0100
+@@ -80,5 +80,3 @@
+ }
+
+ }
+-
+-#include "extension.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/fragment.cpp avogadro-1.0.3-edit/libavogadro/src/fragment.cpp
+--- avogadro-1.0.3/libavogadro/src/fragment.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/fragment.cpp 2011-11-29 18:52:01.906788880 +0100
+@@ -82,5 +82,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "fragment.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/glwidget.cpp avogadro-1.0.3-edit/libavogadro/src/glwidget.cpp
+--- avogadro-1.0.3/libavogadro/src/glwidget.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/glwidget.cpp 2011-11-29 18:52:14.346721486 +0100
+@@ -1966,5 +1966,3 @@
+ d->updateCache = true;
+ }
+ }
+-
+-#include "glwidget.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/mesh.cpp avogadro-1.0.3-edit/libavogadro/src/mesh.cpp
+--- avogadro-1.0.3/libavogadro/src/mesh.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/mesh.cpp 2011-11-29 18:52:23.033341093 +0100
+@@ -231,5 +231,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "mesh.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/molecule.cpp avogadro-1.0.3-edit/libavogadro/src/molecule.cpp
+--- avogadro-1.0.3/libavogadro/src/molecule.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/molecule.cpp 2011-11-29 18:52:33.573283993 +0100
+@@ -1575,5 +1575,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "molecule.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/moleculefile.cpp avogadro-1.0.3-edit/libavogadro/src/moleculefile.cpp
+--- avogadro-1.0.3/libavogadro/src/moleculefile.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/moleculefile.cpp 2011-11-29 18:56:26.728687548 +0100
+@@ -22,23 +22,14 @@
+ 02110-1301, USA.
+ **********************************************************************/
+
+-#include "moleculefile.h"
++#include "moleculefile_p.h"
+
+ #include <avogadro/molecule.h>
+
+-#include <QFile>
+ #include <QFileInfo>
+-#include <QStringList>
+-#include <QThread>
+ #include <QDebug>
+ #include <QPointer>
+
+-#include <openbabel/mol.h>
+-#include <openbabel/obconversion.h>
+-
+-// Included in obconversion.h
+-//#include <iostream>
+-
+ namespace Avogadro {
+
+ using OpenBabel::OBConversion;
+@@ -578,164 +569,6 @@
+ return false;
+ }
+
+- class ReadFileThread : public QThread
+- {
+- // Q_OBJECT
+-
+- public:
+- ReadFileThread(MoleculeFile *moleculeFile) : m_moleculeFile(moleculeFile)
+- {
+- }
+-
+- void addConformer(const OpenBabel::OBMol &conformer)
+- {
+- unsigned int numAtoms = conformer.NumAtoms();
+- std::vector<Eigen::Vector3d> *coords = new std::vector<Eigen::Vector3d>(numAtoms);
+- for (unsigned int i = 0; i < numAtoms; ++i)
+- coords->push_back(Eigen::Vector3d(conformer.GetAtom(i+1)->GetVector().AsArray()));
+- m_moleculeFile->m_conformers.push_back(coords);
+- }
+-
+- void detectConformers(unsigned int c, const OpenBabel::OBMol &first, const OpenBabel::OBMol &current)
+- {
+- if (!c) {
+- // this is the first molecule read
+- m_moleculeFile->setConformerFile(true);
+- addConformer(current);
+- return;
+- }
+-
+- if (!m_moleculeFile->isConformerFile())
+- return;
+-
+- // as long as we are not sure if this really is a
+- // conformer/trajectory file, add the conformers
+- addConformer(current);
+-
+- // performance: check only certain molecule 1-10,20,50
+- switch (c) {
+- case 1:
+- case 2:
+- case 3:
+- case 4:
+- case 5:
+- case 6:
+- case 7:
+- case 8:
+- case 9:
+- case 10:
+- case 20:
+- case 50:
+- break;
+- default:
+- return;
+- }
+-
+- if (first.NumAtoms() != current.NumAtoms()) {
+- m_moleculeFile->setConformerFile(false);
+- m_moleculeFile->m_conformers.clear();
+- return;
+- }
+-
+- for (unsigned int i = 0; i < first.NumAtoms(); ++i) {
+- OpenBabel::OBAtom *firstAtom = first.GetAtom(i+1);
+- OpenBabel::OBAtom *currentAtom = current.GetAtom(i+1);
+- if (firstAtom->GetAtomicNum() != currentAtom->GetAtomicNum()) {
+- m_moleculeFile->setConformerFile(false);
+- m_moleculeFile->m_conformers.clear();
+- return;
+- }
+- }
+- }
+-
+- void run()
+- {
+- // Check that the file can be read from disk
+- if (!MoleculeFile::canOpen(m_moleculeFile->m_fileName, QFile::ReadOnly | QFile::Text)) {
+- // Cannot read the file
+- m_moleculeFile->m_error.append(QObject::tr("File %1 cannot be opened for reading.")
+- .arg(m_moleculeFile->m_fileName));
+- return;
+- }
+-
+- // Construct the OpenBabel objects, set the file type
+- OpenBabel::OBConversion conv;
+- OpenBabel::OBFormat *inFormat;
+- if (!m_moleculeFile->m_fileType.isEmpty() && !conv.SetInFormat(m_moleculeFile->m_fileType.toAscii().data())) {
+- // Input format not supported
+- m_moleculeFile->m_error.append(
+- QObject::tr("File type '%1' is not supported for reading.").arg(m_moleculeFile->m_fileType));
+- return;
+- } else {
+- inFormat = conv.FormatFromExt(m_moleculeFile->m_fileName.toAscii().data());
+- if (!inFormat || !conv.SetInFormat(inFormat)) {
+- // Input format not supported
+- m_moleculeFile->m_error.append(QObject::tr("File type for file '%1' is not supported for reading.")
+- .arg(m_moleculeFile->m_fileName));
+- return;
+- }
+- }
+-
+- // set any options
+- if (!m_moleculeFile->m_fileOptions.isEmpty()) {
+- foreach(const QString &option,
+- m_moleculeFile->m_fileOptions.split('\n', QString::SkipEmptyParts)) {
+- conv.AddOption(option.toAscii().data(), OBConversion::INOPTIONS);
+- }
+- }
+-
+- // Now attempt to read the molecule in
+- ifstream ifs;
+- ifs.open(m_moleculeFile->m_fileName.toLocal8Bit()); // This handles utf8 file names etc
+- if (!ifs) // Should not happen, already checked file could be opened
+- return;
+-
+- // read all molecules
+- OpenBabel::OBMol firstOBMol, currentOBMol;
+- unsigned int c = 0;
+- conv.SetInStream(&ifs);
+- m_moleculeFile->streamposRef().push_back(ifs.tellg());
+- while (ifs.good() && conv.Read(&currentOBMol)) {
+- if (!c)
+- firstOBMol = currentOBMol;
+-
+- if (c > 20 && !m_moleculeFile->isConformerFile())
+- m_moleculeFile->setFirstReady(true);
+-
+- // detect conformer/trajectory files
+- detectConformers(c, firstOBMol, currentOBMol);
+- // store information about molecule
+- m_moleculeFile->streamposRef().push_back(ifs.tellg());
+- m_moleculeFile->titlesRef().append(currentOBMol.GetTitle());
+- // increment count
+- ++c;
+- }
+- m_moleculeFile->streamposRef().pop_back();
+-
+- // signle molecule files are not conformer files
+- if (c == 1) {
+- m_moleculeFile->setConformerFile(false);
+- m_moleculeFile->m_conformers.clear();
+- }
+-
+- // check for empty titles
+- for (int i = 0; i < m_moleculeFile->titlesRef().size(); ++i) {
+- if (!m_moleculeFile->titlesRef()[i].isEmpty())
+- continue;
+-
+- QString title;
+- if (m_moleculeFile->isConformerFile())
+- title = tr("Conformer %1").arg(i+1);
+- else
+- title = tr("Molecule %1").arg(i+1);
+-
+- m_moleculeFile->titlesRef()[i] = title;
+- }
+- }
+-
+- MoleculeFile *m_moleculeFile;
+- }; // end ReadFileThread class
+-
+ MoleculeFile* MoleculeFile::readFile(const QString &fileName,
+ const QString &fileType, const QString &fileOptions, bool wait)
+ {
+@@ -794,6 +627,3 @@
+ }
+
+ } // end namespace Avogadro
+-
+-#include "moleculefile.moc"
+-
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/moleculefile_p.h avogadro-1.0.3-edit/libavogadro/src/moleculefile_p.h
+--- avogadro-1.0.3/libavogadro/src/moleculefile_p.h 1970-01-01 01:00:00.000000000 +0100
++++ avogadro-1.0.3-edit/libavogadro/src/moleculefile_p.h 2011-11-29 18:57:43.108273764 +0100
+@@ -0,0 +1,202 @@
++/**********************************************************************
++ MoleculeFile - Class representing molecule file.
++
++ Copyright (C) 2009 Marcus Hanwell, Tim Vandermeersch
++
++ This file is part of the Avogadro molecular editor project.
++ For more information, see <http://avogadro.openmolecules.net/>
++
++ Avogadro is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ Avogadro is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ 02110-1301, USA.
++ **********************************************************************/
++
++#ifndef MOLECULEFILE_P_H
++#define MOLECULEFILE_P_H
++
++#include "moleculefile.h"
++
++#include <openbabel/mol.h>
++#include <openbabel/obconversion.h>
++
++#include <QFile>
++#include <QStringList>
++#include <QThread>
++
++namespace Avogadro {
++
++ using OpenBabel::OBConversion;
++ using std::ifstream;
++
++class ReadFileThread : public QThread
++{
++ Q_OBJECT
++
++ public:
++ ReadFileThread(MoleculeFile *moleculeFile) : m_moleculeFile(moleculeFile)
++ {
++ }
++
++ void addConformer(const OpenBabel::OBMol &conformer)
++ {
++ unsigned int numAtoms = conformer.NumAtoms();
++ std::vector<Eigen::Vector3d> *coords = new std::vector<Eigen::Vector3d>(numAtoms);
++ for (unsigned int i = 0; i < numAtoms; ++i)
++ coords->push_back(Eigen::Vector3d(conformer.GetAtom(i+1)->GetVector().AsArray()));
++ m_moleculeFile->m_conformers.push_back(coords);
++ }
++
++ void detectConformers(unsigned int c, const OpenBabel::OBMol &first, const OpenBabel::OBMol &current)
++ {
++ if (!c) {
++ // this is the first molecule read
++ m_moleculeFile->setConformerFile(true);
++ addConformer(current);
++ return;
++ }
++
++ if (!m_moleculeFile->isConformerFile())
++ return;
++
++ // as long as we are not sure if this really is a
++ // conformer/trajectory file, add the conformers
++ addConformer(current);
++
++ // performance: check only certain molecule 1-10,20,50
++ switch (c) {
++ case 1:
++ case 2:
++ case 3:
++ case 4:
++ case 5:
++ case 6:
++ case 7:
++ case 8:
++ case 9:
++ case 10:
++ case 20:
++ case 50:
++ break;
++ default:
++ return;
++ }
++
++ if (first.NumAtoms() != current.NumAtoms()) {
++ m_moleculeFile->setConformerFile(false);
++ m_moleculeFile->m_conformers.clear();
++ return;
++ }
++
++ for (unsigned int i = 0; i < first.NumAtoms(); ++i) {
++ OpenBabel::OBAtom *firstAtom = first.GetAtom(i+1);
++ OpenBabel::OBAtom *currentAtom = current.GetAtom(i+1);
++ if (firstAtom->GetAtomicNum() != currentAtom->GetAtomicNum()) {
++ m_moleculeFile->setConformerFile(false);
++ m_moleculeFile->m_conformers.clear();
++ return;
++ }
++ }
++ }
++
++ void run()
++ {
++ // Check that the file can be read from disk
++ if (!MoleculeFile::canOpen(m_moleculeFile->m_fileName, QFile::ReadOnly | QFile::Text)) {
++ // Cannot read the file
++ m_moleculeFile->m_error.append(QObject::tr("File %1 cannot be opened for reading.")
++ .arg(m_moleculeFile->m_fileName));
++ return;
++ }
++
++ // Construct the OpenBabel objects, set the file type
++ OpenBabel::OBConversion conv;
++ OpenBabel::OBFormat *inFormat;
++ if (!m_moleculeFile->m_fileType.isEmpty() && !conv.SetInFormat(m_moleculeFile->m_fileType.toAscii().data())) {
++ // Input format not supported
++ m_moleculeFile->m_error.append(
++ QObject::tr("File type '%1' is not supported for reading.").arg(m_moleculeFile->m_fileType));
++ return;
++ } else {
++ inFormat = conv.FormatFromExt(m_moleculeFile->m_fileName.toAscii().data());
++ if (!inFormat || !conv.SetInFormat(inFormat)) {
++ // Input format not supported
++ m_moleculeFile->m_error.append(QObject::tr("File type for file '%1' is not supported for reading.")
++ .arg(m_moleculeFile->m_fileName));
++ return;
++ }
++ }
++
++ // set any options
++ if (!m_moleculeFile->m_fileOptions.isEmpty()) {
++ foreach(const QString &option,
++ m_moleculeFile->m_fileOptions.split('\n', QString::SkipEmptyParts)) {
++ conv.AddOption(option.toAscii().data(), OBConversion::INOPTIONS);
++ }
++ }
++
++ // Now attempt to read the molecule in
++ ifstream ifs;
++ ifs.open(m_moleculeFile->m_fileName.toLocal8Bit()); // This handles utf8 file names etc
++ if (!ifs) // Should not happen, already checked file could be opened
++ return;
++
++ // read all molecules
++ OpenBabel::OBMol firstOBMol, currentOBMol;
++ unsigned int c = 0;
++ conv.SetInStream(&ifs);
++ m_moleculeFile->streamposRef().push_back(ifs.tellg());
++ while (ifs.good() && conv.Read(&currentOBMol)) {
++ if (!c)
++ firstOBMol = currentOBMol;
++
++ if (c > 20 && !m_moleculeFile->isConformerFile())
++ m_moleculeFile->setFirstReady(true);
++
++ // detect conformer/trajectory files
++ detectConformers(c, firstOBMol, currentOBMol);
++ // store information about molecule
++ m_moleculeFile->streamposRef().push_back(ifs.tellg());
++ m_moleculeFile->titlesRef().append(currentOBMol.GetTitle());
++ // increment count
++ ++c;
++ }
++ m_moleculeFile->streamposRef().pop_back();
++
++ // signle molecule files are not conformer files
++ if (c == 1) {
++ m_moleculeFile->setConformerFile(false);
++ m_moleculeFile->m_conformers.clear();
++ }
++
++ // check for empty titles
++ for (int i = 0; i < m_moleculeFile->titlesRef().size(); ++i) {
++ if (!m_moleculeFile->titlesRef()[i].isEmpty())
++ continue;
++
++ QString title;
++ if (m_moleculeFile->isConformerFile())
++ title = tr("Conformer %1").arg(i+1);
++ else
++ title = tr("Molecule %1").arg(i+1);
++
++ m_moleculeFile->titlesRef()[i] = title;
++ }
++ }
++
++ MoleculeFile *m_moleculeFile;
++};
++
++} // end namespace Avogadro
++
++#endif // MOLECULEFILE_P_H
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/periodictablescene_p.cpp avogadro-1.0.3-edit/libavogadro/src/periodictablescene_p.cpp
+--- avogadro-1.0.3/libavogadro/src/periodictablescene_p.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/periodictablescene_p.cpp 2011-11-29 18:52:50.259860261 +0100
+@@ -213,5 +213,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "periodictablescene_p.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/periodictableview.cpp avogadro-1.0.3-edit/libavogadro/src/periodictableview.cpp
+--- avogadro-1.0.3/libavogadro/src/periodictableview.cpp 2011-11-29 19:30:25.130970122 +0000
++++ avogadro-1.0.3-edit/libavogadro/src/periodictableview.cpp 2011-11-29 18:52:50.259860261 +0100
+@@ -69,4 +69,3 @@
+
+ } // End namespace Avogadro
+
+-#include "periodictableview.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/plotwidget.cpp avogadro-1.0.3-edit/libavogadro/src/plotwidget.cpp
+--- avogadro-1.0.3/libavogadro/src/plotwidget.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/plotwidget.cpp 2011-11-29 18:53:09.389756626 +0100
+@@ -27,7 +27,6 @@
+ **********************************************************************/
+
+ #include "plotwidget.h"
+-#include "plotwidget.moc"
+
+ #include <math.h>
+ #include <QDebug>
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/plugin.cpp avogadro-1.0.3-edit/libavogadro/src/plugin.cpp
+--- avogadro-1.0.3/libavogadro/src/plugin.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/plugin.cpp 2011-11-29 18:53:16.016387394 +0100
+@@ -65,5 +65,3 @@
+ }
+
+ } // end namespace Avogadro
+-
+-#include "plugin.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/pluginmanager.cpp avogadro-1.0.3-edit/libavogadro/src/pluginmanager.cpp
+--- avogadro-1.0.3/libavogadro/src/pluginmanager.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/pluginmanager.cpp 2011-11-29 18:53:23.569679807 +0100
+@@ -784,5 +784,3 @@
+ }
+
+ }
+-
+-#include "pluginmanager.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/primitive.cpp avogadro-1.0.3-edit/libavogadro/src/primitive.cpp
+--- avogadro-1.0.3/libavogadro/src/primitive.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/primitive.cpp 2011-11-29 18:53:29.139649631 +0100
+@@ -77,5 +77,3 @@
+ }
+
+ }
+-
+-#include "primitive.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/protein.cpp avogadro-1.0.3-edit/libavogadro/src/protein.cpp
+--- avogadro-1.0.3/libavogadro/src/protein.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/protein.cpp 2011-11-29 18:53:37.952935219 +0100
+@@ -978,5 +978,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+-#include "protein.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/python/CMakeLists.txt avogadro-1.0.3-edit/libavogadro/src/python/CMakeLists.txt
+--- avogadro-1.0.3/libavogadro/src/python/CMakeLists.txt 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/python/CMakeLists.txt 2011-11-29 18:58:02.354836165 +0100
+@@ -11,9 +11,9 @@
+ # use all cpp files in this directory
+ FILE(GLOB wrapper_SRCS "*.cpp")
+
+-qt4_automoc(moleculelist.cpp)
++QT4_WRAP_CPP(MOC_SRCS moleculelist.h)
+
+-ADD_LIBRARY(python-module MODULE ${wrapper_SRCS})
++ADD_LIBRARY(python-module MODULE ${wrapper_SRCS} ${MOC_SRCS})
+ SET_TARGET_PROPERTIES(python-module PROPERTIES OUTPUT_NAME Avogadro)
+ SET_TARGET_PROPERTIES(python-module PROPERTIES PREFIX "")
+ if (WIN32)
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/python/moleculelist.cpp avogadro-1.0.3-edit/libavogadro/src/python/moleculelist.cpp
+--- avogadro-1.0.3/libavogadro/src/python/moleculelist.cpp 2011-11-29 19:26:07.562214311 +0100
++++ avogadro-1.0.3-edit/libavogadro/src/python/moleculelist.cpp 2011-11-29 19:26:14.538843182 +0100
+@@ -70,4 +70,3 @@
+
+ }
+
+-#include "moleculelist.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/pythonengine_p.cpp avogadro-1.0.3-edit/libavogadro/src/pythonengine_p.cpp
+--- avogadro-1.0.3/libavogadro/src/pythonengine_p.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/pythonengine_p.cpp 2011-11-29 18:53:45.492894371 +0100
+@@ -289,5 +289,3 @@
+
+
+ }
+-
+-#include "pythonengine_p.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/pythonerror.cpp avogadro-1.0.3-edit/libavogadro/src/pythonerror.cpp
+--- avogadro-1.0.3/libavogadro/src/pythonerror.cpp 2011-11-29 19:24:26.949426045 +0100
++++ avogadro-1.0.3-edit/libavogadro/src/pythonerror.cpp 2011-11-29 19:24:41.176015640 +0100
+@@ -112,4 +112,3 @@
+
+ } // namespace
+
+-#include "pythonerror.moc"
+
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/pythonextension_p.cpp avogadro-1.0.3-edit/libavogadro/src/pythonextension_p.cpp
+--- avogadro-1.0.3/libavogadro/src/pythonextension_p.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/pythonextension_p.cpp 2011-11-29 18:53:54.082847836 +0100
+@@ -340,5 +340,3 @@
+ }
+
+ }
+-
+-#include "pythonextension_p.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/pythontool_p.cpp avogadro-1.0.3-edit/libavogadro/src/pythontool_p.cpp
+--- avogadro-1.0.3/libavogadro/src/pythontool_p.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/pythontool_p.cpp 2011-11-29 18:54:02.269470152 +0100
+@@ -344,5 +344,3 @@
+ }
+
+ }
+-
+-#include "pythontool_p.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/residue.cpp avogadro-1.0.3-edit/libavogadro/src/residue.cpp
+--- avogadro-1.0.3/libavogadro/src/residue.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/residue.cpp 2011-11-29 18:54:14.316071557 +0100
+@@ -160,6 +160,3 @@
+ }
+
+ } // End namespace Avogadro
+-
+- #include "residue.moc"
+-
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/tool.cpp avogadro-1.0.3-edit/libavogadro/src/tool.cpp
+--- avogadro-1.0.3/libavogadro/src/tool.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/tool.cpp 2011-11-29 18:55:05.515794184 +0100
+@@ -117,5 +117,3 @@
+ }
+
+ } // end namespace Avogadro
+-
+-#include "tool.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/toolgroup.cpp avogadro-1.0.3-edit/libavogadro/src/toolgroup.cpp
+--- avogadro-1.0.3/libavogadro/src/toolgroup.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/toolgroup.cpp 2011-11-29 18:55:11.699094018 +0100
+@@ -206,5 +206,3 @@
+ }
+
+ } // end namespace Avogadro
+-
+-#include "toolgroup.moc"
+diff -U 3 -H -d -r -N -- avogadro-1.0.3/libavogadro/src/zmatrix.cpp avogadro-1.0.3-edit/libavogadro/src/zmatrix.cpp
+--- avogadro-1.0.3/libavogadro/src/zmatrix.cpp 2011-04-25 07:22:18.000000000 +0200
++++ avogadro-1.0.3-edit/libavogadro/src/zmatrix.cpp 2011-11-29 18:55:17.209064168 +0100
+@@ -149,5 +149,3 @@
+
+
+ } // End namespace Avogadro
+-
+-#include "zmatrix.moc"