Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Piece wise remove topology item #486

Merged
merged 65 commits into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
cb5a69a
Remove topology item
JoshuaSBrown Dec 20, 2019
3c605ec
removed bead type class
JoshuaSBrown Dec 20, 2019
f9a2a72
Removed bead type include from topology class
JoshuaSBrown Dec 20, 2019
663554e
Removed topology item include
JoshuaSBrown Dec 20, 2019
5e5b373
Corrected header guard in molecule.h
JoshuaSBrown Dec 20, 2019
4f5b7ac
Remove extra space
JoshuaSBrown Dec 20, 2019
3d23b3e
Removed topology item parent
JoshuaSBrown Dec 20, 2019
940b43c
Corrected header in residue
JoshuaSBrown Dec 20, 2019
0b14e30
Added pragma once to residue.h
JoshuaSBrown Dec 20, 2019
a19d898
Corrected topology header guard
JoshuaSBrown Dec 20, 2019
d55db68
Added pragma once to topology.h
JoshuaSBrown Dec 20, 2019
819975d
Added pragma once to molecule.h
JoshuaSBrown Dec 20, 2019
ac6d59e
Remove topology item include and parent from residue
JoshuaSBrown Dec 20, 2019
06d87f8
Removed topology item from molecule constructor
JoshuaSBrown Dec 20, 2019
48f1bec
Removed topology item from residue.h
JoshuaSBrown Dec 20, 2019
e0bb3e7
Corrected constructors for Molecule and Residue in topology.h
JoshuaSBrown Dec 20, 2019
db5c53e
Fix function calls in csg_gmxtopology
JoshuaSBrown Dec 20, 2019
419fea8
Added const correctness
JoshuaSBrown Dec 20, 2019
a00014d
Added const correctness to methods in interaction.h
JoshuaSBrown Dec 21, 2019
ae60c76
Corrected header guard
JoshuaSBrown Dec 21, 2019
e30e0e0
Added pragma once to interaction.h
JoshuaSBrown Dec 21, 2019
0d99821
Added const correctness to Bonded Interactions method call
JoshuaSBrown Dec 21, 2019
30fd548
Added pragma once to within header guard
JoshuaSBrown Dec 21, 2019
367ba51
Removed getParent call from main.cc
JoshuaSBrown Dec 21, 2019
8731f7f
Remove topologyitem from basebead.h
JoshuaSBrown Dec 21, 2019
57c6979
moved pragma once inside header guard
JoshuaSBrown Dec 21, 2019
25f5e49
Remove getParent method from basebead
JoshuaSBrown Dec 21, 2019
ce98884
Removed topology item from bead.h constructor
JoshuaSBrown Dec 21, 2019
eed488c
Corrected include guard
JoshuaSBrown Dec 21, 2019
c1b06ad
Corrected call to bead constructor
JoshuaSBrown Dec 21, 2019
b1d8f83
Added pragma once to bead
JoshuaSBrown Dec 21, 2019
bf66a80
Added Topology class back as friend
JoshuaSBrown Dec 21, 2019
72fc6a5
Moved method from topology to boundary condition
JoshuaSBrown Dec 21, 2019
e7df891
moved to pragma once to inside include guards
JoshuaSBrown Dec 21, 2019
e532ee6
moved method from topology to boundary condition class
JoshuaSBrown Dec 21, 2019
e5ad98f
Passed boundary condition into apply method
JoshuaSBrown Dec 21, 2019
b6d54eb
Corrected include guard
JoshuaSBrown Dec 21, 2019
c26ff1f
Added pragma once
JoshuaSBrown Dec 21, 2019
eae788b
Fixed typo missing return type
JoshuaSBrown Dec 21, 2019
d98bcf7
Include boundarycondition include
JoshuaSBrown Dec 21, 2019
a70d676
Fixed typo
JoshuaSBrown Dec 21, 2019
bacd48c
Fixed typo of internal type
JoshuaSBrown Dec 21, 2019
aeaa6be
Corrected typo in method name
JoshuaSBrown Dec 21, 2019
ae6b95d
Corrected typo
JoshuaSBrown Dec 21, 2019
7a0339d
Fixed typo
JoshuaSBrown Dec 21, 2019
70fc6b5
Pass boundary condtion to bead mapping apply function call, and creat…
JoshuaSBrown Dec 21, 2019
2a55c42
Merge branch 'master' into piece-wise-remove-topology-item
JoshuaSBrown Dec 21, 2019
1ed1b69
Remove unneeded include from test
JoshuaSBrown Dec 21, 2019
e0a8f3d
Merge branch 'piece-wise-remove-topology-item' of https://github.com/…
JoshuaSBrown Dec 21, 2019
552dc3b
Remove beadtype.h include
JoshuaSBrown Dec 21, 2019
83bd3c0
Removed beadtype include from test_bead
JoshuaSBrown Dec 21, 2019
a86d3b9
Removed beadtype include from test_beadtriple
JoshuaSBrown Dec 21, 2019
0876040
Removed beadtype from test_nblist_3body
JoshuaSBrown Dec 21, 2019
c156767
Removed beadtype from nblistgrid_3body
JoshuaSBrown Dec 21, 2019
2b2ab00
Remove beadtype include from test_triplelist
JoshuaSBrown Dec 21, 2019
9f6d4f1
Merge branch 'master' into piece-wise-remove-topology-item
JoshuaSBrown Dec 21, 2019
4c7adff
Made beadmap apply method safer for MapSphere
JoshuaSBrown Dec 21, 2019
618309e
Made Map_Ellipsoid Apply method safer, removed or statement
JoshuaSBrown Dec 21, 2019
656d9c3
Merge branch 'master' into piece-wise-remove-topology-item
JoshuaSBrown Dec 21, 2019
32bfdec
Remove topology item from basebead.h
JoshuaSBrown Dec 21, 2019
182fcf2
Fixed includes in test
JoshuaSBrown Dec 22, 2019
9330b9a
Update formatting boundarycondition.cc
JoshuaSBrown Dec 22, 2019
5fe31d2
Fix formatting
JoshuaSBrown Dec 22, 2019
f3d8fd4
Fix to ensure get position is consistent between cg_top and top
JoshuaSBrown Dec 23, 2019
56d5b2e
Applied fix
JoshuaSBrown Dec 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions include/votca/csg/basebead.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* limitations under the License.
*
*/
#pragma once
#ifndef VOTCA_CSG_BASEBEAD_H
#define VOTCA_CSG_BASEBEAD_H
#pragma once

#include "topologyitem.h"
#include <assert.h>
#include <memory>
#include <votca/tools/constants.h>
Expand Down Expand Up @@ -74,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
Expand Down Expand Up @@ -141,8 +137,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;
Expand Down
12 changes: 6 additions & 6 deletions include/votca/csg/bead.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*
*/

#ifndef _VOTCA_CSG_BEAD_H
#define _VOTCA_CSG_BEAD_H
#ifndef VOTCA_CSG_BEAD_H
#define VOTCA_CSG_BEAD_H
#pragma once

#include <assert.h>
#include <cassert>
Expand Down Expand Up @@ -289,10 +290,9 @@ class Bead : public BaseBead {
bool bead_force_set_;

/// constructor
Bead(Topology *owner, 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) {
topology_item_._parent = owner;
setId(id);
setType(type);
setName(name);
Expand Down Expand Up @@ -372,4 +372,4 @@ inline void Bead::HasW(bool b) { bW_ = b; }
} // namespace csg
} // namespace votca

#endif // _VOTCA_CSG_BEAD_H
#endif // VOTCA_CSG_BEAD_H
51 changes: 0 additions & 51 deletions include/votca/csg/beadtype.h

This file was deleted.

10 changes: 9 additions & 1 deletion include/votca/csg/boundarycondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*
*/
#pragma once
#ifndef VOTCA_CSG_BOUNDARYCONDITION_H
#define VOTCA_CSG_BOUNDARYCONDITION_H
#pragma once

#include <memory>
#include <votca/tools/eigen.h>
Expand Down Expand Up @@ -62,6 +62,14 @@ 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
Expand Down
11 changes: 6 additions & 5 deletions include/votca/csg/interaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*
*/

#ifndef _VOTCA_CSG_INTERACTION_H
#define _VOTCA_CSG_INTERACTION_H
#pragma once
#ifndef VOTCA_CSG_INTERACTION_H
#define VOTCA_CSG_INTERACTION_H

#include "bead.h"
#include "topology.h"
Expand Down Expand Up @@ -79,8 +80,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<size_t>(bead) < _beads.size());
return _beads[bead];
}
Expand Down Expand Up @@ -321,4 +322,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
16 changes: 9 additions & 7 deletions include/votca/csg/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
*
*/

#ifndef _VOTCA_CSG_MAP_H
#define _VOTCA_CSG_MAP_H
#ifndef VOTCA_CSG_MAP_H
#define VOTCA_CSG_MAP_H
#pragma once

#include "boundarycondition.h"
#include "molecule.h"
#include <vector>
#include <votca/tools/eigen.h>
Expand All @@ -37,7 +39,7 @@ class Map {

void AddBeadMap(BeadMap *bmap) { _maps.push_back(bmap); }

void Apply();
void Apply(const BoundaryCondition &bc);

protected:
Molecule _in, _out;
Expand All @@ -50,7 +52,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);

Expand All @@ -76,7 +78,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;
Expand Down Expand Up @@ -106,12 +108,12 @@ 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:
};

} // namespace csg
} // namespace votca

#endif /* _VOTCA_CSG_MAP_H */
#endif // VOTCA_CSG_MAP_H
13 changes: 6 additions & 7 deletions include/votca/csg/molecule.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*
*/

#ifndef _VOTCA_CSG_MOLECULE_H
#define _VOTCA_CSG_MOLECULE_H
#pragma once
#ifndef VOTCA_CSG_MOLECULE_H
#define VOTCA_CSG_MOLECULE_H

#include "bead.h"
#include "topologyitem.h"
#include <assert.h>
#include <map>
#include <string>
Expand All @@ -39,7 +39,7 @@ class Interaction;
\todo sort atoms in molecule

*/
class Molecule : public TopologyItem {
class Molecule {
public:
/// get the molecule ID
Index getId() const { return _id; }
Expand Down Expand Up @@ -98,8 +98,7 @@ class Molecule : public TopologyItem {
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;
};
Expand All @@ -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
14 changes: 6 additions & 8 deletions include/votca/csg/residue.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* limitations under the License.
*
*/
#pragma once
#ifndef VOTCA_CSG_RESIDUE_H
#define VOTCA_CSG_RESIDUE_H

#ifndef _VOTCA_CSG_RESIDUE_H
#define _VOTCA_CSG_RESIDUE_H

#include "topologyitem.h"
#include <string>

namespace votca {
Expand All @@ -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();
Expand All @@ -46,8 +45,7 @@ class Residue : public TopologyItem {

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;
};

Expand All @@ -56,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
26 changes: 18 additions & 8 deletions include/votca/csg/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*
*/

#ifndef _VOTCA_CSG_TOPOLOGY_H
#define _VOTCA_CSG_TOPOLOGY_H
#ifndef VOTCA_CSG_TOPOLOGY_H
#define VOTCA_CSG_TOPOLOGY_H
#pragma once

#include <cassert>
#include <list>
Expand All @@ -25,7 +26,6 @@
#include <vector>

#include "bead.h"
#include "beadtype.h"
#include "boundarycondition.h"
#include "exclusionlist.h"
#include "molecule.h"
Expand Down Expand Up @@ -176,6 +176,9 @@ class Topology {
* @return bonded interaction container
*/
InteractionContainer &BondedInteractions() { return _interactions; }
const InteractionContainer &BondedInteractions() const {
return _interactions;
}

void AddBondedInteraction(Interaction *ic);
std::list<Interaction *> InteractionsInGroup(const std::string &group);
Expand Down Expand Up @@ -289,6 +292,13 @@ 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
Expand Down Expand Up @@ -427,25 +437,25 @@ 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;
}

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;
}
Expand All @@ -464,4 +474,4 @@ inline void Topology::InsertExclusion(Bead *bead1, iteratable &l) {

#include "interaction.h"

#endif /* _VOTCA_CSG_TOPOLOGY_H */
#endif // VOTCA_CSG_TOPOLOGY_H
Loading