Modelling of magnetic structure using interior point optimization given exchange parameters