Skip to content

Commit

Permalink
Add UnitCell.ChangeSpaceGroup()
Browse files Browse the repository at this point in the history
  • Loading branch information
vincefn committed Dec 7, 2022
1 parent 115d1ef commit d47650b
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 106 deletions.
187 changes: 81 additions & 106 deletions examples/crystal_3d_widget.ipynb

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/extensions/unitcell_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ double _getgamma(UnitCell& u)
return u.GetLatticePar(5);
}

void SafeChangeSpaceGroup(UnitCell& u, const std::string& sgid)
{
MuteObjCrystUserInfo muzzle;
// this may throw invalid_argument which is translated to ValueError
u.ChangeSpaceGroup(sgid);
}


}

Expand Down Expand Up @@ -180,6 +187,7 @@ void wrap_unitcell()
&OrthonormalToMillerCoords)
.def("GetSpaceGroup", (SpaceGroup& (UnitCell::*)()) &UnitCell::GetSpaceGroup,
return_internal_reference<>())
.def("ChangeSpaceGroup", &SafeChangeSpaceGroup)
.def("GetVolume", &UnitCell::GetVolume)
.def("__str__", &__str__<UnitCell>)
// python-only
Expand Down

0 comments on commit d47650b

Please sign in to comment.