source: trunk/testinp/gencelltests.py @ 70

Last change on this file since 70 was 70, checked in by toby, 12 years ago

move lattice operations into GSASIIlattice w/unit tests

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/Users/toby/build/cctbx_build/bin/python
2import sys
3import cctbx.uctbx as uc
4import numpy as np
5import datetime
6
7fp = sys.stdout
8fp.write("# output from uctbx computed on platform %s on %s\n" %
9         (sys.platform, datetime.date.today()) )
10fp.write("import numpy as np\n")
11fp.write("array = np.array\n\n")
12fp.write("CellTestData = [\n")
13
14for 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)
40fp.write("]\n")
41
Note: See TracBrowser for help on using the repository browser.