Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{standalone}
- usepackage[inline]{asymptote}
- begin{document}
- begin{asy}
- size(300);
- import solids;
- // save predefined 2D orientation vectors
- pair NN=N;
- pair SS=S;
- pair EE=E;
- pair WW=W;
- triple C1 = (-3.19898,0.68575,-0.09137);
- triple N1 = (-2.00788,-0.15303,-0.05472);
- triple H1 = (-3.17155,1.39571,-0.92422);
- triple H2 = (-3.31563,1.23754,0.84706);
- triple H3 = (-4.08519,0.05549,-0.21396);
- triple C2 = (-0.78815,0.67831,0.01256);
- triple H4 = (-1.95362,-0.69266,-0.92177);
- triple C3 = (0.47237,-0.18670,0.21998);
- triple H5 = (-0.86520,1.39211,0.84227);
- triple H6 = (-0.69535,1.26040,-0.91400);
- triple C4 = (1.73163,0.67172,0.09304);
- triple N2 = (0.51467,-1.32801,-0.73516);
- triple H7 = (0.46502,-0.59296,1.23918);
- triple H8 = (1.39360,-1.82407,-0.57104);
- triple H9 = (-0.23067,-1.96899,-0.46111);
- triple O1 = (1.80456,1.88884,0.13111);
- triple O2 = (2.86188,-0.07112,0.00360);
- triple H10 = (3.57354,0.59879,-0.06651);
- triple[] Carbon={
- C1,C2,C3,C4,
- };
- triple[] Nitrogen={
- N1,N2,
- };
- triple[] Oxygen={
- O1,O2,
- }
- triple[] Hydrgeon={
- C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,
- }
- void Draw(guide3 g,pen p=currentpen){
- draw(
- cylinder(
- point(g,0),cylR,arclength(g),point(g,1)-point(g,0)
- ).surface(
- new pen(int i, real j){
- return p;
- }
- )
- );
- }
- real cylR=0.062;
- pen connectPen=lightgray
- Draw(C1--N1,connectPen)
- Draw(N1--C2,connectPen)
- Draw(C2--C3,connectPen)
- Draw(C3--C4,connectPen)
- Draw(C4--O1,connectPen)
- Draw(H1--C1,connectPen)
- Draw(H2--C1,connectPen)
- Draw(H3--C1,connectPen)
- Draw(H4--N1,connectPen)
- Draw(C2--H5,connectPen)
- Draw(C2--H6,connectPen)
- Draw(C3--H7,connectPen)
- Draw(C3--N2,connectPen)
- Draw(N2--H8,connectPen)
- Draw(N2--H9,connectPen)
- Draw(C4--O2,connectPen)
- Draw(O2--H10,connectPen)
- void drawSpheres(triple[] C, real R, pen p=currentpen){
- for(int i=0;i<C.length;++i){
- draw(sphere(C[i],R).surface(
- new pen(int i, real j){return p;}
- )
- );
- }
- }
- drawSpheres(Carbon,darkgray);
- drawSpheres(Nitrogen,lightblue);
- drawSpheres(Oxygen,red);
- drawSpheres(Hydrogen,lightgray);
- end{asy}
- end{document}
- import settings;
- dir="C:Program FilesAsymptote";
- documentclass{standalone}
- usepackage{asypictureB}
- begin{document}
- begin{asypicture}{name=crystal}
- size(300);
- import solids;
- currentprojection=orthographic (
- camera=(8,5,4),
- up=(0,0,1),
- target=(2,2,2),
- zoom=0.5
- );
- // save predefined 2D orientation vectors
- pair NN=N;
- pair SS=S;
- pair EE=E;
- pair WW=W;
- triple C1 = (-3.19898,0.68575,-0.09137);
- triple N1 = (-2.00788,-0.15303,-0.05472);
- triple H1 = (-3.17155,1.39571,-0.92422);
- triple H2 = (-3.31563,1.23754,0.84706);
- triple H3 = (-4.08519,0.05549,-0.21396);
- triple C2 = (-0.78815,0.67831,0.01256);
- triple H4 = (-1.95362,-0.69266,-0.92177);
- triple C3 = (0.47237,-0.18670,0.21998);
- triple H5 = (-0.86520,1.39211,0.84227);
- triple H6 = (-0.69535,1.26040,-0.91400);
- triple C4 = (1.73163,0.67172,0.09304);
- triple N2 = (0.51467,-1.32801,-0.73516);
- triple H7 = (0.46502,-0.59296,1.23918);
- triple H8 = (1.39360,-1.82407,-0.57104);
- triple H9 = (-0.23067,-1.96899,-0.46111);
- triple O1 = (1.80456,1.88884,0.13111);
- triple O2 = (2.86188,-0.07112,0.00360);
- triple H10 = (3.57354,0.59879,-0.06651);
- triple[] Carbon={
- C1,C2,C3,C4
- };
- triple[] Nitrogen={
- N1,N2
- };
- triple[] Oxygen={
- O1,O2
- };
- triple[] Hydrogen={
- H1,H2,H3,H4,H5,H6,H7,H8,H9,H10
- };
- //%place non-atom cube corners
- real cylR=0.062;
- void Draw(guide3 g,pen p=currentpen){
- draw(
- cylinder(
- point(g,0),cylR,arclength(g),point(g,1)-point(g,0)
- ).surface(
- new pen(int i, real j){
- return p;
- }
- )
- );
- }
- pen connectPen=lightgray;
- Draw(C1--N1,connectPen);
- Draw(N1--C2,connectPen);
- Draw(C2--C3,connectPen);
- Draw(C3--C4,connectPen);
- Draw(C4--O1,connectPen);
- Draw(H1--C1,connectPen);
- Draw(H2--C1,connectPen);
- Draw(H3--C1,connectPen);
- Draw(H4--N1,connectPen);
- Draw(C2--H5,connectPen);
- Draw(C2--H6,connectPen);
- Draw(C3--H7,connectPen);
- Draw(C3--N2,connectPen);
- Draw(N2--H8,connectPen);
- Draw(N2--H9,connectPen);
- Draw(C4--O2,connectPen);
- Draw(O2--H10,connectPen);
- void drawSpheres(triple[] C, real R, pen p=currentpen){
- for(int i=0;i<C.length;++i){
- draw(sphere(C[i],R).surface(
- new pen(int i, real j){return p;}
- )
- );
- }
- }
- real radC=0.15;
- real radN=0.2;
- real radO=0.2;
- real radH=0.1;
- drawSpheres(Carbon,radC,darkgray);
- drawSpheres(Nitrogen,radN,lightblue);
- drawSpheres(Oxygen,radO,red);
- drawSpheres(Hydrogen,radH,lightgray);
- end{asypicture}
- end{document}
Add Comment
Please, Sign In to add comment