Article View: sci.techniques.xtallography
Article #37Re: Generating LARGE Cartesian Lattices?
From: Paul Nuber
Date: Fri, 18 Oct 2002 05:19
Date: Fri, 18 Oct 2002 05:19
46 lines
3116 bytes
3116 bytes
uncle Al wants it to work in windows, he may not have a fortran compiler.
It is more easy with python. You can download it from www.python.org.
Read the tutorial and here you go, it allows you to do other cool things too.
In the python shell you can type (translate from fortran below)
from math import *
ff = open("te.xyz","w")
a = 4. ; c=5. ; r=150.
iamin = int(r/a) + 1 ; icmin = int(r/c) + 1
for i in range(iamin):
for j in range(iamin):
for k in range(icmin):
x = a*i + a*j*cos(2.*pi/3.)
y = b*j*sin(2.*pi/3.)
z = c*k
if x**2 + y**2 + z**2 < r**2 :
ff.write("%8s%12.6f%12.6f%12.6f\n" % ("Te",x,y,z))
ff.close()
(ctrl-Z to exist shell)
It takes about 30 seconds on my pentium 4 machine to generate
the required file (about 10 Mbytes).
best
paul
> > Just loop over a, b and c lattice translations throwing away anything
> > outside the radius you want. In fortran (which I hope you can read)
> > that leads to something like the following:
> > program hexlat
> > a=4.0 ! a and c parameters
> > c=5.0 ! ...clearly you'll want to fill in the right numbers
> > r=150.0 ! radius of sphere
> > PI=4.0*atan(1.0)
>
> Aw, c'mon, explictly enter it as double precision floating point.
>
> > iamin=int(r/a)+1 ! number of cells in a,c directions
> > icmin=int(r/c)+1 ! ...plus 1 as fortran rounds down
> > do 1 ia=-iamin,iamin
> > do 1 ib=-iamin,iamin
> > do 1 ic=-icmin,icmin
> > x=a*ia+a*ib*cos(2.*PI/3.) ! Check these equations...
> > y= a*ib*sin(2.*PI/3.) ! You might want different
> > z=c*ic ! coords to these (a||x, c||z)
> > 1 if(sqrt(x*x+y*y+z*z).le.r)write(*,*)x,y,z
> > end
Technical Details
Message-ID:
<46223b20.0210172119.334bb773@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailReferences:
<3DAC8E95.4E7ACFD1@hate.spam.net> <85160b48.0210151846.74eeb9f6@posting.google.com> <3DAD8AE7.59098CA4@hate.spam.net> <52fe159d.0210171148.380ede5a@posting.google.com> <3DAF2B5B.601E8D20@hate.spam.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcf0b,b1027c29d7d8962b X-Google-Attributes: gidfcf0b,public X-Google-Thread: f804b,b1027c29d7d8962b X-Google-Attributes: gidf804b,public X-Google-ArrivalTime: 2002-10-17 22:19:21 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: nuberpaul@nandomail.com (Paul Nuber) Newsgroups: sci.techniques.xtallography,bionet.xtallography Subject: Re: Generating LARGE Cartesian Lattices? Date: 17 Oct 2002 22:19:20 -0700 Organization: http://groups.google.com/ Lines: 46 Message-ID: <46223b20.0210172119.334bb773@posting.google.com> References: <3DAC8E95.4E7ACFD1@hate.spam.net> <85160b48.0210151846.74eeb9f6@posting.google.com> <3DAD8AE7.59098CA4@hate.spam.net> <52fe159d.0210171148.380ede5a@posting.google.com> <3DAF2B5B.601E8D20@hate.spam.net> NNTP-Posting-Host: 146.215.0.37 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1034918361 23433 127.0.0.1 (18 Oct 2002 05:19:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 18 Oct 2002 05:19:21 GMT