Non-primitive unit cell to the Niggli reduced primitive version...

Is there a way that I can convert a non-primitive unit cell to it's Niggli reduced primitive version manually...? CASTEP usually ask this before it's get started but I was wondering is there a way that I can convert those structures manually...? 

-Monu