/src/rdkit/Code/GraphMol/Conformer.cpp
Line | Count | Source |
1 | | // |
2 | | // Copyright (C) 2001-2024 Greg Landrum and other RDKit contributors |
3 | | // |
4 | | // @@ All Rights Reserved @@ |
5 | | // This file is part of the RDKit. |
6 | | // The contents are covered by the terms of the BSD license |
7 | | // which is included in the file license.txt, found at the root |
8 | | // of the RDKit source tree. |
9 | | // |
10 | | #include "Conformer.h" |
11 | | #include "ROMol.h" |
12 | | |
13 | | namespace RDKit { |
14 | | |
15 | 20.9k | void Conformer::setOwningMol(ROMol *mol) { |
16 | 20.9k | PRECONDITION(mol, ""); |
17 | 20.9k | dp_mol = mol; |
18 | 20.9k | } |
19 | | |
20 | 0 | void Conformer::setOwningMol(ROMol &mol) { setOwningMol(&mol); } |
21 | | |
22 | 12.6k | const RDGeom::POINT3D_VECT &Conformer::getPositions() const { |
23 | 12.6k | if (dp_mol) { |
24 | 3.75k | PRECONDITION(dp_mol->getNumAtoms() == d_positions.size(), ""); |
25 | 3.75k | } |
26 | 12.6k | return d_positions; |
27 | 12.6k | } |
28 | | |
29 | 1.06k | RDGeom::POINT3D_VECT &Conformer::getPositions() { return d_positions; } |
30 | | |
31 | 202k | const RDGeom::Point3D &Conformer::getAtomPos(unsigned int atomId) const { |
32 | 202k | if (dp_mol) { |
33 | 202k | PRECONDITION(dp_mol->getNumAtoms() == d_positions.size(), ""); |
34 | 202k | } |
35 | 202k | URANGE_CHECK(atomId, d_positions.size()); |
36 | 202k | return d_positions.at(atomId); |
37 | 202k | } |
38 | | |
39 | 59.4k | RDGeom::Point3D &Conformer::getAtomPos(unsigned int atomId) { |
40 | 59.4k | if (dp_mol) { |
41 | 0 | PRECONDITION(dp_mol->getNumAtoms() == d_positions.size(), ""); |
42 | 0 | } |
43 | 59.4k | URANGE_CHECK(atomId, d_positions.size()); |
44 | 59.4k | return d_positions.at(atomId); |
45 | 59.4k | } |
46 | | } // namespace RDKit |