Hi Jan,
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@phenix-online.org
http://phenix-online.org/mailman/listinfo/cctbxbb