@@ -5317,7 +5317,7 @@ def strTest(text):
53175317 G2frame.OnFileSave(event)
53185318 wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
53195319
5320- def OnISODISTORT_kvec(event):
5320+ def OnISODISTORT_kvec(event, mag=False ):
53215321 '''Search for k-vector using the ISODISTORT web service.
53225322 Developed by Yuanpeng Zhang with help from Branton Campbell.
53235323 '''
@@ -5571,6 +5571,25 @@ def setup_kvec_input(k_vec, k_vec_dict, isocif_cif):
55715571
55725572 isocif_out_cif = requests.post(isocifformsite, data=isocif_formDict).text
55735573
5574+ if mag:
5575+ atom_names = [atom[0] for atom in Phase['Atoms']]
5576+ dlg = G2G.G2MultiChoiceDialog(G2frame,
5577+ 'Select magnetic atom(s)',
5578+ 'Select magnetic atom(s) from the list below:',
5579+ atom_names, filterBox=False)
5580+ try:
5581+ if dlg.ShowModal() != wx.ID_OK:
5582+ return
5583+ selected_indices = dlg.GetSelections()
5584+ finally:
5585+ dlg.Destroy()
5586+ if not selected_indices:
5587+ wx.MessageBox('No atoms selected. Aborting.',
5588+ caption='No Selection', style=wx.ICON_EXCLAMATION)
5589+ return
5590+ selected_atoms = [atom_names[i] for i in selected_indices]
5591+ G2frame.kvecSearch['magAtoms'] = selected_atoms
5592+
55745593 kvec_dict = grab_all_kvecs(out2)
55755594 #lat_sym = Phase['General']['SGData']
55765595 data_update = setup_kvec_input(kpoint, kvec_dict, isocif_out_cif)
@@ -7291,6 +7310,10 @@ def OnRefreshKeep(event):
72917310 ISObut.Bind(wx.EVT_BUTTON, OnISODISTORT_kvec)
72927311 hSizer.Add(ISObut)
72937312
7313+ ISOmagbut = wx.Button(G2frame.dataWindow,label='Call ISODISTORT-MAG')
7314+ ISOmagbut.Bind(wx.EVT_BUTTON, lambda evt: OnISODISTORT_kvec(evt, mag=True))
7315+ hSizer.Add(ISOmagbut)
7316+
72947317 mainSizer.Add(hSizer)
72957318 else:
72967319 mainSizer.Add(gridDisplay)
0 commit comments