| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,7 +164,7 @@ def toLines(self, stru): | |||
| 164 | 164 | lines = [] | |
| 165 | 165 | ||
| 166 | 166 | # title | |
| 167 | - titles = structure.title.split("\n") | ||
| 167 | + titles = stru.title.split("\n") | ||
| 168 | 168 | for t in titles: | |
| 169 | 169 | lines.append("title = %s"%t) | |
| 170 | 170 | ||
@@ -221,20 +221,3 @@ def getParser(): | |||
| 221 | 221 | return P_bratoms() | |
| 222 | 222 | ||
| 223 | 223 | # End of file | |
| 224 | - | ||
| 225 | - if __name__ == "__main__": | ||
| 226 | - | ||
| 227 | - files = ["GaAs.inp"] | ||
| 228 | - | ||
| 229 | - ep = getParser() | ||
| 230 | - | ||
| 231 | - for fn in files: | ||
| 232 | - infile = file(fn, 'r') | ||
| 233 | - fstr = infile.read() | ||
| 234 | - infile.close() | ||
| 235 | - lines = fstr.split("\n") | ||
| 236 | - structure = ep.parseLines(lines) | ||
| 237 | - lines = ep.toLines(structure) | ||
| 238 | - print "\n".join(lines) | ||
| 239 | - | ||
| 240 | - | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,13 +13,15 @@ def makeCuboctahedron(S, dist): | |||
| 13 | 13 | Arguments | |
| 14 | 14 | S -- A Structure instance | |
| 15 | 15 | dist -- Distance from center to nearest face | |
| 16 | + axis -- Tuple defining the z-axis of the cuboctahedron (default | ||
| 17 | + (0,0,1)). | ||
| 16 | 18 | ||
| 17 | 19 | Returns a new structure instance | |
| 18 | 20 | """ | |
| 19 | 21 | ||
| 20 | 22 | # Create a supercell large enough for the ellipsoid | |
| 21 | 23 | frac = S.lattice.fractional((dist, dist, dist)) | |
| 22 | - mno = map(ceil, 4*frac) | ||
| 24 | + mno = map(ceil, 2*frac) | ||
| 23 | 25 | # Make the supercell | |
| 24 | 26 | from supercell import supercell | |
| 25 | 27 | newS = supercell(S, mno) | |
@@ -30,24 +32,19 @@ def makeCuboctahedron(S, dist): | |||
| 30 | 32 | ||
| 31 | 33 | # Make the cuboctahedron template | |
| 32 | 34 | from geometry.composites import cuboctahedron | |
| 33 | - from geometry.operations import translate | ||
| 35 | + from geometry.operations import translate, rotate | ||
| 34 | 36 | c0 = translate(cuboctahedron(dist), lat.cartesian(newS[ncenter].xyz)) | |
| 35 | 37 | ||
| 36 | 38 | # Cut out an octahedron | |
| 37 | 39 | from geometry import locate | |
| 38 | - delList = [] | ||
| 39 | 40 | ||
| 40 | 41 | N = len(newS) | |
| 41 | 42 | j = N | |
| 42 | 43 | for i in xrange(N): | |
| 43 | - j -= 1 | ||
| 44 | 44 | ||
| 45 | - xyz = lat.cartesian(newS[j].xyz) | ||
| 45 | + xyz = lat.cartesian(newS[N-1-i].xyz) | ||
| 46 | 46 | if locate(xyz, c0) == 1: | |
| 47 | - delList.append(j) | ||
| 48 | - | ||
| 49 | - for i in delList: | ||
| 50 | - newS.pop(i) | ||
| 47 | + newS.pop(N-1-i) | ||
| 51 | 48 | ||
| 52 | 49 | return newS | |
| 53 | 50 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -416,6 +416,21 @@ def test_writeStr_cif(self): | |||
| 416 | 416 | stru.read(datafile('CdSe_bulk.stru'), 'pdffit') | |
| 417 | 417 | s_s = stru.writeStr(self.format) | |
| 418 | 418 | ||
| 419 | + ############################################################################## | ||
| 420 | + class TestP_bratoms(unittest.TestCase): | ||
| 421 | + """test Parser for Bruce Ravel's atoms file format""" | ||
| 422 | + | ||
| 423 | + def setUp(self): | ||
| 424 | + self.stru = Structure() | ||
| 425 | + self.format = "bratoms" | ||
| 426 | + self.places = 6 | ||
| 427 | + | ||
| 428 | + def test_writeStr_cif(self): | ||
| 429 | + """check conversion to CIF string""" | ||
| 430 | + stru = self.stru | ||
| 431 | + stru.read(datafile('GaAs.inp'), 'bratoms') | ||
| 432 | + s_s = stru.writeStr(self.format) | ||
| 433 | + | ||
| 419 | 434 | # End of TestP_cif | |
| 420 | 435 | ||
| 421 | 436 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,33 @@ | |||
| 1 | + title Cell structure file of CdSe #186 | ||
| 2 | + format pdffit | ||
| 3 | + scale 1.000000 | ||
| 4 | + sharp 0.000000, 0.000000, 1.000000, 0.000000 | ||
| 5 | + spcgr P63mc | ||
| 6 | + cell 4.300000, 4.300000, 7.010000, 90.000000, 90.000000, 120.000000 | ||
| 7 | + dcell 0.000493, 0.000493, 0.001368, 0.000000, 0.000000, 0.000000 | ||
| 8 | + ncell 1, 1, 1, 4 | ||
| 9 | + atoms | ||
| 10 | + CD 0.33340001 0.66670001 0.00000000 1.0000 | ||
| 11 | + 0.00000000 0.00000000 0.00000000 0.0000 | ||
| 12 | + 0.01400000 0.01400000 0.01400000 | ||
| 13 | + 0.00011127 0.00011127 0.00019575 | ||
| 14 | + 0.00000000 0.00000000 0.00000000 | ||
| 15 | + 0.00000000 0.00000000 0.00000000 | ||
| 16 | + CD 0.66659999 0.33329999 0.50000000 1.0000 | ||
| 17 | + 0.00000000 0.00000000 0.00000000 0.0000 | ||
| 18 | + 0.01400000 0.01400000 0.01400000 | ||
| 19 | + 0.00011127 0.00011127 0.00019575 | ||
| 20 | + 0.00000000 0.00000000 0.00000000 | ||
| 21 | + 0.00000000 0.00000000 0.00000000 | ||
| 22 | + SE 0.33340001 0.66670001 0.37500000 1.0000 | ||
| 23 | + 0.00000000 0.00000000 0.00000000 0.0000 | ||
| 24 | + 0.01500000 0.01500000 0.01500000 | ||
| 25 | + 0.00022268 0.00022268 0.00071372 | ||
| 26 | + 0.00000000 0.00000000 0.00000000 | ||
| 27 | + 0.00000000 0.00000000 0.00000000 | ||
| 28 | + SE 0.66659999 0.33329999 0.87500000 1.0000 | ||
| 29 | + 0.00000000 0.00000000 0.00000000 0.0000 | ||
| 30 | + 0.01500000 0.01500000 0.01500000 | ||
| 31 | + 0.00022268 0.00022268 0.00071372 | ||
| 32 | + 0.00000000 0.00000000 0.00000000 | ||
| 33 | + 0.00000000 0.00000000 0.00000000 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + !This file is generated by atoms.py. | ||
| 2 | + title = GaAs | ||
| 3 | + a = 5.6537 b = 5.6537 c = 5.6537 | ||
| 4 | + alpha = 90.000000 beta = 90.000000 gamma = 90.000000 | ||
| 5 | + space = F-43m | ||
| 6 | + core = As | ||
| 7 | + edge = K | ||
| 8 | + atoms | ||
| 9 | + ! x y z tag occ | ||
| 10 | + AS 0.250000 0.250000 0.250000 As 1.0000 | ||
| 11 | + GA 0.000000 0.000000 0.000000 Ga 1.0000 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments