Skip to content

Instantly share code, notes, and snippets.

@istitov
Last active December 29, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save istitov/7633654 to your computer and use it in GitHub Desktop.
Save istitov/7633654 to your computer and use it in GitHub Desktop.
Picture of bcc unit cell written in asymptote language. 'asy L21_cell.asy -f png' will produce png out of it. For http://wp.me/p2FT07-x
settings.maxtile = (0,0);
if(settings.render < 0) settings.render = 10;
settings.antialias=1;
import three;
size(250,0);
currentprojection=perspective(250,-1000,250,center=true);
//L21 lattice.
//define two types of ions
path3 circle3d = scale3(10)*path3(circle(0,1),ZXplane);
surface unitcirlcle3d=surface(circle(0,1),ZXplane);
surface iona = scale3(12)*unitcirlcle3d;
path ct = ((0,1)..(-1,0)..(0,-1)--cycle);
surface ionb = scale3(10)*unitcirlcle3d;
surface ionc = scale3(10)*unitcirlcle3d;
pen Ni = heavygrey;
pen Mn = red;
pen Ga = green;
//atoms
for(int x=-1; x<2; ++x) {
for(int y=-1; y<2; ++y) {
for(int z=-1; z<2; ++z) {
//draw(shift(100*(x,y,z))*iona,Ni);
draw(shift(100*(x,y-0.01,z))*iona,Ni,black+0.5,nolight);
}
}
}
//"upper" part
draw(shift(50*(1,1-0.01,1))*ionb,Mn,black+0.5,nolight); draw(shift(50*(-1,1-0.01,1))*ionb,Ga,black+0.5,nolight);
draw(shift(50*(1,-1-0.01,1))*ionb,Ga,black+0.5,nolight); draw(shift(50*(-1,-1-0.01,1))*ionb,Mn,black+0.5,nolight);
//"lower" part
draw(shift(50*(-1,-1-0.01,-1))*ionb,Ga,black+0.5,nolight); draw(shift(50*(1,1-0.01,-1))*ionb,Ga,black+0.5,nolight);
draw(shift(50*(-1, 1-0.01,-1))*ionb,Mn,black+0.5,nolight); draw(shift(50*(1,-1-0.01,-1))*ionb,Mn,black+0.5,nolight);
//style of lines connecting ions
pen thick=linewidth(1.5);
pen thin=linewidth(1.5)+gray(0.4)+dotted;
//lattice
//z=2;
for(int z=-1; z<2; ++z) {
draw((100*(1,1,z)--100*(-1,1,z)--100*(-1,-1,z)--100*(1,-1,z)--cycle),thick);
draw((100*(0,-1,z)--100*(0,1,z)),thick);
}
for(int x=-1; x<2; ++x) {
for(int y=-1; y<2; ++y) {
draw((100*(x,y,-1)--100*(x,y,1)),thick);
}
}
//sublattice
draw(box(50(-1,-1,-1),50*(1,1,1)),thin);
defaultpen(TimesRoman()+fontsize(24));
label("$L2_1$ unit cell",-100*(0,1.5,1.5),N);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment