Ticket #4679 (closed: invalid)

Opened 9 years ago

Last modified 5 years ago

segfault while setting non-cubic reciprocal lattice.

Reported by: Alex Buts Owned by: Andrei Savici
Priority: critical Milestone: Release 2.0
Component: Mantid Keywords:
Cc: saviciat@… Blocked By:
Blocking: Tester: Ronald Fowler

Description

The code below segfaults Mantid on SetupUB while inverting some internal matrix.

WS_Name = 'CNCS_7860_event' Load(Filename='CNCS_7860_event.nxs',OutputWorkspace=WS_Name )

AddSampleLog(Workspace=WS_Name,LogName='Ei',LogText='3',LogType='Number') MD_Name='MD1' SetUB(Workspace=WS_Name,a='10.4165',b='3.4165',c='10.4165',alpha=30,beta=45,gamma=80,u='1,0,0',v='0,1,0') ConvertToMDEvents(InputWorkspace=WS_Name,OutputWorkspace=MD_Name,QDimensions='QhQkQl',QinHKL=False,dEAnalysisMode='Direct',MinValues='-2,-2,-3,-1',MaxValues='2,2,3,3',SplitInto="20,20,20,1") ps=plotSlice(MD_Name, xydim=["Q1","Q2"], slicepoint=[0,0] )

Change History

comment:1 Changed 9 years ago by Alex Buts

Segfault occurs in UnitCell when inverting some matrices while Gstar become #IND

no permutation is calculated and undefined indexes cause segfailt.

May go unnoticed and cause just wrong results if arrays are initated by 0 during allocation.

Have to go today.

comment:2 Changed 9 years ago by Nick Draper

  • Owner set to Alex Buts
  • Status changed from new to assigned

comment:3 Changed 9 years ago by Alex Buts

refs #4679 unit test which crashes on win

Changeset: 52c7354c798d7b3e15b86c98369718c430d6dcde

comment:4 Changed 9 years ago by Andrei Savici

  • Cc saviciat@… added

comment:5 Changed 9 years ago by Alex Buts

  • Owner changed from Alex Buts to Andrei Savici

comment:6 Changed 9 years ago by Andrei Savici

  • Status changed from assigned to accepted

Maybe we should test this, but for any lattice to be physical the following inequalities should be true:

alpha<beta+gamma
beta<alpha+gamma
gamma<alpha+beta

If one of these changes to equality, than the lattice vectors are all in plane

comment:7 Changed 9 years ago by Andrei Savici

  • Status changed from accepted to verify
  • Resolution set to invalid

if the inequalities above do not hold, you would get a negative volume for the unit cell. For the example above, change alpha to 50. If we want to throw an explicit "angles invalid", we can write a ticket, and put the check in void UnitCell::recalculate().

comment:8 Changed 9 years ago by Andrei Savici

comment:9 Changed 9 years ago by Ronald Fowler

  • Status changed from verify to verifying
  • Tester set to Ronald Fowler

comment:10 Changed 9 years ago by Ronald Fowler

  • Status changed from verifying to closed

The input values given in the test case are invalid, as can be seen from the references. Using valid angle values the algorithm runs OK, even down to the case of alpha==beta==gamma/2 (i.e. coplanar vectors). Mantid should not crash on invalid inputs such as this and the ticket to update UnitCell:recalculate is a high priority. The test that Alex has added, currently commented out, should be enabled and throw "angles invalid". If the angles are such that the vectors are co-planar, or close to this, a warning message would be useful.

The two debug lines that were added to UnitCell.cpp in the above checkin should be removed.

While checking the input data is physical is important, it is hard to cover all cases. Hence UnitCell should also check that inversion has not failed and throw something suitable in that case.

comment:11 Changed 9 years ago by Alex Buts

refs #4679 debugging operations

Changeset: fb6ee04b04acefa86234593fc40d6c7647267804

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 5526

Note: See TracTickets for help on using tickets.