Skip to content
Snippets Groups Projects
Commit 542653d3 authored by Niklaus Johner's avatar Niklaus Johner
Browse files

Added EntityHandle::GetAtomPosList

This function returns a geom::Vec3List containing the positions
of all the atoms in the entity.
parent 610921c6
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,7 @@ void export_Entity()
.def("GetMass", &EntityHandle::GetMass)
.def("GetCenterOfMass", &EntityHandle::GetCenterOfMass)
.def("GetCenterOfAtoms", &EntityHandle::GetCenterOfAtoms)
.def("GetAtomPosList", &EntityHandle::GetAtomPosList)
.def("GetGeometricCenter", geom_center<EntityHandle>)
.add_property("geometric_center", geom_center<EntityHandle>)
......
......@@ -362,6 +362,11 @@ AtomHandleList EntityHandle::GetAtomList() const
return atoms;
}
geom::Vec3List EntityHandle::GetAtomPosList() const {
this->CheckValidity();
return Impl()->GetAtomPosList();
}
EntityHandle EntityHandle::GetHandle() const
{
return *this;
......
......@@ -280,6 +280,9 @@ public:
/// \sa #AtomsBegin, #AtomsEnd
AtomHandleList GetAtomList() const;
/// \brief get complete list of atom positions
geom::Vec3List GetAtomPosList() const;
/// \brief Get editor for external coordinate system to manipulate atom
/// positions
/// \sa editors
......
......@@ -307,6 +307,15 @@ geom::Vec3 EntityImpl::GetCenterOfMass() const {
return center;
}
geom::Vec3List EntityImpl::GetAtomPosList() const {
geom::Vec3List atom_pos_list;
atom_pos_list.reserve(this->GetAtomCount());
for(AtomImplMap::const_iterator it = atom_map_.begin();it!=atom_map_.end();++it) {
atom_pos_list.push_back(it->second->TransformedPos());
}
return atom_pos_list;
}
Real EntityImpl::GetMass() const {
double mass=0.0;
for (ChainImplList::const_iterator i=chain_list_.begin(),
......
......@@ -93,7 +93,7 @@ public:
Real GetMass() const;
geom::Vec3 GetCenterOfMass() const;
geom::Vec3 GetCenterOfAtoms() const;
geom::Vec3List GetAtomPosList() const;
/// \brief returns the axis-aligned bounding box of the entity
geom::AlignedCuboid GetBounds() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment