From cb5a69a66fbfd48855af923dfca89f4be73aba5d Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:25:13 -0700 Subject: [PATCH 01/61] Remove topology item --- include/votca/csg/topologyitem.h | 44 -------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 include/votca/csg/topologyitem.h diff --git a/include/votca/csg/topologyitem.h b/include/votca/csg/topologyitem.h deleted file mode 100644 index ef7f18eb91..0000000000 --- a/include/votca/csg/topologyitem.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef _VOTCA_CSG_TOPOLOGYITEM_H -#define _VOTCA_CSG_TOPOLOGYITEM_H - -namespace votca { -namespace csg { - -class Topology; - -class TopologyItem { - public: - virtual ~TopologyItem() = default; - Topology *getParent() const { return _parent; } - - protected: - TopologyItem(Topology *parent) : _parent(parent) {} - - Topology *_parent; - - friend class Topology; - friend class BaseBead; - friend class Bead; -}; - -} // namespace csg -} // namespace votca - -#endif /* _VOTCA_CSG_TOPOLOGYITEM_H */ From 3c605ecfa82afe64d3dab35ec7a52a6fdc8653c5 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:26:34 -0700 Subject: [PATCH 02/61] removed bead type class --- include/votca/csg/beadtype.h | 51 ------------------------------------ 1 file changed, 51 deletions(-) delete mode 100644 include/votca/csg/beadtype.h diff --git a/include/votca/csg/beadtype.h b/include/votca/csg/beadtype.h deleted file mode 100644 index eb08732ee5..0000000000 --- a/include/votca/csg/beadtype.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef _VOTCA_CSG_BEADTYPE_H -#define _VOTCA_CSG_BEADTYPE_H - -#include "topologyitem.h" -#include - -namespace votca { -namespace csg { - -/** - \brief Bead Type informaton - - Each bead has a type. While the bead name should be unique, - several beads can share the same type. - */ -class BeadType : public TopologyItem { - public: - const Index &getId() const { return _id; } - const std::string &getName() const { return _name; } - void setName(const std::string &name) { _name = name; } - - private: - Index _id; - std::string _name; - - BeadType(Topology *parent, Index id, const std::string &name) - : TopologyItem(parent), _id(id), _name(name) {} - friend class Topology; -}; - -} // namespace csg -} // namespace votca - -#endif /* _VOTCA_CSG_BEADTYPE_H */ From f9a2a72f9923879240225047f67a0819998f8d21 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:28:31 -0700 Subject: [PATCH 03/61] Removed bead type include from topology class --- include/votca/csg/topology.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index a4a0d3534b..06dee8865f 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -25,7 +25,6 @@ #include #include "bead.h" -#include "beadtype.h" #include "boundarycondition.h" #include "exclusionlist.h" #include "molecule.h" From 663554e125382a9cc113149ed0a029e2297aa592 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:31:12 -0700 Subject: [PATCH 04/61] Removed topology item include --- include/votca/csg/molecule.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index 5c34590cda..a8c10dd6db 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -19,7 +19,6 @@ #define _VOTCA_CSG_MOLECULE_H #include "bead.h" -#include "topologyitem.h" #include #include #include From 5e5b37372bac11c6330cc8aadbe6575dee409f5c Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:31:37 -0700 Subject: [PATCH 05/61] Corrected header guard in molecule.h --- include/votca/csg/molecule.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index a8c10dd6db..56a2a50375 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -15,8 +15,8 @@ * */ -#ifndef _VOTCA_CSG_MOLECULE_H -#define _VOTCA_CSG_MOLECULE_H +#ifndef VOTCA_CSG_MOLECULE_H +#define VOTCA_CSG_MOLECULE_H #include "bead.h" #include @@ -116,4 +116,4 @@ inline Index Molecule::getBeadIdByName(const std::string &name) { } // namespace csg } // namespace votca -#endif /* _VOTCA_CSG_MOLECULE_H */ +#endif // VOTCA_CSG_MOLECULE_H From 4f5b7ac36408246937024b7697e7235632bf61e2 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:34:50 -0700 Subject: [PATCH 06/61] Remove extra space --- include/votca/csg/molecule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index 56a2a50375..6713651b1b 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -116,4 +116,4 @@ inline Index Molecule::getBeadIdByName(const std::string &name) { } // namespace csg } // namespace votca -#endif // VOTCA_CSG_MOLECULE_H +#endif // VOTCA_CSG_MOLECULE_H From 3d23b3e9391c52ac309ec0883b5483b5bde662b5 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:35:54 -0700 Subject: [PATCH 07/61] Removed topology item parent --- include/votca/csg/molecule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index 6713651b1b..3c66cf30fc 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -38,7 +38,7 @@ class Interaction; \todo sort atoms in molecule */ -class Molecule : public TopologyItem { +class Molecule { public: /// get the molecule ID Index getId() const { return _id; } From 940b43c5f830234f4d621db276940f8526126370 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:36:33 -0700 Subject: [PATCH 08/61] Corrected header in residue --- include/votca/csg/residue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/residue.h b/include/votca/csg/residue.h index 84751d693a..9e8ff0eb60 100644 --- a/include/votca/csg/residue.h +++ b/include/votca/csg/residue.h @@ -15,8 +15,8 @@ * */ -#ifndef _VOTCA_CSG_RESIDUE_H -#define _VOTCA_CSG_RESIDUE_H +#ifndef VOTCA_CSG_RESIDUE_H +#define VOTCA_CSG_RESIDUE_H #include "topologyitem.h" #include @@ -56,4 +56,4 @@ inline const std::string &Residue::getName() { return _name; } } // namespace csg } // namespace votca -#endif /* _VOTCA_CSG_RESIDUE_H */ +#endif // VOTCA_CSG_RESIDUE_H From 0b14e307e4c9f61b5ec9808e2545c006d666fd84 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:36:52 -0700 Subject: [PATCH 09/61] Added pragma once to residue.h --- include/votca/csg/residue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/residue.h b/include/votca/csg/residue.h index 9e8ff0eb60..1a9a7c2214 100644 --- a/include/votca/csg/residue.h +++ b/include/votca/csg/residue.h @@ -14,7 +14,7 @@ * limitations under the License. * */ - +#pragma once #ifndef VOTCA_CSG_RESIDUE_H #define VOTCA_CSG_RESIDUE_H From a19d89889a88e932cfe7a58ac7e99c6ca220a598 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:37:24 -0700 Subject: [PATCH 10/61] Corrected topology header guard --- include/votca/csg/topology.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index 06dee8865f..ad0ef83962 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -15,8 +15,8 @@ * */ -#ifndef _VOTCA_CSG_TOPOLOGY_H -#define _VOTCA_CSG_TOPOLOGY_H +#ifndef VOTCA_CSG_TOPOLOGY_H +#define VOTCA_CSG_TOPOLOGY_H #include #include @@ -463,4 +463,4 @@ inline void Topology::InsertExclusion(Bead *bead1, iteratable &l) { #include "interaction.h" -#endif /* _VOTCA_CSG_TOPOLOGY_H */ +#endif // VOTCA_CSG_TOPOLOGY_H From d55db6866b94b3a170f185a46f4774b270be0a37 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:37:48 -0700 Subject: [PATCH 11/61] Added pragma once to topology.h --- include/votca/csg/topology.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index ad0ef83962..775a23ee4e 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -15,6 +15,7 @@ * */ +#pragma once #ifndef VOTCA_CSG_TOPOLOGY_H #define VOTCA_CSG_TOPOLOGY_H From 819975d5210783108c290c7125a9c306e4258d15 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:38:10 -0700 Subject: [PATCH 12/61] Added pragma once to molecule.h --- include/votca/csg/molecule.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index 3c66cf30fc..c65201bcde 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -15,6 +15,7 @@ * */ +#pragma once #ifndef VOTCA_CSG_MOLECULE_H #define VOTCA_CSG_MOLECULE_H From ac6d59e813888c435ce71efeec2872c8f6b41ac9 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:39:28 -0700 Subject: [PATCH 13/61] Remove topology item include and parent from residue --- include/votca/csg/residue.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/votca/csg/residue.h b/include/votca/csg/residue.h index 1a9a7c2214..f94151945c 100644 --- a/include/votca/csg/residue.h +++ b/include/votca/csg/residue.h @@ -18,7 +18,6 @@ #ifndef VOTCA_CSG_RESIDUE_H #define VOTCA_CSG_RESIDUE_H -#include "topologyitem.h" #include namespace votca { @@ -32,7 +31,7 @@ namespace csg { based on their residue. */ -class Residue : public TopologyItem { +class Residue { public: /// get the name of the residue const std::string &getName(); From 06d87f894a528b19be7f4ac6c72f23494b4b427b Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:42:42 -0700 Subject: [PATCH 14/61] Removed topology item from molecule constructor --- include/votca/csg/molecule.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index c65201bcde..b1d0dc030a 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -98,8 +98,8 @@ class Molecule { void *_userdata; /// constructor - Molecule(Topology *parent, Index id, std::string name) - : TopologyItem(parent), _id(id), _name(name) {} + Molecule(Index id, std::string name) + : _id(id), _name(name) {} friend class Topology; }; From 48f1becb18a2f70f1903b1f01098acf8f66751bc Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:43:12 -0700 Subject: [PATCH 15/61] Removed topology item from residue.h --- include/votca/csg/residue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/votca/csg/residue.h b/include/votca/csg/residue.h index f94151945c..3bab7f6e36 100644 --- a/include/votca/csg/residue.h +++ b/include/votca/csg/residue.h @@ -45,8 +45,8 @@ class Residue { private: /// constructor - Residue(Topology *parent, Index id, const std::string &name) - : TopologyItem(parent), _id(id), _name(name) {} + Residue(Index id, const std::string &name) + : _id(id), _name(name) {} friend class Topology; }; From e0bb3e7701616f19512ff3155c2df7407d0a6a26 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:45:59 -0700 Subject: [PATCH 16/61] Corrected constructors for Molecule and Residue in topology.h --- include/votca/csg/topology.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index 775a23ee4e..b60eae34df 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -433,19 +433,19 @@ inline Bead *Topology::CreateBead(Bead::Symmetry symmetry, std::string name, } inline Molecule *Topology::CreateMolecule(std::string name) { - Molecule *mol = new Molecule(this, _molecules.size(), name); + Molecule *mol = new Molecule(_molecules.size(), name); _molecules.push_back(mol); return mol; } inline Residue *Topology::CreateResidue(std::string name, Index id) { - Residue *res = new Residue(this, id, name); + Residue *res = new Residue(id, name); _residues.push_back(res); return res; } inline Residue *Topology::CreateResidue(std::string name) { - Residue *res = new Residue(this, _residues.size(), name); + Residue *res = new Residue(_residues.size(), name); _residues.push_back(res); return res; } From db5c53e00074d6cfa782ada3f05c758e1451ef25 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:56:18 -0700 Subject: [PATCH 17/61] Fix function calls in csg_gmxtopology --- src/tools/csg_gmxtopol.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/csg_gmxtopol.cc b/src/tools/csg_gmxtopol.cc index 97cf458474..8c5232520b 100644 --- a/src/tools/csg_gmxtopol.cc +++ b/src/tools/csg_gmxtopol.cc @@ -44,8 +44,8 @@ class GmxTopolApp : public CsgApplication { protected: void WriteAtoms(ostream &out, Molecule &cg); - void WriteInteractions(ostream &out, Molecule &cg); - void WriteMolecule(ostream &out, Molecule &cg); + void WriteInteractions(ostream &out,Topology & top, Molecule &cg); + void WriteMolecule(ostream &out,Topology & top, Molecule &cg); }; void GmxTopolApp::Initialize(void) { @@ -62,7 +62,7 @@ bool GmxTopolApp::EvaluateTopology(Topology *top, Topology *) { } ofstream fl; fl.open((OptionsMap()["out"].as() + ".top")); - WriteMolecule(fl, *(top->MoleculeByIndex(0))); + WriteMolecule(fl,*top, *(top->MoleculeByIndex(0))); fl.close(); return true; } @@ -78,10 +78,10 @@ void GmxTopolApp::WriteAtoms(ostream &out, Molecule &cg) { out << endl; } -void GmxTopolApp::WriteInteractions(ostream &out, Molecule &cg) { +void GmxTopolApp::WriteInteractions(ostream &out,Topology & top, Molecule &cg) { votca::Index nb = -1; - for (Interaction *ic : cg.getParent()->BondedInteractions()) { + for (Interaction *ic : top.BondedInteractions()) { if (ic->getMolecule() != cg.getId()) { continue; } @@ -114,12 +114,12 @@ void GmxTopolApp::WriteInteractions(ostream &out, Molecule &cg) { } } -void GmxTopolApp::WriteMolecule(ostream &out, Molecule &cg) { +void GmxTopolApp::WriteMolecule(ostream &out,Topology & top, Molecule &cg) { out << "[ moleculetype ]\n"; out << cg.getName() << " 3\n\n"; WriteAtoms(out, cg); - WriteInteractions(out, cg); + WriteInteractions(out,top, cg); } int main(int argc, char **argv) { From 419fea8e63ec2c1c537cf05ca7418418baff90fb Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 16:59:15 -0700 Subject: [PATCH 18/61] Added const correctness --- src/tools/csg_gmxtopol.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/csg_gmxtopol.cc b/src/tools/csg_gmxtopol.cc index 8c5232520b..2512be857e 100644 --- a/src/tools/csg_gmxtopol.cc +++ b/src/tools/csg_gmxtopol.cc @@ -44,8 +44,8 @@ class GmxTopolApp : public CsgApplication { protected: void WriteAtoms(ostream &out, Molecule &cg); - void WriteInteractions(ostream &out,Topology & top, Molecule &cg); - void WriteMolecule(ostream &out,Topology & top, Molecule &cg); + void WriteInteractions(ostream &out,const Topology & top, Molecule &cg); + void WriteMolecule(ostream &out,const Topology & top, Molecule &cg); }; void GmxTopolApp::Initialize(void) { @@ -78,10 +78,10 @@ void GmxTopolApp::WriteAtoms(ostream &out, Molecule &cg) { out << endl; } -void GmxTopolApp::WriteInteractions(ostream &out,Topology & top, Molecule &cg) { +void GmxTopolApp::WriteInteractions(ostream &out,const Topology & top, Molecule &cg) { votca::Index nb = -1; - for (Interaction *ic : top.BondedInteractions()) { + for (const Interaction *ic : top.BondedInteractions()) { if (ic->getMolecule() != cg.getId()) { continue; } @@ -114,7 +114,7 @@ void GmxTopolApp::WriteInteractions(ostream &out,Topology & top, Molecule &cg) { } } -void GmxTopolApp::WriteMolecule(ostream &out,Topology & top, Molecule &cg) { +void GmxTopolApp::WriteMolecule(ostream &out,const Topology & top, Molecule &cg) { out << "[ moleculetype ]\n"; out << cg.getName() << " 3\n\n"; From a00014d6f33dbe7853351d81a6f26a6ed8110beb Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 17:07:58 -0700 Subject: [PATCH 19/61] Added const correctness to methods in interaction.h --- include/votca/csg/interaction.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/votca/csg/interaction.h b/include/votca/csg/interaction.h index 26a52dae7d..46f7452243 100644 --- a/include/votca/csg/interaction.h +++ b/include/votca/csg/interaction.h @@ -79,8 +79,8 @@ class Interaction { } virtual Eigen::Vector3d Grad(const Topology &top, Index bead) = 0; - Index BeadCount() { return _beads.size(); } - Index getBeadId(Index bead) { + Index BeadCount() const { return _beads.size(); } + Index getBeadId(Index bead) const { assert(bead > -1 && boost::lexical_cast(bead) < _beads.size()); return _beads[bead]; } From ae60c76109b14f478924c2517a3ea7a407ba815d Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 17:08:24 -0700 Subject: [PATCH 20/61] Corrected header guard --- include/votca/csg/interaction.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/interaction.h b/include/votca/csg/interaction.h index 46f7452243..9f5c5ed91b 100644 --- a/include/votca/csg/interaction.h +++ b/include/votca/csg/interaction.h @@ -15,8 +15,8 @@ * */ -#ifndef _VOTCA_CSG_INTERACTION_H -#define _VOTCA_CSG_INTERACTION_H +#ifndef VOTCA_CSG_INTERACTION_H +#define VOTCA_CSG_INTERACTION_H #include "bead.h" #include "topology.h" @@ -321,4 +321,4 @@ inline Eigen::Vector3d IDihedral::Grad(const Topology &top, Index bead) { } // namespace csg } // namespace votca -#endif // _VOTCA_CSG_INTERACTION_H +#endif // VOTCA_CSG_INTERACTION_H From e30e0e01d07a0b395bc615d256100b1ffb58df70 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 17:08:45 -0700 Subject: [PATCH 21/61] Added pragma once to interaction.h --- include/votca/csg/interaction.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/interaction.h b/include/votca/csg/interaction.h index 9f5c5ed91b..4a99a2349c 100644 --- a/include/votca/csg/interaction.h +++ b/include/votca/csg/interaction.h @@ -15,6 +15,7 @@ * */ +#pragma once #ifndef VOTCA_CSG_INTERACTION_H #define VOTCA_CSG_INTERACTION_H From 0d99821f0958e6b21586490ad4c9dd986bb98408 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 17:16:11 -0700 Subject: [PATCH 22/61] Added const correctness to Bonded Interactions method call --- include/votca/csg/topology.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index b60eae34df..8246feb2e1 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -176,6 +176,7 @@ class Topology { * @return bonded interaction container */ InteractionContainer &BondedInteractions() { return _interactions; } + const InteractionContainer &BondedInteractions() const { return _interactions; } void AddBondedInteraction(Interaction *ic); std::list InteractionsInGroup(const std::string &group); From 30fd5489a23b41c9b8854bf7dd341553268d3c29 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 17:16:31 -0700 Subject: [PATCH 23/61] Added pragma once to within header guard --- include/votca/csg/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index 8246feb2e1..410fca7657 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -15,9 +15,9 @@ * */ -#pragma once #ifndef VOTCA_CSG_TOPOLOGY_H #define VOTCA_CSG_TOPOLOGY_H +#pragma once #include #include From 367ba51492975cbc0fe902a084abfad06fda288f Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 17:17:09 -0700 Subject: [PATCH 24/61] Removed getParent call from main.cc --- src/csg_boltzmann/main.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/csg_boltzmann/main.cc b/src/csg_boltzmann/main.cc index 9a1dcb218f..4ac0994dfc 100644 --- a/src/csg_boltzmann/main.cc +++ b/src/csg_boltzmann/main.cc @@ -53,7 +53,7 @@ class CsgBoltzmann : public CsgApplication { bool EvaluateTopology(Topology *top, Topology *top_ref) override; protected: - ExclusionList *CreateExclusionList(Molecule &atomistic, Molecule &cg); + ExclusionList *CreateExclusionList(Topology * top_atomistic, Molecule &atomistic, Topology * top_cg, Molecule &cg); BondedStatistics _bs; }; void CsgBoltzmann::Initialize() { @@ -86,8 +86,8 @@ bool CsgBoltzmann::EvaluateTopology(Topology *top, Topology *top_ref) { << " in coarse grained representation " << top_ref->MoleculeByIndex(0)->getName() << endl; - ex = CreateExclusionList(*top_ref->MoleculeByIndex(0), - *top->MoleculeByIndex(0)); + ex = CreateExclusionList(top_ref, *top_ref->MoleculeByIndex(0), + top, *top->MoleculeByIndex(0)); std::ofstream fl; fl.open(OptionsMap()["excl"].as()); fl << "# atomistic: " << top_ref->MoleculeByIndex(0)->getName() @@ -101,8 +101,8 @@ bool CsgBoltzmann::EvaluateTopology(Topology *top, Topology *top_ref) { return true; } -ExclusionList *CsgBoltzmann::CreateExclusionList(Molecule &atomistic, - Molecule &cg) { +ExclusionList *CsgBoltzmann::CreateExclusionList(Topology * top_atomistic, Molecule &atomistic, + Topology * top_cg, Molecule &cg) { ExclusionList *ex = new ExclusionList(); // exclude all with all { @@ -114,23 +114,21 @@ ExclusionList *CsgBoltzmann::CreateExclusionList(Molecule &atomistic, } // remove exclusions from inside a mapped bead - Topology *at_top = atomistic.getParent(); for (votca::Index i = 0; i < cg.BeadCount(); ++i) { const vector &parent_beads = cg.getBead(i)->ParentBeads(); list excl_list; for (const votca::Index &parent_bead_id : parent_beads) { - excl_list.push_back(at_top->getBead(parent_bead_id)); + excl_list.push_back(top_atomistic->getBead(parent_bead_id)); } ex->Remove(excl_list); } // remove exclusion which come from atomistic topology and hence bonds and // angles - Topology *cg_top = cg.getParent(); for (votca::Index i = 0; i < cg.BeadCount() - 1; ++i) { for (votca::Index j = i + 1; j < cg.BeadCount(); ++j) { - if (cg_top->getExclusions().IsExcluded(cg.getBead(i), cg.getBead(j))) { + if (top_cg->getExclusions().IsExcluded(cg.getBead(i), cg.getBead(j))) { const vector &parent_beads_w = cg.getBead(i)->ParentBeads(); const vector &parent_beads_v = @@ -138,8 +136,8 @@ ExclusionList *CsgBoltzmann::CreateExclusionList(Molecule &atomistic, for (const votca::Index parent_bead_id_w : parent_beads_w) { for (const votca::Index parent_bead_id_v : parent_beads_v) { - ex->RemoveExclusion(at_top->getBead(parent_bead_id_w), - at_top->getBead(parent_bead_id_v)); + ex->RemoveExclusion(top_atomistic->getBead(parent_bead_id_w), + top_atomistic->getBead(parent_bead_id_v)); } } } From 8731f7fe1f64dfa65100a606c13b152c711a4a0c Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:20:23 -0700 Subject: [PATCH 25/61] Remove topologyitem from basebead.h --- include/votca/csg/basebead.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/votca/csg/basebead.h b/include/votca/csg/basebead.h index f4c351c5a2..8f02031491 100644 --- a/include/votca/csg/basebead.h +++ b/include/votca/csg/basebead.h @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -141,8 +140,6 @@ class BaseBead { protected: BaseBead(){}; - TopologyItem topology_item_ = nullptr; - std::string type_ = tools::topology_constants::unassigned_bead_type; Index id_ = tools::topology_constants::unassigned_residue_id; Index molecule_id_ = tools::topology_constants::unassigned_molecule_id; From 57c6979e6b6b626559cf8bd9bb2e71c12a12ad8d Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:20:58 -0700 Subject: [PATCH 26/61] moved pragma once inside header guard --- include/votca/csg/basebead.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/basebead.h b/include/votca/csg/basebead.h index 8f02031491..6b258fed62 100644 --- a/include/votca/csg/basebead.h +++ b/include/votca/csg/basebead.h @@ -14,9 +14,9 @@ * limitations under the License. * */ -#pragma once #ifndef VOTCA_CSG_BASEBEAD_H #define VOTCA_CSG_BASEBEAD_H +#pragma once #include #include From 25f5e495393437133197e79f93f1dc2a42b0702c Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:24:15 -0700 Subject: [PATCH 27/61] Remove getParent method from basebead --- include/votca/csg/basebead.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/votca/csg/basebead.h b/include/votca/csg/basebead.h index 6b258fed62..e58a67a0f5 100644 --- a/include/votca/csg/basebead.h +++ b/include/votca/csg/basebead.h @@ -73,9 +73,6 @@ class BaseBead { */ Index getMoleculeId() const noexcept { return molecule_id_; } - /// Gets the topology pointer the bead is attached too - Topology *getParent() const { return topology_item_.getParent(); } - /** * get the bead type * \return const string From ce988848c95b616c5deb37ccc4cf0c3605b5f9c8 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:31:03 -0700 Subject: [PATCH 28/61] Removed topology item from bead.h constructor --- include/votca/csg/bead.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/votca/csg/bead.h b/include/votca/csg/bead.h index ac2553b021..f773aef5ee 100644 --- a/include/votca/csg/bead.h +++ b/include/votca/csg/bead.h @@ -289,10 +289,9 @@ class Bead : public BaseBead { bool bead_force_set_; /// constructor - Bead(Topology *owner, Index id, std::string type, Symmetry symmetry, + Bead(Index id, std::string type, Symmetry symmetry, std::string name, Index resnr, double m, double q) : symmetry_(symmetry), charge_(q), residue_number_(resnr) { - topology_item_._parent = owner; setId(id); setType(type); setName(name); @@ -305,7 +304,6 @@ class Bead : public BaseBead { bead_force_set_ = false; } - friend class Topology; friend class Molecule; }; From eed488cdf0068b10f5f7fa388c1f74ffafc3406e Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:31:37 -0700 Subject: [PATCH 29/61] Corrected include guard --- include/votca/csg/bead.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/bead.h b/include/votca/csg/bead.h index f773aef5ee..99dabac2a1 100644 --- a/include/votca/csg/bead.h +++ b/include/votca/csg/bead.h @@ -15,8 +15,8 @@ * */ -#ifndef _VOTCA_CSG_BEAD_H -#define _VOTCA_CSG_BEAD_H +#ifndef VOTCA_CSG_BEAD_H +#define VOTCA_CSG_BEAD_H #include #include @@ -370,4 +370,4 @@ inline void Bead::HasW(bool b) { bW_ = b; } } // namespace csg } // namespace votca -#endif // _VOTCA_CSG_BEAD_H +#endif // VOTCA_CSG_BEAD_H From c1b06adcbb5c514ab36f135259fda59511cc1e40 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:32:52 -0700 Subject: [PATCH 30/61] Corrected call to bead constructor --- include/votca/csg/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index 410fca7657..63561f8450 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -428,7 +428,7 @@ inline Bead *Topology::CreateBead(Bead::Symmetry symmetry, std::string name, std::string type, Index resnr, double m, double q) { - Bead *b = new Bead(this, _beads.size(), type, symmetry, name, resnr, m, q); + Bead *b = new Bead(_beads.size(), type, symmetry, name, resnr, m, q); _beads.push_back(b); return b; } From b1d8f831bfe89d31cfda1266ba0670f5913730d0 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:33:07 -0700 Subject: [PATCH 31/61] Added pragma once to bead --- include/votca/csg/bead.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/bead.h b/include/votca/csg/bead.h index 99dabac2a1..e82b895c03 100644 --- a/include/votca/csg/bead.h +++ b/include/votca/csg/bead.h @@ -17,6 +17,7 @@ #ifndef VOTCA_CSG_BEAD_H #define VOTCA_CSG_BEAD_H +#pragma once #include #include From bf66a80fce704d7ccd42a1bf2afbfd1d1dc6dbbc Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:34:43 -0700 Subject: [PATCH 32/61] Added Topology class back as friend --- include/votca/csg/bead.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/bead.h b/include/votca/csg/bead.h index e82b895c03..725c14f055 100644 --- a/include/votca/csg/bead.h +++ b/include/votca/csg/bead.h @@ -305,6 +305,7 @@ class Bead : public BaseBead { bead_force_set_ = false; } + friend class Topology; friend class Molecule; }; From 72fc6a5f65e2f3f2148339c98b8841c76ec27117 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:51:53 -0700 Subject: [PATCH 33/61] Moved method from topology to boundary condition --- include/votca/csg/boundarycondition.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/votca/csg/boundarycondition.h b/include/votca/csg/boundarycondition.h index d2c78a439b..158ca8cfaa 100644 --- a/include/votca/csg/boundarycondition.h +++ b/include/votca/csg/boundarycondition.h @@ -62,6 +62,15 @@ class BoundaryCondition { */ const Eigen::Matrix3d &getBox() const noexcept { return _box; }; + + /** + * @brief Self explanatory gets the shortest dimension of the boundary + * conditions + * + * @return + */ + double getShortestBoxDimension() const; + /** * get the volume of the box * \return box volume as double From e7df891f1464106eb0d2350b45045732dba58f3d Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:52:20 -0700 Subject: [PATCH 34/61] moved to pragma once to inside include guards --- include/votca/csg/boundarycondition.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/votca/csg/boundarycondition.h b/include/votca/csg/boundarycondition.h index 158ca8cfaa..95e1adc259 100644 --- a/include/votca/csg/boundarycondition.h +++ b/include/votca/csg/boundarycondition.h @@ -14,9 +14,9 @@ * limitations under the License. * */ -#pragma once #ifndef VOTCA_CSG_BOUNDARYCONDITION_H #define VOTCA_CSG_BOUNDARYCONDITION_H +#pragma once #include #include From e532ee6b929fbf58d05a05b76e350a93f2561e66 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:55:03 -0700 Subject: [PATCH 35/61] moved method from topology to boundary condition class --- src/libcsg/boundarycondition.cc | 34 ++++++++++++++++++++++++++++----- src/libcsg/topology.cc | 19 +----------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/libcsg/boundarycondition.cc b/src/libcsg/boundarycondition.cc index f580f772a2..01f495b510 100644 --- a/src/libcsg/boundarycondition.cc +++ b/src/libcsg/boundarycondition.cc @@ -14,16 +14,40 @@ * limitations under the License. * */ - +#include #include #include namespace votca { -namespace csg { + namespace csg { + + double BoundaryCondition::BoxVolume() const noexcept { + return std::abs(_box.determinant()); + } + + undaryCondition::getShortestBoxDimension() const { + assert(getBoxType() != eBoxtype::typeOpen && + "Cannot get the shortest dimension of the box because it is open"); + + Eigen::Vector3d box_a = box_.col(0); + Eigen::Vector3d box_b = box_.col(1); + Eigen::Vector3d box_c = box_.col(2); + + // create plane normals + Eigen::Vector3d norm_a = box_b.cross(box_c); + Eigen::Vector3d norm_b = box_c.cross(box_a); + Eigen::Vector3d norm_c = box_a.cross(box_b); + + norm_a.normalize(); + norm_b.normalize(); + norm_c.normalize(); + + double la = box_a.dot(norm_a); + double lb = box_b.dot(norm_b); + double lc = box_c.dot(norm_c); -double BoundaryCondition::BoxVolume() const noexcept { - return std::abs(_box.determinant()); -} + return std::min(la, std::min(lb, lc)); + } } // namespace csg } // namespace votca diff --git a/src/libcsg/topology.cc b/src/libcsg/topology.cc index 785b321694..24065704d2 100644 --- a/src/libcsg/topology.cc +++ b/src/libcsg/topology.cc @@ -336,24 +336,7 @@ BoundaryCondition::eBoxtype Topology::autoDetectBoxType( } double Topology::ShortestBoxSize() const { - Eigen::Vector3d box_a = getBox().col(0); - Eigen::Vector3d box_b = getBox().col(1); - Eigen::Vector3d box_c = getBox().col(2); - - // create plane normals - Eigen::Vector3d norm_a = box_b.cross(box_c); - Eigen::Vector3d norm_b = box_c.cross(box_a); - Eigen::Vector3d norm_c = box_a.cross(box_b); - - norm_a.normalize(); - norm_b.normalize(); - norm_c.normalize(); - - double la = box_a.dot(norm_a); - double lb = box_b.dot(norm_b); - double lc = box_c.dot(norm_c); - - return std::min(la, std::min(lb, lc)); + return _bc->getShortestBoxSize(); } } // namespace csg From e5ad98fcf73e4f5dbec3cd5fa3df6362b9fd8258 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:56:12 -0700 Subject: [PATCH 36/61] Passed boundary condition into apply method --- include/votca/csg/map.h | 8 ++++---- src/libcsg/map.cc | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/votca/csg/map.h b/include/votca/csg/map.h index 8405f8322d..89222a3975 100644 --- a/include/votca/csg/map.h +++ b/include/votca/csg/map.h @@ -37,7 +37,7 @@ class Map { void AddBeadMap(BeadMap *bmap) { _maps.push_back(bmap); } - void Apply(); + void Apply(const BoundaryCondition & bc); protected: Molecule _in, _out; @@ -50,7 +50,7 @@ class Map { class BeadMap { public: virtual ~BeadMap() = default; - virtual void Apply() = 0; + virtual void Apply(const BoundaryCondition & ) = 0; virtual void Initialize(Molecule *in, Bead *out, tools::Property *opts_map, tools::Property *opts_bead); @@ -76,7 +76,7 @@ inline void BeadMap::Initialize(Molecule *in, Bead *out, class Map_Sphere : public BeadMap { public: Map_Sphere() = default; - void Apply() override; + void Apply(const BoundaryCondition & ) override; void Initialize(Molecule *in, Bead *out, tools::Property *opts_bead, tools::Property *opts_map) override; @@ -106,7 +106,7 @@ inline void Map_Sphere::AddElem(Bead *in, double weight, double force_weight) { class Map_Ellipsoid : public Map_Sphere { public: Map_Ellipsoid() = default; - void Apply() override; + void Apply(const BoundaryCondition &) override; protected: }; diff --git a/src/libcsg/map.cc b/src/libcsg/map.cc index d9f3b36c6e..842231f4a7 100644 --- a/src/libcsg/map.cc +++ b/src/libcsg/map.cc @@ -45,9 +45,9 @@ Map::~Map() { _maps.clear(); } -void Map::Apply() { +void Map::Apply(const BoundaryCondition & bc) { for (auto &_map : _maps) { - _map->Apply(); + _map->Apply(bc); } } @@ -129,15 +129,14 @@ void Map_Sphere::Initialize(Molecule *in, Bead *out, Property *opts_bead, } } -void Map_Sphere::Apply() { +void Map_Sphere::Apply(const BoundaryCondition & bc) { bool bPos, bVel, bF; bPos = bVel = bF = false; _out->ClearParentBeads(); // the following is needed for pbc treatment - Topology *top = _out->getParent(); - double max_dist = 0.5 * top->ShortestBoxSize(); + double max_dist = 0.5 * bc.getShortestBoxSize(); Eigen::Vector3d r0 = Eigen::Vector3d::Zero(); string name0; Index id0 = 0; @@ -159,7 +158,7 @@ void Map_Sphere::Apply() { _out->AddParentBead(bead->getId()); M += bead->getMass(); if (bead->HasPos()) { - Eigen::Vector3d r = top->BCShortestConnection(r0, bead->getPos()); + Eigen::Vector3d r = bc.BCShortestConnection(r0, bead->getPos()); if (r.norm() > max_dist) { cout << r0 << " " << bead->getPos() << endl; throw std::runtime_error( @@ -195,14 +194,13 @@ void Map_Sphere::Apply() { } /// \todo implement this function -void Map_Ellipsoid::Apply() { +void Map_Ellipsoid::Apply(const BoundaryConditions & bc) { bool bPos, bVel, bF; bPos = bVel = bF = false; // the following is needed for pbc treatment - Topology *top = _out->getParent(); - double max_dist = 0.5 * top->ShortestBoxSize(); + double max_dist = 0.5 * bc.getShortestBoxSize(); Eigen::Vector3d r0 = Eigen::Vector3d::Zero(); if (_matrix.size() > 0) { if (_matrix.front()._in->HasPos()) { @@ -221,7 +219,7 @@ void Map_Ellipsoid::Apply() { Bead *bead = iter._in; _out->AddParentBead(bead->getId()); if (bead->HasPos()) { - Eigen::Vector3d r = top->BCShortestConnection(r0, bead->getPos()); + Eigen::Vector3d r = bc.BCShortestConnection(r0, bead->getPos()); if (r.norm() > max_dist) { throw std::runtime_error( "coarse-grained bead is bigger than half the box"); From b6d54ebee7c7bbf30fa0cca85b896643ded072de Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:56:47 -0700 Subject: [PATCH 37/61] Corrected include guard --- include/votca/csg/map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/votca/csg/map.h b/include/votca/csg/map.h index 89222a3975..87450bcc07 100644 --- a/include/votca/csg/map.h +++ b/include/votca/csg/map.h @@ -15,8 +15,8 @@ * */ -#ifndef _VOTCA_CSG_MAP_H -#define _VOTCA_CSG_MAP_H +#ifndef VOTCA_CSG_MAP_H +#define VOTCA_CSG_MAP_H #include "molecule.h" #include @@ -114,4 +114,4 @@ class Map_Ellipsoid : public Map_Sphere { } // namespace csg } // namespace votca -#endif /* _VOTCA_CSG_MAP_H */ +#endif // VOTCA_CSG_MAP_H From c26ff1f8c0d615e506fea59d481b9e3ee77e5430 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:57:08 -0700 Subject: [PATCH 38/61] Added pragma once --- include/votca/csg/map.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/map.h b/include/votca/csg/map.h index 87450bcc07..4c2feb6bae 100644 --- a/include/votca/csg/map.h +++ b/include/votca/csg/map.h @@ -17,6 +17,7 @@ #ifndef VOTCA_CSG_MAP_H #define VOTCA_CSG_MAP_H +#pragma once #include "molecule.h" #include From eae788b17bb85b906468acac6ff3badd0fe472c0 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:58:46 -0700 Subject: [PATCH 39/61] Fixed typo missing return type --- src/libcsg/boundarycondition.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcsg/boundarycondition.cc b/src/libcsg/boundarycondition.cc index 01f495b510..712addb265 100644 --- a/src/libcsg/boundarycondition.cc +++ b/src/libcsg/boundarycondition.cc @@ -25,7 +25,7 @@ namespace votca { return std::abs(_box.determinant()); } - undaryCondition::getShortestBoxDimension() const { + double BundaryCondition::getShortestBoxDimension() const { assert(getBoxType() != eBoxtype::typeOpen && "Cannot get the shortest dimension of the box because it is open"); From d98bcf7247dbda42799a825440ec8541c586c01c Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 21:59:37 -0700 Subject: [PATCH 40/61] Include boundarycondition include --- include/votca/csg/map.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/votca/csg/map.h b/include/votca/csg/map.h index 4c2feb6bae..d8b2a7fe35 100644 --- a/include/votca/csg/map.h +++ b/include/votca/csg/map.h @@ -20,6 +20,7 @@ #pragma once #include "molecule.h" +#include "boundarycondition.h" #include #include #include From a70d6769cca5d1f47d8887c1142b94ed1310ca0a Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 22:00:08 -0700 Subject: [PATCH 41/61] Fixed typo --- src/libcsg/boundarycondition.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcsg/boundarycondition.cc b/src/libcsg/boundarycondition.cc index 712addb265..dbc43f5b68 100644 --- a/src/libcsg/boundarycondition.cc +++ b/src/libcsg/boundarycondition.cc @@ -25,7 +25,7 @@ namespace votca { return std::abs(_box.determinant()); } - double BundaryCondition::getShortestBoxDimension() const { + double BoundaryCondition::getShortestBoxDimension() const { assert(getBoxType() != eBoxtype::typeOpen && "Cannot get the shortest dimension of the box because it is open"); From bacd48c89c06abebde031e85a90e0e22df078bcd Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 22:02:23 -0700 Subject: [PATCH 42/61] Fixed typo of internal type --- src/libcsg/boundarycondition.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcsg/boundarycondition.cc b/src/libcsg/boundarycondition.cc index dbc43f5b68..dc927cabad 100644 --- a/src/libcsg/boundarycondition.cc +++ b/src/libcsg/boundarycondition.cc @@ -29,9 +29,9 @@ namespace votca { assert(getBoxType() != eBoxtype::typeOpen && "Cannot get the shortest dimension of the box because it is open"); - Eigen::Vector3d box_a = box_.col(0); - Eigen::Vector3d box_b = box_.col(1); - Eigen::Vector3d box_c = box_.col(2); + Eigen::Vector3d box_a = _box.col(0); + Eigen::Vector3d box_b = _box.col(1); + Eigen::Vector3d box_c = _box.col(2); // create plane normals Eigen::Vector3d norm_a = box_b.cross(box_c); From aeaa6be01474dd554ac8aa2650eac59273e83433 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 22:03:40 -0700 Subject: [PATCH 43/61] Corrected typo in method name --- src/libcsg/map.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcsg/map.cc b/src/libcsg/map.cc index 842231f4a7..a78dbee203 100644 --- a/src/libcsg/map.cc +++ b/src/libcsg/map.cc @@ -136,7 +136,7 @@ void Map_Sphere::Apply(const BoundaryCondition & bc) { _out->ClearParentBeads(); // the following is needed for pbc treatment - double max_dist = 0.5 * bc.getShortestBoxSize(); + double max_dist = 0.5 * bc.getShortestBoxDimension(); Eigen::Vector3d r0 = Eigen::Vector3d::Zero(); string name0; Index id0 = 0; @@ -200,7 +200,7 @@ void Map_Ellipsoid::Apply(const BoundaryConditions & bc) { bPos = bVel = bF = false; // the following is needed for pbc treatment - double max_dist = 0.5 * bc.getShortestBoxSize(); + double max_dist = 0.5 * bc.getShortestBoxDimension(); Eigen::Vector3d r0 = Eigen::Vector3d::Zero(); if (_matrix.size() > 0) { if (_matrix.front()._in->HasPos()) { From ae6b95d919a0dd0c6536132651b5a51bb7bf914e Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 22:04:13 -0700 Subject: [PATCH 44/61] Corrected typo --- src/libcsg/map.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcsg/map.cc b/src/libcsg/map.cc index a78dbee203..179b8f8396 100644 --- a/src/libcsg/map.cc +++ b/src/libcsg/map.cc @@ -194,7 +194,7 @@ void Map_Sphere::Apply(const BoundaryCondition & bc) { } /// \todo implement this function -void Map_Ellipsoid::Apply(const BoundaryConditions & bc) { +void Map_Ellipsoid::Apply(const BoundaryCondition & bc) { bool bPos, bVel, bF; bPos = bVel = bF = false; From 7a0339da13fb220ea97008aab302e7167862997f Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 22:07:27 -0700 Subject: [PATCH 45/61] Fixed typo --- src/libcsg/topology.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcsg/topology.cc b/src/libcsg/topology.cc index 24065704d2..e4d1e7fb03 100644 --- a/src/libcsg/topology.cc +++ b/src/libcsg/topology.cc @@ -336,7 +336,7 @@ BoundaryCondition::eBoxtype Topology::autoDetectBoxType( } double Topology::ShortestBoxSize() const { - return _bc->getShortestBoxSize(); + return _bc->getShortestBoxDimension(); } } // namespace csg From 70fc6b5a444130963fad31d61cccdc712f462a4b Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 22:15:50 -0700 Subject: [PATCH 46/61] Pass boundary condtion to bead mapping apply function call, and create method --- include/votca/csg/topology.h | 4 ++++ src/libcsg/topologymap.cc | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index 63561f8450..2083e4d7a5 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -290,6 +290,10 @@ class Topology { */ const Eigen::Matrix3d &getBox() const { return _bc->getBox(); }; + /** + * @brief Return the boundary condition object + */ + const BoundaryCondition & getBoundary() const { assert(_bc!=nullptr && "Cannot return boundary condition is null"); return *_bc; }; /** * set the time of current frame * \param t simulation time in ns diff --git a/src/libcsg/topologymap.cc b/src/libcsg/topologymap.cc index 6f2dcfda64..290e0c0fcc 100644 --- a/src/libcsg/topologymap.cc +++ b/src/libcsg/topologymap.cc @@ -15,6 +15,7 @@ * */ +#include "../../include/votca/csg/boundarycondition.h" #include namespace votca { @@ -34,7 +35,7 @@ void TopologyMap::Apply() { _out->setBox(_in->getBox()); for (auto& _map : _maps) { - _map->Apply(); + _map->Apply(_out->getBoundary()); } } From 1ed1b6949de72774cb33be9b372a325ef3822217 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Fri, 20 Dec 2019 23:25:47 -0700 Subject: [PATCH 47/61] Remove unneeded include from test --- src/tests/test_interaction.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_interaction.cc b/src/tests/test_interaction.cc index cea0814d36..228ea05774 100644 --- a/src/tests/test_interaction.cc +++ b/src/tests/test_interaction.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include #include From 552dc3ba7d25a3146c2deb64c5483c7aa0a042d9 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 08:09:40 -0700 Subject: [PATCH 48/61] Remove beadtype.h include --- src/tests/test_basebead.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_basebead.cc b/src/tests/test_basebead.cc index 15f34dc5df..8df08f755a 100644 --- a/src/tests/test_basebead.cc +++ b/src/tests/test_basebead.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include #include From 83bd3c0183251ed89a6ec0c1263176d60fa7f4e6 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 08:10:25 -0700 Subject: [PATCH 49/61] Removed beadtype include from test_bead --- src/tests/test_bead.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_bead.cc b/src/tests/test_bead.cc index 2db3078726..4bde6f7544 100644 --- a/src/tests/test_bead.cc +++ b/src/tests/test_bead.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include #include From a86d3b9d1d8422e9ed352406ecbc303b0381e992 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 08:11:12 -0700 Subject: [PATCH 50/61] Removed beadtype include from test_beadtriple --- src/tests/test_beadtriple.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_beadtriple.cc b/src/tests/test_beadtriple.cc index aa7add5050..b09e23dc15 100644 --- a/src/tests/test_beadtriple.cc +++ b/src/tests/test_beadtriple.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include using namespace std; From 087604038ddbc0fe068beab68587dff17cac7a05 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 08:12:03 -0700 Subject: [PATCH 51/61] Removed beadtype from test_nblist_3body --- src/tests/test_nblist_3body.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_nblist_3body.cc b/src/tests/test_nblist_3body.cc index 4fd5526b4b..2ae4c5e8a6 100644 --- a/src/tests/test_nblist_3body.cc +++ b/src/tests/test_nblist_3body.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include #include From c15676778ceeb27eae635fb4513ee54bc4815c95 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 08:12:46 -0700 Subject: [PATCH 52/61] Removed beadtype from nblistgrid_3body --- src/tests/test_nblistgrid_3body.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_nblistgrid_3body.cc b/src/tests/test_nblistgrid_3body.cc index c6dc425245..37d10610eb 100644 --- a/src/tests/test_nblistgrid_3body.cc +++ b/src/tests/test_nblistgrid_3body.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include #include From 2b2ab001a069544a98cf3e4bc32a0218ef2af6ad Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 08:13:34 -0700 Subject: [PATCH 53/61] Remove beadtype include from test_triplelist --- src/tests/test_triplelist.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_triplelist.cc b/src/tests/test_triplelist.cc index a997f1dbae..ae0a2c3e83 100644 --- a/src/tests/test_triplelist.cc +++ b/src/tests/test_triplelist.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include #include From 4c7adff8675520f6c0f12210abd86529ddf814bf Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 13:09:21 -0700 Subject: [PATCH 54/61] Made beadmap apply method safer for MapSphere --- src/libcsg/map.cc | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/libcsg/map.cc b/src/libcsg/map.cc index 179b8f8396..1b0f32540b 100644 --- a/src/libcsg/map.cc +++ b/src/libcsg/map.cc @@ -45,7 +45,7 @@ Map::~Map() { _maps.clear(); } -void Map::Apply(const BoundaryCondition & bc) { +void Map::Apply(const BoundaryCondition &bc) { for (auto &_map : _maps) { _map->Apply(bc); } @@ -129,14 +129,15 @@ void Map_Sphere::Initialize(Molecule *in, Bead *out, Property *opts_bead, } } -void Map_Sphere::Apply(const BoundaryCondition & bc) { +void Map_Sphere::Apply(const BoundaryCondition &bc) { + + assert(_matrix.size() > 0 && "Cannot map to sphere there are no beads"); bool bPos, bVel, bF; bPos = bVel = bF = false; _out->ClearParentBeads(); // the following is needed for pbc treatment - double max_dist = 0.5 * bc.getShortestBoxDimension(); Eigen::Vector3d r0 = Eigen::Vector3d::Zero(); string name0; Index id0 = 0; @@ -153,25 +154,45 @@ void Map_Sphere::Apply(const BoundaryCondition & bc) { Eigen::Vector3d f = Eigen::Vector3d::Zero(); Eigen::Vector3d vel = Eigen::Vector3d::Zero(); + Bead *bead_max_dist = _matrix.at(0)._in; + double max_bead_dist = + bc.BCShortestConnection(r0, bead_max_dist->getPos()).norm(); + for (auto &iter : _matrix) { Bead *bead = iter._in; _out->AddParentBead(bead->getId()); M += bead->getMass(); if (bead->HasPos()) { Eigen::Vector3d r = bc.BCShortestConnection(r0, bead->getPos()); - if (r.norm() > max_dist) { - cout << r0 << " " << bead->getPos() << endl; - throw std::runtime_error( - "coarse-grained bead is bigger than half the box \n (atoms " + - name0 + " (id " + boost::lexical_cast(id0 + 1) + ")" + - ", " + bead->getName() + " (id " + - boost::lexical_cast(bead->getId() + 1) + ")" + - +" , molecule " + - boost::lexical_cast(bead->getMoleculeId() + 1) + ")"); + if (r.norm() > max_bead_dist || max_bead_dist < 0.0) { + max_bead_dist = r.norm(); + bead_max_dist = bead; } cg += iter._weight * (r + r0); bPos = true; } + } + + /// Safety check, if box is not open check if the bead is larger than the + /// boundaries + if (bc.getBoxType() != BoundaryCondition::eBoxtype::typeOpen) { + double max_dist = 0.5 * bc.getShortestBoxDimension(); + if (max_bead_dist > max_dist) { + cout << r0 << " " << bead_max_dist->getPos() << endl; + throw std::runtime_error( + "coarse-grained bead_max_dist is bigger than half the box \n " + "(atoms " + + name0 + " (id " + boost::lexical_cast(id0 + 1) + ")" + ", " + + bead_max_dist->getName() + " (id " + + boost::lexical_cast(bead_max_dist->getId() + 1) + ")" + + +" , molecule " + + boost::lexical_cast(bead_max_dist->getMoleculeId() + 1) + + ")"); + } + } + + for (auto &iter : _matrix) { + Bead *bead = iter._in; if (bead->HasVel()) { vel += iter._weight * bead->getVel(); bVel = true; @@ -194,7 +215,7 @@ void Map_Sphere::Apply(const BoundaryCondition & bc) { } /// \todo implement this function -void Map_Ellipsoid::Apply(const BoundaryCondition & bc) { +void Map_Ellipsoid::Apply(const BoundaryCondition &bc) { bool bPos, bVel, bF; bPos = bVel = bF = false; From 618309e83b2921b6b9dce0f0ea6e698f0ead485b Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 13:16:39 -0700 Subject: [PATCH 55/61] Made Map_Ellipsoid Apply method safer, removed or statement --- src/libcsg/map.cc | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/src/libcsg/map.cc b/src/libcsg/map.cc index 1b0f32540b..51785d6cb5 100644 --- a/src/libcsg/map.cc +++ b/src/libcsg/map.cc @@ -164,7 +164,7 @@ void Map_Sphere::Apply(const BoundaryCondition &bc) { M += bead->getMass(); if (bead->HasPos()) { Eigen::Vector3d r = bc.BCShortestConnection(r0, bead->getPos()); - if (r.norm() > max_bead_dist || max_bead_dist < 0.0) { + if (r.norm() > max_bead_dist) { max_bead_dist = r.norm(); bead_max_dist = bead; } @@ -180,7 +180,7 @@ void Map_Sphere::Apply(const BoundaryCondition &bc) { if (max_bead_dist > max_dist) { cout << r0 << " " << bead_max_dist->getPos() << endl; throw std::runtime_error( - "coarse-grained bead_max_dist is bigger than half the box \n " + "coarse-grained bead is bigger than half the box \n " "(atoms " + name0 + " (id " + boost::lexical_cast(id0 + 1) + ")" + ", " + bead_max_dist->getName() + " (id " + @@ -217,15 +217,20 @@ void Map_Sphere::Apply(const BoundaryCondition &bc) { /// \todo implement this function void Map_Ellipsoid::Apply(const BoundaryCondition &bc) { + assert(_matrix.size() > 0 && "Cannot map to ellipsoid there are no beads"); + bool bPos, bVel, bF; bPos = bVel = bF = false; // the following is needed for pbc treatment - double max_dist = 0.5 * bc.getShortestBoxDimension(); Eigen::Vector3d r0 = Eigen::Vector3d::Zero(); + string name0; + Index id0 = 0; if (_matrix.size() > 0) { if (_matrix.front()._in->HasPos()) { r0 = _matrix.front()._in->getPos(); + name0 = _matrix.front()._in->getName(); + id0 = _matrix.front()._in->getId(); } } Eigen::Vector3d cg = Eigen::Vector3d::Zero(); @@ -236,18 +241,45 @@ void Map_Ellipsoid::Apply(const BoundaryCondition &bc) { Index n; n = 0; _out->ClearParentBeads(); + + Bead *bead_max_dist = _matrix.at(0)._in; + double max_bead_dist = + bc.BCShortestConnection(r0, bead_max_dist->getPos()).norm(); + for (auto &iter : _matrix) { Bead *bead = iter._in; _out->AddParentBead(bead->getId()); if (bead->HasPos()) { Eigen::Vector3d r = bc.BCShortestConnection(r0, bead->getPos()); - if (r.norm() > max_dist) { - throw std::runtime_error( - "coarse-grained bead is bigger than half the box"); + if (r.norm() > max_bead_dist) { + max_bead_dist = r.norm(); + bead_max_dist = bead; } cg += iter._weight * (r + r0); bPos = true; } + } + + /// Safety check, if box is not open check if the bead is larger than the + /// boundaries + if (bc.getBoxType() != BoundaryCondition::eBoxtype::typeOpen) { + double max_dist = 0.5 * bc.getShortestBoxDimension(); + if (max_bead_dist > max_dist) { + cout << r0 << " " << bead_max_dist->getPos() << endl; + throw std::runtime_error( + "coarse-grained bead is bigger than half the box \n " + "(atoms " + + name0 + " (id " + boost::lexical_cast(id0 + 1) + ")" + ", " + + bead_max_dist->getName() + " (id " + + boost::lexical_cast(bead_max_dist->getId() + 1) + ")" + + +" , molecule " + + boost::lexical_cast(bead_max_dist->getMoleculeId() + 1) + + ")"); + } + } + + for (auto &iter : _matrix) { + Bead *bead = iter._in; if (bead->HasVel() == true) { vel += iter._weight * bead->getVel(); bVel = true; From 32bfdec0435cc360c4f00457014b2f111a5dd7c9 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 16:24:38 -0700 Subject: [PATCH 56/61] Remove topology item from basebead.h --- include/votca/csg/basebead.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/votca/csg/basebead.h b/include/votca/csg/basebead.h index 3a08129f93..e58a67a0f5 100644 --- a/include/votca/csg/basebead.h +++ b/include/votca/csg/basebead.h @@ -18,7 +18,6 @@ #define VOTCA_CSG_BASEBEAD_H #pragma once -#include "topologyitem.h" #include #include #include From 182fcf24a720b35438fe56ea4b13e5053a4f4c7a Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 17:46:33 -0700 Subject: [PATCH 57/61] Fixed includes in test --- src/tests/test_basebead.cc | 1 - src/tests/test_bead.cc | 1 - src/tests/test_beadtriple.cc | 1 - src/tests/test_interaction.cc | 1 - src/tests/test_nblist_3body.cc | 1 - src/tests/test_nblistgrid_3body.cc | 1 - src/tests/test_triplelist.cc | 1 - 7 files changed, 7 deletions(-) diff --git a/src/tests/test_basebead.cc b/src/tests/test_basebead.cc index c617649d58..cf0617c297 100644 --- a/src/tests/test_basebead.cc +++ b/src/tests/test_basebead.cc @@ -19,7 +19,6 @@ #define BOOST_TEST_MODULE basebead_test #include "../../include/votca/csg/basebead.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/molecule.h" #include "../../include/votca/csg/topology.h" #include diff --git a/src/tests/test_bead.cc b/src/tests/test_bead.cc index a0fb9e79d5..42a0bdfdc4 100644 --- a/src/tests/test_bead.cc +++ b/src/tests/test_bead.cc @@ -19,7 +19,6 @@ #define BOOST_TEST_MODULE bead_test #include "../../include/votca/csg/bead.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/molecule.h" #include "../../include/votca/csg/topology.h" #include diff --git a/src/tests/test_beadtriple.cc b/src/tests/test_beadtriple.cc index 0303dbccef..f24a3c79f9 100644 --- a/src/tests/test_beadtriple.cc +++ b/src/tests/test_beadtriple.cc @@ -22,7 +22,6 @@ #include "../../include/votca/csg/bead.h" #include "../../include/votca/csg/beadtriple.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/topology.h" #include #include diff --git a/src/tests/test_interaction.cc b/src/tests/test_interaction.cc index 735a0c83cf..9ca62902be 100644 --- a/src/tests/test_interaction.cc +++ b/src/tests/test_interaction.cc @@ -21,7 +21,6 @@ #include #include "../../include/votca/csg/bead.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/interaction.h" #include "../../include/votca/csg/molecule.h" #include "../../include/votca/csg/topology.h" diff --git a/src/tests/test_nblist_3body.cc b/src/tests/test_nblist_3body.cc index 33bac14518..c4f07c085f 100644 --- a/src/tests/test_nblist_3body.cc +++ b/src/tests/test_nblist_3body.cc @@ -22,7 +22,6 @@ #include "../../include/votca/csg/bead.h" #include "../../include/votca/csg/beadlist.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/nblist_3body.h" #include "../../include/votca/csg/topology.h" #include diff --git a/src/tests/test_nblistgrid_3body.cc b/src/tests/test_nblistgrid_3body.cc index 86606b59c3..46a8d0fa6f 100644 --- a/src/tests/test_nblistgrid_3body.cc +++ b/src/tests/test_nblistgrid_3body.cc @@ -22,7 +22,6 @@ #include "../../include/votca/csg/bead.h" #include "../../include/votca/csg/beadlist.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/nblistgrid_3body.h" #include "../../include/votca/csg/topology.h" #include diff --git a/src/tests/test_triplelist.cc b/src/tests/test_triplelist.cc index 465119531b..5ff9039b65 100644 --- a/src/tests/test_triplelist.cc +++ b/src/tests/test_triplelist.cc @@ -20,7 +20,6 @@ #define BOOST_TEST_MODULE triplelist_test #include "../../include/votca/csg/bead.h" #include "../../include/votca/csg/beadtriple.h" -#include "../../include/votca/csg/beadtype.h" #include "../../include/votca/csg/topology.h" #include "../../include/votca/csg/triplelist.h" #include From 9330b9af456fb3376a0c06020b319307c1f35d58 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 20:05:30 -0700 Subject: [PATCH 58/61] Update formatting boundarycondition.cc --- src/libcsg/boundarycondition.cc | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/libcsg/boundarycondition.cc b/src/libcsg/boundarycondition.cc index f988dbc0c8..32fd97628e 100644 --- a/src/libcsg/boundarycondition.cc +++ b/src/libcsg/boundarycondition.cc @@ -20,35 +20,35 @@ #include "../../include/votca/csg/boundarycondition.h" namespace votca { - namespace csg { +namespace csg { - double BoundaryCondition::BoxVolume() const noexcept { - return std::abs(_box.determinant()); - } +double BoundaryCondition::BoxVolume() const noexcept { + return std::abs(_box.determinant()); +} - double BoundaryCondition::getShortestBoxDimension() const { - assert(getBoxType() != eBoxtype::typeOpen && - "Cannot get the shortest dimension of the box because it is open"); +double BoundaryCondition::getShortestBoxDimension() const { + assert(getBoxType() != eBoxtype::typeOpen && + "Cannot get the shortest dimension of the box because it is open"); - Eigen::Vector3d box_a = _box.col(0); - Eigen::Vector3d box_b = _box.col(1); - Eigen::Vector3d box_c = _box.col(2); + Eigen::Vector3d box_a = _box.col(0); + Eigen::Vector3d box_b = _box.col(1); + Eigen::Vector3d box_c = _box.col(2); - // create plane normals - Eigen::Vector3d norm_a = box_b.cross(box_c); - Eigen::Vector3d norm_b = box_c.cross(box_a); - Eigen::Vector3d norm_c = box_a.cross(box_b); + // create plane normals + Eigen::Vector3d norm_a = box_b.cross(box_c); + Eigen::Vector3d norm_b = box_c.cross(box_a); + Eigen::Vector3d norm_c = box_a.cross(box_b); - norm_a.normalize(); - norm_b.normalize(); - norm_c.normalize(); + norm_a.normalize(); + norm_b.normalize(); + norm_c.normalize(); - double la = box_a.dot(norm_a); - double lb = box_b.dot(norm_b); - double lc = box_c.dot(norm_c); + double la = box_a.dot(norm_a); + double lb = box_b.dot(norm_b); + double lc = box_c.dot(norm_c); - return std::min(la, std::min(lb, lc)); - } + return std::min(la, std::min(lb, lc)); +} } // namespace csg } // namespace votca From 5fe31d2a5d7177b9d0f35de82e73503b5ba6c076 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Sat, 21 Dec 2019 20:14:37 -0700 Subject: [PATCH 59/61] Fix formatting --- include/votca/csg/bead.h | 4 ++-- include/votca/csg/boundarycondition.h | 5 ++--- include/votca/csg/map.h | 10 +++++----- include/votca/csg/molecule.h | 5 ++--- include/votca/csg/residue.h | 5 ++--- include/votca/csg/topology.h | 11 ++++++++--- src/csg_boltzmann/main.cc | 14 +++++++++----- src/libcsg/topologymap.cc | 2 +- src/tools/csg_gmxtopol.cc | 14 ++++++++------ 9 files changed, 39 insertions(+), 31 deletions(-) diff --git a/include/votca/csg/bead.h b/include/votca/csg/bead.h index 725c14f055..6b7ea2853d 100644 --- a/include/votca/csg/bead.h +++ b/include/votca/csg/bead.h @@ -290,8 +290,8 @@ class Bead : public BaseBead { bool bead_force_set_; /// constructor - Bead(Index id, std::string type, Symmetry symmetry, - std::string name, Index resnr, double m, double q) + Bead(Index id, std::string type, Symmetry symmetry, std::string name, + Index resnr, double m, double q) : symmetry_(symmetry), charge_(q), residue_number_(resnr) { setId(id); setType(type); diff --git a/include/votca/csg/boundarycondition.h b/include/votca/csg/boundarycondition.h index 95e1adc259..3a06bb91e5 100644 --- a/include/votca/csg/boundarycondition.h +++ b/include/votca/csg/boundarycondition.h @@ -62,12 +62,11 @@ class BoundaryCondition { */ const Eigen::Matrix3d &getBox() const noexcept { return _box; }; - /** - * @brief Self explanatory gets the shortest dimension of the boundary + * @brief Self explanatory gets the shortest dimension of the boundary * conditions * - * @return + * @return */ double getShortestBoxDimension() const; diff --git a/include/votca/csg/map.h b/include/votca/csg/map.h index d8b2a7fe35..e52539785b 100644 --- a/include/votca/csg/map.h +++ b/include/votca/csg/map.h @@ -19,8 +19,8 @@ #define VOTCA_CSG_MAP_H #pragma once -#include "molecule.h" #include "boundarycondition.h" +#include "molecule.h" #include #include #include @@ -39,7 +39,7 @@ class Map { void AddBeadMap(BeadMap *bmap) { _maps.push_back(bmap); } - void Apply(const BoundaryCondition & bc); + void Apply(const BoundaryCondition &bc); protected: Molecule _in, _out; @@ -52,7 +52,7 @@ class Map { class BeadMap { public: virtual ~BeadMap() = default; - virtual void Apply(const BoundaryCondition & ) = 0; + virtual void Apply(const BoundaryCondition &) = 0; virtual void Initialize(Molecule *in, Bead *out, tools::Property *opts_map, tools::Property *opts_bead); @@ -78,7 +78,7 @@ inline void BeadMap::Initialize(Molecule *in, Bead *out, class Map_Sphere : public BeadMap { public: Map_Sphere() = default; - void Apply(const BoundaryCondition & ) override; + void Apply(const BoundaryCondition &) override; void Initialize(Molecule *in, Bead *out, tools::Property *opts_bead, tools::Property *opts_map) override; @@ -116,4 +116,4 @@ class Map_Ellipsoid : public Map_Sphere { } // namespace csg } // namespace votca -#endif // VOTCA_CSG_MAP_H +#endif // VOTCA_CSG_MAP_H diff --git a/include/votca/csg/molecule.h b/include/votca/csg/molecule.h index b1d0dc030a..1cad3994ce 100644 --- a/include/votca/csg/molecule.h +++ b/include/votca/csg/molecule.h @@ -98,8 +98,7 @@ class Molecule { void *_userdata; /// constructor - Molecule(Index id, std::string name) - : _id(id), _name(name) {} + Molecule(Index id, std::string name) : _id(id), _name(name) {} friend class Topology; }; @@ -117,4 +116,4 @@ inline Index Molecule::getBeadIdByName(const std::string &name) { } // namespace csg } // namespace votca -#endif // VOTCA_CSG_MOLECULE_H +#endif // VOTCA_CSG_MOLECULE_H diff --git a/include/votca/csg/residue.h b/include/votca/csg/residue.h index 3bab7f6e36..ea3ded4f45 100644 --- a/include/votca/csg/residue.h +++ b/include/votca/csg/residue.h @@ -45,8 +45,7 @@ class Residue { private: /// constructor - Residue(Index id, const std::string &name) - : _id(id), _name(name) {} + Residue(Index id, const std::string &name) : _id(id), _name(name) {} friend class Topology; }; @@ -55,4 +54,4 @@ inline const std::string &Residue::getName() { return _name; } } // namespace csg } // namespace votca -#endif // VOTCA_CSG_RESIDUE_H +#endif // VOTCA_CSG_RESIDUE_H diff --git a/include/votca/csg/topology.h b/include/votca/csg/topology.h index 2083e4d7a5..bbd84efdff 100644 --- a/include/votca/csg/topology.h +++ b/include/votca/csg/topology.h @@ -176,7 +176,9 @@ class Topology { * @return bonded interaction container */ InteractionContainer &BondedInteractions() { return _interactions; } - const InteractionContainer &BondedInteractions() const { return _interactions; } + const InteractionContainer &BondedInteractions() const { + return _interactions; + } void AddBondedInteraction(Interaction *ic); std::list InteractionsInGroup(const std::string &group); @@ -293,7 +295,10 @@ class Topology { /** * @brief Return the boundary condition object */ - const BoundaryCondition & getBoundary() const { assert(_bc!=nullptr && "Cannot return boundary condition is null"); return *_bc; }; + const BoundaryCondition &getBoundary() const { + assert(_bc != nullptr && "Cannot return boundary condition is null"); + return *_bc; + }; /** * set the time of current frame * \param t simulation time in ns @@ -469,4 +474,4 @@ inline void Topology::InsertExclusion(Bead *bead1, iteratable &l) { #include "interaction.h" -#endif // VOTCA_CSG_TOPOLOGY_H +#endif // VOTCA_CSG_TOPOLOGY_H diff --git a/src/csg_boltzmann/main.cc b/src/csg_boltzmann/main.cc index 4ef38e7078..751482ebb3 100644 --- a/src/csg_boltzmann/main.cc +++ b/src/csg_boltzmann/main.cc @@ -53,7 +53,9 @@ class CsgBoltzmann : public CsgApplication { bool EvaluateTopology(Topology *top, Topology *top_ref) override; protected: - ExclusionList *CreateExclusionList(Topology * top_atomistic, Molecule &atomistic, Topology * top_cg, Molecule &cg); + ExclusionList *CreateExclusionList(Topology *top_atomistic, + Molecule &atomistic, Topology *top_cg, + Molecule &cg); BondedStatistics _bs; }; void CsgBoltzmann::Initialize() { @@ -86,8 +88,8 @@ bool CsgBoltzmann::EvaluateTopology(Topology *top, Topology *top_ref) { << " in coarse grained representation " << top_ref->MoleculeByIndex(0)->getName() << endl; - ex = CreateExclusionList(top_ref, *top_ref->MoleculeByIndex(0), - top, *top->MoleculeByIndex(0)); + ex = CreateExclusionList(top_ref, *top_ref->MoleculeByIndex(0), top, + *top->MoleculeByIndex(0)); std::ofstream fl; fl.open(OptionsMap()["excl"].as()); fl << "# atomistic: " << top_ref->MoleculeByIndex(0)->getName() @@ -101,8 +103,10 @@ bool CsgBoltzmann::EvaluateTopology(Topology *top, Topology *top_ref) { return true; } -ExclusionList *CsgBoltzmann::CreateExclusionList(Topology * top_atomistic, Molecule &atomistic, - Topology * top_cg, Molecule &cg) { +ExclusionList *CsgBoltzmann::CreateExclusionList(Topology *top_atomistic, + Molecule &atomistic, + Topology *top_cg, + Molecule &cg) { ExclusionList *ex = new ExclusionList(); // exclude all with all { diff --git a/src/libcsg/topologymap.cc b/src/libcsg/topologymap.cc index 8ad55a2c3c..a707e08eca 100644 --- a/src/libcsg/topologymap.cc +++ b/src/libcsg/topologymap.cc @@ -15,8 +15,8 @@ * */ -#include "../../include/votca/csg/boundarycondition.h" #include "../../include/votca/csg/topologymap.h" +#include "../../include/votca/csg/boundarycondition.h" namespace votca { namespace csg { diff --git a/src/tools/csg_gmxtopol.cc b/src/tools/csg_gmxtopol.cc index fd7b363ddc..9e9e387552 100644 --- a/src/tools/csg_gmxtopol.cc +++ b/src/tools/csg_gmxtopol.cc @@ -44,8 +44,8 @@ class GmxTopolApp : public CsgApplication { protected: void WriteAtoms(ostream &out, Molecule &cg); - void WriteInteractions(ostream &out,const Topology & top, Molecule &cg); - void WriteMolecule(ostream &out,const Topology & top, Molecule &cg); + void WriteInteractions(ostream &out, const Topology &top, Molecule &cg); + void WriteMolecule(ostream &out, const Topology &top, Molecule &cg); }; void GmxTopolApp::Initialize(void) { @@ -62,7 +62,7 @@ bool GmxTopolApp::EvaluateTopology(Topology *top, Topology *) { } ofstream fl; fl.open((OptionsMap()["out"].as() + ".top")); - WriteMolecule(fl,*top, *(top->MoleculeByIndex(0))); + WriteMolecule(fl, *top, *(top->MoleculeByIndex(0))); fl.close(); return true; } @@ -78,7 +78,8 @@ void GmxTopolApp::WriteAtoms(ostream &out, Molecule &cg) { out << endl; } -void GmxTopolApp::WriteInteractions(ostream &out,const Topology & top, Molecule &cg) { +void GmxTopolApp::WriteInteractions(ostream &out, const Topology &top, + Molecule &cg) { votca::Index nb = -1; for (const Interaction *ic : top.BondedInteractions()) { @@ -114,12 +115,13 @@ void GmxTopolApp::WriteInteractions(ostream &out,const Topology & top, Molecule } } -void GmxTopolApp::WriteMolecule(ostream &out,const Topology & top, Molecule &cg) { +void GmxTopolApp::WriteMolecule(ostream &out, const Topology &top, + Molecule &cg) { out << "[ moleculetype ]\n"; out << cg.getName() << " 3\n\n"; WriteAtoms(out, cg); - WriteInteractions(out,top, cg); + WriteInteractions(out, top, cg); } int main(int argc, char **argv) { From f3d8fd48560787e7eece198763e82c012ead358c Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Mon, 23 Dec 2019 12:10:28 -0700 Subject: [PATCH 60/61] Fix to ensure get position is consistent between cg_top and top --- src/libcsg/csgapplication.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcsg/csgapplication.cc b/src/libcsg/csgapplication.cc index 79fdc2585c..c82e4eb980 100644 --- a/src/libcsg/csgapplication.cc +++ b/src/libcsg/csgapplication.cc @@ -225,6 +225,9 @@ void CsgApplication::Run(void) { // read in the topology for master ////////////////////////////////////////////////// reader->ReadTopology(_op_vm["top"].as(), master->_top); + // Ensure that the coarse grained topology will have the same boundaries + master->_top_cg.setBox(master->_top.getBox()); + std::cout << "I have " << master->_top.BeadCount() << " beads in " << master->_top.MoleculeCount() << " molecules" << std::endl; master->_top.CheckMoleculeNaming(); From 56d5b2e0139858a8338df0e00a873bb820c36de2 Mon Sep 17 00:00:00 2001 From: JoshuaSBrown Date: Mon, 23 Dec 2019 22:09:29 -0700 Subject: [PATCH 61/61] Applied fix --- src/libcsg/csgapplication.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libcsg/csgapplication.cc b/src/libcsg/csgapplication.cc index c82e4eb980..d279da33a3 100644 --- a/src/libcsg/csgapplication.cc +++ b/src/libcsg/csgapplication.cc @@ -252,9 +252,17 @@ void CsgApplication::Run(void) { std::cout << "I have " << master->_top_cg.BeadCount() << " beads in " << master->_top_cg.MoleculeCount() << " molecules for the coarsegraining" << std::endl; - master->_map->Apply(); - if (!EvaluateTopology(&master->_top_cg, &master->_top)) { - return; + + // If the trajectory reader is off but mapping flag is specified do apply + // the mapping, this switch is necessary in cases where xml files are + // specified, which do not contain positional information. In such cases + // it is not possible to apply the positional mapping, a trajectory file + // must be read in. + if (DoTrajectory() == false) { + master->_map->Apply(); + if (!EvaluateTopology(&master->_top_cg, &master->_top)) { + return; + } } } else if (!EvaluateTopology(&master->_top)) { return;