40 std::vector<tools::Edge> connections_vector;
42 connections_vector.push_back(edge);
45 for (std::pair<const Index, BeadInfo> &id_bead_ptr_pair :
beads_) {
65 std::unordered_map<std::string, double> attributes1;
66 std::unordered_map<std::string, std::string> attributes2;
68 attributes1[
"Mass"] = bead_info.
mass;
69 attributes2[
"Name"] = bead_info.
name;
74 graphnode.
setStr(attributes2);
84 const std::vector<Index> &bead_ids,
85 const std::vector<tools::Edge> &connections)
const {
87 for (
const Index &bead_id : bead_ids) {
88 if (
beads_.count(bead_id) == 0) {
90 "Cannot get bead substructure from current "
91 "BeadStructure, bead with id " +
95 throw runtime_error(error_msg);
102 "Cannot get bead substructure from current "
103 "BeadStructure, edge between beads " +
104 to_string(edge.getEndPoint1()) +
" and " +
105 to_string(edge.getEndPoint2()) +
106 " is not found in the "
108 throw runtime_error(error_msg);
110 new_beadstructure.
ConnectBeads(edge.getEndPoint1(), edge.getEndPoint2());
112 return new_beadstructure;
116 if (!(
beads_.count(bead1_id)) || !(
beads_.count(bead2_id))) {
118 "Cannot connect beads in bead structure that do not exist";
119 throw std::invalid_argument(err);
121 if (bead1_id == bead2_id) {
122 std::string err =
"Beads cannot be self-connected";
123 throw std::invalid_argument(err);
144 if (vertices.size() == 0) {
159 if (vertices.size() !=
beads_.size()) {
190 vector<Index> bead_ids;
191 for (
auto &id_and_bead_info :
beads_) {
192 bead_ids.push_back(id_and_bead_info.first);
Designed to determine if the structure beads passed in.
std::string structure_id_
tools::GraphNode BeadInfoToGraphNode_(const BeadInfo &)
bool single_structureUpToDate_
std::set< tools::Edge > connections_
std::vector< Index > getNeighBeadIds(const Index &index)
Return a vector of all the ids of the beads neighboring the index.
virtual void ConnectBeads(const Index &bead1_id, const Index &bead2_id)
Create a connection between two beads in the structure.
std::unordered_map< Index, tools::GraphNode > graphnodes_
std::unordered_map< Index, BeadInfo > beads_
void CalculateStructure_()
bool isStructureEquivalent(BeadStructure &beadstructure)
Compare the topology of two bead structures.
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.
std::vector< Index > getBeadIds() const
Return the ids of the beads that are in the structure.
bool isSingleStructure()
Determine if the bead structure consists of a single connected structure.
base class for all analysis tools
Small structure to help store bead info relevant to the structure.