%----------------------------------------------------------------------- % File : fpmex.mp % Contents: figures for exercise sheets % Author : Christian Borgelt % History : 2017.05.12 file created %----------------------------------------------------------------------- input moltg.mp; %----------------------------------------------------------------------- vardef common (expr branch) = start((0,0),0); single(-60); single(60); single(60); single(60); single(60); single(60); single(-60); if branch >= 2: goto(5); single(120); atom(8, "O", red); elseif branch >= 1: goto(3); single(0); fi % atom(8, "C", black); fi atom(7, "O", red); ring(1, 4); % for i = 0 upto 5: atom(i, "C", black); endfor; enddef; %----------------------------------------------------------------------- vardef molecule (expr type) = start((0,0),0); % 0: N single(0); % 1: C single(-90); % 2: C goto(1); single(0); % 3: C double(45, 0); % 4: O goto(3); single(-45); % 5: O goto(2); if type >= 1: single(-90); else: phantom(-90); fi; atom(0, "N", blue); atom(1, "C", black); atom(2, "C", black); atom(3, "C", black); atom(4, "O", red); atom(5, "O", red); if type >= 2: atom(6, "O", red); elseif type >= 1: atom(6, "S", yellow); else: atom(6, "O", white); fi; enddef; %----------------------------------------------------------------------- beginfig(0); pair m[]; start((14u,0),0); % 0: N single(120); % 1: C single(60); % 2: N single(60); % 3: C single(60); % 4: C double(60, 1); % 5: C single(60); % 6: = 0 single(-60); % 7: C single(36); % 8: O single(-72); % 9: C single(66); % 10: C single(-60); % 11: C single(60); % 12: O double(-60, 0); % 13: C goto(7); single(-72); % 14: C single(72); % 15: C single(72); % 16: = 9 goto(1); double( 60, 0); % 17: O goto(3); double(180, 0); % 18: O atom( 0, "N", blue); atom( 2, "N", blue); atom( 8, "O", red); atom(11, "O", red); atom(13, "O", red); atom(17, "O", red); atom(18, "O", red); for i = 0 upto 18: m[i] = z[i]; endfor; endfig; %----------------------------------------------------------------------- beginfig(1); % phenol common(0); endfig; %----------------------------------------------------------------------- beginfig(2); % p-cresol common(1); endfig; %----------------------------------------------------------------------- beginfig(3); % catechol common(2); endfig; %----------------------------------------------------------------------- beginfig(4); % spanning tree pair m[]; start((0,0),0); single(0); single(72); single(72); single(72); single(72); goto( 4); single(angle(z4-0.5[z1,z2])); goto( 2); single(angle(z3-z2)-120); double(60,1); single(60); single(60); single(60); goto( 8); single(angle( z8-z7)-60); goto(10); double(angle(z10-z9)-60, 0); atom( 1, "O", red); atom( 6, "F", green); atom( 7, "N", blue); atom( 9, "N", blue); atom(12, "O", red); atom(13, "O", red); for i = 0 upto 13: m[i] = z[i]; endfor; endfig; %----------------------------------------------------------------------- beginfig(5); % example molecule for canonical forms start((0,0),0); % 0: O single( 54); % 1: N single( 54); % 2: S single(-72); % 3: C single(-72); % 4: C single(-72); % 5: C single(-72); % 6: (equal to S) goto(5); single(-54); % 7: C single(-60); % 8: O goto(7); double(0, 0); % 9: O atom(0, "O", red); atom(1, "N", blue); atom(2, "S", yellow); atom(8, "O", red); atom(9, "O", red); pair m[]; % buffer for coordinates for i = 0 upto 9: m[i] = z[i]; endfor; endfig; %----------------------------------------------------------------------- beginfig(6); % cyclin molecule(0); endfig; %----------------------------------------------------------------------- beginfig(7); % cystein molecule(1); endfig; %----------------------------------------------------------------------- beginfig(8); % serin molecule(2); endfig; %----------------------------------------------------------------------- beginfig(9); z0 = ( 0,0); z1 = (bondlen,0); z2 = (bondlen,bondlen); z3 = ( 0,bondlen); z4 = (z1-z0) rotated 45 shifted z2; pickup pencircle scaled pw; draw z1--z2--z3--z0--z1--z3; draw z2--z4; for i = 0 upto 4: fill fullcircle scaled 3pw shifted z[i]; endfor; endfig; %----------------------------------------------------------------------- beginfig(10); z0 = (0,0); z1 = z0 +(4bondlen,0); z2 = z1 +(0,2bondlen); z3 = z0 +(0,2bondlen); z4 = z0 +(bondlen,bondlen); z5 = z4 +(bondlen,0); z6 = z5 +(bondlen,0); z7 = z0 +(2bondlen,0); pickup pencircle scaled pw; draw z0--z1--z2--z3--cycle; draw z0--z4--z6--z1; draw z4--z3; draw z6--z2; draw z5--z7; for i = 0 upto 7: fill fullcircle scaled 3pw shifted z[i]; endfor; endfig; %----------------------------------------------------------------------- beginfig(11); % NCy_CCyxC start((0,1.5bondlen),0); % 0: N single(-150); % 1: C single(0); % 2: C single(120); % 3: C single(120); % 4: N (= 0) single(-120); % 5: C atom(0, "N", blue); atom(1, "C", black); atom(2, "C", black); atom(3, "C", black); atom(5, "C", black); endfig; %----------------------------------------------------------------------- end.