Skip to content

Commit

Permalink
Check angles in UnitCell. Refs #4708
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSavici committed Feb 1, 2012
1 parent a3f21a4 commit c34b644
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 8 additions & 4 deletions Code/Mantid/Framework/Geometry/src/Crystal/UnitCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,14 @@ namespace Geometry
/// Private function, called at initialization or whenever lattice parameters are changed
void UnitCell::recalculate()
{
calculateG();
calculateGstar();
calculateReciprocalLattice();
calculateB();
if ((da[3]>da[4]+da[5])||(da[4]>da[3]+da[5])||(da[5]>da[4]+da[3]))
{
throw std::invalid_argument("Invalid angles");
}
calculateG();
calculateGstar();
calculateReciprocalLattice();
calculateB();
}

/// Private function to calculate #G matrix
Expand Down
3 changes: 1 addition & 2 deletions Code/Mantid/Framework/Geometry/test/UnitCellTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class UnitCellTest : public CxxTest::TestSuite

}
void test_UnitCellCrash(){
TS_WARN("This throw unhandled exception");
//UnitCell US(10.4165,3.4165,10.4165,30,45,80);
TS_ASSERT_THROWS(UnitCell(10.4165,3.4165,10.4165,30,45,80);,std::invalid_argument);
}

};
Expand Down

0 comments on commit c34b644

Please sign in to comment.