Skip to content

Commit cc7281d

Browse files
committed
consolidate referenced papers into a dict; show in w/new menu item
1 parent 0286251 commit cc7281d

File tree

9 files changed

+398
-369
lines changed

9 files changed

+398
-369
lines changed

GSASII/GSASIIctrlGUI.py

Lines changed: 118 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5681,6 +5681,9 @@ def __init__(self,frame,includeTree=False,morehelpitems=[]):
56815681
helpobj = self.Append(wx.ID_ANY,'Help on current data tree item\tF1',
56825682
'Access web page on selected item in tree')
56835683
frame.Bind(wx.EVT_MENU, self.OnHelpById, id=helpobj.GetId())
5684+
helpobj = self.Append(wx.ID_ANY,'Citation information',
5685+
'Show papers that GSAS-II users may wish to cite')
5686+
frame.Bind(wx.EVT_MENU, ShowCitations, id=helpobj.GetId())
56845687

56855688
def OnHelpById(self,event):
56865689
'''Called when Help on... is pressed in a menu. Brings up a web page
@@ -5722,24 +5725,22 @@ def OnHelpAbout(self, event):
57225725
info = wxadv.AboutDialogInfo()
57235726
info.Name = 'GSAS-II'
57245727
info.SetVersion(GSASIIpath.getG2VersionInfo())
5725-
#info.Developers = ['Robert B. Von Dreele','Brian H. Toby']
5726-
info.Copyright = ('(c) ' + time.strftime('%Y') +
5727-
''' Argonne National Laboratory
5728-
This product includes software developed
5729-
by the UChicago Argonne, LLC, as
5730-
Operator of Argonne National Laboratory.''')
5731-
info.Description = '''General Structure Analysis System-II (GSAS-II)
5732-
Robert B. Von Dreele and Brian H. Toby
5733-
5734-
Please cite as:
5735-
B.H. Toby & R.B. Von Dreele, J. Appl. Cryst. 46, 544-549 (2013)
5736-
For small angle use cite:
5737-
R.B. Von Dreele, J. Appl. Cryst. 47, 1748-9 (2014)
5738-
For DIFFaX use cite:
5739-
M.M.J. Treacy, J.M. Newsam & M.W. Deem,
5740-
Proc. Roy. Soc. Lond. A 433, 499-520 (1991)
5741-
'''
5728+
info.Developers = ['Robert B. Von Dreele','Brian H. Toby']
57425729
info.WebSite = ("https://gsasii.github.io","GSAS-II home page")
5730+
msg = '''Argonne National Laboratory
5731+
This product includes software developed
5732+
by the UChicago Argonne, LLC, as Operator
5733+
of Argonne National Laboratory.'''
5734+
info.Copyright = f'(c) {time.strftime("%Y")} {msg}'
5735+
msg = '''General Structure Analysis System-II (GSAS-II). Please cite as:
5736+
B.H. Toby & R.B. Von Dreele, J. Appl. Cryst.
5737+
46, 544-549 (2013)
5738+
Also see Help/"Citation information" for other works used in GSAS-II. Citations encourage scientists to make their software available.'''
5739+
# msg += '\n'
5740+
# for key in CitationDict:
5741+
# msg += f"\n * For {key} use cite:\n"
5742+
# msg += GetCite(key,wrap=50,indent=3)
5743+
info.Description = msg
57435744
wxadv.AboutBox(info)
57445745

57455746
def OnCheckUpdates(self,event):
@@ -5769,6 +5770,38 @@ def OnSelectVersion(self,event):
57695770
dlg.Destroy()
57705771
return
57715772

5773+
def ShowCitations(event):
5774+
'''Show all work that GSAS-II users may wish to cite
5775+
'''
5776+
parent = wx.GetApp().GetMainTopWindow()
5777+
def copy2clip(event):
5778+
'copy citation info to clipboard'
5779+
if wx.TheClipboard.Open():
5780+
wx.TheClipboard.SetData(wx.TextDataObject(msg))
5781+
wx.TheClipboard.Close()
5782+
else:
5783+
G2frame.ErrorDialog('Clipboard locked','Sorry, unable to access the clipboard, try again later. You might need to restart GSAS-II or reboot')
5784+
return
5785+
G2MessageBox(parent,
5786+
'Citation information placed in clipboard. ',
5787+
'Citations copied')
5788+
event.GetEventObject().GetParent().EndModal(wx.ID_OK)
5789+
msg = '''You are using GSAS-II. Please cite it as:
5790+
5791+
B.H. Toby & R.B. Von Dreele, J. Appl. Cryst. 46, 544-549 (2013).
5792+
5793+
Depending on what sections of the code you are using, you may wish to
5794+
cite some of the following works as well:'''
5795+
for key in CitationDict:
5796+
msg += f"\n\n * For {key} use cite:\n"
5797+
msg += GetCite(key,wrap=95,indent=6)
5798+
msg += '\n\nNote that your citations are one of the strongest ways you can say thank you to the\nscientists who make their software available to you.'
5799+
res = ShowScrolledInfo(parent,msg,header='Please Cite',
5800+
buttonlist=[
5801+
('Close', lambda event: event.GetEventObject().GetParent().EndModal(wx.ID_OK)),
5802+
('Copy to clipboard', copy2clip),
5803+
])
5804+
57725805
################################################################################
57735806
class HelpButton(wx.Button):
57745807
'''Create a help button that displays help information.
@@ -8801,13 +8834,75 @@ def onSetColour(event):
88018834
colorButton.Bind(wcs.EVT_COLOURSELECT, OnColor)
88028835
return colorButton
88038836

8837+
CitationDict = {}
8838+
def SaveCite(prog,text):
8839+
'''Save citation information as it is referenced so that all of it can be
8840+
displayed in the About GSAS-II window
8841+
'''
8842+
global CitationDict
8843+
CitationDict[prog] = text
8844+
8845+
def GetCite(key,wrap=None,indent=None):
8846+
'''Return citation information, optionally with text wrapping.
8847+
'''
8848+
if GSASIIpath.GetConfigValue('debug') and key not in CitationDict:
8849+
print(f'Warning: GetCite citation ref {key!r} not defined.')
8850+
txt = CitationDict.get(key,'')
8851+
leftmargin = ''
8852+
if indent:
8853+
leftmargin=indent*' '
8854+
if wrap:
8855+
import textwrap
8856+
txt = '\n'.join(textwrap.wrap(txt,wrap,
8857+
replace_whitespace=False,
8858+
break_long_words=False,
8859+
initial_indent=leftmargin, subsequent_indent=leftmargin))
8860+
return txt
8861+
#########################
8862+
# Catalog citation refs #
8863+
#########################
8864+
# OK to call SaveCite anywhere in GSAS-II, but putting calls here allows control
8865+
# over their sequence. Calls anywhere else will show up after these.
8866+
SaveCite('small angle scattering',
8867+
'R.B. Von Dreele, J. Appl. Cryst. 47, 1748-9 (2014)')
8868+
SaveCite('DIFFaX',
8869+
'M.M.J. Treacy, J.M. Newsam & M.W. Deem, Proc. Roy. Soc. Lond. A 433, 499-520 (1991) doi: https://doi.org/10.1098/rspa.1991.0062')
8870+
SaveCite('NIST*LATTICE',
8871+
'''V. L. Karen and A. D. Mighell, NIST Technical Note 1290 (1991), https://nvlpubs.nist.gov/nistpubs/Legacy/TN/nbstechnicalnote1290.pdf; V. L. Karen & A. D. Mighell, U.S. Patent 5,235,523, https://patents.google.com/patent/US5235523A/en?oq=5235523''')
8872+
SaveCite('Parameter Impact',
8873+
'Toby, B. H. (2024). "A simple solution to the Rietveld refinement recipe problem." J. Appl. Cryst. 57(1): 175-180.')
8874+
SaveCite('Fundamental parameter fitting',
8875+
'''MH Mendenhall, K Mullen && JP Cline (2015), J. Res. of NIST, 120, p223. DOI: 10.6028/jres.120.014;
8876+
For Incident Beam Mono model, also cite: MH Mendenhall, D Black && JP Cline (2019), J. Appl. Cryst., 52, p1087. DOI: 10.1107/S1600576719010951
8877+
''')
8878+
SaveCite('RMCProfile',
8879+
'"RMCProfile: Reverse Monte Carlo for polycrystalline materials", M.G. Tucker, D.A. Keen, M.T. Dove, A.L. Goodwin and Q. Hui, Jour. Phys.: Cond. Matter 2007, 19, 335218. doi: https://doi.org/10.1088/0953-8984/19/33/335218')
8880+
SaveCite('PDFfit2',
8881+
'"PDFfit2 and PDFgui: computer programs for studying nanostructures in crystals", C.L. Farrow, P.Juhas, J.W. Liu, D. Bryndin, E.S. Bozin, J. Bloch, Th. Proffen and S.J.L. Billinge, J. Phys, Condens. Matter 19, 335219 (2007)., https://doi.org/10.1088/0953-8984/19/33/335219')
8882+
SaveCite('ISOTROPY, ISODISTORT, ISOCIF...',
8883+
'H. T. Stokes, D. M. Hatch, and B. J. Campbell, ISOTROPY Software Suite, iso.byu.edu.; B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions." J. Appl. Cryst. 39, 607-614 (2006).')
8884+
SaveCite('ISODISPLACE',
8885+
'D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions." J. Appl. Cryst. 39, 607-614 (2006).')
8886+
SaveCite('fullrmc',
8887+
'''"Atomic Stochastic Modeling & Optimization with fullrmc", B. Aoun, J. Appl. Cryst. 2022, 55(6) 1664-1676, DOI: 10.1107/S1600576722008536.
8888+
"Fullrmc, a Rigid Body Reverse Monte Carlo Modeling Package Enabled with Machine Learning and Artificial Intelligence", B. Aoun, Jour. Comp. Chem. 2016, 37, 1102-1111. DOI: 10.1002/jcc.24304''')
8889+
SaveCite('Bilbao: PSEUDO',
8890+
'''C. Capillas, E.S. Tasci, G. de la Flor, D. Orobengoa, J.M. Perez-Mato and M.I. Aroyo. "A new computer tool at the Bilbao Crystallographic Server to detect and characterize pseudosymmetry". Z. Krist. (2011), 226(2), 186-196 DOI:10.1524/zkri.2011.1321.''')
8891+
SaveCite('Bilbao: k-SUBGROUPSMAG',
8892+
'Symmetry-Based Computational Tools for Magnetic Crystallography, J.M. Perez-Mato, S.V. Gallego, E.S. Tasci, L. Elcoro, G. de la Flor, and M.I. Aroyo, Annu. Rev. Mater. Res. 2015. 45,217-48. doi: 10.1146/annurev-matsci-070214-021008')
8893+
SaveCite('Bilbao: PSEUDOLATTICE',
8894+
'Bilbao Crystallographic Server I: Databases and crystallographic computing programs, M. I. Aroyo, J. M. Perez-Mato, C. Capillas, E. Kroumova, S. Ivantchev, G. Madariaga, A. Kirov & H. Wondratschek, Z. Krist. 221, 1, 15-27 (2006). doi: https://doi.org/doi:10.1524/zkri.2006.221.1.15''')
8895+
SaveCite('Bilbao+GSAS-II magnetism',
8896+
'Determining magnetic structures in GSAS-II using the Bilbao Crystallographic Server tool k-SUBGROUPSMAG, R.B. Von Dreele & L. Elcoro, Acta Cryst. 2024, B80. doi: https://doi.org/10.1107/S2052520624008436')
8897+
SaveCite('SHAPES',
8898+
'A New Algorithm for the Reconstruction of Protein Molecular Envelopes from X-ray Solution Scattering Data, J. Badger, Jour. of Appl. Chrystallogr. 2019, 52, 937-944. doi: https://doi.org/10.1107/S1600576719009774')
8899+
SaveCite('Scikit-Learn',
8900+
'"Scikit-learn: Machine Learning in Python", Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M. and Duchesnay, E., Journal of Machine Learning Research (2011) 12, 2825-2830.')
8901+
SaveCite('Dysnomia',
8902+
'Dysnomia, a computer program for maximum-entropy method (MEM) analysis and its performance in the MEM-based pattern fitting, K. Moma, T. Ikeda, A.A. Belik & F. Izumi, Powder Diffr. 2013, 28, 184-193. doi: https://doi.org/10.1017/S088571561300002X')
8903+
88048904
def NISTlatUse(msgonly=False):
8805-
msg = '''Performing cell symmetry search using NIST*LATTICE. Please cite:
8806-
V. L. Karen and A. D. Mighell, NIST Technical Note 1290 (1991),
8807-
https://nvlpubs.nist.gov/nistpubs/Legacy/TN/nbstechnicalnote1290.pdf
8808-
and
8809-
V. L. Karen & A. D. Mighell, U.S. Patent 5,235,523,
8810-
https://patents.google.com/patent/US5235523A/en?oq=5235523'''
8905+
msg = f'Performing cell symmetry search using NIST*LATTICE.\n\nPlease cite: {GetCite("NIST*LATTICE")}'
88118906
print(msg)
88128907
if msgonly: return msg
88138908
wx.MessageBox(msg,caption='Using NIST*LATTICE',style=wx.ICON_INFORMATION)

GSASII/GSASIIdataGUI.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def new_util_find_library( name ):
8484
VERY_LIGHT_GREY = wx.Colour(240,240,240)
8585
DULL_YELLOW = (230,230,190)
8686

87-
# define Ids for wx menu items
87+
# transformation matrices
8888
commonTrans = {'abc':np.eye(3),'a-cb':np.array([[1.,0.,0.],[0.,0.,-1.],[0.,1.,0.]]),
8989
'ba-c':np.array([[0.,1.,0.],[1.,0.,0.],[0.,0.,-1.]]),'-cba':np.array([[0.,0.,-1.],[0.,1.,0.],[1.,0.,0.]]),
9090
'bca':np.array([[0.,1.,0.],[0.,0.,1.],[1.,0.,0.]]),'cab':np.array([[0.,0.,1.],[1.,0.,0.],[0.,1.,0.]]),
@@ -2792,10 +2792,6 @@ def FillMainMenu(self,menubar,addhelp=True):
27922792
menubar.Append(menu=self.ExportMenu, title='Export')
27932793
self._init_Exports(self.ExportMenu)
27942794
self._Add_ExportMenuItems(self.ExportMenu)
2795-
if GSASIIpath.GetConfigValue('Enable_logging'):
2796-
self.MacroMenu = wx.Menu(title='')
2797-
menubar.Append(menu=self.MacroMenu, title='Macro')
2798-
self._init_Macro()
27992795
if addhelp:
28002796
HelpMenu=G2G.MyHelp(self,includeTree=True,
28012797
morehelpitems=[('&Tutorials\tCtrl+T','Tutorials'),])
@@ -5240,7 +5236,11 @@ def OnShowLSParms(self,event):
52405236
dlg.Destroy()
52415237

52425238
def OnDerivCalc(self,event):
5243-
Controls = self.GPXtree.GetItemPyData(GetGPXtreeItemId(self,self.root, 'Controls'))
5239+
controlId = GetGPXtreeItemId(self,self.root, 'Controls')
5240+
if not controlId:
5241+
self.ErrorDialog('Computation error','No refinement information present')
5242+
return
5243+
Controls = self.GPXtree.GetItemPyData(controlId)
52445244
self._cleanPartials(Controls) # set phase partials as invalid
52455245
self.OnFileSave(event)
52465246
errmsg, warnmsg = G2stIO.ReadCheckConstraints(self.GSASprojectfile) # check constraints are OK
@@ -5271,7 +5271,7 @@ def OnDerivCalc(self,event):
52715271
txt = txt.replace('Pwd=','Histogram: ')
52725272
tbl.append([x,(' T' if x in varyList else ' '),derivCalcs[x][1],txt])
52735273
G2G.G2ScrolledGrid(self,'Parameter Impact Results','Impact Results',tbl,colLbls,colTypes,
5274-
maxSize=(700,400),comment=' Cite: Toby, B. H. (2024). "A simple solution to the Rietveld refinement recipe problem." J. Appl. Cryst. 57(1): 175-180.')
5274+
maxSize=(700,400),comment=f' Cite: {G2G.GetCite("Parameter Impact")}')
52755275

52765276
def OnExpressionCalc(self,event):
52775277
'''Compute an arbitrary expression (supplied by user) as well as the

GSASII/GSASIIfpaGUI.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@
8080
'''Additional FPA dict entries used in :func:`FillParmSizer`, needed for Incident Beam Monochromator
8181
'''
8282

83-
Citation = '''MH Mendenhall, K Mullen && JP Cline (2015), J. Res. of NIST, 120, p223. DOI: 10.6028/jres.120.014
84-
85-
For Incident Beam Mono model, also cite: MH Mendenhall, D Black && JP Cline (2019), J. Appl. Cryst., 52, p1087. DOI: 10.1107/S1600576719010951
86-
'''
87-
8883
IBmono = False
8984
'''set to True if an incident beam monochromator is in use
9085
'''
@@ -782,7 +777,9 @@ def _onReadFPA(event):
782777
readBtn.Bind(wx.EVT_BUTTON,_onReadFPA)
783778
MainSizer.Add(btnsizer, 0, wx.ALIGN_CENTER, 0)
784779
MainSizer.Add((-1,4),1,wx.EXPAND,1)
785-
txt = wx.StaticText(dlg,wx.ID_ANY,'If you use this, please cite: '+Citation,size=(350,-1))
780+
txt = wx.StaticText(dlg,wx.ID_ANY,'If you use this, please cite: '+
781+
G2G.GetCite('Fundamental parameter fitting'),
782+
size=(350,-1))
786783
txt.Wrap(340)
787784
MainSizer.Add(txt,0,wx.ALIGN_CENTER)
788785
btnsizer = wx.BoxSizer(wx.HORIZONTAL)

0 commit comments

Comments
 (0)