Skip to content

Can not read cif file download from Crystallography Open Database without GUI #172

@GKNB

Description

@GKNB

Here I want to report (possibly) a bug where the latest GSAS-II can not read cif file downloaded from Crystallography Open Database (http://www.crystallography.net/cod/cif) on Polaris ALCF machine. (for example, http://www.crystallography.net/cod/cif/1/00/14/1001460.cif). Detail is the minimal requirement to reproduce this problem. Since it is running on Polaris, we don't want to use GUI and want to fully work with cmd.

I first install gsas-ii with the following command:

g2="https://github.com/AdvancedPhotonSource/GSAS-II-buildtools/releases/download/v1.0.1/gsas2main-Latest-Linux-x86_64.sh"
curl -L "$g2" > /tmp/g2.sh; bash /tmp/g2.sh -b -p /lus/eagle/projects/RECUP/twang/g2full_04282025

I got the following outputs:

PREFIX=/lus/eagle/projects/RECUP/twang/g2full_04282025
Unpacking payload ...
entry_point.py:256: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
entry_point.py:256: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.

Installing base environment...

Preparing transaction: ...working... done
Executing transaction: ...working... 


done
entry_point.py:256: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
Finish up GSAS-II installation
launching bootstrap process
GSAS-II installer completed
installation finished.
WARNING:
    You currently have a PYTHONPATH environment variable set. This may cause
    unexpected behavior when running the Python interpreter in gsas2main.
    For best results, please verify that your PYTHONPATH only points to
    directories of packages that are compatible with the Python interpreter
    in gsas2main: /lus/eagle/projects/RECUP/twang/g2full_04282025

Then I notice there is a script in the installation directory, RunGSASII.sh, which says:

source /lus/eagle/projects/RECUP/twang/g2full_04282025/bin/activate
/lus/eagle/projects/RECUP/twang/g2full_04282025/bin/python3.13 /lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II/GSASII/G2.py $*

and the content of /lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II/GSASII/G2.py is basically adding the installation directory to the python path, so I did the following:

# Source the python environment
source /lus/eagle/projects/RECUP/twang/g2full_04282025/bin/activate

python -c "import sys, os; sys.path.insert(0, '/lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II'); from GSASII import GSASIIscriptable as g2sc; gpx=g2sc.G2Project(newgpx = '/lus/eagle/projects/RECUP/twang/testbed/gsas_temp/FB.gpx'); phase0=gpx.add_phase('/lus/eagle/projects/RECUP/twang/testbed/gsas_temp/1001460.cif')"

Where '/lus/eagle/projects/RECUP/twang/testbed/gsas_temp/1001460.cif' is downloaded from Crystallography Open Database. Then I got the following error message:

N.B. Configuration file /home/twang3/.GSASII/config.ini does not exist
Error importing config.py file
 No module named 'config'
0 values read from /home/twang3/.GSASII/config.ini
======================================================================
Module pyspg in '/lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II/GSASII-bin/linux_64_p3.13_n2.2' could not be loaded
error msg: /lib64/libm.so.6: version `GLIBC_2.38' not found (required by /lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II/GSASII-bin/linux_64_p3.13_n2.2/pyspg.cpython-313-x86_64-linux-gnu.so)
======================================================================
*** ERROR: Unable to find GSAS-II binaries. Much of GSAS-II cannot function
binary load error: pyspg not found
pypowder is not available - profile calcs. not allowed
pydiffax is not available for this platform
pypowder is not available - profile calcs. not allowed
validator:  True
Warning: CIF Reader failed to read /lus/eagle/projects/RECUP/twang/testbed/gsas_temp/1001460.cif
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import sys, os; sys.path.insert(0, '/lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II'); from GSASII import GSASIIscriptable as g2sc; gpx=g2sc.G2Project(newgpx = '/lus/eagle/projects/RECUP/twang/testbed/gsas_temp/FB.gpx'); phase0=gpx.add_phase('/lus/eagle/projects/RECUP/twang/testbed/gsas_temp/1001460.cif')
                                                                                                                                                                                                                                                ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II/GSASII/GSASIIscriptable.py", line 1350, in add_phase
    phasereaders = import_generic(phasefile, Readers['Phase'],
                                      fmthint=fmthint, URL=URL)
  File "/lus/eagle/projects/RECUP/twang/g2full_04282025/GSAS-II/GSASII/GSASIIscriptable.py", line 503, in import_generic
    raise G2ImportException(f"No reader could read file: {filename}")
GSASII.GSASIIscriptable.G2ImportException: No reader could read file: /lus/eagle/projects/RECUP/twang/testbed/gsas_temp/1001460.cif

Since it first report error on not finding config module, I also did pip install config inside this environment and rerun that python command, but I still get the same error.

Meanwhile, as mentioned in https://github.com/AdvancedPhotonSource/GSAS-II/issues/165, gsas-ii is supposed to use PyCIFRW to read cif file, so I also did the following to test if PyCIFRW could read the cif file correctly:

source /lus/eagle/projects/RECUP/twang/g2full_04282025/bin/activate
python -c "from CifFile import ReadCif; cf = ReadCif('/lus/eagle/projects/RECUP/twang/testbed/gsas_temp/1001460.cif'); print(cf)"

and then I can get good result, part of the output is shown below:

Writing 1001460, <CifFile.StarFile.StarBlock object at 0x7fbb253ffcb0>
All blocks output.

##########################################################################
#               Crystallographic Information Format file
#               Produced by PyCifRW module
#
#  This is a CIF file.  CIF has been adopted by the International
#  Union of Crystallography as the standard for data archiving and
#  transmission.
#
#  For information on this file format, follow the CIF links at
#  http://www.iucr.org
##########################################################################

data_1001460

loop_
  _publ_author_name
         'Licheron, M'       
         'Gervais, F'        
         'Coutures, J'       
         'Choisnet, J' 
_publ_section_title      
<......................skip to save space......................>
loop_
  _atom_type_symbol
  _atom_type_oxidation_number
         Ba2+      2.000     
         Bi3+      3.000     
         Bi5+      5.000     
         O2-       -2.000

and you can see PyCIFRW can read that cif correctly.

So the question I want to ask is, is there any way I can solve this issue? Thanks!

Sub-issues

Metadata

Metadata

Assignees

Labels

APSBug or need identified/requested by APS user/staffIn progressthis is being addressed but is not complete

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions