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

topology of the whole system More...

#include <topology.h>

Collaboration diagram for votca::csg::Topology:

Public Member Functions

 Topology ()
 constructor
 
 ~Topology ()
 
void Cleanup ()
 Cleans up all the stored data.
 
BeadCreateBead (Bead::Symmetry symmetry, std::string name, std::string type, Index resnr, double m, double q)
 Creates a new Bead.
 
MoleculeCreateMolecule (std::string name)
 Creates a new molecule.
 
void CheckMoleculeNaming (void)
 checks weather molecules with the same name really contain the same number of beads
 
ResidueCreateResidue (std::string name)
 Create a new resiude.
 
ResidueCreateResidue (std::string name, Index id)
 
void CreateMoleculesByRange (std::string name, Index first, Index nbeads, Index nmolecules)
 create molecules based on blocks of atoms
 
Index MoleculeCount () const
 number of molecules in the system
 
Index BeadCount () const
 
Index ResidueCount () const
 
MoleculeMoleculeByIndex (Index index)
 
BeadContainerBeads ()
 
ResidueContainerResidues ()
 
const ResidueContainerResidues () const
 
MoleculeContainerMolecules ()
 
const MoleculeContainerMolecules () const
 
InteractionContainerBondedInteractions ()
 
const InteractionContainerBondedInteractions () const
 
void AddBondedInteraction (Interaction *ic)
 
std::vector< Interaction * > InteractionsInGroup (const std::string &group)
 
bool BeadTypeExist (std::string type) const
 Determine if a bead type exists.
 
void RegisterBeadType (std::string type)
 Register the bead type with the topology object.
 
Index getBeadTypeId (std::string type) const
 Given a bead type this method returns the id associated with the type.
 
BeadgetBead (const Index i)
 Returns a pointer to the bead with index i.
 
const BeadgetBead (const Index i) const
 
ResiduegetResidue (const Index i)
 
const ResiduegetResidue (const Index i) const
 
MoleculegetMolecule (const Index i)
 
const MoleculegetMolecule (const Index i) const
 
void ClearMoleculeList ()
 
void CopyTopologyData (Topology *top)
 copy topology data of different topology
 
void RenameMolecules (std::string range, std::string name)
 rename all the molecules in range
 
void RenameBeadType (std::string name, std::string newname)
 rename all the bead types
 
void SetBeadTypeMass (std::string name, double value)
 set the mass of all the beads of a certain type
 
void setBox (const Eigen::Matrix3d &box, BoundaryCondition::eBoxtype boxtype=BoundaryCondition::typeAuto)
 
const Eigen::Matrix3d & getBox () const
 
const BoundaryConditiongetBoundary () const
 Return the boundary condition object.
 
void setTime (double t)
 
double getTime () const
 
void setStep (Index s)
 
Index getStep () const
 
void setParticleGroup (std::string particle_group)
 
std::string getParticleGroup () const
 
Eigen::Vector3d getDist (Index bead1, Index bead2) const
 pbc correct distance of two beads
 
Eigen::Vector3d BCShortestConnection (const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const
 calculate shortest vector connecting two points
 
double ShortestBoxSize () const
 return the shortest box size
 
double BoxVolume () const
 
void RebuildExclusions ()
 
ExclusionListgetExclusions ()
 
const ExclusionListgetExclusions () const
 
BoundaryCondition::eBoxtype getBoxType () const
 
template<typename iteratable >
void InsertExclusion (Bead *bead1, iteratable &l)
 
bool HasVel ()
 
void SetHasVel (const bool v)
 
bool HasForce ()
 
void SetHasForce (const bool v)
 

Protected Member Functions

BoundaryCondition::eBoxtype autoDetectBoxType (const Eigen::Matrix3d &box) const
 

Protected Attributes

std::unique_ptr< BoundaryConditionbc_
 
std::unordered_map< std::string, Indexbeadtypes_
 bead types in the topology
 
BeadContainer beads_
 beads in the topology
 
MoleculeContainer molecules_
 molecules in the topology
 
ResidueContainer residues_
 residues in the topology
 
InteractionContainer interactions_
 bonded interactions in the topology
 
ExclusionList exclusions_
 
std::map< std::string, Indexinteraction_groups_
 
std::map< std::string, std::vector< Interaction * > > interactions_by_group_
 
double time_ = 0.0
 
Index step_ = 0
 
bool has_vel_ = false
 
bool has_force_ = false
 
std::string particle_group_ = "unassigned"
 The particle group (For H5MD file format)
 

Detailed Description

topology of the whole system

The Topology class stores the topology of the system like the beads, bonds, molecules and residues.

Definition at line 81 of file topology.h.

Constructor & Destructor Documentation

◆ Topology()

votca::csg::Topology::Topology ( )
inline

constructor

Definition at line 84 of file topology.h.

◆ ~Topology()

votca::csg::Topology::~Topology ( )

Definition at line 47 of file topology.cc.

Member Function Documentation

◆ AddBondedInteraction()

void votca::csg::Topology::AddBondedInteraction ( Interaction * ic)

Definition at line 188 of file topology.cc.

◆ autoDetectBoxType()

BoundaryCondition::eBoxtype votca::csg::Topology::autoDetectBoxType ( const Eigen::Matrix3d & box) const
protected

Definition at line 252 of file topology.cc.

◆ BCShortestConnection()

Eigen::Vector3d votca::csg::Topology::BCShortestConnection ( const Eigen::Vector3d & r_i,
const Eigen::Vector3d & r_j ) const

calculate shortest vector connecting two points

Parameters
r_ifirst point
r_jsecond point
Returns
distance vector

calculates the smallest distance between two points with correct treatment of pbc

Definition at line 238 of file topology.cc.

◆ BeadCount()

Index votca::csg::Topology::BeadCount ( ) const
inline

number of beads in the system

Returns
number of beads in the system

Definition at line 150 of file topology.h.

◆ Beads()

BeadContainer & votca::csg::Topology::Beads ( )
inline

access containter with all beads

Returns
bead container

Definition at line 169 of file topology.h.

◆ BeadTypeExist()

bool votca::csg::Topology::BeadTypeExist ( std::string type) const

Determine if a bead type exists.

Returns
bool true if it has been registered

Definition at line 210 of file topology.cc.

◆ BondedInteractions() [1/2]

InteractionContainer & votca::csg::Topology::BondedInteractions ( )
inline

access containter with all bonded interactions

Returns
bonded interaction container

Definition at line 189 of file topology.h.

◆ BondedInteractions() [2/2]

const InteractionContainer & votca::csg::Topology::BondedInteractions ( ) const
inline

Definition at line 190 of file topology.h.

◆ BoxVolume()

double votca::csg::Topology::BoxVolume ( ) const

calculates the box volume

Returns
box volume

Definition at line 248 of file topology.cc.

◆ CheckMoleculeNaming()

void votca::csg::Topology::CheckMoleculeNaming ( void )

checks weather molecules with the same name really contain the same number of beads

Definition at line 169 of file topology.cc.

◆ Cleanup()

void votca::csg::Topology::Cleanup ( )

Cleans up all the stored data.

Definition at line 49 of file topology.cc.

◆ ClearMoleculeList()

void votca::csg::Topology::ClearMoleculeList ( )
inline

delete all molecule information

Definition at line 237 of file topology.h.

◆ CopyTopologyData()

void votca::csg::Topology::CopyTopologyData ( Topology * top)

copy topology data of different topology

Parameters
toptopology to copy from

Definition at line 102 of file topology.cc.

◆ CreateBead()

Bead * votca::csg::Topology::CreateBead ( Bead::Symmetry symmetry,
std::string name,
std::string type,
Index resnr,
double m,
double q )
inline

Creates a new Bead.

Parameters
[in]symmetrysymmetry of the bead, 1: spherical 3: ellipsoidal
[in]namename of the bead
[in]typebead type
[in]resnrresidue number
[in]mmass
[in]qcharge
Returns
pointer to created bead

The function creates a new bead and adds it to the list of beads.

Definition at line 441 of file topology.h.

◆ CreateMolecule()

Molecule * votca::csg::Topology::CreateMolecule ( std::string name)
inline

Creates a new molecule.

Parameters
[in]namename of the molecule
Returns
pointer to created molecule

Definition at line 449 of file topology.h.

◆ CreateMoleculesByRange()

void votca::csg::Topology::CreateMoleculesByRange ( std::string name,
Index first,
Index nbeads,
Index nmolecules )

create molecules based on blocks of atoms

Parameters
[in]namemolecule name
[in]firstfirst bead
[in]nbeadsnumber of beads per molecule
[in]nmoleculesnumber of molecules
Todo
implement checking, only used in xml topology reader

Definition at line 72 of file topology.cc.

◆ CreateResidue() [1/2]

Residue & votca::csg::Topology::CreateResidue ( std::string name)
inline

Create a new resiude.

Parameters
[in]nameresidue name
Returns
created residue

Definition at line 462 of file topology.h.

◆ CreateResidue() [2/2]

Residue & votca::csg::Topology::CreateResidue ( std::string name,
Index id )
inline

Definition at line 454 of file topology.h.

◆ getBead() [1/2]

Bead * votca::csg::Topology::getBead ( const Index i)
inline

Returns a pointer to the bead with index i.

Parameters
[in]ithe id of the bead
Returns
Bead * is a pointer to the bead

Definition at line 227 of file topology.h.

◆ getBead() [2/2]

const Bead * votca::csg::Topology::getBead ( const Index i) const
inline

Definition at line 228 of file topology.h.

◆ getBeadTypeId()

Index votca::csg::Topology::getBeadTypeId ( std::string type) const

Given a bead type this method returns the id associated with the type.

Parameters
[in]typestring name of the type
Returns
Index the id of the type

Definition at line 133 of file topology.cc.

◆ getBoundary()

const BoundaryCondition & votca::csg::Topology::getBoundary ( ) const
inline

Return the boundary condition object.

Definition at line 303 of file topology.h.

◆ getBox()

const Eigen::Matrix3d & votca::csg::Topology::getBox ( ) const
inline

get the simulation box

Returns
triclinic box matrix

Definition at line 298 of file topology.h.

◆ getBoxType()

BoundaryCondition::eBoxtype votca::csg::Topology::getBoxType ( ) const
inline

Definition at line 394 of file topology.h.

◆ getDist()

Eigen::Vector3d votca::csg::Topology::getDist ( Index bead1,
Index bead2 ) const

pbc correct distance of two beads

Parameters
bead1index of first bead
bead2index of second bead
Returns
distance vector

calculates the smallest distance between two beads with correct treatment of pbc

Definition at line 243 of file topology.cc.

◆ getExclusions() [1/2]

ExclusionList & votca::csg::Topology::getExclusions ( )
inline

access exclusion list

Returns
exclusion list

Definition at line 391 of file topology.h.

◆ getExclusions() [2/2]

const ExclusionList & votca::csg::Topology::getExclusions ( ) const
inline

Definition at line 392 of file topology.h.

◆ getMolecule() [1/2]

Molecule * votca::csg::Topology::getMolecule ( const Index i)
inline

Definition at line 231 of file topology.h.

◆ getMolecule() [2/2]

const Molecule * votca::csg::Topology::getMolecule ( const Index i) const
inline

Definition at line 232 of file topology.h.

◆ getParticleGroup()

std::string votca::csg::Topology::getParticleGroup ( ) const
inline

Gets the particle group.

Returns
The name of a particle group.

Definition at line 343 of file topology.h.

◆ getResidue() [1/2]

Residue & votca::csg::Topology::getResidue ( const Index i)
inline

Definition at line 229 of file topology.h.

◆ getResidue() [2/2]

const Residue & votca::csg::Topology::getResidue ( const Index i) const
inline

Definition at line 230 of file topology.h.

◆ getStep()

Index votca::csg::Topology::getStep ( ) const
inline

get the step number of current frame

Returns
step number

Definition at line 329 of file topology.h.

◆ getTime()

double votca::csg::Topology::getTime ( ) const
inline

get the time of current frame

Returns
simulation time in ns

Definition at line 317 of file topology.h.

◆ HasForce()

bool votca::csg::Topology::HasForce ( )
inline

Definition at line 402 of file topology.h.

◆ HasVel()

bool votca::csg::Topology::HasVel ( )
inline

Definition at line 399 of file topology.h.

◆ InsertExclusion()

template<typename iteratable >
void votca::csg::Topology::InsertExclusion ( Bead * bead1,
iteratable & l )
inline

Definition at line 475 of file topology.h.

◆ InteractionsInGroup()

std::vector< Interaction * > votca::csg::Topology::InteractionsInGroup ( const std::string & group)

Definition at line 201 of file topology.cc.

◆ MoleculeByIndex()

Molecule * votca::csg::Topology::MoleculeByIndex ( Index index)
inline

get molecule by index

Parameters
indexmolecule number
Returns
pointer to molecule

Definition at line 470 of file topology.h.

◆ MoleculeCount()

Index votca::csg::Topology::MoleculeCount ( ) const
inline

number of molecules in the system

Returns
number of molecule in topology

Definition at line 144 of file topology.h.

◆ Molecules() [1/2]

MoleculeContainer & votca::csg::Topology::Molecules ( )
inline

access containter with all molecules

Returns
molecule container

Definition at line 182 of file topology.h.

◆ Molecules() [2/2]

const MoleculeContainer & votca::csg::Topology::Molecules ( ) const
inline

Definition at line 183 of file topology.h.

◆ RebuildExclusions()

void votca::csg::Topology::RebuildExclusions ( )

rebuild exclusion list

Definition at line 250 of file topology.cc.

◆ RegisterBeadType()

void votca::csg::Topology::RegisterBeadType ( std::string type)

Register the bead type with the topology object.

Records are kept of the different bead types in the topology object. This method stores the bead type.

Definition at line 214 of file topology.cc.

◆ RenameBeadType()

void votca::csg::Topology::RenameBeadType ( std::string name,
std::string newname )

rename all the bead types

Parameters
namecurrent rame of the bead type
newnamenew name of bead type

Definition at line 150 of file topology.cc.

◆ RenameMolecules()

void votca::csg::Topology::RenameMolecules ( std::string range,
std::string name )

rename all the molecules in range

Parameters
rangerange string of type 1:2:10 = 1, 3, 5, 7, ...
namenew name of molecule range is a string which is parsed by RangeParser,

Definition at line 138 of file topology.cc.

◆ ResidueCount()

Index votca::csg::Topology::ResidueCount ( ) const
inline

number of residues in the system

Returns
number of residues

Definition at line 156 of file topology.h.

◆ Residues() [1/2]

ResidueContainer & votca::csg::Topology::Residues ( )
inline

access containter with all residues

Returns
bead container

Definition at line 175 of file topology.h.

◆ Residues() [2/2]

const ResidueContainer & votca::csg::Topology::Residues ( ) const
inline

Definition at line 176 of file topology.h.

◆ SetBeadTypeMass()

void votca::csg::Topology::SetBeadTypeMass ( std::string name,
double value )

set the mass of all the beads of a certain type

Parameters
namethe bead type
valuemass value

Definition at line 160 of file topology.cc.

◆ setBox()

void votca::csg::Topology::setBox ( const Eigen::Matrix3d & box,
BoundaryCondition::eBoxtype boxtype = BoundaryCondition::typeAuto )
inline

set the simulation box

Parameters
boxtriclinic box matrix
boxtypetype of the box (triclinic, orthorhombic, open)

Definition at line 272 of file topology.h.

◆ SetHasForce()

void votca::csg::Topology::SetHasForce ( const bool v)
inline

Definition at line 403 of file topology.h.

◆ SetHasVel()

void votca::csg::Topology::SetHasVel ( const bool v)
inline

Definition at line 400 of file topology.h.

◆ setParticleGroup()

void votca::csg::Topology::setParticleGroup ( std::string particle_group)
inline

Sets the particle group. (For the H5MD file format)

Parameters
particle_groupThe name of a particle group.

Definition at line 335 of file topology.h.

◆ setStep()

void votca::csg::Topology::setStep ( Index s)
inline

set the step number of current frame

Parameters
sstep number

Definition at line 323 of file topology.h.

◆ setTime()

void votca::csg::Topology::setTime ( double t)
inline

set the time of current frame

Parameters
tsimulation time in ns

Definition at line 311 of file topology.h.

◆ ShortestBoxSize()

double votca::csg::Topology::ShortestBoxSize ( ) const

return the shortest box size

Returns
shortest size

Calculates the shortest length to connect two sides of the box

Definition at line 268 of file topology.cc.

Member Data Documentation

◆ bc_

std::unique_ptr<BoundaryCondition> votca::csg::Topology::bc_
protected

Definition at line 406 of file topology.h.

◆ beads_

BeadContainer votca::csg::Topology::beads_
protected

beads in the topology

Definition at line 415 of file topology.h.

◆ beadtypes_

std::unordered_map<std::string, Index> votca::csg::Topology::beadtypes_
protected

bead types in the topology

Definition at line 412 of file topology.h.

◆ exclusions_

ExclusionList votca::csg::Topology::exclusions_
protected

Definition at line 426 of file topology.h.

◆ has_force_

bool votca::csg::Topology::has_force_ = false
protected

Definition at line 435 of file topology.h.

◆ has_vel_

bool votca::csg::Topology::has_vel_ = false
protected

Definition at line 434 of file topology.h.

◆ interaction_groups_

std::map<std::string, Index> votca::csg::Topology::interaction_groups_
protected

Definition at line 428 of file topology.h.

◆ interactions_

InteractionContainer votca::csg::Topology::interactions_
protected

bonded interactions in the topology

Definition at line 424 of file topology.h.

◆ interactions_by_group_

std::map<std::string, std::vector<Interaction *> > votca::csg::Topology::interactions_by_group_
protected

Definition at line 430 of file topology.h.

◆ molecules_

MoleculeContainer votca::csg::Topology::molecules_
protected

molecules in the topology

Definition at line 418 of file topology.h.

◆ particle_group_

std::string votca::csg::Topology::particle_group_ = "unassigned"
protected

The particle group (For H5MD file format)

Definition at line 438 of file topology.h.

◆ residues_

ResidueContainer votca::csg::Topology::residues_
protected

residues in the topology

Definition at line 421 of file topology.h.

◆ step_

Index votca::csg::Topology::step_ = 0
protected

Definition at line 433 of file topology.h.

◆ time_

double votca::csg::Topology::time_ = 0.0
protected

Definition at line 432 of file topology.h.


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