diff --git a/modules/mol/base/pymod/export_entity.cc b/modules/mol/base/pymod/export_entity.cc index bb55d9bd68234616da9d4bf69d646adccf559d71..0373b2590e3ea66f3067b2ae0234df9891783fbb 100644 --- a/modules/mol/base/pymod/export_entity.cc +++ b/modules/mol/base/pymod/export_entity.cc @@ -197,6 +197,7 @@ void export_Entity() .add_property("transform",&EntityHandle::GetTransform,&EntityHandle::SetTransform) .def("HasTransform",&EntityHandle::HasTransform) .def("ClearTransform",&EntityHandle::ClearTransform) + .def("FixTransform",&EntityHandle::FixTransform) .def("EditXCS", &EntityHandle::EditXCS, arg("mode")=UNBUFFERED_EDIT) .def("EditICS", &EntityHandle::EditICS, arg("mode")=UNBUFFERED_EDIT) .def("RequestXCSEditor", &depr_request_xcs_editor, arg("mode")=UNBUFFERED_EDIT) diff --git a/modules/mol/base/src/entity_handle.cc b/modules/mol/base/src/entity_handle.cc index e34e11d2e233ab4a60da62e20c3e085c4ece1f58..eaa348914fec1595be83283c10358cc81df7ea0c 100644 --- a/modules/mol/base/src/entity_handle.cc +++ b/modules/mol/base/src/entity_handle.cc @@ -295,6 +295,12 @@ void EntityHandle::ClearTransform() Impl()->ClearTransform(); } +void EntityHandle::FixTransform() +{ + this->CheckValidity(); + Impl()->FixTransform(); +} + ResidueHandle EntityHandle::FindResidue(const String& chain_name, const ResNum& residue) const { this->CheckValidity(); diff --git a/modules/mol/base/src/entity_handle.hh b/modules/mol/base/src/entity_handle.hh index fe2a439135306d6f2a7c080ed91f1e15604faea0..63a2bc6be27c10908072c5ea72ff6106e315d541 100644 --- a/modules/mol/base/src/entity_handle.hh +++ b/modules/mol/base/src/entity_handle.hh @@ -279,6 +279,8 @@ public: bool HasTransform() const; /// \brief remove transform void ClearTransform(); + /// \brief write transformed pos to orig, and the clear tf + void FixTransform(); /// \brief get complete list of residues /// \sa #ResiduesBegin, #ResiduesEnd diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index f8fa19e32b363590ccb7b10d536e1c72f3a3eba2..852b9bebb1653110cde6610f94ef3a620f09c8b6 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -748,8 +748,20 @@ void EntityImpl::SetTransform(const geom::Transform& tf) void EntityImpl::ClearTransform() { - has_transform_=false; SetTransform(geom::Transform()); + has_transform_=false; +} + +void EntityImpl::FixTransform() +{ + if(!has_transform_) return; + for(AtomImplMap::iterator it = atom_map_.begin();it!=atom_map_.end();++it) { + it->second->OriginalPos()=it->second->TransformedPos(); + } + transform_=geom::Transform(); + has_transform_=false; + this->UpdateTransformedPos(); + this->MarkOrganizerDirty(); } void EntityImpl::AttachObserver(const EntityObserverPtr& o) diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh index 74d8ded333567b09e2b9da6c5843c57a646c6884..6862e5e27f2d827c17aee720725b9b0ebda97100 100644 --- a/modules/mol/base/src/impl/entity_impl.hh +++ b/modules/mol/base/src/impl/entity_impl.hh @@ -151,6 +151,7 @@ public: const geom::Transform& GetTransform() const {return transform_;} bool HasTransform() const {return has_transform_;} void ClearTransform(); + void FixTransform(); void AttachObserver(const EntityObserverPtr& o); void DetachObserver(const EntityObserverPtr& o); diff --git a/modules/mol/base/src/xcs_editor.cc b/modules/mol/base/src/xcs_editor.cc index 5596e3962d1479921f2c5b8ae5108d0c92ee9b38..7bf68701df4f77f2a6d6246b3a08c0bfc4336ecc 100644 --- a/modules/mol/base/src/xcs_editor.cc +++ b/modules/mol/base/src/xcs_editor.cc @@ -205,6 +205,11 @@ void XCSEditor::SetTransform(const geom::Transform& transform) this->Update(); } +void XCSEditor::FixTransform() +{ + ent_.Impl()->FixTransform(); +} + void XCSEditor::Update() { if (GetMode()==UNBUFFERED_EDIT) { diff --git a/modules/mol/base/src/xcs_editor.hh b/modules/mol/base/src/xcs_editor.hh index a7cc317b2e5273b62211b03a8d04559de97f0fff..e52d9e4c5057f7f3046d6ba21646d1952caffcd7 100644 --- a/modules/mol/base/src/xcs_editor.hh +++ b/modules/mol/base/src/xcs_editor.hh @@ -104,6 +104,9 @@ public: void SetTransform(const geom::Mat4& transform); void SetTransform(const geom::Transform& transform); + /// \brief set transformed pos to new original pos + void FixTransform(); + /// \brief immediately update internal coordinate system void UpdateICS();