votca 2024.2-dev
Loading...
Searching...
No Matches
template_serial.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 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#include <cstdlib>
19#include <votca/csg/beadlist.h>
21#include <votca/csg/nblist.h>
24
25// using namespace votca::tools;
26using namespace std;
27using namespace votca::csg;
28
29class CsgTestApp : public CsgApplication {
30 string ProgramName() override { return "template_nblist"; }
31 void HelpText(ostream &out) override {
32 out << "rough template for rdf calculations";
33 }
34
35 void Initialize() override;
36
37 bool DoTrajectory() override { return true; }
38
39 void BeginEvaluate(Topology *top, Topology *top_ref) override;
40 void EvalConfiguration(Topology *top, Topology *top_ref) override;
41 void EndEvaluate() override;
42
43 protected:
45 double cut_off_;
46};
47
48int main(int argc, char **argv) {
49 CsgTestApp app;
50
51 return app.Exec(argc, argv);
52}
53
55 BeadList b;
56 b.Generate(*top, "*");
57 NBListGrid nb;
59 nb.Generate(b);
60 for (auto &pair : nb) {
61 rdf_.Process(pair->dist());
62 }
63}
64
67 AddProgramOptions("RDF options")(
68 "c", boost::program_options::value<double>()->default_value(1.0),
69 "the cutoff");
70}
71
73 cut_off_ = OptionsMap()["c"].as<double>();
74 rdf_.Initialize(0, cut_off_, 50);
75}
76
77void CsgTestApp::EndEvaluate() { rdf_.data().Save("rdf.dat"); }
void HelpText(ostream &out) override
help text of application without version information
void Initialize() override
Initialize application data.
void EvalConfiguration(Topology *top, Topology *top_ref) override
votca::tools::HistogramNew rdf_
void BeginEvaluate(Topology *top, Topology *top_ref) override
called before the first frame
void EndEvaluate() override
called after the last frame
bool DoTrajectory() override
overload and return true to enable trajectory command line options
string ProgramName() override
program name
Index Generate(Topology &top, const std::string &select)
Select all beads of type "select".
Definition beadlist.cc:30
void Initialize() override
Initialize application data.
void Generate(BeadList &list1, BeadList &list2, bool do_exclusions=true) override
Generate the neighbour list based on two bead lists (e.g. bead types)
Definition nblistgrid.cc:28
void setCutoff(double cutoff)
set the cutoff for the neighbour search
Definition nblist.h:53
topology of the whole system
Definition topology.h:81
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
class to generate histograms
Table & data()
get access to content of histogram
void Initialize(double min, double max, Index nbins)
Initialize the HistogramNew.
void Process(const double &v, double scale=1.0)
process a data point
void Save(std::string filename) const
Definition table.cc:59
STL namespace.
int main(int argc, char **argv)