votca 2024.2-dev
Loading...
Searching...
No Matches
cgengine.h
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#ifndef VOTCA_CSG_CGENGINE_H
19#define VOTCA_CSG_CGENGINE_H
20
21// Standard includes
22#include <list>
23#include <map>
24#include <memory>
25
26// Third party includes
27#include <boost/program_options.hpp>
28
29// VOTCA includes
32
33// Local VOTCA includes
34#include "cgengine.h"
35#include "cgmoleculedef.h"
36#include "cgobserver.h"
37#include "molecule.h"
38#include "nematicorder.h"
39#include "topology.h"
40#include "topologymap.h"
41#include "topologyreader.h"
42#include "trajectoryreader.h"
43#include "trajectorywriter.h"
44
45namespace votca {
46namespace csg {
47
57class CGEngine {
58 public:
60
64 std::unique_ptr<TopologyMap> CreateCGTopology(const Topology &in,
65 Topology &out);
66
70 void LoadMoleculeType(const std::string &filename);
71
72 CGMoleculeDef *getMoleculeDef(const std::string &name);
73
78 void AddIgnore(const std::string &pattern) { ignores_.push_back(pattern); }
79
85 bool IsIgnored(const std::string &ident);
86
87 private:
88 std::map<std::string, std::unique_ptr<CGMoleculeDef>> molecule_defs_;
89
90 std::list<std::string> ignores_;
91};
92
93inline CGMoleculeDef *CGEngine::getMoleculeDef(const std::string &name) {
94 std::map<std::string, std::unique_ptr<CGMoleculeDef>>::iterator iter;
95
96 // if there is only 1 molecule definition, don't care about the name
97 if (molecule_defs_.size() == 1 && name == "unnamed") {
98 return (*(molecule_defs_.begin())).second.get();
99 }
100
101 iter = molecule_defs_.find(name);
102 if (iter == molecule_defs_.end()) {
103 return nullptr;
104 }
105 return (*iter).second.get();
106}
107
108inline bool CGEngine::IsIgnored(const std::string &ident) {
109 for (auto &ignore_ : ignores_) {
110 if (tools::wildcmp(ignore_, ident)) {
111 return true;
112 }
113 }
114 return false;
115}
116
117} // namespace csg
118} // namespace votca
119
120#endif // VOTCA_CSG_CGENGINE_H
coarse graining engine
Definition cgengine.h:57
std::unique_ptr< TopologyMap > CreateCGTopology(const Topology &in, Topology &out)
Definition cgengine.cc:41
CGMoleculeDef * getMoleculeDef(const std::string &name)
Definition cgengine.h:93
void AddIgnore(const std::string &pattern)
ignores molecule in mapping process
Definition cgengine.h:78
std::list< std::string > ignores_
Definition cgengine.h:90
std::map< std::string, std::unique_ptr< CGMoleculeDef > > molecule_defs_
Definition cgengine.h:88
bool IsIgnored(const std::string &ident)
checks whether molecule is ignored
Definition cgengine.h:108
void LoadMoleculeType(const std::string &filename)
Definition cgengine.cc:70
definition of a coarse grained molecule
topology of the whole system
Definition topology.h:81
int wildcmp(const char *wild, const char *string)
Definition tokenizer.cc:28
base class for all analysis tools
Definition basebead.h:33