Giter VIP home page Giter VIP logo

advancedphotonsource / gsas-ii Goto Github PK

View Code? Open in Web Editor NEW
25.0 6.0 7.0 299.04 MB

New home for GSAS-II, for crystallographic and diffraction-based structural characterization of materials

License: Other

Python 74.55% C++ 0.24% Fortran 3.68% Makefile 0.03% C 0.15% HTML 21.30% SAS 0.02% Meson 0.01% Cython 0.03%
crystallography gsas-ii materials-science neutron-diffraction powder-diffraction structure-determination

gsas-ii's Introduction

GSAS-II

Summary

GSAS-II is used to analyze all types of x-ray and neutron diffraction data, including single-crystal, powder, constant-wavelength, pink-beam and time-of-flight, lab, synchrotron, spallation and reactor sources, including Rietveld analysis. It can handle large numbers of datasets. GSAS-II is free open source software.

URLs

Please Cite

If you use GSAS-II in any part of your project, please cite it in your publications. This is the most valuable way you can demonstrate your support of the project. Note that some sections of program utilize work by others and will display citations for that. If you use those sections, please cite those papers as well.
The primary citation for GSAS-II is:

Toby, B. H., & Von Dreele, R. B. (2013). "GSAS-II: the genesis of
a modern open-source all purpose crystallography software
package". Journal of Applied Crystallography, 46(2),
544-549. doi:10.1107/S0021889813003531 

Full Description

GSAS-II is a unique and comprehensive Python project for the calibration, reduction and analysis of all types of x-ray and neutron diffraction data, including single-crystal and powder data, including constant-wavelength, pink-beam and time-of-flight data types and from lab, synchrotron, spallation and reactor sources. Its primary use is for determination of crystal structures and diffraction-based materials characterization for crystalline solids on all scales, from perovskites through protein. Refinements can combine measurements from multiple data types and large groups of data can be analyzed together via "sequential fitting". It also provides powerful and flexible capabilities for integration of 2D powder diffraction image data. In addition to single-crystal and powder diffraction, GSAS-II offers small-angle scattering and reflectometry analysis, structure solution capabilities and interfaces to several other types of analysis tools, such as for pair distribution functions, faulted materials, maximum entropy Fourier maps and symmetry analysis.

GSAS-II offers extensive visualization capabilities and a complete GUI implementation. An applications-interface (API) allows for scripted use of much of the GSAS-II functionality.

Many capabilities of GSAS-II are unique to GSAS-II or are only found in software with very limited scope. For magnetic scattering, all possible color subgroups can be derived and explored. For incommensurate structures, a generalized form of 3+1 superstructures can be handled. From powder diffraction, GSAS-II supports all stages of data reduction and analysis, including area detector calibration and integration, pattern indexing, LeBail and Pawley intensity extraction and peak fitting. Pair distribution functions (PDF) can be computed from high-energy x-ray diffraction. Instrumental profile parameters can be fit to data from standards or derived from fundamental parameters; sample profile effects (crystallite size and microstrain) are treated independently from the instrument. Sequential fitting is a novel process that allows large numbers of data sets, measured with parametric changes in measurement settings, to be fit single refinement with subsequent parametric fitting.

GSAS-II is freely distributed as open source software; see the license file for more details. GSAS-II runs on Windows, MacOS, Linux and Raspberry Pi computers. It currently receives >600 citations/year.

gsas-ii's People

Contributors

bfrosik avatar briantoby avatar kvieta1990 avatar prjemian avatar vondreele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gsas-ii's Issues

Only 1 exclusion region can be added at a time

Hi
I am using GSAS to process some synchotron data with high background from the sample holder. I am trying to hone in on some key regions by excluing the rest but it seems like only one region can be excluded at a time. I just updated to the latest version but this is still an issue. I'm not sure if I am doing anything wrong or if this is a bug. Thanks for looking into it. Attached is my GSAS project with the 3 excluded regions.
gsas_exclusionbug.zip

Problem with constraint equation

Good day,

I cannot constrain the phase fraction by constraint equation. The error is as follows in the image.

image

Thank you for the help!

Implement option to convert structures to standard settings

When a structure is reported in a non-standard setting, it is possible that the reported setting may not match the one that GSAS-II will generate from the space group name. One possible solution to this would be to use Bilbao to xform the structure into a standard setting on import.

As an example, this entry:

_database_code_ICSD 420002
_chemical_name_common 'Iron oxide hydroxide - epsilon'

in

_space_group_name_H-M_alt 'P 21 n m'
_space_group_IT_number 31

is not set correctly. This could be offered as an import option: https://www.cryst.ehu.es/cryst/cif2standard.html when non-standard settings are encountered.

GSAS-II CSV Exporting bug

From "Konjeti, Vineeth" [email protected]:

Hey, I finally can get around to explaining the process of what I did to get this bug.

All work done on Windows 11.
I am using a similar GSAS-II project to the base.gpx file except this time, I have the Shelx HKLF 4 data attached and have already done a refinement cycle.

I click CSV file option or the Text File option under Export > "Single Crystal data as"
image

it asks me to give the file a name as usual
image

when I open the file up, it comes up empty
image

refinement.gpx.zip

Utilize Cinema: Debye-Scherrer

The LANL Cinema: Debye-Scherrer visualization package looks nice. What would be needed to allow GSAS-II to generate files that could be used in that?

Try out wx.html2 for web browser

wxpython offers a html viewer that may be better that the current webbrowser import for use with help & possibly tutorials. Maybe access to external codes (SUBGROUPS & ISODISTORT?).

Code outline:

import wx
import wx.html2

class Frame(wx.Frame):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        
        self.browser = wx.html2.WebView.New(self)

        self.Bind(wx.html2.EVT_WEBVIEW_NAVIGATING,
                  lambda v: self.SetTitle(v.URL))

if __name__ == "__main__":
    app = wx.App()
    frm = Frame(None)
    frm.browser.LoadURL("https://www.office.com/?auth=1") # Microsoft 365
    frm.Show()
    app.MainLoop()

Importer calling FabIO

FabIO reads lots of image types that GSAS-II does not. An importer could call FabIO. This requires matching FabIO metadata reporting to the GSAS-II input needs.

matplotlib=3.8.4 `Ellipse` function redefinition

When attempting to calibrate data from a Ni standard, GSASIIplot.py flags a TypeError: Ellipse.__init__() takes 4 positional arguments but 5 were given when trying to call Plot.add_artist() on line 8985.

This issue seems to be due to a redefinition of matplotlib.patches.Ellipse where angle is no longer a positional argument but a keyword argument (at least, it appears after * and must now be called as a keyword). I have verified that updating line 8985 of GSASIIplot.py with:

Plot.add_artist(Ellipse([cent[0],cent[1]],2*width,2*height,angle=phi,ec=col,fc='none'))

corrects the issue.

For completeness, here is the GSAS-II configuration:

Python/module versions loaded:
  Python:     3.11.9  from /Users/niklas/opt/gsas2full/GSAS-II/GSAS-II.app/Contents/MacOS/GSAS-II. 
  wx:         4.2.1  
  matplotlib: 3.8.4  
  numpy:      1.26.4  
  scipy:      1.13.0  
  OpenGL:     3.1.6  
  Image:      10.3.0 (PIL or Pillow)
  Platform:   darwin 64bit arm64
  GSAS-II:    b26156 from 20-May-2024 14:49 (0.1 days old). Version: last tag #5788
MIDAS_Zarr Reader skipped because zarr module is not installed

Look at effectiveness of LoadImportRoutines

The GSASIIfiles.LoadImportRoutines is called multiple times on startup (from GSASIIdataGUI.py). This could be streamlined so that the imports are done only once and then the objects are scanned only on later calls.

Alternately, perhaps error messages can be displayed once.

propogate rigid body uncertainties to atom coordinates

Rigid body parameters determine the uncertainties on atom coordinates for atoms in those groups. Likewise for Uiso and Uaniso values from TLS fits, etc. At present these s.u. values are not computed, but should be (from the rigid body derivatives and the covariance matrix). Report these in the CIF export.

Allow plotting in Q during fit

The plot shown during fitting can be in TOF or 2theta, but not Q. If the plotting mode has been set to Q, it would be nice if it stayed in Q.

K-vector Search Discussion Notes

04102024


Agenda


  • Documentation needed for the k-vector search functionality -> howto?

  • How are those ARM32 binaries built? Do we have dedicated machines or virtual machines with the specific architecture?

  • I created a branch called develop from the main master branch and added in our new implementation of the k-vector search functionality. I tested it out, fixed several little bugs and I am now confident that the functionality is working robustly. This also includes the change of the k-vector search routine itself, which does need a bit of attention as detailed below.

  • Through testing against artificially generated data (for which we know exactly the ground truth k-vector), we found that we have to go with a fine k-grid for the k-vector searching. This proposes the need for fast calculation. Concerning the speedup, we introduced a combination of two types of solutions -- using multiprocessing together with Cython.

  • Question for @briantoby -- are we currently using any Cython in GSAS-II? Basically, a Cython file is something pretty much like Python code but can be compiled as C library to be imported into Python routine, which can significantly boost up the calculation. So I implemented multiprocessing in Cython and considering the two layers of speedup, we can now perform a heavy calculation with relatively acceptable amount of time (but still on the level of several hours).

  • Testing routine needed for internal people to test out the implementation before releasing to public. I will work on creating a script for people to easily test out the new implementation, with the develop branch.


Minutes


  • Add the Cython compiling stuff into the local build scripts

    Create new files for the new implementation

    Refer to those files that are not starting with G2 here

  • GSAS-II Web Documentation (here) contains general introduction to GSAS-II, meaning it is NOT the place to host the technical details.

    Refer to the source codes here for building the documentation with sphinx.

  • The repo here is for building up the tutorial website. We need to manually populate HTML files for new tutorials (by creating its own directory or putting into existing ones). If a new directory is created to host the new tutorials, we need to follow the instructions here to worry about getting the new directory into the website structure.

  • The GSAS-II development documentation (see here) is built from source RST files together with the docstring in GSAS-II source codes. The source RST files can be found here. To populate the docstring in GSAS-II python source codes into the rendered documentation, we only need to follow the source code structure and refer to certain classes/methods inside the RST file. The place to search for the source Python files for the doc building purpose is defined here.

    Concerning the documentation for the k-vector search, we want to put the reference to the k-vector search docstring into GSASIIutil.rst file which can be found here.

  • For creating the tutorials, relevant exercise files should go into the data subdirectory under certain directory for the specific tutorial. There is an index.htm file inside the data subdirectory -- we don't need to worry about it as it will be automatically generated based on the files we have in the data subdirectory.

  • Do a local build for sphinx to make sure the documentation is rendered as expected before pushing to the repo.

  • Refer to the GSASIImapvars.py and GSASIIscriptable.rst files for nitty-gritties of using reStructuredText.

04032024


Agenda


  • See the todo list in k_vector_search.py.

  • Easy way to have a local test version for beamline scientists to test out, e.g., the k-vector search functionality?

  • When clicking on different items in the tree, the menu options will be updated. How?


Minutes


  • Finish up the k-vector search new implementation.

  • Create a branch for hosting the new implementation of k-vector and we will work out a way for people to do the testing.

  • Brian walked through the implementation of the menu bar items => see notebook for more information.

    https://yr.iris-home.net/gsasiimenunotes

Multibank sequential fitting

Allow grouping of histograms in sequential fitting: combined fits or for TOF instruments that produce multiple histograms.

Needs a tool (in controls) to select groups histograms into groups and save them (nested list?). Then in sequential fit, iterate over groups of histograms. Need to think how to display results in sequential fit table.

remove warnings from update

Bob objects to the three "not available" messages during a git update:

Press any key to continue . . . git repo opened
Updating to latest GSAS-II version
git: updated to latest version
Restart GSAS-II without a project file
pypowder is not available - profile calcs. not allowed
pydiffax is not available for this platform
pypowder is not available - profile calcs. not allowed
exiting update process

This probably can be fixed without too much work.

developer menu command to switch to a remote branch

To facilitate testing of branches, it would be useful to have a menu command (available only in debug mode) that allows one to switch to a remote branch (and back to master)

Steps needed:

  • confirm there are no local changes etc.
  • find remote branches (is there anything better than?
    brList = [i.split()[1] for i in g2repo.git.ls_remote('--heads').split('\n')])
  • fetch the remote branch (how?)
  • switch to that branch
  • restart GSAS-II

Revisit logging: put info into notebook

The logging code, mostly commented out at present, would provide a useful track of what has been done in a refinement if placed into the GSAS-II notebook. Perhaps a filter on the notebook would also be useful to pick out only some types of entries there.

Integrate MIDAS & GSAS-II via powder importer

MIDAS provides an integrated HS pipeline for 2D data treatment, but for non-HEDM analysis, it is desired that MIDAS should transfer powder diffraction patterns (aka lineouts in 1D-speak) directly to GSAS-II. The MIDAS export mechanism has been established as Zarr, but the MIDAS Zarr importer needs more work.

Import Goniometer radius

From APS CAT member & GSAS-II user "Would it be possible to put the Goniometer radius in the instrument parameter file? It would be useful to make this instrument specific."

Likewise, the other stuff in the .samprm ('Type', 'Gonio. radius', 'InstrName') also makes sense in a .instprm file.

Thoughts: add to existing file; could somehow combine reading/writing the two.

Scripting install status message

Scripting needs a way to generate a status message that shows version #'s. This works:

from GSASIIdataGUI import ShowVersions
ShowVersions()

but only if wx etc is present. Need something with only script-needed packages.

setting config overwrites changes

When a change is made to the config, for example, when saving a "previous file" after a "save as", this change is not retained when the final version of the file is saved when the program exists.

Improve project CIF Exports

Note comments below from 2/12/24 email "GSAS-II CIF requests"

Hi, Brian and Bob:
A committee of the Commission on Powder Diffraction and IUCr staff in Chester have been working on making checkCIF and the publication process more powder diffraction friendly. Some progress has been made in eliminating irrelevant alerts, but a few things would be better fixed from your end.

  1. Could GSAS-II add
    the weighting scheme
    the excluded regions
    H-atom treatment
    the number of restraints
    to the CIF it writes? Or do we make the author add these?
  2. I gave them a CIF where the radiation was Mo. _diffrn_radiation_type was just K\a1,2. The Mo had to be added. Is this a glitch?
  3. There is the matter of the maximum shift/esd. If the refinement has converged, could this value be set to the convergence criterion, or could you just do the one more cycle suggested?
    Are these things doable?

They have fixed the problem of senseless esds on bond distances and angles involving non-refined H (!). They are also working on recognizing wavelengths and residuals which are art of loops.

Reply 2/15/24

I have to say that writing code to create CIFs is one of my least
favorite tasks, but I am certainly willing to work on improving the
CIFs that GSAS-II creates. What would make this task a lot easier
would be examples showing what GSAS-II produces and what would be
better. I’ll include some comments and questions below.

On Feb 12, 2024, at 2:56 PM, [email protected] wrote:

  1. Could GSAS-II add
    the weighting scheme

As far as I am aware, Rietveld is always weighted by experimental
uncertainties (which depends on the data provider getting that right),
except that we provide the possibility for changing the relative
importance of different data sets. How would all this be indicated in
CIF?

the excluded regions

This information is there, in that weights are set to zero for
excluded points, but I could specify the actual regions. I’m not sure
this was in pdCIF when I wrote the exporter or maybe I was just lazy.

H-atom treatment

What is being sought? How were the positions generated? Or how were
they refined? The former is going to need to be put in by the user,
but could go into the template for each phase. As for refinement, I
don’t think we offer a riding mode, but people can create their own
restraints and constraints so that could be messy.

the number of restraints

Is this number really worth anything? What about constraints? What
about the relative contributions of restraints to the total chi
squared? All of this can be produced.

  1. I gave them a CIF where the radiation was Mo.
    _diffrn_radiation_type was just K\a1,2. The Mo had to be added. Is
    this a glitch?

I’m not sure if we store the anode or perhaps just the wavelengths.
This will need some investigation and might be a no-can-do.

  1. There is the matter of the maximum shift/esd. If the refinement
    has converged, could this value be set to the convergence criterion,
    or could you just do the one more cycle suggested?

I’m not sure if I understand this. Are you saying to have the
refinement engine run for one more cycle after convergence is
detected? Or run a cycle of refinement just before creating the CIF
(I’d be reluctant to do that). What do you want reported for this?

I think most of this is doable. Maybe all.

Brian

cynarine_5.cif.gz
cynarine_5.gpx.gz
cynarine_H2O_R1.cif.gz
vege083.gpx.gz
vege083E_GSAS.cif.gz
vege083E.cif.gz

Limits and excluded regions

Hi, I'm doing a Rietveld refinement of lab XRD data which includes large background peaks at high angles.
I set up histogram excluded regions in a project using the GUI.
Excluded regions were [64.58, 65.58] and [77.84, 78.84].
When I open this project in the scripting interface I can inspect the excluded regions I set up:

In:  hist.get('Limits')  
Out: [(10.0, 80.0), [10.0, 80.0], [64.58, 65.58], [77.84, 78.84]]

In a new project (starting without any excluded regions) my attempt to add exclusions to hist parameters via the scripting interface is as follows:

limits = hist.get('Limits')
exclusions = [[64.58, 65.58], [77.84, 78.84]]
limits.extend(exclusions)
hist.set_refinements({"Limits": limits,
                          "Background": {"no. coeffs": coeffs, "refine": True},
                          "Sample Parameters": ["Scale"]})

Returns the error:

hist.set_refinements({"Limits": limits,

  File ~\gsas2full\GSASII\GSASIIscriptable.py:3444 in set_refinements
    old_limits[0], old_limits[1] = new_limits

ValueError: too many values to unpack (expected 2)

Any help, pointers, code most welcome and appreciated!

Cheers,
Operandos

gsas2full-5773-MacOSX-x86_64.sh errors

I tried to install GSAS-II via the self-installer downloads at https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/tag/v1.0.1, but the install failed (see commands below). I think the installer is looking for an exe file that I likely don't have (MacOS 14.4, Intel Core i7)

PS - The installer implies the version is 4446, but the download page implies 5773. Which is correct?

PSS - Do you want installer questions here, or in build tools (https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/). The new webpage guidance only directs here (https://advancedphotonsource.github.io/GSAS-II-tutorials/bug.html)

cd Downloads/
./gsas2full-4446-MacOSX-x86_64.sh 

Welcome to gsas2full 4446

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue

Do you accept the license terms? [yes|no]
[no] >>> yes

gsas2full will now be installed into this location:
/Users/**********/gsas2full

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/Users/**********/gsas2full] >>> /Users/**********/gsas2full-5773  
PREFIX=/Users/**********/gsas2full-5773
Unpacking payload ...
/Users/**********/gsas2full-5773/conda.exe: line 1: =============================================: command not found
/Users/**********/gsas2full-5773/conda.exe: line 2: syntax error near unexpected token `c'
/Users/**********/gsas2full-5773/conda.exe: line 2: ` Copyright (c) 2016, Continuum Analytics, Inc.'
ERROR: could not extract tar starting at offset 000000000000015246+9490254+2


k-vector todos

  • (bug) NiO with space group R-3m and k=(0,0,3/2) with respect to the conventional cell (hexagonal axes). This one doesn't seem to work correctly: when searching high symmetry points, (0,0,3/2) doesn't appear in the list of potential solutions, which suggests there's a bug in either the conventional/primitive cell conversion or the d-spacing calculation.

  • The "HighSymPts & HighSymPaths" option actually searches only HighSymPaths. So we should change the label.

  • replacing the tolerance box with a "List top N results" box, that defaults to show the top 10 results (if there are more than 10, and all results otherwise).

  • isodistort implementation

  • List Avg. \delta(d) and Max. \delta(d) in the table, as well as Avg. \delta(d)/d.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.