Skip to content

Commit d47650b

Browse files
committed
Add UnitCell.ChangeSpaceGroup()
1 parent 115d1ef commit d47650b

File tree

2 files changed

+89
-106
lines changed

2 files changed

+89
-106
lines changed

examples/crystal_3d_widget.ipynb

+81-106
Large diffs are not rendered by default.

src/extensions/unitcell_ext.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ double _getgamma(UnitCell& u)
136136
return u.GetLatticePar(5);
137137
}
138138

139+
void SafeChangeSpaceGroup(UnitCell& u, const std::string& sgid)
140+
{
141+
MuteObjCrystUserInfo muzzle;
142+
// this may throw invalid_argument which is translated to ValueError
143+
u.ChangeSpaceGroup(sgid);
144+
}
145+
139146

140147
}
141148

@@ -180,6 +187,7 @@ void wrap_unitcell()
180187
&OrthonormalToMillerCoords)
181188
.def("GetSpaceGroup", (SpaceGroup& (UnitCell::*)()) &UnitCell::GetSpaceGroup,
182189
return_internal_reference<>())
190+
.def("ChangeSpaceGroup", &SafeChangeSpaceGroup)
183191
.def("GetVolume", &UnitCell::GetVolume)
184192
.def("__str__", &__str__<UnitCell>)
185193
// python-only

0 commit comments

Comments
 (0)