votca 2024-dev
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
votca::csg::BeadStructure Class Reference

Designed to determine if the structure beads passed in. More...

#include <beadstructure.h>

Inheritance diagram for votca::csg::BeadStructure:
Inheritance graph
[legend]
Collaboration diagram for votca::csg::BeadStructure:
Collaboration graph
[legend]

Classes

struct  BeadInfo
 Small structure to help store bead info relevant to the structure. More...
 

Public Member Functions

virtual ~BeadStructure ()=default
 
BeadStructure getSubStructure (const std::vector< Index > &idx, const std::vector< tools::Edge > &edges) const
 Given indices and edges that exist are a subset of beadstructure, return the sub-beadstructure.
 
bool isSingleStructure ()
 Determine if the bead structure consists of a single connected structure.
 
size_t BeadCount () const noexcept
 returns the number of beads in the bead structure
 
template<class T >
void AddBead (const T &bead)
 add a bead to the bead structure
 
virtual void ConnectBeads (const Index &bead1_id, const Index &bead2_id)
 Create a connection between two beads in the structure.
 
std::vector< IndexgetNeighBeadIds (const Index &index)
 Return a vector of all the ids of the beads neighboring the index.
 
tools::Graph getGraph ()
 
bool isStructureEquivalent (BeadStructure &beadstructure)
 Compare the topology of two bead structures.
 
bool BeadExist (Index bead_id) const
 Determine if a bead exists in the structure.
 
std::vector< IndexgetBeadIds () const
 Return the ids of the beads that are in the structure.
 

Protected Member Functions

virtual void UpdateOnBeadAddition_ ()
 
void InitializeGraph_ ()
 
void CalculateStructure_ ()
 
tools::GraphNode BeadInfoToGraphNode_ (const BeadInfo &)
 

Protected Attributes

bool structureIdUpToDate = false
 
bool graphUpToDate = false
 
bool single_structureUpToDate_ = false
 
bool single_structure_ = false
 
std::string structure_id_ = ""
 
tools::Graph graph_
 
std::set< tools::Edgeconnections_
 
std::unordered_map< Index, BeadInfobeads_
 
std::unordered_map< Index, tools::GraphNodegraphnodes_
 

Detailed Description

Designed to determine if the structure beads passed in.

Essentially it will have the functionality to determine if the stored beads make up a single molecule. It can also break the stored beads up into molecules. It can compare two bead structures and determine if they are the same structure. The Ids of a bead will not determine if a structure is equivalent or not. Each bead must have a unique Id.

E.g. If a beadstructure is composed of the following:

BeadStructure 1 Name:"A" Id:1 -— Name:"B" Id:2

BeadStucture 2 Name:"A" Id:3 -— Name:"B" Id:4

Here BeadStructure 1 and 2 will compare equal

Definition at line 51 of file beadstructure.h.

Constructor & Destructor Documentation

◆ ~BeadStructure()

virtual votca::csg::BeadStructure::~BeadStructure ( )
virtualdefault

Member Function Documentation

◆ AddBead()

template<class T >
void votca::csg::BeadStructure::AddBead ( const T &  bead)

add a bead to the bead structure

The same bead cannot be added twice.

Definition at line 159 of file beadstructure.h.

◆ BeadCount()

size_t votca::csg::BeadStructure::BeadCount ( ) const
inlinenoexcept

returns the number of beads in the bead structure

Definition at line 87 of file beadstructure.h.

◆ BeadExist()

bool votca::csg::BeadStructure::BeadExist ( Index  bead_id) const
inline

Determine if a bead exists in the structure.

Definition at line 125 of file beadstructure.h.

◆ BeadInfoToGraphNode_()

tools::GraphNode BeadStructure::BeadInfoToGraphNode_ ( const BeadInfo bead_info)
protected

Add graphnodes

Definition at line 63 of file beadstructure.cc.

◆ CalculateStructure_()

void BeadStructure::CalculateStructure_ ( )
protected

Definition at line 54 of file beadstructure.cc.

◆ ConnectBeads()

void BeadStructure::ConnectBeads ( const Index bead1_id,
const Index bead2_id 
)
virtual

Create a connection between two beads in the structure.

A bead cannot be connected to itself. It also may not be connected to a bead that has not yet been added to the structure.

Reimplemented in votca::csg::BeadMotif.

Definition at line 115 of file beadstructure.cc.

◆ getBeadIds()

std::vector< Index > BeadStructure::getBeadIds ( ) const

Return the ids of the beads that are in the structure.

Returns
vector of the ids

Do not use graph_.getVertices() because this would require that the graph is updated

Definition at line 187 of file beadstructure.cc.

◆ getGraph()

tools::Graph BeadStructure::getGraph ( )

Definition at line 134 of file beadstructure.cc.

◆ getNeighBeadIds()

std::vector< Index > BeadStructure::getNeighBeadIds ( const Index index)

Return a vector of all the ids of the beads neighboring the index.

Definition at line 179 of file beadstructure.cc.

◆ getSubStructure()

BeadStructure BeadStructure::getSubStructure ( const std::vector< Index > &  idx,
const std::vector< tools::Edge > &  edges 
) const

Given indices and edges that exist are a subset of beadstructure, return the sub-beadstructure.

If the edges and and indices passed in do not exist within the current BeadStructure a runtime exception is thrown, as the the sub structure is not actually a sub structure of the current BeadStructure.

Parameters
idxIndices of the substructure, must exist within the current BeadStructure
edgesEdges of the substructure, must exist within the current BeadStructure
Returns
BeadStructure which is a substructure of BeadStructure

Definition at line 83 of file beadstructure.cc.

◆ InitializeGraph_()

void BeadStructure::InitializeGraph_ ( )
protected

Definition at line 38 of file beadstructure.cc.

◆ isSingleStructure()

bool BeadStructure::isSingleStructure ( )

Determine if the bead structure consists of a single connected structure.

This function will determine if all beads in the structure are connected somehow to everyother bead. The connection does not have to be direct

Returns
- returns a boolean true if it is a single Structure

Definition at line 139 of file beadstructure.cc.

◆ isStructureEquivalent()

bool BeadStructure::isStructureEquivalent ( BeadStructure beadstructure)

Compare the topology of two bead structures.

This function looks at how the beads are arranged within the bead structure and determines if the topology is the same.

Parameters
[in]beadstructure- beadstructure to compare with
Returns
- if the same returns true else false

Definition at line 169 of file beadstructure.cc.

◆ UpdateOnBeadAddition_()

virtual void votca::csg::BeadStructure::UpdateOnBeadAddition_ ( )
inlineprotectedvirtual

If extra initialization is needed by a child class when a bead is added this method can be overridden.

Reimplemented in votca::csg::BeadMotif.

Definition at line 142 of file beadstructure.h.

Member Data Documentation

◆ beads_

std::unordered_map<Index, BeadInfo> votca::csg::BeadStructure::beads_
protected

Definition at line 154 of file beadstructure.h.

◆ connections_

std::set<tools::Edge> votca::csg::BeadStructure::connections_
protected

Definition at line 153 of file beadstructure.h.

◆ graph_

tools::Graph votca::csg::BeadStructure::graph_
protected

Definition at line 152 of file beadstructure.h.

◆ graphnodes_

std::unordered_map<Index, tools::GraphNode> votca::csg::BeadStructure::graphnodes_
protected

Definition at line 155 of file beadstructure.h.

◆ graphUpToDate

bool votca::csg::BeadStructure::graphUpToDate = false
protected

Definition at line 148 of file beadstructure.h.

◆ single_structure_

bool votca::csg::BeadStructure::single_structure_ = false
protected

Definition at line 150 of file beadstructure.h.

◆ single_structureUpToDate_

bool votca::csg::BeadStructure::single_structureUpToDate_ = false
protected

Definition at line 149 of file beadstructure.h.

◆ structure_id_

std::string votca::csg::BeadStructure::structure_id_ = ""
protected

Definition at line 151 of file beadstructure.h.

◆ structureIdUpToDate

bool votca::csg::BeadStructure::structureIdUpToDate = false
protected

Definition at line 147 of file beadstructure.h.


The documentation for this class was generated from the following files: