votca 2024.2-dev
Loading...
Searching...
No Matches
xyzwriter.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
19#include <cstdio>
20#include <string>
21namespace votca {
22namespace csg {
23
24void XYZWriter::Open(std::string file, bool bAppend) {
25 if (bAppend) {
26 out_.open(file, std::ios_base::app);
27 } else {
28 out_.open(file);
29 }
30}
31
32void XYZWriter::Close() { out_.close(); }
33
35 std::string header = (boost::format("frame: %1$d time: %2$f\n") %
36 (conf->getStep() + 1) % conf->getTime())
37 .str();
38 Write<Topology>(*conf, header);
39}
40} // namespace csg
41} // namespace votca
topology of the whole system
Definition topology.h:81
double getTime() const
Definition topology.h:317
Index getStep() const
Definition topology.h:329
void Close() override
Definition xyzwriter.cc:32
void Open(std::string file, bool bAppend=false) override
Definition xyzwriter.cc:24
std::ofstream out_
Definition xyzwriter.h:76
void Write(Topology *conf) override
Definition xyzwriter.cc:34
base class for all analysis tools
Definition basebead.h:33