Skip to content

Commit

Permalink
calculate_fractional_box(): throw error if Structure has no unit cell
Browse files Browse the repository at this point in the history
it should be less surprising than getting Cartesian coordinates as fractional

closes #307
  • Loading branch information
wojdyr committed Apr 24, 2024
1 parent be4fa7f commit c4dd5f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/gemmi/calculate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ inline Box<Position> calculate_box(const Structure& st, double margin=0.) {
}

inline Box<Fractional> calculate_fractional_box(const Structure& st, double margin=0.) {
if (!st.cell.is_crystal())
fail("calculate_fractional_box(): Structure has no unit cell for fractionalization");
Box<Fractional> box;
for (const Model& model : st.models)
for (const Chain& chain : model.chains)
Expand Down

0 comments on commit c4dd5f9

Please sign in to comment.