Commit 1f06a123 authored by Florian Weik's avatar Florian Weik

core: clang-format most of the things.

parent af8ded85
......@@ -36,8 +36,6 @@ BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
......@@ -55,12 +53,9 @@ IncludeCategories:
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
......
......@@ -22,8 +22,8 @@
#include "Vector.hpp"
#include "utils/keys.hpp"
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/collectives/all_reduce.hpp>
#include <boost/mpi/communicator.hpp>
#include <unordered_map>
#include <vector>
......
......@@ -165,8 +165,7 @@ protected:
: m_gpu_npart(0), m_gpu(false), m_r_gpu_begin(0), m_r_gpu_end(0),
m_dip_gpu_begin(0), m_v_gpu_begin(0), m_v_gpu_end(0), m_q_gpu_begin(0),
m_q_gpu_end(0), m_quatu_gpu_begin(0), m_quatu_gpu_end(0),
m_needsParticleStructGpu(false), m_splitParticleStructGpu(false)
{};
m_needsParticleStructGpu(false), m_splitParticleStructGpu(false){};
virtual ~EspressoSystemInterface() {}
void gatherParticles();
......
#include "config.hpp"
#include "Geometry.hpp"
#include "config.hpp"
#include "EspressoSystemInterface.hpp"
class Geometry {
public:
void set_box_l(Vector3d x) {m_box_l =x;}
void set_my_left(Vector3d x) {m_my_left=x;}
void set_my_right(Vector3d x) { m_my_right=x;}
Vector3d get_box_l() {return m_box_l;}
Vector3d get_my_left() { return m_my_left; }
Vector3d get_my_right() { return m_my_right; }
private:
Vector3d m_box_l;
Vector3d m_my_left;
Vector3d m_my_right;
};
public:
void set_box_l(Vector3d x) { m_box_l = x; }
void set_my_left(Vector3d x) { m_my_left = x; }
void set_my_right(Vector3d x) { m_my_right = x; }
Vector3d get_box_l() { return m_box_l; }
Vector3d get_my_left() { return m_my_left; }
Vector3d get_my_right() { return m_my_right; }
private:
Vector3d m_box_l;
Vector3d m_my_left;
Vector3d m_my_right;
};
......@@ -30,8 +30,7 @@ class GetLocalParts {
public:
Range operator()() const {
if (local_particles == nullptr) {
auto begin =
skip_it(nullptr, nullptr, SkipIfNullOrGhost());
auto begin = skip_it(nullptr, nullptr, SkipIfNullOrGhost());
return Utils::make_range(make_indirect_iterator(begin),
make_indirect_iterator(begin));
}
......
......@@ -20,9 +20,9 @@ struct ParticleIterator : public boost::iterator_facade<
public:
friend typename std::iterator_traits<ParticleIterator>::difference_type
distance(ParticleIterator const &begin, ParticleIterator const &end) {
if(begin == end)
if (begin == end)
return 0;
/* Remaining parts in this cell */
auto dist = ((*begin.m_cell)->n - begin.m_part_id);
/* Now add the size of all cells between the next
......
/*
Copyright (C) 2014,2015,2016 The ESPResSo project
This file is part of ESPResSo.
ESPResSo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ESPResSo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* vim: set ts=8 sts=2 sw=2 et: */
#include "PdbParser.hpp"
#include <sstream>
#include <fstream>
#include <sstream>
using namespace std;
namespace PdbParser {
BoundingBox PdbParser::calc_bounding_box() const {
BoundingBox bb;
bb.llx = std::numeric_limits<float>::max();
bb.lly = std::numeric_limits<float>::max();
bb.llz = std::numeric_limits<float>::max();
bb.urx = -std::numeric_limits<float>::max();
bb.ury = -std::numeric_limits<float>::max();
bb.urz = -std::numeric_limits<float>::max();
for(std::vector<pdb_atom>::const_iterator it = pdb_atoms.begin(); it != pdb_atoms.end(); ++it) {
bb.llx = std::min(it->x, bb.llx);
bb.lly = std::min(it->y, bb.lly);
bb.llz = std::min(it->z, bb.llz);
bb.urx = std::max(it->x, bb.urx);
bb.ury = std::max(it->y, bb.ury);
bb.urz = std::max(it->z, bb.urz);
}
return bb;
BoundingBox PdbParser::calc_bounding_box() const {
BoundingBox bb;
bb.llx = std::numeric_limits<float>::max();
bb.lly = std::numeric_limits<float>::max();
bb.llz = std::numeric_limits<float>::max();
bb.urx = -std::numeric_limits<float>::max();
bb.ury = -std::numeric_limits<float>::max();
bb.urz = -std::numeric_limits<float>::max();
for (std::vector<pdb_atom>::const_iterator it = pdb_atoms.begin();
it != pdb_atoms.end(); ++it) {
bb.llx = std::min(it->x, bb.llx);
bb.lly = std::min(it->y, bb.lly);
bb.llz = std::min(it->z, bb.llz);
bb.urx = std::max(it->x, bb.urx);
bb.ury = std::max(it->y, bb.ury);
bb.urz = std::max(it->z, bb.urz);
}
return bb;
}
bool PdbParser::parse_pdb_file(const string & filename) {
ifstream file;
string tmp;
pdb_atom a;
pdb_atoms.clear();
bool PdbParser::parse_pdb_file(const string &filename) {
ifstream file;
string tmp;
pdb_atom a;
try {
file.open(filename.c_str());
while(file.good()) {
file >> tmp;
if(tmp == "ATOM") {
file.ignore(246,' ');
file >> a.i;
file >> tmp >> tmp >> tmp >> tmp;
file >> a.x >> a.y >> a.z;
pdb_atoms.push_back(a);
}
}
}
catch (ifstream::failure& e) {
return false;
}
pdb_atoms.clear();
try {
file.open(filename.c_str());
while (file.good()) {
return true;
file >> tmp;
if (tmp == "ATOM") {
file.ignore(246, ' ');
file >> a.i;
file >> tmp >> tmp >> tmp >> tmp;
file >> a.x >> a.y >> a.z;
pdb_atoms.push_back(a);
}
}
} catch (ifstream::failure &e) {
return false;
}
bool PdbParser::parse_itp_file(const string & filename) {
ifstream file(filename.c_str());
string tmp, buf;
itp_atom atom;
std::size_t pos;
itp_atoms.clear();
itp_atomtypes.clear();
while(file.good()) {
try {
buf = char(file.get());
/* Skipp leading whitespace */
if(std::isspace(buf[0]))
continue;
/* Comment, ignore rest of line */
if(buf[0] == ';') {
std::getline(file, buf);
continue;
}
/* Section statement */
if(buf == "[") {
std::getline(file, buf);
pos = buf.find_first_not_of(" \t[");
if(pos == std::string::npos)
continue;
std::string section = buf.substr(pos, std::string::npos);
pos = section.find_first_of(']');
section = section.substr(0, pos);
pos = section.find_last_not_of(" \t");
section = section.substr(0, pos+1);
if(section == "atoms") {
while(file.good()) {
buf = char(file.get());
/* Ignore leading whitespace, check for end of file (standard says EOF is "generaly" -1) */
if(std::isspace(buf[0]) || (buf[0] == -1)) {
continue;
}
/* End of atoms section */
if(buf[0] == '[') {
file.unget();
break;
}
/* Comment, ignore line */
if(buf[0] == ';') {
std::getline(file, buf);
continue;
}
/* Push back first char */
file.unget();
/* Parse line */
std::getline(file, buf);
std::istringstream line(buf);
line >> atom.i >> atom.type >> tmp >> tmp >> tmp >> tmp >> atom.charge;
itp_atoms.insert(std::pair<int, itp_atom>(atom.i, atom));
}
}
if(section == "atomtypes") {
itp_atomtype type;
std::string type_name;
while(file.good()) {
buf = char(file.get());
/* Ignore leading whitespace */
if(std::isspace(buf[0])) {
continue;
}
/* End of atoms section */
if(buf[0] == '[') {
file.unget();
break;
}
/* Ignore leading whitespace, check for end of file (standard says EOF is "generaly" -1) */
if(std::isspace(buf[0]) || (buf[0] == -1)) {
continue;
}
/* Push back first char */
file.unget();
/* Parse line */
std::getline(file, buf);
std::istringstream line(buf);
line >> type_name >> tmp >> tmp >> tmp >> tmp >> type.sigma >> type.epsilon;
/* Id is sequential number starting from zero */
type.id = itp_atomtypes.size();
itp_atomtypes.insert(std::pair<std::string, itp_atomtype>(type_name, type));
}
}
}
return true;
}
bool PdbParser::parse_itp_file(const string &filename) {
ifstream file(filename.c_str());
string tmp, buf;
itp_atom atom;
std::size_t pos;
itp_atoms.clear();
itp_atomtypes.clear();
while (file.good()) {
try {
buf = char(file.get());
/* Skipp leading whitespace */
if (std::isspace(buf[0]))
continue;
/* Comment, ignore rest of line */
if (buf[0] == ';') {
std::getline(file, buf);
continue;
}
catch (...) {
return false;
/* Section statement */
if (buf == "[") {
std::getline(file, buf);
pos = buf.find_first_not_of(" \t[");
if (pos == std::string::npos)
continue;
std::string section = buf.substr(pos, std::string::npos);
pos = section.find_first_of(']');
section = section.substr(0, pos);
pos = section.find_last_not_of(" \t");
section = section.substr(0, pos + 1);
if (section == "atoms") {
while (file.good()) {
buf = char(file.get());
/* Ignore leading whitespace, check for end of file (standard says
* EOF is "generaly" -1) */
if (std::isspace(buf[0]) || (buf[0] == -1)) {
continue;
}
/* End of atoms section */
if (buf[0] == '[') {
file.unget();
break;
}
/* Comment, ignore line */
if (buf[0] == ';') {
std::getline(file, buf);
continue;
}
/* Push back first char */
file.unget();
/* Parse line */
std::getline(file, buf);
std::istringstream line(buf);
line >> atom.i >> atom.type >> tmp >> tmp >> tmp >> tmp >>
atom.charge;
itp_atoms.insert(std::pair<int, itp_atom>(atom.i, atom));
}
}
if (section == "atomtypes") {
itp_atomtype type;
std::string type_name;
while (file.good()) {
buf = char(file.get());
/* Ignore leading whitespace */
if (std::isspace(buf[0])) {
continue;
}
/* End of atoms section */
if (buf[0] == '[') {
file.unget();
break;
}
/* Ignore leading whitespace, check for end of file (standard says
* EOF is "generaly" -1) */
if (std::isspace(buf[0]) || (buf[0] == -1)) {
continue;
}
/* Push back first char */
file.unget();
/* Parse line */
std::getline(file, buf);
std::istringstream line(buf);
line >> type_name >> tmp >> tmp >> tmp >> tmp >> type.sigma >>
type.epsilon;
/* Id is sequential number starting from zero */
type.id = itp_atomtypes.size();
itp_atomtypes.insert(
std::pair<std::string, itp_atomtype>(type_name, type));
}
}
}
} catch (...) {
return false;
}
return true;
}
bool PdbParser::parse_file(const string & pdb_filename, const string & itp_filename) {
return parse_pdb_file(pdb_filename) && parse_itp_file(itp_filename);
}
return true;
}
bool PdbParser::parse_file(const string &pdb_filename,
const string &itp_filename) {
return parse_pdb_file(pdb_filename) && parse_itp_file(itp_filename);
}
}
/*
Copyright (C) 2014,2015,2016 The ESPResSo project
This file is part of ESPResSo.
ESPResSo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ESPResSo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* vim: set ts=8 sts=2 sw=2 et: */
#ifndef __PDBPARSER_HPP
#define __PDBPARSER_HPP
#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <string>
#include <vector>
namespace PdbParser {
struct BoundingBox {
float llx, lly, llz;
float urx, ury, urz;
};
struct BoundingBox {
float llx, lly, llz;
float urx, ury, urz;
};
typedef struct {
int i; // index
int m; // model index
float x,y,z;
} pdb_atom;
typedef struct {
int i; // index
int m; // model index
float x, y, z;
} pdb_atom;
typedef struct {
int i;
std::string type;
float charge;
} itp_atom;
typedef struct {
int i;
std::string type;
float charge;
} itp_atom;
typedef struct {
int id, espresso_id;
float sigma,epsilon;
} itp_atomtype;
typedef struct {
int id, espresso_id;
float sigma, epsilon;
} itp_atomtype;
struct itp_atomtype_compare {
bool operator() (const itp_atomtype &a, const itp_atomtype &b) { return a.id < b.id; }
};
struct itp_atomtype_compare {
bool operator()(const itp_atomtype &a, const itp_atomtype &b) {
return a.id < b.id;
}
};
class PdbParser {
public:
bool parse_pdb_file(const std::string & filename);
bool parse_itp_file(const std::string & filename);
bool parse_file(const std::string & pdb_filename, const std::string & itp_filename);
BoundingBox calc_bounding_box() const;
std::vector<pdb_atom> pdb_atoms;
std::map<int, itp_atom> itp_atoms;
std::map<std::string, itp_atomtype> itp_atomtypes;
};
class PdbParser {
public:
bool parse_pdb_file(const std::string &filename);
bool parse_itp_file(const std::string &filename);
bool parse_file(const std::string &pdb_filename,
const std::string &itp_filename);
BoundingBox calc_bounding_box() const;
std::vector<pdb_atom> pdb_atoms;
std::map<int, itp_atom> itp_atoms;
std::map<std::string, itp_atomtype> itp_atomtypes;
};
}
#endif
......@@ -19,8 +19,8 @@
#include "RuntimeError.hpp"
#include <sstream>
#include <iostream>
#include <sstream>
namespace ErrorHandling {
......@@ -53,8 +53,6 @@ std::string RuntimeError::format() const {
return ostr.str();
}
void RuntimeError::print() const {
std::cerr << format() << std::endl;
}
void RuntimeError::print() const { std::cerr << format() << std::endl; }
} /* ErrorHandling */
......@@ -61,8 +61,7 @@ struct RuntimeError {
private:
/** Boost serialization */
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive &ar, const unsigned int) {
template <class Archive> void serialize(Archive &ar, const unsigned int) {
ar &m_level;
ar &m_who;