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