Debian Codegraph @

src/Programs/syd_example_2.py

raw symbols SCIP
1 # Example python program: native use
2
3 from __future__ import print_function
4 from CifFile import ValidCifFile,CifDic #import definitions
5
6 # change the following as required by your installation
7 test_dic = "../dictionaries/cif_core.dic"
8 test_data = "../drel/testing/data/nacltest.cif"
9
10 # only proceed if CifFile is valid
11 my_cif = ValidCifFile(datasource=test_data,dic=CifDic(test_dic))
12
13 # get the first blockname
14 my_data_block = my_cif.first_block()
15
16 # get some data
17 cela = my_data_block["_cell_length_a"] #cell dimension
18 name = my_data_block["_symmetry_cell_setting"] #cell setting
19
20 allnames = my_data_block.keys()
21 # get a random data name which may be one of the above
22 data = my_data_block[allnames[0]]
23
24 # to print, don't need to check type
25 print("%s %s" % (allnames[0],data))
26
27 # loop atom sites
28 names = my_data_block["_atom_site_label"]
29 xsxs = my_data_block["_atom_site_fract_x"]
30 processed = zip(names,xsxs)
31 for label, data in processed:
32 print("%s %s" % (label,data))