VTK
vtkMolecule.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMolecule.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
72#ifndef vtkMolecule_h
73#define vtkMolecule_h
74
75#include "vtkCommonDataModelModule.h" // For export macro
76#include "vtkUndirectedGraph.h"
77#include "vtkSmartPointer.h" // For vtkSmartPointer
78
79#include "vtkAtom.h" // Simple proxy class dependent on vtkMolecule
80#include "vtkBond.h" // Simple proxy class dependent on vtkMolecule
81
82#include "vtkVector.h" // Small templated vector convenience class
83
85class vtkMatrix3x3;
86class vtkPlane;
87class vtkPoints;
89
90class VTKCOMMONDATAMODEL_EXPORT vtkMolecule : public vtkUndirectedGraph
91{
92public:
93 static vtkMolecule *New();
95 void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
96 void Initialize() VTK_OVERRIDE;
97
101 int GetDataObjectType() VTK_OVERRIDE {return VTK_MOLECULE;}
102
108 {
109 return this->AppendAtom(0, vtkVector3f(0, 0, 0));
110 }
111
116 vtkAtom AppendAtom(unsigned short atomicNumber, const vtkVector3f &pos);
117
122 vtkAtom AppendAtom(unsigned short atomicNumber, double x, double y, double z)
123 {
124 return this->AppendAtom(atomicNumber, vtkVector3f(x, y, z));
125 }
126
131
136
138
144 unsigned short order = 1);
145 vtkBond AppendBond(const vtkAtom &atom1, const vtkAtom &atom2,
146 unsigned short order = 1)
147 {
148 return this->AppendBond(atom1.Id, atom2.Id, order);
149 }
151
156
161
165 unsigned short GetAtomAtomicNumber(vtkIdType atomId);
166
171 unsigned short atomicNum);
172
174
177 void SetAtomPosition(vtkIdType atomId, const vtkVector3f &pos);
178 void SetAtomPosition(vtkIdType atomId, double x, double y, double z);
180
182
186 void GetAtomPosition(vtkIdType atomId, float pos[3]);
188
190
193 void SetBondOrder(vtkIdType bondId, unsigned short order);
194 unsigned short GetBondOrder(vtkIdType bondId);
196
206 double GetBondLength(vtkIdType bondId);
207
209
215
217
220 vtkGetObjectMacro(ElectronicData, vtkAbstractElectronicData);
223
229 bool CheckedShallowCopy(vtkGraph *g) VTK_OVERRIDE;
230
236 bool CheckedDeepCopy(vtkGraph *g) VTK_OVERRIDE;
237
241 void ShallowCopy(vtkDataObject *obj) VTK_OVERRIDE;
242
246 void DeepCopy(vtkDataObject *obj) VTK_OVERRIDE;
247
252
257
263
269
271
298 static bool GetPlaneFromBond(const vtkBond &bond, const vtkVector3f &normal,
299 vtkPlane *plane);
300 static bool GetPlaneFromBond(const vtkAtom &atom1, const vtkAtom &atom2,
301 const vtkVector3f &normal, vtkPlane *plane);
303
308
313
315
320 void SetLattice(const vtkVector3d &a,
321 const vtkVector3d &b,
322 const vtkVector3d &c);
324
332
334
339 vtkVector3d &origin);
341
343
346 vtkGetMacro(LatticeOrigin, vtkVector3d)
347 vtkSetMacro(LatticeOrigin, vtkVector3d)
349
350 protected:
352 ~vtkMolecule() VTK_OVERRIDE;
353
357 virtual void CopyStructureInternal(vtkMolecule *m, bool deep);
358
362 virtual void CopyAttributesInternal(vtkMolecule *m, bool deep);
363
365
371 bool BondListIsDirty;
372 void SetBondListDirty() {this->BondListIsDirty = true;}
376
377 friend class vtkAtom;
378 friend class vtkBond;
379
383
384private:
385 vtkMolecule(const vtkMolecule&) VTK_DELETE_FUNCTION;
386 void operator=(const vtkMolecule&) VTK_DELETE_FUNCTION;
387};
388
389#endif
Provides access to and storage of chemical electronic data.
convenience proxy for vtkMolecule
Definition: vtkAtom.h:35
vtkIdType Id
Definition: vtkAtom.h:75
convenience proxy for vtkMolecule
Definition: vtkBond.h:34
friend class vtkMolecule
Definition: vtkBond.h:81
general representation of visualization data
Definition: vtkDataObject.h:65
Base class for graph data types.
Definition: vtkGraph.h:288
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:40
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:37
class describing a molecule
Definition: vtkMolecule.h:91
vtkAbstractElectronicData * ElectronicData
Definition: vtkMolecule.h:380
void GetAtomPosition(vtkIdType atomId, float pos[3])
vtkAtom AppendAtom()
Add new atom with atomic number 0 (dummy atom) at origin.
Definition: vtkMolecule.h:107
vtkVector3f GetAtomPosition(vtkIdType atomId)
Get the position of the atom with the specified id.
void SetLattice(vtkMatrix3x3 *matrix)
The unit cell vectors.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkMolecule * New()
vtkBond AppendBond(const vtkAtom &atom1, const vtkAtom &atom2, unsigned short order=1)
Definition: vtkMolecule.h:145
vtkUnsignedShortArray * GetAtomicNumberArray()
void SetBondOrder(vtkIdType bondId, unsigned short order)
Get/Set the bond order of the bond with the specified id.
vtkAtom AppendAtom(unsigned short atomicNumber, double x, double y, double z)
Convenience methods to append a new atom with the specified atomic number and position.
Definition: vtkMolecule.h:122
vtkAtom GetAtom(vtkIdType atomId)
Return a vtkAtom that refers to the atom with the specified id.
virtual void DeepCopyStructure(vtkMolecule *m)
Deep copies the atoms and bonds from m into this.
void GetLattice(vtkVector3d &a, vtkVector3d &b, vtkVector3d &c, vtkVector3d &origin)
void Initialize() override
Initialize to an empty graph.
void ClearLattice()
Remove any unit cell lattice information from the molecule.
virtual void ShallowCopyAttributes(vtkMolecule *m)
Shallow copies attributes (i.e.
void SetAtomAtomicNumber(vtkIdType atomId, unsigned short atomicNum)
Set the atomic number of the atom with the specified id.
virtual void ShallowCopyStructure(vtkMolecule *m)
Shallow copies the atoms and bonds from m into this.
double GetBondLength(vtkIdType bondId)
Get the bond length of the bond with the specified id.
vtkSmartPointer< vtkMatrix3x3 > Lattice
Definition: vtkMolecule.h:381
virtual void DeepCopyAttributes(vtkMolecule *m)
Deep copies attributes (i.e.
static bool GetPlaneFromBond(const vtkBond &bond, const vtkVector3f &normal, vtkPlane *plane)
Obtain the plane that passes through the indicated bond with the given normal.
void ShallowCopy(vtkDataObject *obj) override
Shallow copies the data object into this molecule.
void GetLattice(vtkVector3d &a, vtkVector3d &b, vtkVector3d &c)
Get the unit cell lattice vectors, and optionally, the origin.
void SetAtomPosition(vtkIdType atomId, double x, double y, double z)
void UpdateBondList()
vtkPoints * GetAtomicPositionArray()
Access the raw arrays used in this vtkMolecule instance.
void DeepCopy(vtkDataObject *obj) override
Deep copies the data object into this molecule.
static bool GetPlaneFromBond(const vtkAtom &atom1, const vtkAtom &atom2, const vtkVector3f &normal, vtkPlane *plane)
void SetAtomPosition(vtkIdType atomId, const vtkVector3f &pos)
Set the position of the atom with the specified id.
virtual void SetElectronicData(vtkAbstractElectronicData *)
unsigned short GetAtomAtomicNumber(vtkIdType atomId)
Return the atomic number of the atom with the specified id.
vtkIdType GetNumberOfBonds()
Return the number of bonds in the molecule.
bool HasLattice()
Return true if a unit cell lattice is defined.
vtkBond AppendBond(vtkIdType atom1, vtkIdType atom2, unsigned short order=1)
Add a bond between the specified atoms, optionally setting the bond order (default: 1).
void SetLattice(const vtkVector3d &a, const vtkVector3d &b, const vtkVector3d &c)
vtkMatrix3x3 * GetLattice()
Get the unit cell lattice vectors.
unsigned short GetBondOrder(vtkIdType bondId)
vtkAtom AppendAtom(unsigned short atomicNumber, const vtkVector3f &pos)
Add new atom with the specified atomic number and position.
vtkBond GetBond(vtkIdType bondId)
Return a vtkAtom that refers to the bond with the specified id.
vtkIdType GetNumberOfAtoms()
Return the number of atoms in the molecule.
vtkVector3d LatticeOrigin
Definition: vtkMolecule.h:382
bool CheckedShallowCopy(vtkGraph *g) override
Performs the same operation as ShallowCopy(), but instead of reporting an error for an incompatible g...
bool CheckedDeepCopy(vtkGraph *g) override
Performs the same operation as DeepCopy(), but instead of reporting an error for an incompatible grap...
vtkIdTypeArray * GetBondList()
perform various plane computations
Definition: vtkPlane.h:38
represent and manipulate 3D points
Definition: vtkPoints.h:40
An undirected graph.
dynamic, self-adjusting array of unsigned short
@ order
Definition: vtkX3D.h:440
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287
#define VTK_MOLECULE
Definition: vtkType.h:120