votca 2024.2-dev
Loading...
Searching...
No Matches
csg_dump.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 <cstdlib>
20
21// Local VOTCA includes
23
24using namespace std;
25using namespace votca::csg;
26
27class CsgDumpApp : public CsgApplication {
28 string ProgramName() override { return "csg_dump"; }
29 void HelpText(ostream &out) override {
30 out << "Print atoms that are read from topology file to help"
31 " debugging atom naming.";
32 }
33 void Initialize() override {
35 AddProgramOptions("Specific options")(
36 "excl", " display exclusion list instead of molecule list");
37 }
38
39 bool EvaluateTopology(Topology *top, Topology *top_ref) override;
40
41 bool DoMapping() override { return true; }
42 bool DoMappingDefault(void) override { return false; }
43};
44
45int main(int argc, char **argv) {
46 CsgDumpApp app;
47
48 return app.Exec(argc, argv);
49}
50
52 if (!OptionsMap().count("excl")) {
53 cout << "Boundary Condition: ";
55 cout << "auto";
56 } else if (top->getBoxType() == BoundaryCondition::typeTriclinic) {
57 cout << "triclinic";
59 cout << "orthorhombic";
60 } else if (top->getBoxType() == BoundaryCondition::typeOpen) {
61 cout << "open";
62 }
63 cout << endl;
65 cout << " Box matix:";
66 Eigen::Matrix3d box = top->getBox();
67 for (votca::Index i = 0; i < 3; i++) {
68 for (votca::Index j = 0; j < 3; j++) {
69 cout << " " << box(i, j);
70 }
71 cout << endl << " ";
72 }
73 }
74
75 cout << "\nList of residues:\n";
76 for (votca::Index i = 0; i < top->ResidueCount(); i++) {
77 cout << i << " name: " << top->getResidue(i).getName()
78 << " id: " << top->getResidue(i).getId() << endl;
79 }
80
81 cout << "\nList of molecules:\n";
82 for (const auto &mol : top->Molecules()) {
83 cout << "molecule: " << mol.getId() + 1 << " " << mol.getName()
84 << " beads: " << mol.BeadCount() << endl;
85 for (votca::Index i = 0; i < mol.BeadCount(); ++i) {
86 votca::Index resnr = mol.getBead(i)->getResnr();
87 cout << mol.getBeadId(i) << " Name " << mol.getBeadName(i) << " Type "
88 << mol.getBead(i)->getType() << " Mass "
89 << mol.getBead(i)->getMass() << " Resnr " << resnr << " Resname "
90 << top->getResidue(resnr).getName() << " Charge "
91 << mol.getBead(i)->getQ() << endl;
92 }
93 }
94 } else {
95 cout << "\nList of exclusions:\n" << top->getExclusions();
96 }
97
98 return true;
99}
bool EvaluateTopology(Topology *top, Topology *top_ref) override
called after topology was loaded
Definition csg_dump.cc:51
bool DoMapping() override
overload and return true to enable mapping command line options
Definition csg_dump.cc:41
void Initialize() override
Initialize application data.
Definition csg_dump.cc:33
void HelpText(ostream &out) override
help text of application without version information
Definition csg_dump.cc:29
bool DoMappingDefault(void) override
if DoMapping is true, will by default require mapping or not
Definition csg_dump.cc:42
string ProgramName() override
program name
Definition csg_dump.cc:28
void Initialize() override
Initialize application data.
Index getId() const
get the name of the residue
Definition residue.h:41
const std::string & getName() const
get the name of the residue
Definition residue.h:52
topology of the whole system
Definition topology.h:81
BoundaryCondition::eBoxtype getBoxType() const
Definition topology.h:394
Index ResidueCount() const
Definition topology.h:156
const Eigen::Matrix3d & getBox() const
Definition topology.h:298
ExclusionList & getExclusions()
Definition topology.h:391
Residue & getResidue(const Index i)
Definition topology.h:229
MoleculeContainer & Molecules()
Definition topology.h:182
int Exec(int argc, char **argv)
executes the program
boost::program_options::variables_map & OptionsMap()
get available program options & descriptions
boost::program_options::options_description_easy_init AddProgramOptions(const std::string &group="")
add option for command line
int main(int argc, char **argv)
Definition csg_dump.cc:45
STL namespace.
Eigen::Index Index
Definition types.h:26