<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>include/OBNbrList</filename>
    </added>
    <added>
      <filename>src/forcefields/mmff94/function.cpp</filename>
    </added>
    <added>
      <filename>src/obnbrlist.cpp</filename>
    </added>
    <added>
      <filename>src/obnbrlist.h</filename>
    </added>
    <added>
      <filename>tests/mockfunction.h</filename>
    </added>
    <added>
      <filename>tests/nbrlisttest.cpp</filename>
    </added>
    <added>
      <filename>tests/varianttest.exe</filename>
    </added>
    <added>
      <filename>tools/minimize_gaff.exe</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -87,12 +87,9 @@ ELSE (WIN32)
   ENDIF(APPLE)
 ENDIF (WIN32)
 
-SET( OPENCL_FOUND &quot;NO&quot; )
 IF(OPENCL_cl_LIBRARY)
-
-    SET( OPENCL_LIBRARIES  ${OPENCL_cl_LIBRARY} ${OPENCL_LIBRARIES})
-    SET( OPENCL_FOUND &quot;YES&quot; )
-
+  SET(OPENCL_LIBRARIES  ${OPENCL_cl_LIBRARY} ${OPENCL_LIBRARIES})
+  SET(OPENCL_FOUND True)
 ENDIF(OPENCL_cl_LIBRARY)
 
 # This deprecated setting is for backward compatibility with CMake1.4</diff>
      <filename>cmake/modules/FindOpenCL.cmake</filename>
    </modified>
    <modified>
      <diff>@@ -87,7 +87,8 @@ namespace OpenBabel {
     {
       p_gaffType = (GAFFType *) GetOBFFType();
       if (p_gaffType==NULL){
-	p_gaffTypeRules = new GAFFTypeRules(&quot;../data/gaff.prm&quot;); //here should be the default value to gaff.prm 
+        std::string filename = std::string(DATADIR) + &quot;gaff.prm&quot;;
+	p_gaffTypeRules = new GAFFTypeRules(filename); //here should be the default value to gaff.prm 
 	if (p_gaffTypeRules==NULL)
 	  return false;
 	else {
@@ -102,7 +103,8 @@ namespace OpenBabel {
 	}
       }
       else if (! (p_gaffType-&gt;IsInitialized()) ) {
-	p_gaffTypeRules = new GAFFTypeRules(&quot;../data/gaff.prm&quot;); //here should be the default value to gaff.prm 
+        std::string filename = std::string(DATADIR) + &quot;gaff.prm&quot;;
+	p_gaffTypeRules = new GAFFTypeRules(filename); //here should be the default value to gaff.prm 
 	if (p_gaffTypeRules==NULL)
 	  return false;
 	else {
@@ -112,7 +114,8 @@ namespace OpenBabel {
       }	
       p_database = (GAFFParameterDB *) GetParameterDB();
       if (p_database==NULL){
-	p_database = new GAFFParameterDB(&quot;../data/gaff.dat&quot;);;
+        std::string filename = std::string(DATADIR) + &quot;gaff.dat&quot;;
+	p_database = new GAFFParameterDB(filename);;
 	if (p_database==NULL)
 	  return false;
 	else {</diff>
      <filename>src/forcefields/gaff/gafffunction.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -19,11 +19,10 @@ GNU General Public License for more details.
 #include &lt;OBFFParameterDB&gt;
 
 namespace OpenBabel {
-
-  class OBMol;
-  namespace OBFFs {
-    class GAFFParameterDB : public OBFFParameterDB
-    {
+namespace OBFFs {
+    
+  class GAFFParameterDB : public OBFFParameterDB
+  {
     public:
       GAFFParameterDB(const std::string &amp;filename);      
       bool IsInitialized() const { return _initialized; }
@@ -32,6 +31,7 @@ namespace OpenBabel {
       bool ParseParamFile();
       bool _initialized;      
       std::string _filename;
-    };
-  }
-}
+  };
+  
+} // namespace OBFFs
+} // namespace OpenBabel</diff>
      <filename>src/forcefields/gaff/gaffparameter.h</filename>
    </modified>
    <modified>
      <diff>@@ -575,27 +575,28 @@ namespace OpenBabel {
       return valid;
     }
 
-    bool GAFFType::IsConnected(const unsigned int &amp;idxA, const unsigned int &amp;idxB) const
+    bool GAFFType::IsConnected(const size_t &amp;idxA, const size_t &amp;idxB) const
     {
       return (m_Connected.find((idxA-1)+m_numAtoms*(idxB-1))!=m_Connected.end());
     }
 
-    bool GAFFType::IsOneThree(const unsigned int &amp;idxA, const unsigned int &amp;idxB) const
+    bool GAFFType::IsOneThree(const size_t &amp;idxA, const size_t &amp;idxB) const
     {
       return (m_OneThree.find((idxA-1)+m_numAtoms*(idxB-1))!=m_OneThree.end());
     }
 
-    bool GAFFType::IsOneFour(const unsigned int &amp;idxA, const unsigned int &amp;idxB) const
+    bool GAFFType::IsOneFour(const size_t &amp;idxA, const size_t &amp;idxB) const
     {
       return (m_OneFour.find((idxA-1)+m_numAtoms*(idxB-1))!=m_OneFour.end());
     }
 
 
-    const string &amp; GAFFType::GetAtomType(const unsigned int &amp; idx) const
+    const string &amp; GAFFType::GetAtomType(const size_t &amp; idx) const
     {
       return m_atoms[idx-1];
     }
 
+    /*
     const vector&lt;OBFFType::AtomIdentifier&gt; &amp; GAFFType::GetAtoms() const
     {
       return m_atoms;
@@ -620,6 +621,7 @@ namespace OpenBabel {
     {
       return m_oops;
     }
+    */
 
     vector&lt;string&gt; GAFFType::MakeAlternativeAtomNames(string aName)
     {</diff>
      <filename>src/forcefields/gaff/gafftype.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -42,15 +42,15 @@ namespace OpenBabel {
       bool ValidateTypes(GAFFParameterDB * pdatabase); //Check if types are in database. If not check for default patterns. If found change name. If still not found remove interaction from list.
       unsigned int Idx(const size_t &amp; i) const {return m_isIdxTrivial ? (unsigned int) i + i : m_IToIdx.at(i);}
       size_t I(const unsigned int &amp; idx) const {return m_isIdxTrivial ? (size_t) idx - 1 : m_IdxToI.find(idx)-&gt;second;}
-      const std::string &amp; GetAtomType(const unsigned int &amp; idx) const;
-      const std::vector&lt;AtomIdentifier&gt; &amp; GetAtoms() const;
-      const std::vector&lt;BondIdentifier&gt; &amp; GetBonds() const;
-      const std::vector&lt;AngleIdentifier&gt; &amp; GetAngles() const;
-      const std::vector&lt;TorsionIdentifier&gt; &amp; GetTorsions() const;
-      const std::vector&lt;OOPIdentifier&gt; &amp; GetOOPs() const;
-      bool IsConnected(const unsigned int &amp; idxA, const unsigned int &amp; idxB) const;
-      bool IsOneThree(const unsigned int &amp; idxA, const unsigned int &amp; idxB) const;
-      bool IsOneFour(const unsigned int &amp; idxA, const unsigned int &amp; idxB) const;
+      const std::string &amp; GetAtomType(const size_t &amp; idx) const;
+      //const std::vector&lt;AtomIdentifier&gt; &amp; GetAtoms() const;
+      //const std::vector&lt;BondIdentifier&gt; &amp; GetBonds() const;
+      //const std::vector&lt;AngleIdentifier&gt; &amp; GetAngles() const;
+      //const std::vector&lt;TorsionIdentifier&gt; &amp; GetTorsions() const;
+      //const std::vector&lt;OOPIdentifier&gt; &amp; GetOOPs() const;
+      bool IsConnected(const size_t &amp; idxA, const size_t &amp; idxB) const;
+      bool IsOneThree(const size_t &amp; idxA, const size_t &amp; idxB) const;
+      bool IsOneFour(const size_t &amp; idxA, const size_t &amp; idxB) const;
     protected:
       static std::vector&lt;std::string&gt; MakeAlternativeAtomNames(std::string aName);
       static std::string MakeBondName(std::string aName, std::string bName);
@@ -65,11 +65,13 @@ namespace OpenBabel {
       GAFFTypeRules * p_typerules;
       unsigned int m_numAtoms;
       bool m_isIdxTrivial;
+      /* now defined in OBFFType
       std::vector&lt;AtomIdentifier&gt; m_atoms;
       std::vector&lt;BondIdentifier&gt; m_bonds;
       std::vector&lt;AngleIdentifier&gt; m_angles;
       std::vector&lt;TorsionIdentifier&gt; m_torsions;
       std::vector&lt;OOPIdentifier&gt; m_oops;
+      */
       std::vector&lt;double&gt; m_masses;
       std::vector&lt;double&gt; m_charges;
       std::set&lt;unsigned long int&gt; m_Connected;</diff>
      <filename>src/forcefields/gaff/gafftype.h</filename>
    </modified>
    <modified>
      <diff>@@ -35,13 +35,18 @@ namespace OpenBabel {
     const std::string AngleHarmonic::m_name = &quot;Angle Harmonic&quot;;
 
     AngleHarmonic::AngleHarmonic(OBFunction *function, std::string tableName)
-      : OBFunctionTerm(function), m_tableName(tableName), m_value(999999.99) {}
+      : OBFunctionTerm(function), m_tableName(tableName), m_i(0), m_calcs(0),
+      m_value(999999.99) 
+    {
+    }
 
 
     AngleHarmonic::~AngleHarmonic()
     {
-      delete [] m_i;
-      delete [] m_calcs;
+      if (m_i)
+        delete [] m_i;
+      if (m_calcs)
+        delete [] m_calcs;
     }
 
     // Conventions taken from Lammps potentials
@@ -109,8 +114,10 @@ namespace OpenBabel {
       if ( (pTable==NULL) || (pOBFFType==NULL) )
 	return false;
       m_numAngles=angles.size();
-      delete [] m_i;
-      delete [] m_calcs;
+      if (m_i)
+        delete [] m_i;
+      if (m_calcs)
+        delete [] m_calcs;
       m_i = new Index [m_numAngles];
       m_calcs = new Parameter [m_numAngles];
       for(unsigned int i=0;i != m_numAngles;++i){</diff>
      <filename>src/forceterms/angle.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -26,17 +26,56 @@ namespace OpenBabel {
     class OBFFTable : public OBParameterDBTable
     {
     public:
+      /**
+       * Constructor specifying the @p tableName and @p header.
+       */
       OBFFTable(const std::string &amp;tableName, const std::vector&lt;std::string&gt; &amp;header);
+      /**
+       * Constructor specifying the @p tableName.
+       */
       OBFFTable(const std::string &amp;tableName);
+      /**
+       * @return The number of rows in this table.
+       */
       unsigned int NumRows() const;
       unsigned int NumColumns() const;
+      /**
+       * @return std::vector containing the column headers as std:sstring
+       */
       std::vector&lt;std::string&gt; GetHeader() const;
+      /**
+       * @return std::vector containing the column types as OBVariant::Type.
+       */
       std::vector&lt;OBVariant::Type&gt; GetTypes() const;
+      /**
+       * @return True if all columns types in @p values match this tables column types.
+       * @sa GetTypes()
+       */
       bool VerifyTypes(const std::vector&lt;OBVariant&gt; &amp;values);
+      /**
+       * Get the row with index @p row.
+       */
       const std::vector&lt;OBVariant&gt;&amp; GetRow(unsigned int row) const;
+      /**
+       * Add a row to this table containing @p values.
+       */
       bool AddRow(const std::vector&lt;OBVariant&gt; &amp;values);
+      /**
+       * Find a row that matches the specified @p query. If the query was matched in
+       * reverse order (e.g. 1-2-3 vs. 3-2-1), the swapped flag will be set when non-zero.
+       * @return A constant reference to the row.
+       */
       const std::vector&lt;OBVariant&gt;&amp; FindRow(const std::vector&lt;Query&gt; &amp;query, bool *swapped = 0) const;
+      /**
+       * Find a row that matches the specified @p query. If the query was matched in
+       * reverse order (e.g. 1-2-3 vs. 3-2-1), the swapped flag will be set when non-zero.
+       * @return A copy of the row.
+       */
       std::vector&lt; std::vector&lt;OBVariant&gt; &gt; FindRows(const std::vector&lt;Query&gt; &amp;query, bool *swapped = 0) const;
+      /**
+       * Get a constant reference to all rows in this table. This function can 
+       * be used in graphical user interfaces to quickly access all data for display.
+       */
       const std::vector&lt;std::vector&lt;OBVariant&gt; &gt;&amp; GetAllRows() const;
     private:
       std::string _name; 
@@ -51,14 +90,38 @@ namespace OpenBabel {
     class OBFFParameterDB : public OBParameterDB
     {
     public:
+      /**
+       * Constructor specifying the @p databaseName.
+       */
       OBFFParameterDB(const std::string &amp;databaseName = &quot;&quot;);
+      /**
+       * Destructor.
+       */
       ~OBFFParameterDB();
+
       OBFFParameterDB(const OBFFParameterDB &amp;rhs) {}; //no copying of databases allowed
+      /**
+       * @return The number of tables in this database.
+       */
       unsigned int NumTables() const;
+      /**
+       * @return std::vector containing the table names as std::string.
+       */
       std::vector&lt;std::string&gt; GetTables() const;
-      OBFFTable *  GetTable(const std::string &amp;tableName) const;
-      OBFFTable *  AddTable(const std::string &amp;tableName, const std::vector&lt;std::string&gt; &amp;header);
-      OBFFTable *  AddTable(const std::string &amp;tableName);
+      /**
+       * Get the table with the specified @p tableName.
+       */
+      OBFFTable* GetTable(const std::string &amp;tableName) const;
+      /**
+       * Add a table named @p tableName and @p header.
+       * @return A pointer to the newly added table.
+       */
+      OBFFTable* AddTable(const std::string &amp;tableName, const std::vector&lt;std::string&gt; &amp;header);
+      /**
+       * Add a table named @p tableName.
+       * @return A pointer to the newly added table.
+       */
+      OBFFTable* AddTable(const std::string &amp;tableName);
     private:
       std::string _name;
       std::vector&lt;OBFFTable *&gt; _tables;</diff>
      <filename>src/obffparameterdb.h</filename>
    </modified>
    <modified>
      <diff>@@ -31,42 +31,119 @@ namespace OpenBabel {
     public:
       typedef std::string AtomIdentifier;
 
+      /**
+       * Bond identifier
+       */
       struct BondIdentifier
       {
 	std::string name;
 	size_t iA, iB;
       };
 
+      /**
+       * Angle identifier.
+       */
       struct AngleIdentifier
       {
-
 	std::string name;
 	size_t iA, iB, iC;
       };
 
+      /**
+       * Torsion identifier.
+       */
       struct TorsionIdentifier
       {
 	std::string name;
 	size_t iA, iB, iC, iD;
       };
 
+      /**
+       * Out-of-plane identifier.
+       */
       struct OOPIdentifier
       {
 	std::string name;
 	size_t iA, iB, iC, iD;
       };
-      virtual bool SetTypes(const OBMol &amp; mol) =0;
+      
+      /**
+       * Find atom types and initialize atom, bond, torsion and out-of-plane
+       * identifiers. This function will also initialize the internal cache
+       * for IsConnected, IsOneThree, IsOneFour.
+       */
+      virtual bool SetTypes(const OBMol &amp; mol) = 0;
+
       virtual unsigned int Idx(const size_t &amp; i) const =0;
       virtual size_t I(const unsigned int &amp; idx) const =0;
       virtual const std::string &amp; GetAtomType(const size_t &amp; i) const =0;
-      virtual const std::vector&lt;AtomIdentifier&gt; &amp; GetAtoms() const =0;
-      virtual const std::vector&lt;BondIdentifier&gt; &amp; GetBonds() const =0;
-      virtual const std::vector&lt;AngleIdentifier&gt; &amp; GetAngles() const =0;
-      virtual const std::vector&lt;TorsionIdentifier&gt; &amp; GetTorsions() const =0;
-      virtual const std::vector&lt;OOPIdentifier&gt; &amp; GetOOPs() const =0;
+      /**
+       * Get the atoms. These are the force field atom types as std::string.
+       * @sa AtomIdentifier
+       */
+      virtual const std::vector&lt;AtomIdentifier&gt; &amp; GetAtoms() const
+      {
+        return m_atoms;
+      }
+      /**
+       * Get the bonds. These are BondIdentifier structs containing the name 
+       * (e.g. &quot;2-5&quot;, &quot;C-O&quot;, &quot;C-X&quot;) for the bond and the atom I's.
+       *
+       * @sa I() Idx() BondIdentifier
+       */
+      virtual const std::vector&lt;BondIdentifier&gt; &amp; GetBonds() const
+      {
+        return m_bonds;
+      }
+      /**
+       * Get the angles. These are AngleIdentifier structs containing the name 
+       * (e.g. &quot;2-5-2&quot;, &quot;C-O-C&quot;, &quot;X-C-X&quot;) for the angle and the atom I's.
+       *
+       * @sa I() Idx() AngleIdentifier
+       */
+      virtual const std::vector&lt;AngleIdentifier&gt; &amp; GetAngles() const
+      {
+        return m_angles;
+      }
+      /**
+       * Get the torsions. These are TorsionIdentifier structs containing the 
+       * name (e.g. &quot;2-5-6-2&quot;, &quot;C-O-C-C&quot;, &quot;X-C-C-X&quot;) for the angle and the atom I's.
+       *
+       * @sa I() Idx() TorsionIdentifier
+       */
+      virtual const std::vector&lt;TorsionIdentifier&gt; &amp; GetTorsions() const
+      {
+        return m_torsions;
+      }
+      /**
+       * Get the out-of-plane angles. These are OOPIdentifier structs containing the 
+       * name (e.g. &quot;2-5-6-2&quot;, &quot;C-O-C-C&quot;, &quot;X-C-C-X&quot;) for the oop angle and the atom I's.
+       *
+       * @sa I() Idx() TorsionIdentifier
+       */
+
+      virtual const std::vector&lt;OOPIdentifier&gt; &amp; GetOOPs() const
+      {
+        return m_oops;
+      }
+      /**
+       * @return True if atoms with index iA &amp; iB are connected.
+       */
       virtual bool IsConnected(const size_t &amp; iA, const size_t &amp; iB) const =0;
+      /**
+       * @return True if atoms with index iA &amp; iB are in a 1-3 relation.
+       */
       virtual bool IsOneThree(const size_t &amp; iA, const size_t &amp; iB) const =0;
+      /**
+       * @return True if atoms with index iA &amp; iB are in a 1-4 relation.
+       */
       virtual bool IsOneFour(const size_t &amp; iA, const size_t &amp; iB) const =0;
+    protected:
+      std::vector&lt;AtomIdentifier&gt;    m_atoms;
+      std::vector&lt;BondIdentifier&gt;    m_bonds;
+      std::vector&lt;AngleIdentifier&gt;   m_angles;
+      std::vector&lt;TorsionIdentifier&gt; m_torsions;
+      std::vector&lt;OOPIdentifier&gt; m_oops;
     }; 
   }
 }// namespace OpenBabel</diff>
      <filename>src/obfftype.h</filename>
    </modified>
    <modified>
      <diff>@@ -83,7 +83,6 @@ GNU General Public License for more details.
 #include &lt;openbabel/rotamer.h&gt;
 #include &lt;openbabel/rotor.h&gt;
 
-#include &lt;OBCutOffGrid&gt;
 #include &lt;OBMinimize&gt;
 #include &lt;OBVectorMath&gt;
 </diff>
      <filename>src/obforcefield.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -21,6 +21,10 @@ GNU General Public License for more details.
 #include &lt;OBMinimize&gt;
 #include &lt;openbabel/obutil.h&gt;
 
+#ifdef __MINGW32__
+#include &lt;cstdio&gt; // FIXME replace snprinf with std::stringstream
+#endif
+
 using namespace std;
 using namespace OpenBabel::OBFFs;
 </diff>
      <filename>src/obminimize.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,6 @@
+# define TESTDATADIR for tests that need input files
+add_definitions(-DTESTDATADIR=&quot;${CMAKE_SOURCE_DIR}/tests/&quot;)
+
 set(QT_USE_QTOPENGL true)
 
 include(${QT_USE_FILE})
@@ -25,6 +28,7 @@ link_directories(
 set(tests
 #  forcefield
   variant
+  nbrlist
   gaffparameterdb
   gaffgradient
   gafffunction</diff>
      <filename>tests/CMakeLists.txt</filename>
    </modified>
    <modified>
      <diff>@@ -184,11 +184,16 @@ int main()
 
   OBMol mol;
   OBConversion conv;
-  conv.SetInFormat(&quot;mol&quot;);
+  conv.SetInFormat(&quot;pdb&quot;);
 
   std::ifstream ifs;
   //ifs.open(&quot;hexane.xyz&quot;);
-  ifs.open(&quot;acetone.pdb&quot;);
+  string filename = string(TESTDATADIR) + string(&quot;aceton.pdb&quot;);
+  ifs.open(filename.c_str());
+  if (!ifs) {
+    cout &lt;&lt; &quot;could not open aceton.pdb&quot; &lt;&lt; endl;
+    return -1;
+  }
   conv.Read(&amp;mol, &amp;ifs);
   ifs.close();
 </diff>
      <filename>tests/gaffgradienttest.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -495,7 +495,8 @@ void testTorsionParameters(OBParameterDB *database)
 
 int main()
 {
-  GAFFParameterDB *database = new GAFFParameterDB(&quot;d:/eajfpeters/My Documents/code/OBForceField/data/gaff.dat&quot;);
+  std::cout &lt;&lt; string(TESTDATADIR) + string(&quot;../data/gaff.dat&quot;) &lt;&lt; std::endl;
+  GAFFParameterDB *database = new GAFFParameterDB(string(TESTDATADIR) + string(&quot;../data/gaff.dat&quot;));
   testTables(database);
   testAtomProperties(database);
   testBondParameters(database);</diff>
      <filename>tests/gaffparameterdbtest.cpp</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>include/OBCutOffGrid</filename>
    </removed>
    <removed>
      <filename>src/obcutoffgrid.cpp</filename>
    </removed>
    <removed>
      <filename>src/obcutoffgrid.h</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>c6915bf895cee982fc8ecc3ebf2d2c758aca1baa</id>
    </parent>
    <parent>
      <id>9f9bf7480c8e90f58dd407a70e4394cd6cdd24b5</id>
    </parent>
  </parents>
  <author>
    <name>eajfpeters</name>
    <email>e.a.j.f.peters@gmail.com</email>
  </author>
  <url>http://github.com/timvdm/OBForceField/commit/cc36dec3b14a1cb6bc84958fc6448a861838f909</url>
  <id>cc36dec3b14a1cb6bc84958fc6448a861838f909</id>
  <committed-date>2009-10-19T04:52:22-07:00</committed-date>
  <authored-date>2009-10-19T04:52:22-07:00</authored-date>
  <message>Merge branch 'master' of git://github.com/timvdm/OBForceField.git

Conflicts:
	CMakeLists.txt
	src/forcefields/gaff/gafffunction.cpp
	src/forcefields/gaff/gaffparameter.h
	src/forcefields/gaff/gafftype.cpp
	src/forcefields/gaff/gafftype.h
	src/forcefields/mmff94/function.cpp
	src/forceterms/angle.cpp
	src/obffparameterdb.h
	src/obfftype.h
	tests/CMakeLists.txt
	tests/gaffgradienttest.cpp
	tests/gaffparameterdbtest.cpp</message>
  <tree>575acdc58f61748e564f0bc2b5062ca0468123f8</tree>
  <committer>
    <name>eajfpeters</name>
    <email>e.a.j.f.peters@gmail.com</email>
  </committer>
</commit>
