[cctbxbb] Bug in cif file parser? (was: How to load a structure from a .cif file?)

Richard Gildea rgildea at gmail.com
Tue Dec 14 07:13:16 PST 2010


Hi Jan,

Thanks for pointing out the problem. There is a fix now on the svn, so you
can either grab the updates off sourceforge, or for now just comment
out (with a #) the offending line (43, beginning _[local]), since this line
is of no use (to the cctbx) anyway.

Cheers,

Richard

2010/12/14 Jan Marten Simons <marten at xtal.rwth-aachen.de>

> Am Samstag 11 Dezember 2010 14:16:37 schrieb Richard Gildea:
> > Hi Jan,
> >
> > This should be fairly straightforward:
> >
> > from cctbx import xray
> >
> > xs = xray.structure.from_cif(file_path="my.cif")
> >
> > This will return you an instance of xray.structure. If you have more than
> > one data block in your cif, you can specify which structure you want to
> > extract using the block_heading keyword (by default it just returns the
> > first structure it can successfully extract from the cif). There is also
> > similar functionality that can be used to extract miller arrays from fcf
> or
> > hkl formats.
>
> Ok, my code is now like this:
> file_name = "./xtal_data/9008806.cif"
> #file_name = "./xtal_data/9010017.cif"
> structure = xray.structure.from_cif(file_path=file_name)
> print(str(structure))
> structure.show_summary().show_scatterers()
>
> > Please let me know if you have any further questions about this.
>
> I've tested it with 2 cif files chosen at will from COD:
>
> * http://www.crystallography.net/cif/9/9010017.cif
> works like expected.
>
> * http://www.crystallography.net/cif/9/9008806.cif
> gives an error:
>
> "
> ./xtal_data/9008806.cif(43)  : error 3 : ()* loopback of 150:8: ( (
> WHITESPACE
> )+ ( data_items | save_frame ) )*, at offset 0
>    near _
>     : cannot match to any predicted input...
>
> Traceback (most recent call last):
>  File "Check_F_calc.py2", line 12, in <module>
>    structure = xray.structure.from_cif(file_path=file_name)
>  File "/home/marten/Arbeit/cctbx-
> latest/cctbx_sources/cctbx/xray/structure.py", line 1366, in from_cif
>    data_structure_builder=builders.crystal_structure_builder).structure
> AttributeError: 'NoneType' object has no attribute 'structure'
> "
>
> This either suggests an error in the .cif file or in the cif file parser of
> cctbx. From taking a look at both cif files I'm not sure why it breaks on
> the
> 2nd one.
>
> With regards,
>
>  Jan Simons
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20101214/90c2e349/attachment.htm>


More information about the cctbxbb mailing list