UNIT ALGORITHM A THREE-DIMENSIONAL PERSPECTIVE PLOTTING (APPLICATION TO MOLECULES)
ROIJTINE
JEAN A. Muss0 U.E.R. Sciences et Techniques, Universitk de Toulon et du Var, P 83130 La Garde, France (Received 11 June 1980) Abstract-A very small and very fast routine for drawing molecules (analyzed as a thrcedimensionaI described The routine makes use of either a line-printer or a plotter. MTRODUCTION
In connection with the use of a general computer pro-
gram which converts molecular bond lengths, bond angles and dihedral angles to atomic coordinates (ATCOOR program for example; Nordlander, 1973) or calculates the geometry of a molecule by minimizing the energy (MIND0 3 program; DEWAR, 1975 or GSPCILO program; Goursot, 1975) I have written the smallesr and the fastest rotike that creates a perspective plot of a molecule (analyzed as a three-dimensional model) either on a line-printer or a plotter.
model) is
as well as the quantity: DMAX = max (XMAX - XMIN, ZMAX - ZMIN)
YMAX - YMIN,
so:Xl = (X - (XMAX + XMIN)/2)IDMAX
YI = (Y - ( YMAX + YMIN)/Z)/DMAX Zl = (Z - (ZMAX + ZMIN)/2)/DMAX.
The modified coordinates X2, Y2, 22 are computed after a rotation around the z-axis of an angle ROT
PRINCIPLES
program makes use of five main routines (one step per routine). (i) PERSP performs all geometric calculations. Given the X, Y, Z coordinates of atoms, expressed in terms of a set of rectangular coordinates x, y, z (see Fig. 1). All coordinates are scaled and shifted so that the minimum and the maximum values are equal to -0.5 and +0.5 respectively. (All points are contained in a cube, the length of the side is equal to 1.Oand the center is situated at the origin of the coordinate system.) These new coordinates are called Xl, Yl, Zl. The maximum values XMAX, YMAX, ZMAX and the minimum values XMIN, YMIN, ZMIN of the coordinates are computed The
observers
X2 = Y 1. sin(ROT) + X1 ncos(ROT) Y2 = Y 1’ cos(ROT) - XI * sin(ROT) z2= Zl. The final coordinate X3. Y3, 23 are calculated after an inclination of the z-axis (rotation around the x-axis) of an angle INC towards the observer X3=X2 Y3 = Y2 *cos(INC) - 22 *sin(INC) Z3 = Y2. sin(INC) + 22. cos(INC).
150
J.
A. Muss0 version of the routine prints each center of the atoms with an asterisk. (iii) The line-printer version of the LIARS routine prints the chemical bonds with one of the three following symbols: “I” for vertical lines; “-” for horizontal lines; “+” for oblique lines. The plotter version of the above routine plots the chemical bonds with a straight line. A chemical bond is described by the numbers of bonded atoms. Simple linear interpolations between positions of atoms (in the x- and y-directions) as well as the maximum number of points are both used. (iv) NUMSYM prints (plots) the number and/or the chemical symbols of atoms. Ten (in the line-printer version) or sixteen (in the plotter version) possibilities (with two levels of priority) for printing (plotting) are analyzed according to the number of characters to be printed (plotted) and the free space near each atom. (v) The line-printer version of the IMPR routine transfers (line after line) the drawing from the core memory to the line-printer.
Then, perspective calculations are done. The observer’s eye is situated at point F with coordinates Fx, FY, FZ referred to the same rectangular coordinate system (best suggested values are FX= -0.25. FY= -3.00. &Z = +OT?o,; the line of sight is normal to the plane of projection PP. Let a distance D be given (D is equal to the half of the length of the main diagonal of the cube D = d3/2). The perspective image P’ of P in PP projection with respect to F is computed (the coordinates of P’ are XX and T’Y) Xx=(X3-FX)-(D-FY)i(Y3-FY)
(ii) ATOM suits the direction of plotting according to the size of the drawing and the size of the sheet of paper in order to compute the best scale. The routine shifts the plot in the middle of the sheet of paper; the line-printer SURAflllTIME LINE-PRINTER ______-._--_1 CcLLINC
DESSIY VERSION. -_-_____
SEQUENCE:
CALL
DESSIN
IRP:LT DATA: YTA LABELED COMMON STATEMENTS /~:oME/x~Y~~=CO~RDINATFS OF ATOYS* ISYMBL=CMEHICAL SYMBOLS OF ATOMS STORED WITH THE PAI SPECIFICATIONS NATOM=NuMBEA OF ATOMS /LIESON/IATltIAT2nNUMeERS OF ATOMS WHICH ARE BONDEDNLIAISeNUHBER OF CdEMICAL BONDS /uN?TE/L~CTU.IMPRI=LOG~C~L INPUT/OUTPUT UNIT NuHRERS. /TQPV/XX+YY t JXI JY +JL=TEMPORhRY WORKING STORAGENPOIN=MUMBER OF PGIATS OF THE WAWIhlGr LItNEtWORKING STORAGE FOR PRINTING /DECIN/ROT=ANCLE OF ROTATION. iNC=ANGl.E OF INCLINATXOKr CFSr,GESY=SIZE OF THE DQAwING~ PAPXIPAPY=SIZE OF THE SHEET OF PAPER* OPTLIOPTN.O?TS=LOGICAL VALUES GFTL=T FOR PRINTING BONDS. OPTN=T FOR PRINTING NUMBERS OF ATOMOPTS=T FOR PRINTING CUEMICAL SYMBOLS QEQuTRED ROUTINES: PERFIT. RANGE A.ND
PERSP, ATOM, LIAIS.7 THE STAYDAAD FUNCTIONS
NUMSYH, fuPR* STN, COS.
RFAL INC LGrJfCAL CPTL.GPTNTOPTS CCMMON/ATOME/X (35) rY (35) +2 (35) ,ISYHBL 170) rNhTOH/L lIAT2(7S).NLIAIS/U~ITE/LECTUIIMPRI/TRdV/%X(3S)tYY(3S)*JX~750~, ~JY~?~G~~JL~~~~~~~~POXN,LI~~E~I~~~/DECIN/RO~~INC~D~SX~DESY~?APX~ ~FAPY~D?TL,OPTN,~PTS i;lTA UNXT/2.~%0/~t~COL/IO/.NLIN/OB/~RAD~~l.745329F-O2~ 6’eD CONVERTS DECREES TO RADIANS. UkIT=ONE INCn (1 !NCH=2.54 CHJ. NcOL,NLIN=N~!GER OF COLUMS/LINES PER INCH. RISCOL=UNIT/~~COL DiSLIN=UNITiNLIN NFOIN=NATO~M PERSP~X,Y,Z+XX+YY,NATG~.ROT*RAD~~N,C*RAD~ CALL CnLL A7CY~XXrYYrNATOH,JX,JY.JLrOE5XtDESY~CISCOL.DISLI)ur.‘~:~X~PA~Y~ IF (CPTC) CALL LiAIS(JX.JY.J!_.NPDIN .IATl,IATP.NLIAIS) IF(CPTN) CALL NUYSYM~JX~JY~JL~NPOIN~NATOM~ISYHt3L~l) IFCCPTS) CALL NUMSYY(JX.~Y~JLINPOIN+NA~OU,ISYM~L,~) CALL IHPRIIYPRI~~A?X~DISCOL.PAPY~DISLIN.J~~JY~JL.~POIN~LIQNE~ RETIJPN FkD 51!;7JTjuTINE DESSIN PLPTTER VEZSICW. ____I___-__--..e CALaL TNG
SEQUEKCE
:
CALL
OESSIN
Fig. 2.
NINMAX.
IESOH/IAT1(75)
9
IS1
Unit algorithm
l/S
C
C C C
c
E C : c E
VIA LARELFO COMMON STATEMENTS IKPUT DATA: /ATOHE/X~Y~Z=COORDINATES OF ATOHSr ISYHBL=CHEMICAL SYMBOLS OF PTOHS STORED WITH TME 2Al SPECIFICATION,, NATOM=NUHBER OF ATOHS /LIESON/IATl,fAf2=NUM8ERS OF ATOMS WHICH ARE BONDED* NLIAIS=NUHF!ER OF CHEMICAL BONDS /TPAV/XX~YY,JX~JY~JL=TEMPORhRY WORKING STORAGEr NPOIN=NUHRER OF POINTS OF THE OPAUING /OECIN/ROT=ANGLE OF ROTATION, INC=ANGLE OF INCLINATIONI DESX,DESY=SIi’E OF THE DRAWING9 PAPXIPAPY=SIZE OF THE SHEET OF PAPER* OPTL,~PTN,~PTS=L~GICAL VALUES OPTLIT FOR PRINTING RONOS. OPTN=T FOR PRINTING NUMGERS OF ATOM* OPTS=T FOR PRINTING CHEMICAL SYMBOLS (ALWAYS: OPT&T)
c C
C C C
REQUIRED ROUTINES: PERSP. ATOM. LIAIS. NUMSYNI OROITv HINMAX, PERHTI RANGE AN0 THE STANOARD FUNCTIONS SIN. COS. PLOTTER ROUTINES: PCARA PLOTS AN ALPHANUMERIC CHARACTER AND TRAA MOVES THE PEN UP/DOWN.
C REAL INC LOGICAL OPTL~OPTNIOPTS CG~~ON/ATO~E/X~35~~Y~3S~~Z~3S~~ISYMRL~70~~NATO~~LIESON/IATl~7Sl, 11AT2~75~rNLIAIS/UNITE/LECTIJrIMPRI/TRAV/XX~35~rYY!35lrJX~95O~. ZJY~950~,NPOIN/O~CIN/ROT.~NC.CESX~OESY~PAPX~PAPY,~=~L.OPTN~OPTS DATA RAU/+O.~~~~~~E-~~/,UNIT/~.~~O/~NCOL/~.O#,NLIN/~O~ RIO CONVERTS OEGREES TO RADIANS. UNIT=ONE INCH (1 INCH=2.54 CM). NCOL,WLIN=NUMBER OF COLLINS/LINES PER INCH (MUST RE EQUAL OISCOL=UNIT/NCOL nISLIN=UNIT/td_IN NPOIN-NATOM CALL PERSP~X~yvZ~XXiYY~NATOM~pOT*RAD.INC*F?AD~ CALL AT0M~XX~YY~NATOWtDESX~D~SY~PAPX~PAPY~OISCO~~DISLIN~J%~JY~ CALL LIAIS~IAT~~IAT~~NI_IAIS~XX~YY~JX~JY~~FOIN~NATOM~ IF(OPTN) CALL NUMSYN~JX.JY,NPOIN~NATOM~ISYMBL~l~~ISCOL~DISLIN~ lXX.YY) IFtOPTS) CALL NU~SYH~JX.JY~NPOIN~NATOM~ISYMELT~~~ISCOL.D~SLIN~ lLX*YY! RETURN FRO
C C
C C
SUBROUTINE PERSP(X~Y,ZIX~.~~INATO~IROTtfNC) PERFoRMs GEobxTRxc CAL~IILATIONS. ROTH FOR LINE-PRINTER AND PLOTTER VERSIONS. PEAL INC OIHENSION X(l~~YIl~.Z(1~.XX11~.YY~l) EQUIVALENCE (21122).(X2rXJ) DATA 0/*0.8660254/*FX~Fy~F2f-0.25~-3.00~+~.?0~ D=DISTANCE BETWEEN THE PLANE OF PROJECTION ORIGIN OF THE COORDINATES
Fig. 2 (Cod).
AND
THE
TO 20)
152
J. A. Muso
Fx,FY.FZ=COORDINATES OF THE OBSERVER’S CCWUTE LIMIT VALUES. CALL H~~~AX(NATOH~XIXH~N.XMAX~DX~SX) CALL ~INMAX(NATON~YIYMIN,YMAX~OY.SY) ;;:; b+~NMAXtNATOH~Z~ZMIN~2MAX.D2.S2)
EYE
IF&.GT.DMAX) OMAX=DY ;FlOZ.GT.DMAX) OHAX=DZ 5RCT=5:rs~t?OT) CRCT=COS (ROT) SINC=SIN(INC) CPNC=COS(INC) FC:, EACH ATOM: co 101 I=l.NATOH SHIFT AND SCALE. X1=(X(T)-O.SO*SXI/DMAX YI-fYIIi-O.SO’SYI/DHAX
21=~7~I~-0.50*SZ~/DHAX
101
c
ROTATION. X2=Yl~SROT*Xl*CROT Y.?=yI*CRGT-Xl*SROT IkCLINATION. YZl=yZ’CINC-22*SINC 23=YZ’SINC*22*CINC PEb:;PECT:VE PROJECTIOru. FCHEL=(D-FY)/tY3-FY) XxtIl=[X3-FX)*ECHEL YYtII=tZ3-FZ)*ECHEL PFTIJRN FNI, SURROUTINE IPAPYI -0PAii THE DIMFNSION
ATOHIXXIYY~NATOM~JX~JY~JL~DESX,DESY~DISTX~DISTY~PAPX~ CENTER OF EACH ATOM. XX~llryy(~~~Jx~1)~JY~~l~JL~l)
(LINE-PRINTER
VERSION)
DATA IETOIL/'*'/ WIFTS TliE ORAWING. IF(~PAPX.GT.PA?Y.AND.DESX.LT.DESY~.OR. 11PAPx.LT.PAPY.AND.DESX.GT.DESV)) CALL PERwT(DESX,DESY~I) CALL ~INHAX~NATOH.XXtXXMIN~XXMAX~DDX~DDESX) CALL MINHAX(NATOHrYY~YYMINIYYWdX1DDYIDDESY) ODESX=DESX-4.D’DISTX DOESY=DESY-2.0’0ISTY IF~fOOESX.GE.DDESY.AND.DDX.GE.DDY~.OR. l~ODESX.LE.DDESY.AND.DDX~~E.DOr)) GO TO 202 CALL PERHTIXX~YY~NATOH) CAL; PERHTfDOX~DDY,L~ CALL PERblTlXXW1N~YYH1N.1) COMPUTE TEE BEST SCALE. C 202 ECh=DOX/DDESX
C
Fii
2 (Coted).
153
Unit algorithm
ECHY=DDY/DDESY
IF(fCXY.6T.ECk-i)ECH=ECHY COMPUTE THE SHIFT IN EACH DIRECTION.
C
C C
213
C C
C 202
C c C
203
NPOfNX=DDX/ECH/DISTX*l.50 PASX=DDX/(NPOINX-1) JDKLX=lPAPX/DISTX-DDX/PASX)*O.50*0.50 NPOINY=DDY/ECH/DISTY+l.50 PASY=DDY/(NPOINY-1) JOKLY=(PAPY/OISTY-DDY/PASY)*O.50+0.50 FOR EACH ATOM: DO 213 I=lvNATOM DRAW THE CENTER OF ATOMS. JXlI)=LXXII)-XXMIN)/PASXtl.SO+JDKLX JYfI)=(YY(T)-YYHXNl/PASY*li5O*JDKLY JC(Z)=IETDIL RETURN END SUBROUTINE ATOH(XX.YYINATOM.DESX,DESY.PAPXIPAPY,DISTX~DISTY~JX~JY~ DRAYS TtiE CENTER OF EACH ATOM. (PLOTTER VERSIDN) DIMENSIGN XX(11*YY(l)rJX(11*JY(l) SHIFTS - .._. .- ThE- DRAWING. IFt(PAPX.GT.RApv.a~D.DESX.LT.DESY~.OR. l(PAPX.Lt.PAPY.AND.DESX.GT.DESYb1 CALL PERMT(DESX,‘ESYIL~ CALL NINHAX(NATOM~XX~XXNIN,XXt4AX~DDX,DDESX~ CALL ~IN~AX(NATDM*YYIYYMIN.YYMAXIDDYIDDY,DDESY) GDESX=DESX-G.O*DISTX DDESY=DESY-4.D*DISTY IF~~DDESX.GE.DDESY.AND.DDX.GE.DOY~.OR. l(00ESX.LE.DDESY.AND.DDX.LE.DDY)I GO TO 202 CALL PERHT(XXrYY,NATOH) CALL PERHT(DDXIODY~~I CULL PEHMT(XXMINIYYMIN~~) COMPUTE THE BEST SCALE. ECH=DDX/DDESX ECHY=DDY/DDESY IF(ECHY.GT.ECti) ECH=EC%lY COMPUTE THE SHIFT IN EACH DIRECTION. . DECLLX=~PAPX-~DDX/ECHt8.O*DISTX~~*O.5O+4.O”DISTX DECALY=~PAPY-~DDY/ECHt4.O~DISTY~~*O.SOt2.O*DTSTY FOR EACH ATOM: DO 203 I=lrNATOH PLOT THE CENTER OF ATONS. Xlf(I)=(XX(I)-XXNIN)/ECH+OECALX JX~I~=XX~II/DISTXtl.50 YY(I)=(YY(I)-YYWIN)/ECHtDECALY JY(I)tYY(I~/DISTY+I.50 RETURN END Fig 2 (Conrd).
2/5
J. A. MUSSCI
SURSOUTiNE LIAIStJX~JY~JL~NPOIN~IAll~IAT2rNLIAIS~ PPIhTS ChEHICAL BONDS. (LINE-PRINTER VERSION) LFGTCAL FAIT i~rumS:ON JXI1~~JY~l~~JL~l~~IATlfl~tIATZ~l~ DPTP IOBLIIVER~IHON/*+~,.!(((-,/ IORL,IVER*XHO~=C~ARACTERS USED FOR PRINTING. FCR EACH CHEMICAL BOND: DO 30R I=lsNLIAIS X1=14TlLIl JXIl=JXtIlI JYll=JYtIl) IZ=IAT2lI)
JXIZ=JXtItI J'~I.?=JYIIPI Ct-tMGUTETHE Nltb'flER OF POLNTS TO BE NPCINX’JKI l-JX12 IF(wo~NX.LT.O) NPOINY=JYI~-JYI2 IF~~~P~IkY.LT.0)
USED.
NPOINXr-NPOINX NPOINYt-NPOINY
LPDIN=NPOINX*l IFihP~INY.GT~NPOINX)
LPOIN=NPOINY*l
30A COMPUTE THE 1.4CREHENT IN EACH DIR2CTION. PCIt.=LPOIN-1 ECtlX=tJXI2-JXIlIIRDlN EcH~=~JYI~-JYI~~/POIN nETFRHINE THE CHARACTER TO BE USED. IF(LPCItd.LT.31
ICARAC-IOBL IF (CPOIkX .iQ.O, IF (h’P0IkY.EO.C) OEPb THE BONO. LPOIN=Ll=OIH-1 DO 365 K=2rLPOIN
GO TO
ICARAC=IVER ICARAC=IHON
l~r;XJ1*ECnX~tK-ll'O.so I~=JYII+ECHY+~K-~~+O.~O 335 CULL HANGEtIlrI2~ICARAC.JX~JY~JL~NPOIN~l~FAIT~ 3313 CONTINUE RFTURN !aG c 1
c
SUEPOUTINE LIAIS~IAT1~IPT2~NLIAIS~XX.YYrJrtJYINPOIN~ PLOTS CHEMICAL BONDS. (PLOTTER vERSfON~ LCGICIL FAIT DICFNSION IAT~~~~~IAT~I~I.XX~~~~YY~~~~JX(~~~JV~ FGf EACH CHEMICAL BOND: DO .3oF)l=l~tdLIAlS
Il=IATl(Il It=IAT2tIl C
PLOT GILL
A STR4IGH’C LINE FROM DROIT~XX~I1~*YY~Il~rXX~I2~~Y~l~2~1
POINT
Fig. 2 (Contd).
11
TO
POINT
12.
Unitalgorithm
3/5
C
JXIL=JX(II) JYIl=JY(Tl) JXIE=JX t 12) JYI2rJYtI2) COMPUTE THE NUMBER OF POINTS TO BE USED. NPOINX=JXII-JXIE IF(NPOINX.LT.01 NROINX=-NPOINX NPOINY=JYIl-JYI2 IF(NPOIt
C
ECHX=(JXI?-JXIl)/POIN ECHY=tJY12-JY11~/'0'.N ORAU THE BOND.
C
LPOIN=LPOIN-1 00 305 K-2eLPOIN
Il=JXIl*ECHX+tK-1)*0.50 12=JYIl*ECHY+(K-ll*O.SO 365 308
CALL RANGE(I1~.I2~JX~JY,NPOIN~l~FAIT) CONTINUE RETURN END SUBROUTINE NUHSYM~JX~JY,JL~NPOIN~NATOM~ISYMBL~IOPT~ PRINTS CHEMICAL SYMBOLS AND/OR NUMBERS OF ATOMS. VFRSION) LOGICAL FAIT DIMENSION JXfl~.JY~l~rJL~l~rISY~RL~l~~IAX~lO~~IAY~lO~~LX~2~~LY~2~~
C C
(LINE-PRINTER
lIAX/-1*0*0*-l *-lr+2r*l~*lr*2r*2/*IAY/a**l*-l*~l*-l*o*-l*~l*-l**l/. 2ItERL/'O'v' '/r1P/1~1~1.2.2rlrlrIr2rZ/tNPRIJR/2/ C
s C :
C
431 C
ICHIFP=ALPI~ANUHERIC VALUES OF NUMBERS. IPX,IAY=COORDINATES OF FREE SPACES NEAR AN ATOM. IP=LEVELS OF PRIORITY OF FREE SPACES. NPOS=NUHBER OF POSSXBILITIES FOR PRINTING NPRIOR=NWBER OF LEVELS OF PRIORITY FOR ANALYZING FOR EACli ATOM: DO 420 I+l~NATOM GO TO (431r432)rIOPT CONVERT NUMBER TO THE 2Al SPECIFICATION. LL~=ICH~FR~I-I/IO~~O*~~ LLZ=ICHIFR~I/lO*1l GO TO 419 TRANSFER THE CHEMICAL SYMBOL. Fii. 2 (Contd).
FREE
SPACES.
156
J. A. Musso
432 C 419 C c
421 420
C
c
LLl=fSYHRL(E*I) LLZ=IsYHBL (2*1-l) COMPUTE THE NUMBER OF CHIRACTERS TO BE PRINTED. NC*PbC=2 IF~LL~.EO.Z~EBL(IOPTI~ NCARAC=I CHECK TtIE FREE SPACES NEAR EACH ATOM. (10 POSSIBILITIESI 2 LEVELS OF PRIORITY~ 00 421 L’lrNPRIOR DO 421 J=ltNPOs IF(:P(J).NE.L) GO TO 42) ~;;=;;;Il+IAY (J) $;I;+,AX,Jb t IF(hCARAC.EP.l.ANO.J.GT.Sb LXlrLX2 CALL RANGE~LXrLY~Ll.~JX~JY~JL,NPOIN~NCARAC.FAIl~ IFfFAIT) GO TO 420 CONTINUE CONTINUE RETURN END SURROUTINE NUWSYW~JX~JY~NPOIN~NAlOM~ISYMGL~IOPT~~ISTX~DISTY~XX~YY~ PLOTS CWEHXCAL SYMBOLS AND/OR NUMBERS OF ATOMS. fPLOTTER VERSION) LCGrCAL FAIT IKTEGFR HAUAGS @IHENSION JX~1~~JY~l~rISY~BL~l~rI*X(16~,IPY~l6~~LX~6~~~~~l6~~ 1LY~CI~XXll~rYY~l~mIZEBL~2~~IC~IFR~lO~~LL~2~ EQUIVALENCE (LL(2lrLL2)r(LL(l)rLLl) ‘1’,‘2’.~3’.~4~,~5~,~6~~*7*,~6*~*9’/~IZERL~~O*~ DATA ICHIFR/‘O’v I# ~/,1A~~-2.-2~0~-1.0.-].-~1-2,-2.~3~~3~*2,~1.~2.*1,*3~*3/~NPR10R~2~, zIAY/or-1 ~+1~*1,-2~-2~+1,-2~0,-1~+1~+1~-2~-2~-2~~1/~NP0S/16~~ 3IP/1~lrlr?tl~lrS*2*l~l~l*l~l*l~2*2/ ICHIFR=ALPHANUHFRIC VA;:JES OF NUWRERS. IAX.IAY=COOROINATEs OF FREE SPACES NEAR AN ATOM. IP=LEVELS OF PRIORITY OF FREE SPACES. NPOS~NUWGER OF POSSIBILITIES FOR PRINTING tvPR~OR=NUHRER OF LEVELS OF PRIORITY FOR ANALYSING FREE SPACES. DATA WAUR8S/O/~NcPl~/.C0SIrSINd/l.O~O.O/ nAubAS=FLAG CONTROLLING ThE PEN (RAISE PEN BEFORE MOVEMENT) COSP. SINA=COSIA) AND SIN(A)* AsANGLE (RELATIVE TO THE X-AXIS1 AT uHICH A CHARACTER IS TO GE DRAWN (A-0 DEGREE;) NCP=NUHBLR OF CHARACTERS TO BE DRAWN. DIHxsl.8O*DISTX DIMY=l.BO*DISTY DIYX, DlMY=WtDTH AND IIEIOHT OF TM CHARACTER TO RE DRAWN. FOR EACH ATOH: 00 420 I=l*NATOH GO TO (431~432) *IOPT CONVERT NUbleER TO THE 2~1 SPECIFICAtldN. Fig. 2 (Contd).
Unit algorithm
157
4/5
431 LL~=IC~IFR(I-1/10*10*11 LL~=XCHIFR~I/IO*~~ GO TO 419 C 432 C 419 C
442
441
440 404 421 439
438 420
TRAMSFER THE CHEMICAL SYMBOL. LLl=ISyMGL~2+1) LL2s1SYHBL~2*1-1) COMPUTE THE NUMBER OF CHARACTERS TO BE PRINTED. NCARAC=2 IF(IZEGL(IOPT~.EQ.LL2~ NCbR&C=l CHECK THE FREE SPACES NEAR EACH ATOM, (16 POSSIRIL1lIES~ 2 LEVELS OF PRIORITY1 (FOUR PLACES FOR ONE CHARACTERI. DO 421 L=lwNPRIOR DO 421 J=leNPOS IF(IP~J1.NE.L) GO To 421 DO 442 N=l*2 DO 442 K=l*2 LLKr2*tN-l) +K LX(LLKb=JXLI)*IAXLJ1*K-1 LY(LLK)=JYIIl*IAYLJ).N-1 DO 441 Krlm4 LX(K+4)=LX(K)-2 LY (K*41=LY (K) IF(NCARAC.EQ.2.OR.J.LE,8) GO TO 404 DO 440 K=lr4 LX(Kb=lXIK+41 CALL RANGE(LXILY~JXIJY~NPOINT~*NCARAC~FAIT) IF(FAlT1 GO TO 439 CONTINUE GO TO 423 DO 436 K=l,NCARLC X=XX(l)+DISTX*(LXf4~K-3)-JX(I)I Y=Yv~~~*OISTY*~LY~~*K-~~-JY~I~~ XvY=STARTING COORDINATES OF THE CHARACTER TO GE PCAAA DRAWS AN ALPHANUMFRIC CHARACTER. CALL PCAGA~X.YvHAUABS,LL~Kl,NCP+D1MX,DIMY,COSA~SINA~ CONTINUE RETURN END
DRAWN.
SURROUTINE
IMPR~IbPRI~PAPX~OISTX~PAPY~DISTY,JX~JY~JL~NPOIN~LIGN~~ THE DRAuIMG FROM CORE-MEMORY TO THE LINE-PRINTER? LINE-PRINTER VERSION. DIMENSION JX(llrJY(l1rJLIll.LIGNE~1~~FNT~31~FMTl~2~ DATA I&AN/I ‘/rFHTl/*(lH1*,*1 ‘/rFWl/~(lX~~~‘132A’.‘l~ NPOINX~PAPX/DISTX+l.SO NPOINY=@APY/DISTY+l.SO URITE~IMPRItFMTl, 00 SO3 K=lqNPOINY NLWPOINY-K+l
TRANSFERS
Fii. 2 (Contd).
‘/
I. A. Muss0
502 504 503
00 502 J=l+NPOINX L:GNE(J)=IBLAN DO 504 J=l,NPOIN IF(JY[J).EQ.NL) w~ITF(IMpRI*FMT) RETURN END
LItNE(JXfJ))=JL(J) (LJGNE~J)tJ=l~NPOINX~
SURROUTINE HINHAX~NIQ~Q~INIQMAXI~~~SO) FINOS MAXIMUM AND HINIHUH VALUES C(3wuTES CORRELATED VALUES. POTH FOR LINE-PRINTER AND PLOTTER DIMENSION Q(1)
c C C
OHAXrO~l) O*IF;=OMAX DC If101 1=21N QI=Q(I) IF fQI.GT.QhAX) IFI~I.LT.QMIN) CQ=flHAX-QWXN
OF
Q-VECTOR.
VERSIONS.
OHAX=QI OHIN-QI
S3=ChAX+QHIN PETURN END
,c
S!IRROUTINE PERMT IPvQmN) pt-RvLJTS EACH ELEMENT OF
t
0’
C
2oc1
P-VECTOR
WITH
EACH
ELEMENT
O-VECTOR.
3cTh FOR D:MENSION
LINE-PRINTER
AND
PLOTTER
VERSIONS.
Ptl)~Q(lb
DO 1001 I=lvN SAUVE=P(I) PfIl=Q~Il 0 rI )=SAUVE RETURN E?IC SUPROUTINE RANGE(LXILY+LL~JXIJY*~LWNP+NC~FAIT~ STO~~FS OUANTIFXED COORDINATES OF EACH POINT OF THE ORA\J’,G. f LOGICAL DECISION IS MADE FOR STORING OR NOT STORING. LINE-PRINTER VERSION.
C C C
LOGICAL FAIT nIMENSION LX~ll+LY(I)rLL(II~JXfl~~JY~I~~JLfI) FAIT=.FALSE. 00 3311 K=lvNC
Or! 3011 J=ltNP 5011
IF (LX iK1 .EQ.JX(J) lAND.LY CCrJT INUE FC 3.012 K=lrNC NP=KP* 1 IF(NP.GT.750) RETURN
(Kl .EQ.JYIJl)
Fig. 2 (Conrd).
GO TO
3010
159
Unit algorithm
5/5
3012
3010
JXtRPl=LX(KI JY?NPI=LY(Kl JLtNPl=LL(Kl FAIT=.TRUE. RETURN END SURROUTINE RANGE~LXILY*JX~JYINP~NC~FAIT~ STORES GUANTIFIED COORDINATES OF EACH A LOGICAL DECISION IS MADE FOR STORING PLOTTER VERSION LOGICI\L FAIT I)IMENSION LXflI*LYtl)rJX(l)rJY(1) FAIT=.FALSE. DO 3011 K=lrNC
C
c c
DO 3011
J=lrNP
IF(LXtKl.EO.JX(JI.AND.LYtKl.EG.JYo)
3011
3012 3010
C C
: C C
CONTINUE 00 3012
OF THE DRAWING. OR NOT STORING.
POINT
GO TO 3010
K=lvNC
NPtKPe 1 IF(NP.GT.9501 JX(NPl=LXIK) JY (NPI’LY tK1 FAIT=.IRUE. RETURN END
RETURN
SURRGUIINE DROITIXA.YA~WB.YEll DRPkS A STRAIGHT LINE PROM POINT AtXArYAl TO POINT G(XB-YB). PLOTTER VERSION. IhiTEGER HAUARSIEASABS DATb HAUABSrBASABS/O~l/ HAUAGS’RPISE PEN BEFORE MOVEMENT GASABS=LOWER PEN BEFORE MOVEMENT (COCRDINATES FROM THE ORIGIN OF THE COORDINATES SYSTEC) TRAP ROVES THE PEN FROH ITS PRESENT POSITION TO A NEW POSITION. CALL TRAA~XAIYA~HAUABS~ CALL TRAA(XAeYAwBASABS) CALL TRAAtXBwYB*BASABSl CR:~:R~RAAtX9~YG~HAUABSl END Pig. 2 (Conrd).
J. A. Musso
.
l
..
IF”, .++ . .. + l
+ l . l + l
(b) Fig. 3.
*
Unit algorithm ALGourTllMs
The above-mentioned routines are called by the driving routines DESSIN. All input data are transfered via five labeled COMMON statements (the meaning of which is given as comment statements). The listings of the two versions of the routine are given in Fig. 2. RlzsuLTs Such plots are shown below (Figs. 3a and 36). They
draw the molecule: 1,3-dichloro, 5-bromo, 7-methyl adamantane (ring hydrogen atoms omitted). The following input data were used: (atomic coordinates are computed by the ATCOOR program with standard values for bond lengths, bond angles and dihedral angles); angle of rotation: +85.00; angle of inclination: -10.00; size of the sheet of paper 33.00x26.00 cm; size of the drawing
CAC Vd. 4 No. 3!-4-E
161
15.00 X20.OOcm; specification of the line-printer: 10 columnslin., 8 lines/in. The execution of this program with a CII IRIS 50 computer required only the standard functions SIN and COS, 30 kilobytes of core memory (short integers) (+lO kylobytes for the plotter software) and 11.2 set of CPU time (+12 set for movine the BENSON olotter) (the same ‘program required 3.2 set with an ‘IBM %@65 computer). REFEllENCES
Dewar, M. J. S. et al. (1975),QCPE 11,279.
Goursot, A. and Sygusch,J. (1975),QCPE 11, 272. Musso, J. A., (1978)QCPE 11,349. Nordlander,J. E. (1973),J. Chem.Educ. 50(11), 743.