votca 2024.2-dev
Loading...
Searching...
No Matches
votca::csg::BeadMotif Class Reference

Designed determine what kind of structure a beadstructure has. More...

#include <beadmotif.h>

Inheritance diagram for votca::csg::BeadMotif:
Collaboration diagram for votca::csg::BeadMotif:

Public Types

enum  MotifType {
  empty , single_bead , line , loop ,
  fused_ring , single_structure , multiple_structures , undefined
}
 

Public Member Functions

 BeadMotif ()=default
 
 BeadMotif (const BeadStructure &structure)
 
MotifType getType ()
 Gets the motif type, calculates it first if it is not yet known.
 
bool isMotifSimple ()
 Determines if the motif type is a simple type.
 
void ConnectBeads (const Index &bead1_id, const Index &bead2_id) final
 Adds a new connection to the motif.
 
- Public Member Functions inherited from votca::csg::BeadStructure
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
 
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.
 

Private Member Functions

void UpdateOnBeadAddition_ () final
 
void InitializeGraph_ ()
 
bool junctionExist_ ()
 
void CalculateType_ ()
 
bool isSingle_ () const noexcept
 
bool isLine_ ()
 
bool isLoop_ ()
 
bool isFusedRing_ ()
 

Private Attributes

MotifType type_ = MotifType::undefined
 
bool junctionsUpToDate_ = false
 
bool type_up_to_date_ = false
 
std::vector< Indexjunctions_
 
tools::ReducedGraph reduced_graph_
 

Additional Inherited Members

- Protected Member Functions inherited from votca::csg::BeadStructure
void InitializeGraph_ ()
 
void CalculateStructure_ ()
 
tools::GraphNode BeadInfoToGraphNode_ (const BeadInfo &)
 
- Protected Attributes inherited from votca::csg::BeadStructure
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 determine what kind of structure a beadstructure has.

Wants a beadstructure is created there are several different forms it can have, this class helps to classify and break structures up into the appropriate sub class. The possible classes include:

Some of the structures are considered fundamental and cannot be broken up any more than they are. These elements are listed as simple

  1. Single bead // Simple
  2. Line // Simple
  3. Loop // Simple
  4. Fused Ring // Simple
  5. Single Structure // Complex
  6. Multiple Structures // Complex
  1. Undefined // Undefined

Examples of each type are shown below connections are indicated with lines

Single Bead:

H1

Line:

C1 - C2 - C3 H1 - H2 H1 H2 \ / O1 Loop:

C1 - C2 C5 - C6 | | / \ C4 - C3 C7 C8 \ / C9 - C10

Fused Ring:

C5 - C6 / \ C7 C8 - C11 \ / \ C9 - C10 C12 \ / C13 - C14

Single Structures:

 H1                         H5      H6
 |                           \     /

H2 - C1 - H3 C1 - C2 | / \ H4 H7 - C3 C4 - H8 \ / C5 - C6 / \ H9 H10

Multiple Structures:

Any combination of more than one structure

The Single, line, loop and Fused Ring types are all elementary types that represent a fundamental structural unit.

Single Structure represents a type that has not been broken up into its fundamental components but consists of a single interconnected structure.

Multiple Structures means that the structure consists of multiple structures

Undefined means the structure has not yet been categorized.

Though the Beadmotif inherits from the Beadstructure its methods are kept private the reason is that the type might be incorrect if an AddBead from the original class is called.

Definition at line 111 of file beadmotif.h.

Member Enumeration Documentation

◆ MotifType

Enumerator
empty 
single_bead 
line 
loop 
fused_ring 
single_structure 
multiple_structures 
undefined 

Definition at line 113 of file beadmotif.h.

Constructor & Destructor Documentation

◆ BeadMotif() [1/2]

votca::csg::BeadMotif::BeadMotif ( )
default

◆ BeadMotif() [2/2]

votca::csg::BeadMotif::BeadMotif ( const BeadStructure & structure)
inline

Definition at line 126 of file beadmotif.h.

Member Function Documentation

◆ CalculateType_()

void votca::csg::BeadMotif::CalculateType_ ( )
private

Definition at line 53 of file beadmotif.cc.

◆ ConnectBeads()

void votca::csg::BeadMotif::ConnectBeads ( const Index & bead1_id,
const Index & bead2_id )
finalvirtual

Adds a new connection to the motif.

Also switches an internal attribute to indicate the beadtype is no longer up to date.

Parameters
[in]bead1_id- id of the first bead that are connected
[in]bead2_id- id of the second bead that are connected

Reimplemented from votca::csg::BeadStructure.

Definition at line 208 of file beadmotif.cc.

◆ getType()

BeadMotif::MotifType votca::csg::BeadMotif::getType ( )

Gets the motif type, calculates it first if it is not yet known.

Definition at line 191 of file beadmotif.cc.

◆ InitializeGraph_()

void votca::csg::BeadMotif::InitializeGraph_ ( )
private

Definition at line 40 of file beadmotif.cc.

◆ isFusedRing_()

bool votca::csg::BeadMotif::isFusedRing_ ( )
private

One has to explore the whole tree from each of the junctions to determine if the model is a fused ring or not. For speed it might make since to reduce the graph first to junctions of 3 or more.

if There is not way back to the junction than you have something like this:

c1 - c2 - c5 - c6 | | | | c3 - c4 c7 - c8

Say you start at c2 and head down tree c5 if you never find a way back you can split it

If you have something like this

c1 - c2 - c3 | / \ | c4 c5

Then you do not have a fused ring, must be represented as a joint and two lines. Exploring a tree will only lead to one way back.

   c6
  /  |

c1 - c2 - c3 | / \ | c4 c5

Still acts like a joint, For it not to be a joint exploring a single branch originating from the junction should lead to exploration of all the edges.

Definition at line 153 of file beadmotif.cc.

◆ isLine_()

bool votca::csg::BeadMotif::isLine_ ( )
private

Definition at line 79 of file beadmotif.cc.

◆ isLoop_()

bool votca::csg::BeadMotif::isLoop_ ( )
private

Definition at line 104 of file beadmotif.cc.

◆ isMotifSimple()

bool votca::csg::BeadMotif::isMotifSimple ( )

Determines if the motif type is a simple type.

If the motif is of type single_bead, line, loop or fused ring it will return true.

Returns
true if the bead motif type is simple

Definition at line 199 of file beadmotif.cc.

◆ isSingle_()

bool votca::csg::BeadMotif::isSingle_ ( ) const
privatenoexcept

Definition at line 72 of file beadmotif.cc.

◆ junctionExist_()

bool votca::csg::BeadMotif::junctionExist_ ( )
private

Definition at line 45 of file beadmotif.cc.

◆ UpdateOnBeadAddition_()

void votca::csg::BeadMotif::UpdateOnBeadAddition_ ( )
finalprivatevirtual

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

Reimplemented from votca::csg::BeadStructure.

Definition at line 181 of file beadmotif.cc.

Member Data Documentation

◆ junctions_

std::vector<Index> votca::csg::BeadMotif::junctions_
private

Definition at line 157 of file beadmotif.h.

◆ junctionsUpToDate_

bool votca::csg::BeadMotif::junctionsUpToDate_ = false
private

Definition at line 154 of file beadmotif.h.

◆ reduced_graph_

tools::ReducedGraph votca::csg::BeadMotif::reduced_graph_
private

Definition at line 158 of file beadmotif.h.

◆ type_

MotifType votca::csg::BeadMotif::type_ = MotifType::undefined
private

Definition at line 153 of file beadmotif.h.

◆ type_up_to_date_

bool votca::csg::BeadMotif::type_up_to_date_ = false
private

Definition at line 155 of file beadmotif.h.


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