Coverage Report

Created: 2025-08-24 07:05

/src/openbabel/include/openbabel/internalcoord.h
Line
Count
Source (jump to first uncovered line)
1
/**********************************************************************
2
internalcoord.h - Handle OBInternalCoord class, Cartesian <=> Z-matrix
3
4
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
5
Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
6
Some portions Copyright (C) 2003 by Michael Banck
7
8
This file is part of the Open Babel project.
9
For more information, see <http://openbabel.org/>
10
11
This program is free software; you can redistribute it and/or modify
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation version 2 of the License.
14
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
GNU General Public License for more details.
19
***********************************************************************/
20
21
#ifndef OB_INTERNALCOORD_H
22
#define OB_INTERNALCOORD_H
23
24
#include <openbabel/babelconfig.h>
25
#include <stddef.h>
26
27
#ifndef OB_EXTERN
28
#  define OB_EXTERN extern
29
#endif
30
31
namespace OpenBabel
32
{
33
34
  class OBAtom;
35
36
  /** \class OBInternalCoord internalcoord.h <openbabel/internalcoord.h>
37
      \brief Used to transform from z-matrix to cartesian coordinates.
38
39
      Used with OpenBabel::InternalToCartesian and
40
      OpenBabel::CartesianToInternal methods. Does not perform any actions
41
      itself. You must create or free OBAtom pointers yourself.
42
43
      The z-matrix representation uses coordinates relative to up to three
44
      atoms, which need not be bonded in any fashion. A rough sketch of the
45
      a, b, and c atoms would be:
46
47
      \code
48
          '*'
49
         /
50
        /
51
       a----b
52
           /
53
          /
54
         c
55
      \endcode
56
57
      where the OBInternalCoord record reflects the '*' atom.
58
59
      \warning Does not detect if NULL pointers are used. You should be careful.
60
   **/
61
  class OBAPI OBInternalCoord
62
  {
63
  public:
64
    //class members
65
    OBAtom *_a;   //!< First connection for this atom (i.e., distance)
66
    OBAtom *_b;   //!< Second reference atom (i.e., angle)
67
    OBAtom *_c;   //!< Third reference atom (i.e., dihedral / torsion angle)
68
    double  _dst; //!< Distance between this atom and _a
69
    double  _ang; //!< Angle between this, _a, and _b (i.e., _a is the vertex)
70
    double  _tor; //!< Torsional/dihedral angle between this, _a, _b, and _c
71
72
    //! Constructor
73
  OBInternalCoord(OBAtom *a= nullptr, OBAtom *b= nullptr, OBAtom *c= nullptr,
74
                  double dst = 0.0, double ang = 0.0, double tor = 0.0) :
75
0
    _a(a), _b(b), _c(c), _dst(dst), _ang(ang), _tor(tor)
76
0
      {}
77
  };
78
79
} // end namespace
80
81
#endif // OB_INTERNALCOORD_H
82
83
//! \file internalcoord.h
84
//! \brief Declaration of OBInternalCoord class, conversion between Cartesian
85
//!        and Z-matrix form