votca 2024.2-dev
Loading...
Searching...
No Matches
molecule.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2021 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Standard includes
19#include <iostream>
20
21// Local VOTCA includes
22#include "votca/csg/molecule.h"
23
24namespace votca {
25namespace csg {
26
27using namespace std;
28
29void Molecule::AddBead(Bead *bead, const string &name) {
30 beads_.push_back(bead);
31 bead_names_.push_back(name);
32 beadmap_[name] = beads_.size() - 1;
33
34 bead->setMoleculeId(id_);
35}
36
37Index Molecule::getBeadByName(const string &name) const {
38 map<string, Index>::const_iterator iter = beadmap_.find(name);
39 if (iter == beadmap_.end()) {
40 std::cout << "cannot find: <" << name << "> in " << name_ << "\n";
41 return -1;
42 }
43 return beadmap_.at(name);
44}
45
46} // namespace csg
47} // namespace votca
void setMoleculeId(const Index &molecule_id) noexcept
assign the bead to a molecule with the provided id
Definition basebead.h:68
information about a bead
Definition bead.h:50
void AddBead(Bead *bead, const std::string &name)
Add a bead to the molecule.
Definition molecule.cc:29
std::map< std::string, Index > beadmap_
Definition molecule.h:86
Index getBeadByName(const std::string &name) const
find a bead by it's name
Definition molecule.cc:37
std::vector< Bead * > beads_
Definition molecule.h:95
std::string name_
Definition molecule.h:93
std::vector< std::string > bead_names_
Definition molecule.h:96
STL namespace.
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26