{"id":3304,"date":"2014-02-01T18:32:36","date_gmt":"2014-02-02T02:32:36","guid":{"rendered":"http:\/\/bendwavy.org\/wp\/?p=3304"},"modified":"2015-11-17T23:48:51","modified_gmt":"2015-11-18T07:48:51","slug":"fcc-cube-generator","status":"publish","type":"post","link":"https:\/\/bendwavy.org\/wp\/?p=3304","title":{"rendered":"FCC cube generator"},"content":{"rendered":"<p>I could have used this a week ago.<\/p>\n<pre>\r\ndef fccstack():\r\n\tnewlimit = 0\r\n\twhile True:\r\n\t\toldlimit = newlimit\r\n\t\tnewlimit += 1\r\n\t\t# extend z\r\n\t\tfor x in xrange(oldlimit):\r\n\t\t\tfor y in xrange((x+oldlimit)&1, oldlimit, 2):\r\n\t\t\t\tyield (x,y,oldlimit)\r\n\r\n\t\t# extend y\r\n\t\tfor x in xrange(oldlimit):\r\n\t\t\tfor z in xrange((x+oldlimit)&1, newlimit, 2):\r\n\t\t\t\tyield (x,oldlimit,z)\r\n\r\n\t\t# extend x\r\n\t\tfor y in xrange(newlimit):\r\n\t\t\tfor z in xrange((y+oldlimit)&1, newlimit, 2):\r\n\t\t\t\tyield (oldlimit,y,z)\r\n\r\ng = fccstack()\r\nfor dummy in xrange(512):\r\n\tp,q,r = g.next()\r\n\tprint \"%d %d %d\\t%d\" % (p,q,r, p+q+r)\r\n<\/pre>\n<p>This lists coordinates of sites in a face-centred cubic lattice, filling the smallest cube that contains the number of sites required.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I could have used this a week ago. def fccstack(): newlimit = 0 while True: oldlimit = newlimit newlimit += 1 # extend z for x in xrange(oldlimit): for y in xrange((x+oldlimit)&#038;1, oldlimit, 2): yield (x,y,oldlimit) # extend y for &hellip; <a href=\"https:\/\/bendwavy.org\/wp\/?p=3304\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,4],"tags":[],"class_list":["post-3304","post","type-post","status-publish","format-standard","hentry","category-mathematics","category-neep-neep"],"_links":{"self":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3304"}],"version-history":[{"count":5,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3304\/revisions"}],"predecessor-version":[{"id":3524,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3304\/revisions\/3524"}],"wp:attachment":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}