[70] | 1 | #!/Users/toby/build/cctbx_build/bin/python |
---|
| 2 | import sys |
---|
| 3 | import cctbx.uctbx as uc |
---|
| 4 | import numpy as np |
---|
| 5 | import datetime |
---|
| 6 | |
---|
| 7 | fp = sys.stdout |
---|
[71] | 8 | fp.write("# output from uctbx (cctbx) computed on platform %s on %s\n" % |
---|
[70] | 9 | (sys.platform, datetime.date.today()) ) |
---|
[71] | 10 | fp.write("#import numpy as np\n") |
---|
[70] | 11 | fp.write("array = np.array\n\n") |
---|
| 12 | fp.write("CellTestData = [\n") |
---|
| 13 | |
---|
| 14 | for cell in [ |
---|
| 15 | (4,4,4,90,90,90), |
---|
| 16 | (4.1,5.2,6.3,100,80,130), |
---|
| 17 | (3.5,3.5,6,90,90,120), |
---|
| 18 | ]: |
---|
| 19 | fp.write("# cell, g, G, cell*, V, V*\n") |
---|
| 20 | result = [] |
---|
| 21 | result.append(cell) |
---|
| 22 | mm = uc.unit_cell(cell).metrical_matrix() |
---|
| 23 | result.append( |
---|
| 24 | np.array([mm[i] for i in (0,3,4,3,1,5,4,5,2)]).reshape(3,3) |
---|
| 25 | ) |
---|
| 26 | rmm = uc.unit_cell(cell).reciprocal_metrical_matrix() |
---|
| 27 | result.append( |
---|
| 28 | np.array([rmm[i] for i in (0,3,4,3,1,5,4,5,2)]).reshape(3,3) |
---|
| 29 | ) |
---|
| 30 | result.append( |
---|
| 31 | uc.unit_cell(cell).reciprocal().parameters() |
---|
| 32 | ) |
---|
| 33 | result.append( |
---|
| 34 | uc.unit_cell(cell).volume() |
---|
| 35 | ) |
---|
| 36 | result.append( |
---|
| 37 | uc.unit_cell(cell).reciprocal().volume() |
---|
| 38 | ) |
---|
| 39 | fp.write(" %s,\n" % result) |
---|
| 40 | fp.write("]\n") |
---|
| 41 | |
---|
[71] | 42 | fp.write("CoordTestData = [\n") |
---|
| 43 | for cell in [ |
---|
| 44 | (4,4,4,90,90,90), |
---|
| 45 | (4.1,5.2,6.3,100,80,130), |
---|
| 46 | (3.5,3.5,6,90,90,120), |
---|
| 47 | ]: |
---|
| 48 | fp.write("# cell, ((frac, ortho),...)\n") |
---|
| 49 | fp.write(" ((%s,%s,%s,%s,%s,%s,), [\n" % cell) |
---|
| 50 | for frac in [ |
---|
| 51 | (0.1,0.,0.), |
---|
| 52 | (0.,0.1,0.), |
---|
| 53 | (0.,0.,0.1), |
---|
| 54 | (0.1,0.2,0.3), |
---|
| 55 | (0.2,0.3,0.1), |
---|
| 56 | (0.3,0.2,0.1), |
---|
| 57 | (0.5,0.5,0.5), |
---|
| 58 | ]: |
---|
| 59 | fp.write(" (%s,%s),\n" % (frac, uc.unit_cell(cell).orthogonalize(frac))) |
---|
| 60 | fp.write("]),\n") |
---|
| 61 | fp.write("]\n") |
---|
| 62 | |
---|
| 63 | sys.exit() |
---|