File 0004-Port-to-OpenBabel-3.patch of Package molekel
From a340ba28a4f6252952fad7b6ce64bb6bed2dc2e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Wed, 25 Dec 2024 22:23:17 +0100
Subject: [PATCH 4/4] Port to OpenBabel 3
---
src/AbstractAtomAnimator.h | 1 +
src/MolekelMolecule.cpp | 4 +++-
src/molekel_sources.cmake | 8 ++++----
src/utility/BabelToMOIV.cpp | 10 ++++++----
src/utility/MolekelToOpenBabel.cpp | 1 +
src/utility/OBZmatrixFormat.cpp | 6 ++++--
6 files changed, 19 insertions(+), 11 deletions(-)
mode change 100755 => 100644 src/AbstractAtomAnimator.h
mode change 100755 => 100644 src/molekel_sources.cmake
diff --git a/src/AbstractAtomAnimator.h b/src/AbstractAtomAnimator.h
old mode 100755
new mode 100644
index 3843107..f5310bb
--- a/src/AbstractAtomAnimator.h
+++ b/src/AbstractAtomAnimator.h
@@ -36,6 +36,7 @@
#include "MolekelMolecule.h"
#include "old/molekeltypes.h"
+#include <openbabel/atom.h>
#include <openbabel/mol.h>
#include <openbabel/obiter.h>
diff --git a/src/MolekelMolecule.cpp b/src/MolekelMolecule.cpp
index 104f023..ee08308 100644
--- a/src/MolekelMolecule.cpp
+++ b/src/MolekelMolecule.cpp
@@ -79,6 +79,8 @@
//OpenBabel
#include <openbabel/mol.h>
+#include <openbabel/atom.h>
+#include <openbabel/elements.h>
#include <openbabel/obconversion.h>
#include <openbabel/obmolecformat.h>
@@ -2547,7 +2549,7 @@ double MolekelMolecule::GetVdWRadius( int atomId ) const
double MolekelMolecule::GetCovalentRadius( int atomId ) const
{
assert( atomId >= 0 && atomId < GetNumberOfAtoms() );
- return etab.GetCovalentRad( obMol_->GetAtom( atomId + 1 )->GetAtomicNum() );
+ return OBElements::GetCovalentRad( obMol_->GetAtom( atomId + 1 )->GetAtomicNum() );
}
//--------------------------------------------------------------------------------
diff --git a/src/molekel_sources.cmake b/src/molekel_sources.cmake
old mode 100755
new mode 100644
index 9ea441b..172a409
--- a/src/molekel_sources.cmake
+++ b/src/molekel_sources.cmake
@@ -108,18 +108,18 @@ SET ( SRCS
resources/atomsdata.cpp
resources/license.cpp
utility/CommandLine.cpp
- utility/OBGaussianCubeFormat.cpp
+ # utility/OBGaussianCubeFormat.cpp
utility/FoldableWidget.cpp
utility/MolekelChemPDBImporter.cpp
utility/BabelToMOIV.cpp
utility/vtkMSMSReader.cpp
utility/System.cpp
- utility/OBMSMSFormat.cpp
+ # utility/OBMSMSFormat.cpp
utility/ElementTable.cpp
utility/MolekelToOpenBabel.cpp
- utility/OBMoldenFormat.cpp
+ # utility/OBMoldenFormat.cpp
utility/OBZmatrixFormat.cpp
- utility/OBT41Format.cpp
+ # utility/OBT41Format.cpp
utility/events/ObjectName.cpp
utility/events/EventPlayer.cpp
utility/events/EventRecorderWidget.cpp
diff --git a/src/utility/BabelToMOIV.cpp b/src/utility/BabelToMOIV.cpp
index e56ed6b..01ad852 100644
--- a/src/utility/BabelToMOIV.cpp
+++ b/src/utility/BabelToMOIV.cpp
@@ -21,6 +21,8 @@
#include <ChemKit2/ChemData.h>
#include <ChemKit2/ChemAssociatedData.h>
+#include <openbabel/atom.h>
+#include <openbabel/bond.h>
#include <openbabel/mol.h>
#include "ElementTable.h"
@@ -97,8 +99,8 @@ void OpenBabelToMOIV( OBMol* mol, ChemData* chemdata, ChemAssociatedData* chemas
bondTo [ i ] = bond->GetEndAtomIdx() - 1;
bondIndex[ i ] = i;
int t = 1;
- if( bond->IsDouble() ) t = 2;
- else if( bond->IsTriple() ) t = 3;
+ if( bond->GetBondOrder() == 2 ) t = 2;
+ else if( bond->GetBondOrder() == 3 ) t = 3;
bondType [i] = t;
}
@@ -170,8 +172,8 @@ void OpenBabelToChemData( OBMol* mol, ChemData* chemdata )
bondTo [ i ] = bond->GetEndAtomIdx() - 1;
bondIndex[ i ] = i;
int t = 1;
- if( bond->IsDouble() ) t = 2;
- else if( bond->IsTriple() ) t = 3;
+ if( bond->GetBondOrder() == 2) t = 2;
+ else if( bond->GetBondOrder() == 3) t = 3;
bondType [i] = t;
}
diff --git a/src/utility/MolekelToOpenBabel.cpp b/src/utility/MolekelToOpenBabel.cpp
index 1a7ab1a..e2f770d 100644
--- a/src/utility/MolekelToOpenBabel.cpp
+++ b/src/utility/MolekelToOpenBabel.cpp
@@ -19,6 +19,7 @@
//
#include "../old/molekeltypes.h"
+#include <openbabel/atom.h>
#include <openbabel/mol.h>
using namespace std;
diff --git a/src/utility/OBZmatrixFormat.cpp b/src/utility/OBZmatrixFormat.cpp
index d370170..010efe3 100644
--- a/src/utility/OBZmatrixFormat.cpp
+++ b/src/utility/OBZmatrixFormat.cpp
@@ -28,6 +28,9 @@
#include <openbabel/obconversion.h>
#include <openbabel/obmolecformat.h>
+#include <openbabel/atom.h>
+#include <openbabel/elements.h>
+#include <openbabel/internalcoord.h>
#include <openbabel/mol.h>
using namespace std;
@@ -85,8 +88,7 @@ private:
/// Maps atom name to atomic number.
int GetAtomicNumber( const string& name ) const
{
- int iso;
- return etab.GetAtomicNum( name.c_str(), iso );
+ return OBElements::GetAtomicNum( name.c_str() );
}
/// Adjust angle: currently not used; when exporting from
--
2.47.1