An interactive computer program to draw Newman projections

An interactive computer program to draw Newman projections

comp”,NJ d chmdmy vo,. 10. NO. I, pp. 47-79, ,986 Printed in GreatBritain. APPLICATIONS SECTION AN INTERACTIVE COMPUTER PROGRAM NEWMAN PROJECTIONS ...

2MB Sizes 8 Downloads 265 Views

comp”,NJ d chmdmy vo,. 10. NO. I, pp. 47-79, ,986 Printed in GreatBritain.

APPLICATIONS

SECTION

AN INTERACTIVE COMPUTER PROGRAM NEWMAN PROJECTIONS JAMES

KAO

TO DRAW

and LORAINE WAN

Philip Morris, U.S.A. Research Center, P.O. Box 26583, Richmond. VA 23261, U.S.A. (Received 7 May 1985)

Abstract-A generalized interactive computer program, NEWMAN, is described that draws quality Newman projections using various available graphics devices. NEWMAN may be used as a stand alone program or can be called from another program. NEWMAN is very simple to use and is a versatile tool. The program has been developed primarily for use with a DEC-20 system with the PLOT-10 1GL package of Tektronix. However, it can be easily installed on other machines since partability has been kept in mind through all phases of program development. INTRODUCTION

One of our interests in computerized automation is to provide friendly interactive graphics tools for chemical scientists to display their data. Computerized graphics tools can reduce the time from hours to minutes in producing quality chemical pictures while considerably decreasing backlogs in the graphics department. This paper, presented in part at the 2nd Conference on Computers & Chemistry, Tallahassee, Florida, 1983, describes a program that draws Newman projections. (For papers in this series see Kao er al. (1985). Plots produced by this program appear in Kao er al. (1984) and Kao & Seeman (1984)). Newman projections, first advocated by Newman in 1952, (Newman, 1952 and Newman, 1955), have become the uniformly accepted and practiced mode of three dimensional structural information by organic chemists. Indeed, one can hardly find any standard organic chemical text book or current organic chemistry journal without Newman projections. Newman projections are useful in molecular modeling to build molecular structures with chiral centers. To the best of our knowledge, no such software is currently available elsewhere in the public domain. (This program will be sent to Q.C.P.E. for distribution.) DESIGN

PRINCIPLES

A Newman projection is a way to display the spatial arrangement of functional groups which are attached to two connected or bonded atoms. A typical Newman projection plot may look like the one shown in Fig. 1. The head atom, the bonded (axial) atom close to the eyes, may be either represented by chemical symbols or none, while the tail atom, the bonded atom away from the eyes, is always represented by a circle. The contents in Fig. 1 may be classified into graphic and textual information. We shall discuss these two divisions and related program design considerations in the following sections. ( 1) Gene4

program

design considerations

The specifications for this program are as follows: (a) It shall be executable (with no or with minimal modification) on different machines. (b) It will allow the user to promptly obtain the desired Newman 47

projections from any graphics device (including low price graphics terminals). (c) It is to be equally convenient for use by novices to draw simple plots or by experienced users to plot sophisticated graphs (d) It can easily be executed as a stand alone version or be called from another program. In other words, “program portability and maintenance,” “on-line interactive” and “user friendly” were major objectives in program design. We made the following decisions to meet the objectives as closely as possible. The program was written entirely in ANSI 77 FORTRAN, since FORTRAN is probably the most popular language in scientific communities and almost every computer for scientific applications can do the compilation. The textual information was mainly handled using the Al format to increase machine independence. Since the program was expected to be small, program portability was of more concern than the memory usage. The FORTRAN program has to communicate to a graphics device to draw pictures. However, there are no common standards for communications between a FORTRAN program and a graphics device (see Martin (1982)). Thus, no fully machine-independent graphics program currently exists, due to lack of common computer graphics standards. Fortunately, there are a few interactive graphics packages available on the market that come with different device drivers which can relieve the user’s program of device dependent features. We have chosen to use the PLOT-IO IGL of Tektronix, since it is one of the widely accepted packages and is currently availabIe on our machine. The program is modularly structured and documented to increase its portability and maintainability. Furthermore, the branch point technique has been employed to provide the capability for both minimal and extensive users to carry out different tasks through user commands. For novice users, the program provides default values and will prompt for the minimal information which is necessary to draw a projection. On the other hand, the program allows the experienced user to modify the plots through user commands and even to read a list of parameters to customize his routine needs. The program is “friendly” interactive with the user commands in plain English words which are quite easy to remember. The

48

J. KAO NEWMAN AN EXAMPLE

PROJECTION

and L. W~rr

..,,.rn(_

R1

.. -. Functional

“’

R,

: CH3

%

:

NHS

Fig. 1. A typical NEWMAN

Qroupr

.,--.Legandr

projection.

program also has a HELP file to provide information about user commands. Information is entered in free format and the program has certain validating capabilities. Input entered from the keyboard may be upper or lower case letters, the program recognizes both types of letters. As a result, where lower case letters must be retained for plotting (such as chemical symbols), no conversion needs to be carried out. The program was written either to be used as a stand alone program or to be called from another program. To be used in its stand alone version no modification of the program has to be made. To call the NEWMAN program from another program the main routine must be deleted. The NEWMAN pm gram is then accessed by a call to the subroutine BATCH. Thus, the NEWMAN program may be called from a modeling program {such as MOLBUL, Kao et 01. (1985) and Kao er al. in press) to provide a snapshot of spatial arrangement of atoms around a bond. This type of application is very useful when chemists deal with molecules of chiral centers. 2. Graphic

man projections may be categorized into just nine types as depicted in Fig. 2 according to the number of groups attached to the axial atoms. Other Newman projections are minor changes from these nine types which may result from rotating functional groups along the two bonded atoms, changing the textual information of functional groups, or changing the connection between axial atoms and functional groups from single to double bonds. From a graphic standpoint, a single Newman projection consists of only two basic graphic elements besides textual information, namely a circle (0) to represent the tail atom and a bar (-_) to represent the connection between axial atoms and attached functional groups. A generalized program to draw Newman projections should allow the user to define the position of the head atom since he may want to put more than one Newman projection in a plot. The circle and bars can he of any size and located anywhere. If the head atom is to be represented by textual information, the front bars are chosen to start at a proper place from the center of textual symbols. The relative positions of bars, (i.e. the angles between any two bars), are taken to be 120a, 1800 or 360° away from each other depending on the number of attached functional groups. Two single bars can be plotted parallel to one another to represent double bonds. The double bonds are positioned to be parallel to and bisected by the virtual single bond (I) and their coordinates are calcu-

information

One may have seen hundreds of Newman projections through his chemistry classes. However, Newlated from the single bond coordinates by the following equations, rlx - 0.5 . &I - Sine TYPE

13

TYPE

23

TYPE

33

AY-

0.5. AI. Cos0

x,-x-AX,y,-y+Ay X,-X+&Y,Y~-Y-AY 13ARz

R4+

Rzd&

R2 TYPE

12

TYPE

TYPE

II

TYPE

2 2

TYPE

32

TYPE

31

R-2 21

Fig. 2. Nine types of NEWMAN projections.

Where AI is the distance between the two parallel bars of a double bond, and B is the angle between a bar and the reference horizontal line. The distance between two parallel bars is taken to be 10% of the bar length. Certain complications occur when a front functional group eclipses a back functional group. In such a case, one has to look at the molecule from another viewpoint to get a clear view of all functional groups. The algorithm we have adopted to achieve this is that the head atom (as well as its attached functional groups) will stay at the same position while the center of the circle (tail atom) will be moved by aX, and AYwhich

An

interactive computer program

are calculated by AX-~~*s.CClSBj

i

I

I

I

ifIc?,-8,1<10°

As-SINBj

ifIO,-O,l-=lOQ

where, ir and J are respectively the number of functional groups attached to the head and tail atoms, As is an arbitrary number for possible circle origin shift, and 0 is the angle between a functional group and the reference horizontal line, measured clockwise (II). We Rl

49

For a label, three separate text arrays of equal length are used to store the main line of text, the subscripts and superscripts with blanks filling in the appropriate positions. The main line of text is displayed first, then the subscripts and lastly the superscripts. The program can handle lower case as well as upper case characters, if necessary, for chemical symbols, e.g. Br. When there is not enough room to display the chemical formula of functional groups from right to left, the chemical formulas have to be plotted from left to right, (e.g. C,,Hr, or H2LC,0).Since the lack of room to display a chemical formula in the normal order (from right to left) usually occurs when 90” < 0 < 270°, the program is defaulted to perform redirection for such cases. However, the user can redirect the chemical formula whenever it is desired. The current limitations for textual information are as follows. The string length can be up to 80 characters for headers and 20 characters for functional groups. Up to 10 strings are allowed for legends and the maximum length for each string is 80. The maximum character string allowed for the head atom is 6.

PROGRAM

have taken A.r to be 40% of the radius representing the tail atom. This algorithm seems to work well for the cases tested, as shown in Fig. 2. The positions of bars representing chemical bonds between back functional groups and the tail atom are adjusted accordingly.

(3) Textual information Handling textual information was one of the more difficult aspects of the whole project. There are four possible types of textual information appearing in a Newman oroicction as shown in Fig. 1. The headers (main and subtitle) are used for the-title and identification purposes. Separate character sizes are allowed for the headers. The labels for the head atom and functional groups are usually alphanumeric chemical symbols but may be just alphabetic names of functional groups. The legend can be used to explain a particular plot or to define symbols employed in functional groups as is seen in papers from professional journals. The user has the option not to display any of this textual information. The use of subscripts and superscripts are provided for in this program for the labels of the functional groups and head atom, and the legends. Delimiters ‘%, ‘S’, and ‘#’ are used to control super- and subscripts. To distinguish a character or list of characters as a subscript, they must be enclosed by ‘46’signs. Superscripts must be enclosed in ‘$’ signs. As an example of character string, C%S%H%l l%s’$ would be plotted as:

W-4, The ‘#’ sign is used to suppress the automatic spacing. For example, the character string: C%5%H%l l%#s’$, causes the ’ sign to bc placed over the 1 of the subscript and not in the space following it. The result would be:

SlXUCi’URE

To handle two different types of users, minimal and extensive users, the program is as friendly (informative) as possible for the former and as brief as possible for the latter. To make maintenance and enhancements an easier job, the program is well designed and documented. To accomplish these specifications, we have utilized the branch point technique and modular design for this program. The program consists of a main routine and 43 subroutine modules to perform various tasks. The functions of each subprogram appear in the program listing. (This program will be sent to Q.C.P.E. for distribution). The NEWMAN program reads an external file through unit 20. containing parameters specific to an installation. The user default parameters are read from or written to Unit 21. The basic flow diagram of the program is displayed in Fig. 3. After the user starts the program, the user is greeted with an initial dialogue message and prompted to answer two questions. The program then processes user commands until the QUIT command is given which terminates the program. The user commands have been divided into four categories according to their functions. These categories are shown in Fin. 3. The PROGRAM CONTROL commands allow thi user to end the program or restart the program. The DATA INPUT/OUTPUT commands allow the user to input the type of projection and text for a specific projection, and save the display and current plotting parameters. The INFORMATION commands provide help information on the available commands, displays of the different types of projections, and a listing of the current plotting parameters and their descriptions. The DISPLAY commands control the graphic displays. The plotting parameters can be changed. the position of the projection on the page may be selected, and the specification of a new or old page controls how many projections are drawn on one display. The specific commands are listed in Fig. 3 and explained in more detail in the next section.

50

J.

KAO

and

L.

WATT

El

PROGRAM START

DATA INPUT AND OUTPUT COMMANDS

INFORMATION COMMANDS

1 INPUT SAUG SAVP NTYPE TITLE STlTLE XTEXT CTEXT GTEXT GDIR

HELP SHOW LIST

DISPLAY CONMANOS

1 DEVICE NPAGE OPAGE PLOT ETYPE REPEAT CHANGE ORIGIN

Fig. 3. Program Rowdiagram.

EXAMPLE

The functionality and design characteristics of NEWMAN are best illustrated by considering the following example. A brief description of this example will be presented first and is followed by the terminal session. Upon executing the program, a greeting message is printed. The program then asks if the user needs information on how to use the program. A YES is entered and the information is printed. The user is then asked if the default parameters are to be overwritten. A response of N is given here. A list of all the commands and their shortest allowable forms are then printed and the user is prompted to enter a user command. This indicates that the branch point has been reached and any user command may be given to execute a specific task. There are currently 23 user commands available for carrying out various tasks. After entering a user command and hitting the carriage return, the program may prompt for additional information depending on the nature of the command. The program will reach another branch point after completing a user command, with the exception of the QUIT and START commands. User commands can be abbreviated as

long as the abbreviation can uniquely identify a command. The system will reject any illegal command. The HELP command is then given to obtain a listing and brief description of all the commands. The INPUT command is selected to prepare the input data for a display. The DEVICE command is given to set up a correct device driver which will be specific to the user’s graphics terminal and installation. The first plot is then obtained by giving the PLOT command. The LIST command is then selected to list the default parameter values. These are the values that could have been changed if YES had been entered to the question ofoverwriting the system default parameters. The format for an external file needed to overwrite the parameters is just parameter code-parameter value pairs with each pair as a record. The listing obtained from the LIST command contains not only the parameter codes and values but also brief descriptions of each parameter. All parameter values are either dimensionless or in GDUs. A GDU (graphics display unit) is l/100 of the length of the shorter axis on the display surface of the graphics device. Most parameter descriptions appearing in the listing are probably sufficient except for a few which may need further elaboration here. Parameter 17 deals with how

An interactive CIDmputerprogram the user wants to input the position of the head atom. Set the value equal to 1 if numbers are to be keyed in from the keyboard. On the other hand, set the value equal to 0 (or f 1) if the position is to be entered from a graphics input device using joystick, crosshair or thumbwheel. The CHANGE command is then issued to change three of the parameters. The placement of the pro-

51

jection is changed by the ORIGIN command. The title and subtitle are changed by using the TITLE and STITLE commands, respectively. The graphic data is saved by the SAVG command and the parameter values are saved in an external file by the SAVP command. The PLOT command is issued again to produce the second display. The program is then ended with the QUIT command.

BYPEADINC INAPREDEFINEDFILE. IFl?!XANSW??R IS "YE?,'lTIEZ4 AEl%RTHAT.THE ITWILL-?HEUSERFCO(AFILENPMg. LEWFCEXKFS?HEFIRST-FOIKT,WHEREHBmYtiANY AVAILABLE USER C’XdAND TOCARI4LAAIPIC TASK. AWITXcmAL Ih%OFMATICNt%?iYEE-FORDEpBM)1wGCf?THE NATUPEOFlME-. !?OIt?PAFlXRACCFMAND THE-MuREEHAtwflmtBRAxH HAS~crmzIEDourAND?HEwERMAYFuPmEoMeRTASKs.10 ANDmFJR-FTICNS,THKUSER 'XTAINALISTOFUmlQXSIN?HE"HELP"-. FOR ?HE FIRSI’ TIME US&IT IS ~YSU~~ESTEDT~CMXINSW~ALISTBEFOREPFCUZDINGANY

WAlwlu

ovEwIRITESYSTE!lDEFALJLTP-7 N ~CCmANDSPNDTHEIRSHORTFSP-L-X-l B EEECH CTmTcr DEVICE CDIRZ mmTcm tm.Q mEwr1

D al H

LIST NPA(;E NmPEtm OPAGE' ORIGIN % -T

k OP CR : R

&E sn*r SrARrSTA STITLE TITLE .mmTx

SAX SAVP SK WI T

52

J. Kho and L. W~rr ~ZDCHAIGETMEDIFXYICNSOFTDCRGRL INFORXATIONOF FtlMXICNU cXYJPS.

LSIRS

CRIGIN smv tmfPE BTYF‘E DEVICE NPm OPAGE SAW SAVP FEEWiT

mNl%VPAGB FORPLtXTIK;. MIS ISTHE USE M SAME Pm EOR PLOFIXNG.

CEFAULT.

PERMIT’lFlEUSERTOSFXETIiEGRAPHIC!JAl’A FCR EVlWES DISPLAY. ANDFInn-

CuF3mrPAFwmmvALmsImAN SwEnoz m FILE m IXI’ER RoIR?NE USAGE. TO PLC’CUSING A FFJNSCUS FEmIsTniEPIuxRm

TYPE3

m1EY C

tirmasmRTHBFRcrrrAxIAL(liEAD)Am

EN'IERGRUlPSYMBXSAlT~~TREAXIALA~.USE %mmcmSJzSUBsRIPls,$mmtxoSEsupERscRIPTs,AM, #BEFOREA SUmzRwm(%) OR SmEwcFzI FT($) AL?rcmTxc SPXING. Rl:Rl RZ : C%ZIH%5% R3:n R4 :RZ

‘IV OVERRIDE

iz i &%3% EwrERTmNm LEGam. (xmrrl 2A : Rl~H,RZ=F 2B : Rl=cli%3%&?=mi%3% X : Rl=F,Rz_Qi%3% EN’ERAUSWOXMAND DEVICE WTERTHEDEVICEW 4027 mTmTKE LmvIcEoFTIcNcmE 1

R?l’ERAUSERCXIt+!AKU FL

RI H

R2

c 2A 28 2C

: i i

Ri -H. RZ-F R1=CH3,R2-CH3 Rl -F, R2-CH3

An interactive computer

program

PrmmImviuusAAEINQHlSa7D~ICHLESS 1GPALwIcSDEvIcEckmE 2GRAPHIC!SD~CEOFTICNOJDE 3PmTr.mwIM 4FunwIt7m SGRAFHICS~ CCOE(AVALUEn 0 Am 1, Oesxm-mT) 6~SIaBFORTHETITLE 7fzlwmmms1zBmlliESrJB-T1TLE 8CHMAC%RSIzEFORPWITIffi~ 9afANclmSIzE mmESRmING?HEtmDATcM 10~SIZEDISFIAYINGadWPS Am mlmm?DAm llBARWFVR ~I~FRUJTGRWFSc;wxmsAM)HMDATtM 12RADIClB~Iffi'lMETAILATDM l3~SIZBDISFLMINGGKWS AlThZTD ‘ID W TAIL ATcll 14 BAR xmr3m EVRCUWECFfNGBAcK~AN)lWETAIL.AlUd l.5Abu.aBBlWEEWA~GWXJPANDTHEX-AXIS 16 ANGLE EmviEmYABamGRcuPAmTmX-AXIS 17 FL?UZINDICATINGIFCOCIIDINATES?oBEm BY NWEEFS ENIWAUBERaZQ4AND c-f EWER?1IEPARMEIER ATATIM. WlliE Nm LINE 5 0. 6 4. 7 3. S

CGDBANDITSNZWVALUE(3NEPAIR "mm KlKlfJfBY TYPING "S"

Zt?IERA SIX-CIIARACFWFILE NAM3 i%ccnE

IN A

53

4.027l3+03 1.ODmwlo 1.2OoEM2 1.ODoB+O2 2.oooE-01 3.oooE+Oo 2.5ooE+Oo 2.oocmmo 2.000E+00 6.OOOE+OO 1.6OOE+Ol 8.OOoE+oO 4.5ooE+Oo 1.2ODE+o1 9.oooE+o1 3.oooB+o1 1.oooE+Oo

J. KAOand L. WA~I

54

TEST 2

GAUCHE

CONFORMATIONS

RI

H

R2 C

&

2A 26 2C

: RI-H,R2-F : Rl -CH3, R2-CH3 : RI -F, R2=CH3

CONCLUSION

Development of the NEWMAN computer program has been reported. NEWMAN provides research chemists a friendly, efficient, and interactive environment to draw quality Newman projections for presentations, using various available graphics devices. With this program, the user not only has whole control of how to display Newman projections but also can obtain the plots immediately. This program allows chemists to obtain results promptly and will hence increase his productivity tremendously as compared with the traditional manual operation. NEWMAN is a versatile tool because it is highly integrated and has various capabilities. The program is easy to maintain since it is reasonably well written and documented and is modularly structured. This program provides a basis for this type of application in computer automation. NEWMAN is written in ANSI 77 standard FORTRAN and is designed to interface with the PLOT-l 0 IGL package of Tektronix. Every effort has been made

to increase its portability by not using machine dependent features except for some I/O statements. Thus, it can be easily installed in any machine which is equipped with a FORTRAN compiler and IGL subroutines. Acknowledgemenr-We are indebted to Mr. R. M. Jones, Dr. J. I. Seeman, and reviewers of Internal Manuscript

Review Board for helpful comments and Mr. R. M. Waugh and Dr. W. A. Farone for their support. REFRRRNCW

Kao, J. & Katz, T., (1984), J. Mol. Sfrucl. 108,229. Kao, J. & Sesman, J. I., (1984), 1. Camp. Chem. 5,200. Kao, J.. Day, L., Watt, L., (1985). 1. Chem. Inf- Camp. Sci. 25, 129. Kao, J., Eyermann, C., Watt, L., Maher, R. & Lilly, D., J. Chem. !nJ Comp. Sci. in press. Martin, P. (1982), The Economist, August, 67. Newman, M. S. (1952), Rec. Chm. Prog. 13, I1 1.

Newman, M. S. (1955). J.

Chem. Edu. 32,344.

An interactive

wmputer

program

APPENDIX

C C C C C C C C C C C C C C

C

C

C C C C

C

C C C

C

*************t******~*~*************~~***~*****~~~**~*~*~*~** * THEPDRPCZEOF~ VERSION 1.0 IS To PROVIDE A FRImY,

* * EFF1c1Em AND IivrmAcrIvEENv1~ FORRFSEARCHCHPIISTS'l-O* * DRAW~ALITYNEWMAN PKUECTIONS To REPRESENT THEIR DATA USING * * VARIOUSAVAILABLEGRAPHICS DEVICES. n-lENEmmNPmGR?mIs * * MAINJ_YWRITl?ENINANSI STANDARDFORTRAN 77AMl ISDZSIGNEDTO * *IMIERFACEWITHlMEpLoT-1OIGLPACKAGE. THEAUI'HORSHAVEMADE? *EVERYEFFORI'NOT'IOLJSEM?CHINEDEP~~FEATWRESWITHTHE * * EXCXFTICN OF SEVER?& I/O STA-. 'II-IDS, B SHOIJUISE * CNANYM?CHINEEQUIPPEDWI?HAFORllUNCCf+ * * EASILY INsm * *PILERANDIGLSDBPRCGRms, IN ADDITION To THE m-20 AND * * DEC-10 SYSTE2G ON WHICH IT WAS WRITl?l%l. l l niENlmnN PROGR?MW??SDEVET.OpEDBYDR.JAMESKAOAND * * LQRAINE P. WATT AT THE PHILIP MORRIS REZXMXX CXNTER, * RICHMMD, VIRGINIA 23061. THE INITIAL VERSICti(1.0) WAS l l *COMPLETE0 ONDEXXVBER 31, 1982 WITHADDED IN t * MAY 1984. +**~+~*******~*+***t*~~~~~~~*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRCGRAM MAIN UDATA : STORES DATA WHICH CAN BE CHANGED BY USER. ICUNTT : bmx?Es I/O UNITS. LdmTA :s?DRESFARAMETERVALUE9 0NDEREQuIVUXNTNAME.9. SySTEXdDEFAULT VALUES. SDATA :spoREs m CAPFN : S'FXES THEFILEE tylRC?@IURE ANDREPLAYPuRPasE. MODE : xQuALs0FoR1NTERAm IVEMXE,lEDRBA'I'ZHM3DE coMM3N /LJDATA/IT,JT,ORIGX,ORIGY,'IMTIT(80),LMIXT,TSTIT(80),ISTXT, + T==(l0,80),=(10),f-=TxT,a(6,80),m(6), + I'IGDIR(6),TC(6),XTXT,IFGNPG,IEKAP,IFGlKD,IFGDB(6) CCMBON /IOUNIT/ IR,IW,IFILl,IFIL2,IFIW aX'P%M /LDATA/ IDEXUC,IOPT,PL,PW,PGRAIN,SMPXT,SSTXT,SXTXT,SCTXT,

+

C

C

C C C C C

C

C

SE.GI’XT,l?BARL,RADIUS,SBcpxT,B~,FANG,BANG,XFGcaR

coMM3~ /~DATA/ PI,AI~(~),~~~HIFT CCMKON /TLIST/ IPDES(17,62),PDVAL(17) COMIQN /CAPFN/ FILEN(6) CClYKXi/hODE/ IBA'ICH DImSION STRING(20) SETUPTHE 1/0LlN1Ts. IR : UNITFORTHEWRITE STATEMENTS IW : UNIT FOR THE RFAD STAIFILl : UNITFORTHEFILESTORINGD~~TP~VALUES SUPPLJED BY l'¶iE SYSI'EM. IFIL2 : DNITFORTHE FILE STORING DEFAULTPARAMETWVALUES SUPPLIEDBYTRBUSER. IFIL3 :UNITTOSTORE'RIECURRENTPMAMEXERVALUES. IBAlm=O IR=S Iw=5 IFIL1=20 IFIL2=21 IFIL3=22 wEI.cm

MESSAGE.

130 WRITE(Iw,lO) 10 ='I(//, 1' **t**t*************+*********R***************, I# / 2' * VERSION 1.0 *I# , *1 3' * // 4' * WELCOME 'IOTHE NEwAN CaMPuTm PRZRAM *c/: *1-.. 5' * PHILIPMORRIS RFsmRCH c!mTER I/ # *I 6' * RICXXIND, VIRGINIA 23261 *I 7' * 8' *****t***************t**********************,,,i C NEH)BRIEF INFO~TIONoNHoWl'UUSETHIS PRCGRAM? WRITE(IW,15) 15 FOFMAT(' m INFORMATION ON HC%V'IQUSE THIS PRCXRAM (Y/N)?') IANS=IYESND(2) IF(IANS.NE.l)GO To 140 WRITE(IW,16)

55

J.Iho and L. Warr

56

C C

C

C

c

16 FDRMAT( REMAN IS AFRIENDLYJNTERACXVE COMXUXR PRCGMM THAT',/', 1' 2' PROVIDES 'IHEUSER WI?n AN EASY WAY ‘IDDISPLAY QUALITY -I,/, 3' PRcAJB2TIoNS lwmUGH READILY AVAILABLE GRAPHICS DEVICES. THE',/, IS VERY EASY 'IDUSE EVEN FQR BEGINMRS,m IT",/, 4' NmmANPmGRAM 5' CCNTAINS MANY DESIRABLE FEA?uKEs FOR SOPHISTICAL USERS.',/) WRITE(lW,17) 17 FOIwAT( AETERTBEMESSAGE,TBE PROGRAM WILL ASK IF THE',/, 1' 2' USERINSTRUCTIGNSDRNOT. THEPRXEfAM WILL THEX CHECK'/, 3'WHETHERTHEUSERYSANTSTOOVEIWRITEDEFAULTP~~~'/, 4' BY RE'+DINGIN A PREDEFIm FILE. IF THE ANSWER IS "YES", 'IMEU',', 5'ITWILLPXt-lFTTHEUSERFORAFILEtU4ME. AFTER THAT, THE'/, 6'USERREhCHFS lMEFIRSTBRAI'?XPOIhT,WHERF,HEMAYTYPEANY',', 7' AvAILRBLEusERamMAND 'IQCARRY OUT A SPECIFIC TASK.'/, 8' ADDITIONAL INEORMATIONMAY BE Pm FGRDEE'BNDINGDNTBE'/, +' NATURE OF THE tXMMAND.'/) h'RITE(IW,18) 18 FORMAT( 1' TBEPRmRAMMAYREACH ANDTEERBRAECH FOIt'?TAFTERAC!DMAND'/, 2'Hns~cARRIEDooTANDTHEUsWMAYpuRsuEoTHERTAsKs.~'/, 3' OBTAIN A LIST OF USER AND'IHEIRDESCRIPTI0NS,THEUSER'/, 4'KEYSINTKE"HELP"CCXMAND. FOR 'ItIE FIRST TIME USER, IT IS'/, ~'STR@JGLYSUCZESTEDTOOBTAINSUCHALISTBEFOREPRCCEED ING ANY'/, 6' FURmER.', 7 //I INITIALIZE'DiEDEFAULTPL#l'VARIABLES. 140 CALL DEFAUL YWREAQiTBFiBRAbKXWINT. NTIME=l 300 CALL RDRDER(IACT,wrIMEz) 1c!m=(1~1000)/10 anm (101,102,103,104,105,106,107,108,109,110,111 112,113,114, *115,116,117,118,119,120,121,122,123) ICMD EFtF0RMESSAGE CALLERRrNP(IW) GDm 300 'HExP'EtmmED. al To 300 'INFU

ENmRED.

102 CALLINFu m lu 300 'PLm'EmmED. C 103 CAILPLLnNP Go To 300 ,. 'WIT ENTERED. L 104 Gom 500 'LIST' ENTERED. C 105 CALL LIST GO To 300 'cHANc;E'_ C 106 CALLCHANGE GO m 300 'STAR'mlmED. C 107 Go To 130 ‘TITLE’ EwERm. C 108 CWFMlXl! o;,10 300 'STITLE'EMTERED. C 109 CALLRSTXT GCJ'ID300 'xTExr'ENTERED. C 110 CALLRXIXT a, TO 300 'CTExl?_. C 111 CAuFcTKT Go 'ID300 'ORIG' -. C 112 CALLRORIG 03 TD 300

An interactive

computer program

C

'GIEwE??ERx). 113 CALLwrxT Go To 300 C 'COIR' EMIEWD. 114 CALt -1R a ln 300 C '.wcwBvTEHH). 115 CALL SHumP Go To 300 'NTYPE'Emmm. C 116 CALL RMJ!YP Q3 To 300 C 'BTYF'E'-. 117 CALL RDmND GO To 300 C 'DIZVICE'ENPEKED. 118 CALL DEVI a3 To 300 C 'NPAG' EXIXFUD. 119 IFGNPG=l GO 'ID300 C 'cw+G' ENTeRED. 120 IEtxFG=O 03 To 300 C 'SAWZ' -. 121 CALL SAVG Go lo 300 C 'SAW" ENTERED. 122 CALL SAVP 03 To 300 'REPEAT'C 123 CALL EfEPE Go m 300 500 CONTINUE cALL!CMOPm CALLGFsToP CALL MIT Em ***************************************~******************** C SUBRXJTINE INIEF C INITIALIZE IGL GRAPHIC PAFWWl%W. cm /IDATA/ IDEVIC,I~FT,PL,PW,PGRAIN,SIWXT,SST~T,S~~~T,SCTXT, + S~,pBARL,RADIUS,sB(;TxT,BBARt,FANG, INITIALIZE PLOT VARIABLES. C C%LL GMTKI'(IDEVIC.IOFT) IF (IDEVIC.EQ.-1)GOI0 100 C SETUPCOK)RSE-0RTERMINAts CALL BrxxxR(7) QIGI.W(O) CALL IJ1NCLR(0) 03To 200 C SEXUPCOLORSE0R'I'HEPLOlTER 100 CALL LINCLR(7) CALL n(7) 200 CALL TxQuAL(4) CAUTXAl CALL GRAIN(PGRAIN) CALL wINDcw(0.,PL,0.,Pw) CALL vwPORT(0.,FL,0.,pw) CALLCMXDS C C

Em **********************************~*********************** SUBRWl'INE fQFN(IFILE,FILNAM) PKMFTFORTHEFILENAHEANDOPENTHEPILE. REAL18 FIUiAM C?.MWN /IOUNIT/ IR,IW,IFILl,IFIL2,IFIL3 wFuTE(Iw,10) PJWD(IR,lS) FILNAM OPENWNIl'=IFILE,FILE=FILNAM)

J.KAO and L. WATT

58

10 FCPMAT(' ENTER FILE NAME ') 15 FoRMAT(A10) END *******t*tt*************************~************~******~* sUBRmTIBEDEvI PmmTFGRTmDEmcEAND0FT1GNCoDES. C m /ICFJNIT/IR,IW,IFILl,IFIL2,IFfL3 COBM%J/LDATA/ IDEVIC,IOPT,E'L,F'W,PGRAIN,SMJXT,SSTXT,SICI'XT,~, + SFGTXT,FEAFL,RADIUS,SBGl'XT,BEARL,F~,~,IFGZCR 03Lrplr)3J /TLIST/ IFDES(17,62),eDvAt(l7) DIMMSICN STRnm(1) CwQIsroP wRITE(IW,lO) CALL RDATA(SlRIffi,l,I~,IR) IF (Im.RQ.1) GO ID 100 1DEvIc-STRING(l) FDvAL(l)-IDEVIC wRITE(lw,20) IF (ImD.Ep.l) GO To 100 CALL RDATA(STRIEFG,l,IEND,IR) 10PT-STR1ffi(1) PDvAL(2)~IDFT 10 mFMAT(' EMPER‘HE DEVICZENAME') 20 EWMAT(’ EBFI’EBTHE DEVICE OFTION CODE') 100 m1NUE CALL INITGF C

C C

Em ****************************+***t***************************** SrnwrINE mm READ IN A FILE NAME STORING GRAPHIC DATA AND REPLAY TBE PICTURFS.

CC&MGN /tJDATA/IT,JT,ORIQC,ORIGY,lMl'IT(80),LMTXT,TBTIT(80),LSTXT, + 'mEG(lO,SO) ,IxpxT(1O),Nxmrr,n;(6,80),~(6), + I~IR(6).~(6~.LCrXT.IFGNPG.IFGCAP.I~.IFC;DB~6~ 'DMMON /ICUNIT/ IR,IW,IFILi,f~IL2,I~IL3 ' ' ' '' ccmm /IDATA/ IDE~I~,IOFT DIMENSICN FILEN(6) CAI.LCICC!AP CALLGFsToP IJ?GzAP=O WRITE(IW,lQ) FILE NAME') A SIX-m 10 EVRMAT(' a READ(IR,20) (FILEN(I),I=1,6) 20 E'DRMAT(6Al) CALL ICZuC(FILEN,6) 'CAT.& INIlGF z zzx&EN,.TRDE.) CALL_

C C

END *******t*****************~***************~*~~***************** sUBRCUT1NESAvG P~~RTHEFILENAMEANDP~~'POS'IDREGRAPHICDATA. Cm ,'lJDATA/ IT,JT,ORIGX,ORIGY,TMTIT(80),IMTXT,TSTIT(80),LSTXT, + TxL;M;(lO.8O),urm(T(1O),~,n;(6,8O),LGIxT(6), + IToIR(6),~(6),~,IFC;NPG,IFGCAP,IK;TGD,I~B(6) OMEION ,'ICUNIT/IR,IW,IFIL1,IFIL2,IFIL3 Cm ,'cApFN/FILEN(6) WRITE(IW,lO) 10 F'OI(MAT(' EWI!ERA SIX-CHARACTER FILE NAME') READ(IR,20) (FILEN(I),I=1,6) 20 FORBAT(6Al) cw ~~U~(FILEN,~) IFGCAF=l .FzmuRN m

59

An interactive computer program

sUBKxJT1NESAvP P-FORTHEFILENAMEARDSAVEALLPARMETER THE FILE. REAL*8 FN ccMM3N /IODNIT/ IR,IW,IFIL1,IFIL2,IFIL3 CON /TLIST/ IpDES(17,62),FDVAL(17) CALL RQFN(IFIL3,FN) Do 100 ID=l,l7 100 WRITE(IFIL3,30) ID,FDVAL(ID) 30 FORMAT(I2,lX,F10.4)

C C

C C

C C C

vAT.mSIwm

Em t****t***************************tt*****~***~~**~~*~~*~*~~ slJBRcxm1RERORDER(I?cr,wrIm) DEl'ERMINE.SWHIC!B -WAS GIVER REAL*4 INFrJ,LIST,NFAG,m COMM3N /IOUNIT/ IR,IW,IFILl,IFIL2,IFIL3 DIMENSION HEXP(4),INFU(4),PLOT(4),QDIT(4),LIST(4),CHAN(4), + STAR(Q),TITL(4),STIT(4),~(4),CIM(4),ORIG(4),~(4),GDIR(4), + SHdJ(4),~(4),BTYP(4),D~I(4),NPAG(4),OPAG(4),SAIFG(4)rSAVP(4), + R=E(4) DIMENSION CSTRNG(81) DATA HELP/'H','E','L','P'/ DATA INFU/"I','N','P','U'/ DATA PLGT/'P','L','O','T'/ DATA QUIT/'Q','U','I','T'/ DATA LIST/'L','I','S','T'/ DATA CBAN/'C','H','A','N'/ DATA STAR/"S','T','A','R'/ DATA TI'I'L/'T','I','T','L'/ DATA STIT/'S','T','I','T'/ WiTA XTEX/'X','T','E','X'/ DATA CI'EX/'C','T','E','X'/ DATA ORIG,"O','R','I','G'/ DATA Gl'EX/'G','T','E','X'/ RATA GDIF&"G','D','I','R'/ DATA SHM,"S','H','O','W'/ DATA NIYP,"N','T','Y','P'/ DATA BTYP/'B','T','Y','P'/ DATA DEVI/'D','E','V','I'/ DATA NL'AG/'N','P','A','G'/ DATA OPAG/'O','P','A','G'/ DATA SAVG/'S','A','V','G'/ DATA SAVE'/'S','A','V','P'/ DATA REFE/'R','E','P','E'/ IF (NTIMS.NE.1)COT0 30 WRITE (IW,!') 5 FOIU-fAT('USER-S AND THEIR SHORTEST FORM',/) WRITE (IW,lO) 10 FOF@lAT('BTYPE',5X,'B1,9X,'LIST',6X,'L',9X,'SAVG',6X,'SAVG',/ *' CHAKZ',~X,'CR',~X,'NPAGE',~X,'NP',~X,'SAVP',~X,'SAVP',/ *' CTEXT',5X,'CT',8X,'~',5X,'NT1,8X,'SR~',6X,'SR',/ *' DBV1CB',4X,'D',9X,'0PAGE',5X,'0P',8X,'START',5X,'STA1,/ *' Q>I~',5X,'~',8X,'ORIGIN',4X,'OR',8X,'~I~',4X,'STI',/ *' GI'EXT',!3X,'GT',8X,'FLOT',6X,'P',9X,'T1TIE',5X,'T1,/ *' HELP',6X,'H',9X,'QUIT',6X,'Q',9X,'XTEXT',5X,'X1,/ *' 1NPDT1,5X,'1',9X,'REPBAT',4X,'R',9X) Nr1MB=NT1m+1 30 IAcl=o 100 wRITFa(IW,20) 20 FOFM?iT(/,' EBTER A USER WMMAND') CALL EccwD(CSm,ICHR) CALL Lc2UC(cSTRKG,ICBR) DECIFBERTHECONTERTSOFINFDT. 'BELF'ENTERFD? CALL CHRCOM(C~,ICHR,HELP,4,1,IEXIT) IF(IEXIT.EQ.l)GO 'ID1010 'INFU' EwERED? CALL CHRCCM(C!STRRG,ICHR,INPU,4,1,IEXIT) IF(IEXIT.EQ.l)GO 'IO1020

60

J.KAO and L. Wan C

C

C

C

C

C C

C

C

C

C C

C

C

'PLoT'ENmRm? a CHRCOM(CSTPNG,ICHR,PWr,4,1,IEXIT) IF(IMIT.EQ.l) 03 To 1030 'QUIT' -? CALL CI-ECM(CSTRNG,ICHR,Z;UIT,4,l,IEXIT) IF(IEXIT.EQ.1)GO l'01040 'LISP' JmmRED? CALL CHRCXlM(CSTRNG,ICHR,LIST,4,l,IWIT) IF(IMIT.EQ.l) Go l-01050 'QiAN'EwrERED? Cw CHRCCM(CSTI'Z,I~,CHAN,4,2,IWIT) IF(IEXIT.EQ.1)GD 'I01060 'SrAR'EmmED? CALL -(CSTRNG,ICHR,STAR,4,3,IEXIT) IF(IEXIT.Q.l) GO 'PO1070 'TITL' -? CALL CHRCCM(CSTRM3,ICHR,TITL,4,l,IEXIT) IF(IMIT.EQ.l) 03 To 1080 'STIT' B?lERHE CALL CHECM(CSTR%,ICHR,STIT,4,3,IEXIT) IF(IMIT.EQ.l) Go 'IO1090 'XImc'ENImm? (aLI.~(CS'Il?E,ICfIR,XTEX,4,1,IBXIT) IF(IMIT.EQ.l) Go ?o 1100 'cmx'ENmRED? mLLCHRzx-l(csTI(NG,ICHR,CI'EX,4,2,IEXIT) IF(IEXIT.EQ.1)Go ?o 1110 'OFUG' E?IERFD? Cw ~(CSTRE,ICHR,ORIG,4,2,IEXIT) IF(IMIT.EQ.l) CXI'ID1120 'Grml?ENTEmD? CALL CH.KXM(CSTRN,ICHR,GI?X,4,2,IMIT) IF(IEXIT.EQ.l)03 'I01130 'aIR' -. CALL ~(CSTRNG,ICHR,C;DIR,4,2,IMIT) IF(IMIT.EQ.l) GO To 1140 'SHUV' EmEmD? CALL CHFCOM(-,ICHR,SHOW,4,2,IEXIT) IF(IEXIT.EQ.1)Go lU 1150 'NTYP'EwmmD? CALL CIiRCOM(CSlXNG,ICHR,MlYP,4,2,IEXIT) n&EEI~iGD To 1160

C C C

C C C

C

CALL -(CSTRNG,ICHR,BTYP,4,1,IWIT) IF(IEXIT.Q.l) Go To 1170 'DEVI'EMEFED? CZL C!HRCKMKSI'RNG,ICHR,DEVI,4.1.IEXIT) IF(IMIT.~.~) c)3To 1180 'NPAG' ENIEPED? CALL CHRCCM(CSTRNZ,ICHR,NPAG,4,2,IWIT) IF(IEXIT.4.1) Go 'I.0 1190 'OPAL;'ENImm? CALL CHEXXM(CSTRNG,ICHR,OPAG,4,2,IWIT) IF(IEKIT.EQ.l)t;o'IQ1200 'SAVG' ENTEBED? CXLL CHEECOM(CSTMG,ICHR,SAV&4,4,IEXIT) IF(IMIT.EQ.l) Go To 1210 'sAv!?'EhlTERED7 CALLcxxcM(CsrRNG ,ICHR,SAV!?,4,4,IMIT) IF(IMIT.W.l) 00 'IO1220 q&p

-7

CALL CHRKM(CSTRX,ICHR,REPE,4,l,IEXIT) IF(IMIT.EQ.l) Go 'IO1230 WRITE(IW,40) 40 EU?MAT(' UNRXXXNIZED -, TRY AGAIN') GO TO 100 r SETUPIACTANDREKlMTDTHECAU!SUB-1010 1w1010

An interactive

computer program

61

1020 1Acw1020 1030 IACl+1030 1040 IACb1040 1050 IAcx=1050 1060 IACI=1060 1070 LAcr=l070 1080 IJcP1080 1090 Ix?r=1090 1100 1AcT=1100 1110 1AcI=1110 1120 IAcP=1120 1130 IACb1130 1140 IACl=1140 1150 IACl=1150 1160 IACP1160 1170 IACl=1170 1180 IACT= 1190 IAcr=1190 1200 IAm= 1210 1Am=1210 1220 mm=1220 1230 IWl'=1230 mD **********************************~~***********************~******** C SuBRD[TpINE ~(TSTRIG,NT,RSTRNG,NR,MI'EST,IMIT) C stBPRazRAMToc!aeARETHETARGmSTRING (rn) WITH C THEFaFEmcE6NE (RBTRNG). BOl'HSTRIrsGsAEIEINAiFOPM?fi'~ C TSI'FUGIS~~WI'IWABLANKTHECCMPARISON C PEQUIRE5ATIXASTTHEFIRST"-AREcoNs1sm. C IEXIT IS INITIALLY SET 'IO0. IF TIE TARGET STRING IS FOUND IN C THESTRING, IDCIT IS -101. DIMENSION TSTRE(Ml'),RSTlWG(NR) DATA BLK/lH / WI~O Do 100 I=l,NR IF(Wl?RNG(I).NE.RSTRE(I))Go TD 109 IF(I.LT.t?TE!?T) GO To 100 IF(TSTRNG(I+1).EQ.BLX.OR.I.~.NR) GO 'KI101 100 c!mrINuE 109 REmJRN 101 Imu*1

C C

END ***X***********************k*********~~~~*****~***~~~~*~*~~~* SUBIKMCINEDEFAUL SEXDEFAULTVAUW REAL*8 FIINAM

J.KAO and L. WATT

62

-N f

C C C C

C

C

C

C C

/'UDATA/IT,JT,ORIGX,ORIGY,~IT(80),LkXT,TSTIT(80),ISTXT, ~(~O,~O).~(~O),NXTXT,TG(~,~O),~?I'~T(~), f ITGDIR(6),'IC(6),LCTXT,IFC;NP;rIMXAe,IFGIGD,IFGDl3(6) C-N /IOUNIT/ IR,IW,IFIL1,IFIL2,IFIL3 CCMMM /IDATA/ IDEVIC,IOPT,PL,PW,PGRAIN,SMl'XT,SS'EQ',SXTXT,SCTXT, * sFG'IxT,FBART;,RADIUS,~,BBARL,F~,BANG,I~oR am-m /SDATA/ ~I,Amc(3),osm~ CmN/TLIST/ IPD_ES(17,62),PDVAL(17) COMMON/SCRIPT/SUB,SUPER,BACK CCMKON/MDDE/IBATCH DIMENSICN STRING(Z) DATA PI/3.1415927/,OSHIET/2.0/ DATA Ak/360.,18b.,120./ DATA SDB/lH%/ oATASupER/LHs/ DATA BACK/lH#/ IF-: m INDICATOR. IFGDAT: FLAG FOR DATA SOURCE TYPE. IFGIGD: FLAGEQR'TGTEXTDI~ION. INITIALIZE P-. IT=3 Jl=3 IMI'XT=L LsTXT=4 NXTXl=l m(l)=6 LCTXT=l IFGNPG=l -0 1FvxD=0 CALLD_ DO 101 I=l,IT+JT 101 IEGDB(I)=O INITIALIZE pArmmm.s LISTED BY THE "LIST" af+lAND. O~~~(UNIT=IFIL~,DEVICE='PRD:',FI~='~.PAR') Co 100 1=1,17 100 READ(IFIL1,5) IPD,(IPDES(I,J),J=1,62),PDVAL(I) CLcsE (MIT=IFILl) 5 FORMAT(I2,1X,62Al,F12.4) IF (XBAlCH.nQ.1)CQIO 300 WRIm(Iw,1o) 10 FORMAT(' WANTTO OVERWRITE SYsTpl DEFAULT Pm?') IANS=IYEwO(2) IF(IANS.EQ.l)Go To 200 GO To 300 READINDEFADLTPFROMTHE USERDEFINEDFILE. 200 wRITE(Iw,20) 20 FORMAT(' THESYSTEMWILL READTBEDEFAULTVALDES FRCf'lYOURFILE') CALL I@'N(IFIL2,FINAM) Do 210 I=1,17 CALL RDATA(STRIffi,2,IEND,IFIL2) IF(IEND.m.1) Co 'It3 300 ID=STRING(l) VAL&TRING(2) IF(ID.LT.O.OR.ID.GT.17) Co To 250 PDVAL(ID)=VAt 210 cmTINuE co m 300 250 CALL ERRINP(IW) SW 300 CmTINDE SETUPBpuI~P-NAMES. CALLEQINAM IF (IBA'ICH.E().l) cw INITGF END ******************************t***********~**~*~****~***~~ suBRouTINEHELP PRINTOUTTHE CC#MANDDEscRIpTIoNs.

An interactive computer program

63

C~,'IOUNIT/ IR,IW,IFIL1,IFIL2,IFII3 wRITE(Iw,1o) 10 E'OFtMAT(/' USER -S:',//, 13X.'HEw ',3X,'PRINTTHF,DFSCRIFTION OF ALL USER -.I,/, ,3x,mTER THE INPUT MaluLE WHICH WILL sTEpwISEL.Yi',j, 23X;'INPU-f'+ lW,'PRU'lPT POR THE MINIMAL INFOIIMATION FOR A PL#l?.',', 33X,'PwT ',3X,'nJSTRuT TO MAKE A m.',/, 43X,'QUIT ',3X,'T!mMINATETHE PRaiFtAMEXErmION.',/, THE USER lo LIST PARmErms WiIICHCAN'/, SSX,'iIST ',3x,'f lW,'BE MODIFIm BY m cHAN(;EKKXJLuE.') wRITE(IW,20) 20 FORMAT( 13X,'CHANGE',3X,'A MoDul;ETo MODIFY ANY PARAMETER W.'/, + 12X,'WHICH CAN EE LISTED BY THE "LIST" C-.'/, ',/. 23X,'START ',3X,'I~THEPRCGF@@il'OSTARTFKt.l?HE 12X;'BEGINNINGWITHOEC STOPPING THE -ION:";/, To CHANGX THE MAIN TITLE MR PLOT.'/, $X/TITLE ',3X,'mT 43X;'STITLE',3X;'RE&EST To CHANGE THE SUB TITLF FOR pLoT',j; 53X,'xlmT ',3X,'R&UEST To w THE HORIZONTAL TEXT (LEGEND)'/, + 12x,'TKE PLOT.',/, 63X,'CTEXT ',3X,'REQUESTM MODIFY SYMBOLS FOR THE HEAD ATOM.'/, 73X,'GmxT ',3X,'RqyJEq To ENrEFtTHE NEW GmU!? SYMBOrs.',/, To CHANCE,THE DIRECTIONS OF TEXTUAL'/. 83X,'GDIFc ',3X,'wT + 12X,'ItiRMATICN OF FUNCTIONAL -.I,/, 93X,'ORIGIN',3X,'T(EPUEST To SET UP THE HEAO Al-CMPOSITION.') WRITE(liW,40) 40 EORMAT( 13X,'SHm ',3X,'DISmAY AVAILABLE NlmrlANPRmEm1m TYPm',/, 23X,'NIYPE ',3X,'cnANGElnE NEwAN PRamaxON TYPE.',/, 33X,'BTYPE ',3X,'ENIERA MODULE 'KICHA%E THE BAR SHAPES WHICH'/, 12X,'FasmsEm mNDS BETWEEN AXIAL ATOK AND -.I/, :3X,'DEVICE',3X,%ET THE DESIRABLE DEVICE AND OETION.',/, 53X,'NPAGE ',3X,'c;ET m PPGE FOR PIJYlTING.THIS IS ?HE DEE'ADET.'/, 63X,'OPAGE ',3X,'USE THE SAME PAGE E'ORmIKG.',/, 73x;*.wG ';:,",;VE&MIT&HEUSER ?I0STORE THE GRA%C DATA',/, + n EVR FUKJRE DISPLAY.',/, 83X,'SAvP ~,3x:'SAvETHE cmtFm?r PARAtmIm VALxJm INm AN',/, + 12X,'FILE FOR LATER KVl!INE USAGE.',/. + 12X,‘FILJIFORLRTER F0mINE USAGE.';j; 93X,'REPFaAT',3X,'REQUEST TliEPmGRAM To Pm-l!USING A PmvIODS',/, + 12X,‘SAVED FILE.') C

C C C

C C C C

c

SUBRamINE INPU THISISD~IGNEDFOR UNEXPER1EwErluSERs. IT DOE STEPWISE PIdDMTINGFOR SIMpLe (MINIMAL)PV. THESEPARAMEPERSAREWTEXTORREmTEDITmS. REAL*8 FILNAM 03MMoN /UDATA/ IT,JT,ORIGX,ORIGY,'IMTIT(80),IMmrr,'J.'STIT(8O),~TXT, + ~(10,80),wppxT(10),~,~(6,80),~(6), + I'IGDIR(6),TC(6),~,IFG!JPG,IFGCAP,IFGKD,IFQJB(6) /IOUNIT,'IR,ti,IFIL1,IFILZ,IFIL3 /fDATA/ IDEiVIC,IOFT,PL,PW,FGFtAIN,SMPXT,SSTXT,SXl'XT,SCTXT, + SFVl?XT,~,RADIUS,SEGI'XT,BBARL,FANG,EAbE,I-/'l'LIST/ IPDFS(17,62),FQVAL(17) DIMENSION SI'RING(80) PEMFTFORTHE-PROJIKTIONTYPE. CALLRmYP -THEI%INAND SUB-TITLE. CALLRmxT cuLFwmT PKKPTTHESYMBOLSE'ORTHEHEADATCM. CALLRCTm PK!METEDRGEUXlPSYMKKSA'IT~'IUTHEAXIALAL'K&i9. CALLmrxT PEMPTEORTHELEENDS. CALLKXTXT END

.I.

64 C

KAOand L. WATT

********t**t*t**tt*******************Zt*~~~*~~~~~*~*~~~~~~~~*~~~*~

.5uBRovp1NE LIST MODULE 'IOLIST PARAMETER ID'S, DESCRIPTIONS, AND VACUES. C CDM3N/IOUNIT/ IR,IW,IFIL1,IFIL2,IFIL3 CZMDN/TLIST/ IPDES(17,62),PDVAL(l7) 20 FoRMAT(1X,I2,1X,62A1,1XlPElO.3) 80 FORMAT(,',' CCDE',14X !VARIABm DESCRIFTION',29X,'vAwE'/) 90 J!ORMAT('Pw VALW ARE IN (DUS OR DIMENSIONLESS') WRITE(IW,80) wFwIE(IW,90) C PRINTPARAMmmS. Do 210 1=1,17 210 WRITE(IW,20) I,(IPDES(I,J),J=1,62),PDVAL(I) mm ****************************************************************** sOBmuT1m CHANGE M3DtJLEFORC!H?tNGI~PAMMETER~. C CClMZN /IOWNIT/'IR,IW,IFIL1,IFIL2,IFIL3 cDMMoN/TLIST/ IPDES(17,62),pDvAt(l7) DImION STRING(2) wRITE(Iw,1o) + ' ATATIME. EM) ?HE "CHANGE" MODLJLEBY TYPING "S" CN A',', + ' NEW LINE') 100 CALL l?DATA(STRING,2,IEND,IR) IF(IEND.~.~) co m 400 ID=STRING(l) VAbSTmNG(2) FDVAL(ID)=VAL Go !m 100 400 CALLEQINAM C

C C C C C

SmROUl'INE Rl?l%T(STRING,ISTR,NZHR) SDBPIEOGRAM THIssuBFRcGmM RFMS IN A STRING IN Al FO~T,CALU DTSLK To FIND 'ME STRING m (EXCLUDINGTHE TRAILING BLANKS) ANDRE?IURNSITTHROUGHTHE ARGmmTNCHR. mFl1NPwrsTR1ffismuLD BELE9STHANOR~ALToISTR~. coMMoN/IODNIT/IR,IW,IFILl,IFIL2,IFIL3 DIMFNSICNSTRING(ISTR) DATA BLK/lH / w 100 I=l,ISTR 100 STRING(I)=BLK READ(IR,lO) (STRING(I),I=l,ISl-R-1) 10 E'OFMAT(8OAl) F#ZHR=MBLK(STRING,ISTR)

C INl'I%ERE'Dh'CTIU?IYESND(M) FUNCTIONIYESNOREADSARECOPDANDSETSIYFSNO=lIF "Y" IS THE INPUT AND 1-2 IF "N" IS 'IHEAN=. : mN/IOUNIT/ IR,IW,IFIL1,IFIL2,IFIL3 DIMENSION CARD(8l),YES(3),NO(2) DATA YES/'Y','E','S'/ DATA NO/'N','O'/ 100 IYEsNo=O READ AN INFUT~, SKIPBLANKS, ANDCHECKFORVALIDRESFONSEk C CALLEcmD(CARD,ICHR) CALLLc2uC(CARD,ICHR) 'YES'EmEFm. C CALL CHRZCM(CARD,ICHR,YES,3,l,IEX~T) IF(IMIT.EQ.1) a0 113lo1 ‘No’ EwERED. C CALL CHFCOM(CARD,ICHR,NO,2,l,IEXIT) IF(IMIT.EQ.1) Co To 102 CALL EmuNp(IW) Go !m 100

An interactive computer program 101 LYEixw=l 102 IYEsND=2 C C C C

C C C C

C

END **t**t*t**t****tt******,****it**,*************** SIJBKWL'INEBDATA(~NG,ISL'RLN,IS'lQP,IRU) READ DATA IN FREE MRNAT AND IF 'S' IS W, RK'HIFW'LOTHE CALLINGFlcGmM w1m ISmP=l. ISTRIN IS THK NUMBER OF DATA TO BERBADANDsTRLNGsLDRESTHEcoRRFswNDINGvAL~. C!CWMDN/IDUNIT/ IR,LW,IFILl,IFIL2,IFIL3 DImSION STRING(1),ICARD('32),IDIG(10) DATA IDIG/1HO,lHl,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9,' DATA IBLK/lH /,IPERI/lH./,IMINUS,'lH-/,IPLUS/lH+/,ISDB/lHE/ DATA IsLe/~e/,ISuS/1~/,IsLs/~S/ DATA ICAFD(l)/lH/,ICARD(82)/1H/ IsmP=O 105 DD 100 1=2,81 100 ICARD(I)=IBTaK IF(IRD.EQ.IR)Go To 106 READ(IRU,lO,END=170)(ICARD(I),I=2,81) cx)m 107 106 CCmmUFl READ(IRD,lO) (ICARD(I),I=2,81) 107 CONTINUE Do 110 J=l,ISTRIN 110 STRLNG(J)=O.O JCXXJNl+l D~IPHERaXWEWS OFICARD. IF IPAKl?l, m DETECTS DIGITS PRIOR 'NlDECIMAL WINT. IF IPART=2, -DEL'JXTS DIGITS AFTERTHK DECIMAL E'OINT. IF IPAFtT=3,PROGRAM DlWE?ZE DIGITS IN E-FORMAT EXPONENT. IPART= SIGN=l.O SIGNE=l.O Ex=o.o Do 160 K=2,82 IF(ICARD(K).NE.IBLK)GO 'X3142 IF(ICARD(K-l).NE.IBLK)GO TD 158 03 TO 160 142 IF(ICARD(K).EQ.ISUS.GR.ICABD(K).EQ.ISIS) GO 'LO170 Go To (143,150,154),1PAKr IPART=l. 143 IF(ICARD(K).lQ.IPLDS)GCITo 160 LF(ICAKD(K).NE.IMINUS)GO 'ID144 SIGN=-1.0 GO To 160 144 IF(ICARD(K).NK.IPERI)GCYIU145 ImFm=2 NPcwER=o CXIm 160 145 DC 146 N=l,lO 146 XF (ICARD .EQ.IDIG(N) 1 03 To 147 GO To 165 147 STRING(JCOJMl’) =STRI~(JCUJNT)*1O.O+E'LOAT(N-1)

GO TD 160 150 IF(ICAIID(K).NE.ISDE.AND.ICARD(K).NK.ISLl5) GO To 151 C IPAHl'=3. IPART= GO TO 160 C IPART-2. 151 Do 152 N=l,lO IF(ICAFD(K).BQ.IDIG(N)) GO 'LO153 152 aR?FINUE GO To 165 153 NPmm=NpowER-1 ~~CI~(J~)=STRIK;(J~~~K~)+~T(N-~~*~O.O**(N~(RI~~ GO To 160 154 IF(ICARD(K).EQ.IFLUS)GO TO 160

65

J.KAO and L. WATT

66

IF(ICARD(K).NE.IMINUS)GO 'ID155 SIcaE=-1.0 GO '10160 155 DO 156 N=l,lO IF(ICnRD(Kj.EQ.IDIG(N)) Go To 157 156 CONTINUE 03 'I0165 157 EX=EX*lO.O+FLXM'(N-1) Go To 160 158 STRING(JCm)=SIGN*STRING(JCCUNT)*1O.**(SIGNEXk3f) IF(J~.LT.I~N) Go To 159

REliJRN 159 SCCUNT== SIGN=l.O IP?mr=l 160 CONTIm 165 CALLERRINP(IW) Go 'ID105 10 EORMAT(80Al) 170 ISmP=l

******************t***+*********************************************

C

.4?tlrcnoN

m=BLK(X,N)

C

IZ'UNZTICN~FINDTIE ~STRINGLEMZTH INARRAYXBY clMITrINGTRAILINGBLANKS. XMUSTBEINAlE0RMAT. C DIMaJSION X(N) DATAEU/lH/ PINDTREPOGITIDNOFTHELASTNONBLANKCHAREER. C DO 100 1~N,l,-1 IF(X(I).NE.BLK)Go '&J110 100 amwuFi DTBLK=O Go '10120 110 DlBLK-I 120 axlwuE END +**t************************************************************** suBPcuTINEEO!4D(CSTEm,IcwNT) PEGRhMMREAD INPUT INAl E'OFZMAT.THISS~INEWILLDELETE IEADINGELANKSANDAPPaJDARLANK1[0THENONRLANKSTRING.THE SUBPRCGRAMTHBNKEIURNS THELENDIlIOF'IHE~RZANIZEDf7I'RIIJT; (ALLNONBLANK CHrwmmsPLDs1)TIEwxlGH IauNT. O%I~IN/IOUNIT/IR,IW,IFIL~,IFIL~,IFIL~

C C C C C

DIME&ON

‘XlkJ6(8~,,~(8i,

oATA=JnH/ Do 180 1=1,81

180

CsTFwG(I)=ELK READ(IR,lO) (C!S!I'mZ(I),I-1,80) 10 EWRMAT(EOA1) FIND THE POSITION OF THE FIRST NON BUNK m. C DO 100 1=1,80 100 IF(CSTRE(I).NE.BLK) GO 'PO150 ICCUW-0 ISTAmFIND T@ PCBITIONOE'THEIMI'NONBLANKCHAFGtCl'EFL DO 800 1=80,1,-l IF(CSTI@G(I).NELBLK) GO ‘IO 250 800 CONTINUE 250 ImD-I S'lRRTTlBFIRSTNONBLANKCMRXYER AT PCXITION 1. C Do 260 1=1,81 260 WA(I)=BLK Iaxcm-0 Do 300 1=1STARr,1mD IaxlNwI~

An interactive

computer program

61

300 wAA(IcouNT) V(I) ICKlUNT=ICWNT+l Do 310 I=l,IaxJNT 310 csI?wG(I)=wA(I) END *****+************************************************************ SuBRcKrrINEERRINP(IW) WRITETHEERK)RMFsSAGE. wRITE(Iw,lO) 10 E'OFMAT('INPUT ERWR, TRY AGAIN')

C C

C SUSROWCINE IC2UC(STRING,ICHRS) CONVEFZL'THEINPVI?STRING FRCHLOWERCASE MUPPERCASEIEITERS. =*4 Ic DIMENSION STPJNG(l),IC(26),UC(26) DATA UC/'A','B','C','D','E','F','G','H','I','J','K','L', + 'M',~N','O'~'P'~~Q','R','S','T~,'~~,'~~,'W','~~,'~','Z~/ DATA ~/,a,,~b',~c',~d~,~e,,'f',~g~,'h~,~i~,'j~,'k~,'l', + 'm',~n~,'o~,~p~,'q~,'r',~s','t','U',~v',~w',~X~,'~~,'~'/ Do 100 I=l#ICHPs D3 110 J=1,26 IF(STRING(I).NEz.IC(J)) Co 'PO110 STRING(I)=uC(J) 03 To 100 110 CONTINUE 100 axrINDE

C

ZND **********t**R*****~*******t*+********~~**~~~*~~*~*~~~****~******* sJBRcxrrINEFWTYP C REW INTHEDESIRABLETYPEOFNEW4?W-ION. COMMON ,'UDAw IT,JT,ORIGX,ORIGY,'I~+~IT(~O),U?~XT,TSTIT(~O),TS~, + nan;(lO,80),~(1O),~,TG(6,80),~(6), + I%DIR(6),TC(6),Wl'XT,IFC;NPG,IEWAP,IFGRI),I!XDB(6) C&%KlN ,'ICUNIT/IR,IW,IFILl,IFIL2,IFIL3 DIMEXSION STlUNG(2) wRITE(Iw,1o) 10 FOIWAT(' NEHI INEOPMATIONONPRQSBCTICN TYPES?') IANS=IYEs?0(2) IF(IANS.NE.l)GO T0 100 CALL100 wRITE(IW,20) 20 E'ORMAT('SPECIFY 'IWETYPEOF NEWMAN PRIXEETICN') CALL ROATA(STRING,2,IEND,IR) ITYP=STR.Iffi(l) JTYP=STRING(2) E(IEND.EQ.l) RFxulW IF(ITYP.GE.O.AND.ITYP.IE.3.AND.JTYP.GE.O.AND.JTYP.LE.3) GCYlU200 CALL ERRINP(Iw) a0 M 100 200 IT=ITW JT== C

m

C C

***********************************L***t****~*** suSxxlT1NERMTxr READ IN THE MAINTITLE. aMWN ,'UDAT&'1T,JT,ORIGX,ORI~,lWIT(80),Ul'IXT,TsTIT(80),XTXT, + TxLeG(10,8O),LXTX7I'(lO),~,~(6,80),~(6), + I'IGDIR(6),n=(6),ETX'l',IEGNPG,IFGCAP,I~,IE'GDB(6) CCMMON /ICUNIT/ IR,IW,IFILl,IFIL2,IFIW wRITE(IW,lO) 10 FORMAT(' ENTER THE NEW TITLE?) CALL RJxxT('IMPIT,80,UWxr) EM

C

kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

J.KAO and L. WAN

68

.5uBmwr1mRSTxT RF&-IIN THE SUB-TITLE. 03ME13N/UDATA,'IT,JT,ORXX,OFUGY,~IT(80),LmXT,TSTIT(80),LS'I?CI', + ~(10,80),~(lO),~,~G(6,80) rLGTXT(6)r + I'IGDIR(6),173(61 ,LCTXT,IpGNpG,IFGcAp,I~,IMp8(6) CCMIWN /IOUiIT/ IR,IW,IFIL1,IFIL.2,JFIL3 wFum(Iw,1o) 10 EORMAT(' ENTERTHENEWSUBJTITLE') CALL RTEXT(TSTIT,80,LSTXT)

C

Em *****t*k**tk***f******R****+************~~~~~~~~~*~**~~*~~~~~~~* suBRouT1NERxTxT READ IN THE LEZEGNDS. caMM0~ ,&DATA/ IT,JT,ORIGX,ORIGY,'IMTIT(~~),LI~ZI',TS!XT(~O),~STKT, + TXLCG(LOr80),~(10),~,~(6,80) ,LGIxT(6), + I~IR(6),?C(6),~TXT,IFE;NPG,I~,IFGTQ),IF(;DB~6l COMMON /IOUNIT,'IR,IW,IFIL1,IFIL2,lFIL3 DIMENSION TWRK(80)

C C

wRITE(Iw,lO)

lOMRMAT('ENT!XRTHENlGV~ w 100 I=l,lO 15 CALL F?rExT(lwRK,80,LwmT) CALLcKKSTR(m,LWIXP,IERR) IF (IERR.EQ.l)crm, 15 IF(IXl'XT.IQ.0) 'Xl'IO200 Lxl?cr(I)=Lv?rxT CO 150 .J=l,LWmT 150 -(I,J)=?WRK(J) 100 CONTINUE twrxT=I

(XTEXT)')

200 NXTXT=I-1 C C

C C

Em ******************************t******************** suBRommERCTxT READINTHETEXTMRTHEHEADA'ICPl. CCMtXZ)N /'UDATA/IT,JT,ORIGX,ORIGY,'IMTIT(80) ,I.i+?mT.T!TTIT(80).LSTXP, + TxLM;(10,80) ,LxIxT(lO) ,~,~~6,BO) ,UTXT(6), + I'IGDIR(6),TC(6),LClXT,IE'GNX,IEQZAP,IF'GIGD,IEGDB(6) aX4lGN /IOUNIT/ IR,IW.IFIL1,IFIL2,IFIL3 wRITE(rW,lO) 10 EQRMAT(' SPMlIFYSYMBOLS FORTHEE'RONT?.XIAL (HEAD) ATOM') 20 Cw RPExT(TC,6,LC'IxT) c!ALLcHKSTR(Tc,LcTxT,IERR) IF (IERR.EQ.l)GOIU 20 EiND ************+******************I*************~*********~**** suBI(ooc1m IGTXT READ INTEXTUAL IN!?ORMATIopJ ~RFUNCZPICNALGRfXPS. CCMMON /'UDATA/IT,JT,ORIGX,0RIGY,'IT(80),I.MI'XT,'ISTIT(80),UTXT, + ~(10,~0),~(10),~,~(6,80),~(6), + ITGDIR.(6),l'C(6),UX'XT,IFGNFG,IFGCAe,IEVIGD,I~(6) -N /IOUNIT/ IR,IW,IFIL1,IFIL2,IFIL3 DIMENSION lWRK(80) wRITE(Iw,1o) 1O~~~A('R4+ER GROUP SYMKXS ATTXHED ?o THE AXIAL A=.,U.SE',/ RGLOSESUBSCRIPT?Z,$TOENCLOSESUPERSCRfPTS,AND',/ *' # BEEQRE A SUBSCRIPT(%)OR SUPERSCRIPT($)TO OVERRIDE',/, *' AmTIC SPACING.') Do 100 I=l,IT+JT wRITE(Iw,20) I 20 FORMAT(' R',Il,' : ',$) 30 CALL RrExT(mRK.80rLmxT) CALLcHEsTi(TwRi,Livrrr,IimR) IF (IERR.EQ.1)GOM 30 LQTxr(I).LkrxT DO 150 J=l,LKTXT

An interactive

computer program

'R;(I,J)=lWRK(J) 100 CcwTINuE 150

mm *******t*******************************~*~*~~~*~~*~~******* SOBmU'l'INE RORIG P.EADINTHE~I~~OFTHFiHFnADAToM. CCMMCN /-UlJhT?4IT,JT,ORIGX,ORIGY,l%?l'IT(80),UTlXT,TSTIT(80),LSTXT, + ~(10,80),wc?xr(lO),MCIXT,TG(6,80),LGIXT(6), + IToIR(6),~(6),~,IFGNPG,IFCCAP,I~,IMpB(6) COMMON /IDUNIT/'IR,IW,IFILl,IFIL2,IFIL3 ca4MDN /IDATA/ IDEXtC,IOPT,PL,PW,FGFAIN,SMT%T,SSTXT,SXTXT,SCI'XT, + SFGTXT.FBARL.RADIUS.SBCTXT.BBARL.FANG.BANG.IK;COR DIMFNSION STI7sNG(2),~(1),~(1),1~(1) . mITE(1W,10J 10 E-QRMAT('EXfERTHECOORDINATFSFORTHEHEADATcM') IF(IFGCDR.NE.l)Go ?o 100 GEl'COO~INATESFROMNUMBERS KEYED IN BY THE:USER. CALL RDATA(STRING,2,IEND,IR) ORIGX=STRING(1) oRIGY=STRING(Z)

C C

C

100 COt?l-I_ GEI'THE COORDINATES FROM THE GRAPHIC INPUT (GIN) DEVICE. THESE COORDINATES AREUXXlXD FROM JOYSTICK, CRQSSHAIROR -L F'XITICN. CWCMOPEN CALL LocATE(1,XZ,YC,ICUR.IPOINT) ORIGX=XC(l) cRIGY=YC(l) CALL_

C C C

C SUBROUXNEWPIR MDULE?OSPECIFYHOWTHEC~ICALFOREI[lLALSTOBEP~. SET ITGDIR = 0, PLOT FROM RIGHT TO LEFT (I.E., ClOH21). SET ITC;DIR= 1, PLOT FROM LEET 'IORIGHT (I.E., H21ClO). COMMON /UDATA/ IT,JT,ORIGX,ORIGY,TIT(80),UPIXT,'ISTIT(80),TZI'XT, ITxLM;(10,801,~(10~,~,~(6.60~.~(6~, t ITcoIR(6),~(6),LCmPT,IFC;NPG,IFGCAP,I~D,IFQIB~6) /IOUNIT/ IR,IW,IFILl,IFIL2,IFIL3 DIMENSION SlXUNG(2) wRITE(IW,lO) 10 FORMAT(' ENTER THE GRCUP ID AND THE TEXT DIRDZTION CODE '/, + ' (TOWAW) RIGHT=O,LEET=l), ONE PAIR AT A TIME.'/, + ' END THE INPUT BY TYPING "5"') II=IT+JT Do 100 I=l,II 110 CALL RDATA(STRING,2,I~,IR) IF(IEND.EQ.l)GO To 200 IG=STRmG(l) IVAL=STRIla;(2) D?~IG.LE.II.AND.IG.Ql'.O) GO M 150

C C C

cw al

To

ERmNP(Iw) 110

150 ITC;OIR(IG)=O IF(IVAL.EQ.l)I'IGDIR(IG)=l 100 coNTINuE 200 IFGIGD=l C C C C

mD ***********x**~*****+*******************~~~~~~~~~~~~~~~~~~ suBRfx.m1mRDBcND C!HECKIFAIXUBLEEONDIS'lQBEDRAWN. SETIFQlB=1,PLOTACOUBUBOND. SETIFGDB=O,PLOTASINC;LEBOND. CCMMON ,hJDATA/IT,JT,ORIGX,ORIGY,'lMTIT(80),MTXT,TSTIT(8O),LSTXT, + ~(10,8O),IxIxT(10),~,~16,80) ,m(6) I + ITGDIR(6),~(6),~,IFGNR=,I~AP,IFGn;D,IFQIB(6)

69

J.KAO and L. WATT /IOUNIT/ IR,IW,IFIL1,IFIL2,IFIL3 DIMENSION STPlKG(2) wRITE(fW,10) 10 Et3RMAT(' EhTER THE GKXJP ID AND THE BOND CCDE (DOUBLEEOND=l,'/, + ' SINGLE BOND=O), ONE PAIR AT A TIME. %iE GRDUpS ARE'/, + 'DEFAULTEDTOBE~ 'l0THE AXIAL AEMS BY SIMZE'/, + 'EQNDS. END THE INPUT BY TYPING "S"') II=IT-hJT Do 100 I=l,II 110 CALL RDATA(STRING,2,IE??D,IR) IF(IEND.W.l) CT,'IO200 IG=STRIffijl) wALerRING(2) IF(IG.LE.II.AND.IG.GT.0) GO 'IO150 CWEmmP(Iw) 03 M 110 150 IFcDB(I)=O IF(IVAL.EQ.l)IE'GDB(IG)=l 100 CoNTIm 200 RFNRN END *+*************~******************tX****~~~~~***~~~~~~~~~*~~~~~~~~ C SUBROUTINE SHowrp SUBpIEoc;RAMTODRAWAVAILAELENEMMANPRaJJzCTIoNTypEs. C mmoN /SDATA/ PI,AI~~(~),~SHI~ DIME!NSION MR(~,~),~IESC(~),'E~'R(P),TR(~,~O),IRDIR(~),IV~'R(~) DIMEN9ION DAtK(6),BLK(l),IFGDB(6) DATA (DTR(l,I),I=1,2)/lHR,1H1/ DATA (m(2,1),1=1,2)/lHR,lH2/ DATA (DTR(3,1),1=1,2)/lHR,lH3/ DATA (DllZ(4,1),1=1,2)/1HR,lH4/ DA?a (DTR(5.I),I=l.2)/1HR,lH5/ DATA IXTA

C

&‘IR(6,1)

,I=1,2jjlHR;lH6/

DESC/lHT,lHY,1HF',lHE,1H / DATA BLK(l)/lH / INITIALIZEpm ANDsmUplwESCREm. PIW=96. PLL=lZO. CALLCmm IF (IDEVIC.NE.-1)CALL NE%4pAG CALL WImm(O.,pu,O.,FJLW) CALL vwmRT(0.,pLL,0.,~W) RADIUS=4.0 EcHRsz=2. BmRsz=o.75*Ecwsz FBARL-Z'RADIUS mARL=o.75*Fwuu TXTSIZ92.0 NICTR=l XINC=pL;G/C. YIrc=rn/6. Do 200 J-1,3 Do 200 IT=1,3 SET Up 'RIEORIGIN FOR EACH SAMpLE pROJKTION. OX=XINC+2."XIN13*FLoAT(IT-1) OY=YIhlc+2.*YINc*FtDAT(~l) ANGI=90. Do 300 I=l,IT IRDIR(I)=O NrR[1)=2 IE&'(I)=O DANG(I)=ANGI+FLOAT(I-l)*AINC(IT) m1=30. Do 400 I=l,JT KK=m+1 IRDIR(KK)=O NTR(KX)=2 IFGDB(KK)=O nwK(KK)=ANGI+FLOAT(I-l)*AINC(JT)

An interactive computer program

71

400 cm%rINuE CO 500 I=l,IT+JT CO 500 J=1,2 500 TR(I,J)=DTR(I,Jh Do 600 I=l,JT KK=1T+1 IF(DANG(KK).GT.90.AND.DANG(KK).LT.270) IRDIR(KK)=l 600 CmTINUE C NOWDBAWTHE PLOT. IIlT=IT JJTl=JT C%LL PLCT(OX,OY,II'lT,JJTT,DANG,FBARL,BBARL,OSHI~,TCTR,l?ICTR,O., + RADIUS,TR,~,FCHRSZ,BCHRSZ,IRDIR,I~) 0X=0X-5.*Tmsxz OY=OY-2.*RADIUS-3.fTXTSIZ CaLL MovE(ox,oY) CALL TXSIzE(O,!x!HPsZ,EcHF?sz) CALL TExT(S,DESC) CALL INUMBR(II'lT,1) CALL TEtT(l,BLK) CAL& INUMBR(JJ'IT,l) 200 czcmxm CALL0%CU3S m **********C*********+****~**t*******+~~~*~*~~~~~*~~~~~~~~~*~~~* SUBmINE FA!NM(XIN.YIN,CHRSIZ,CHR?xTM,N'ICI'R) C PLOTTHE!HEADATOM. Caacti/MmE/IBAm DIMENSION CHRA!~?~(N'ICIV),~RK~(~),WRKD(~),WRKU(~) C PI#TSYMBOL+SFOR'MTHEADA'IW. IF(CHBSIZ.EQ.0)GO TO 200 CW MWE(XIN,YIN) CALL TXICDR(5) CmL TXSrzE(O,CHRsIZ,CHRsIZ) IF (I~~.np.o)cwsEpAN(cHRA'IM,wRRL,~,wRKu,~) IF (IBATCH.EQ.1)CALL SEPAN2(CHRATt4,WRRL,WRKD,N) ~~(~,~) CALL HWE(XIN,YIN-O.S*CIPSIZ) =T=T(m=) IF (IBATcH.EQ.1)FaWUBl Cw MM(XfN,YIN+O.5*CHRSIZ) ~~(N=m~) 200 CONTINUE C

C C

C C C C C

Em *~******~***,*k********t****************~*~~~~*~**~**~~~~~*~*~**~* SUBFUMI'INEDSP32l(XI,YI,BARl,BAR2,DANG,CHRSIZ,TR,M?R,IFGREV,IFGDB) PLmBDNDSANDFumrIDNALGRaJPS. CCMMON /SDATA/ PI,AIEx:(3),OSHIET cDMEIDN/mE/ IBATCH 1FGREV:FLAG INDICATING IF THl$CHEtlICAL~FtfLJLATOBEIIEVERSED. BAR1 :BARlxNGnIw1LLmBEsHcrwN. BAR2:BARLENmHmBBPLmIm. DIMENSION TR(NTR),~(8O),wRRD(8O),wRKu(80) CU?FSEP=O. IF(DANG.DT.90..AND.DANG.LT.270.) OFFsE?c-1. RANG=DANI;*PI/l80. coSANG=COS(RANG) SINANG=SIN(RAM;) SIGN=l. DELmo.1* BAR2

J.KAO and L. WATT

72 DELX-o.~*DEU*SIN?UG lmY=O.f*DEm*~ II=IFaB+l IF(II.EQ.1) SIcN=O. Do 200 I=l,II

1~u.4.2) sm=-1. x=BARl*CcmNG+x1 Y=Elm1*sINmwYI CALL mm(x+DEesIGN,Y-DEwSImq x=BAR2*cxw4rG+x1 Y=J3AR2"sINaNG+YI CALL DRAW(X+DELX*SIGN,Y-DEL~SIGN)

,

200 CcNTINm 1mNTR IF (IBATCH.~.~) nxmmmfm (T&m) X=X+C!HRSIZ*~~~'I?FUIAT(I~)*CHRSIZ Y=Y+CHlsIz*sINhw IF ((IFcaEv.4.l).AND.(IBA~.4.0)) CALL =v=mTR,~) IF ((I-FG~~,~.~).AND.(IE@~H.~.~)) CALL REVSTI(TR,m) c.ALLM(X,Y) CAtL TXICUR(4) CALL l'XSIZE(O,CHRSIZ,CHRSIZ) IF (IBAlCH.4.0) C.MLSEPAN(TR.WRKLrWRKD,W,NTR) IF (1m1m.4.1) CALL sEpAN2(TR,wRKL,wRm,tmq cwmXT(JCaJm,wFm) CALL MovE(X,Y-0.5*CHRSIZ) cwTExT(IcouNT,m) IF (IENCH.4.11 RETJRN CALL lQVE(X,Y+O.5*CiiRSIZ) C?uLTExT(Iamw,wRKu) Em C C C

kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk*k*kkkkk*kkkk*kkkkkkk*kk*

SUBFKWTINE SEPAN(R,WRKL,WRKD,WRKU,ICHR) SUB~TOSEPARATETHF:C~~OFASTRINGINTO~~ --SIffi !IWE MAINLINEOF

******

TEXT, THESCBSCRIF'B, ANDTHEsuPERsx1PTS. m ENCLOSED BY '%' ARE TAKEN mmsuBCR1mANDlsfoSEEmCtmm BY '$1 m mPERsCRIm. THE'#' ISUSEP~SUPP~SPACINGSO~TA~PPAND C ~IpTCANBCYI'HAPPEhRCNTffESAMESPACEOF?wETEXT. C ITCANCNLYAPPEARBEE'OREASUESCRIPTORSUPERSCRIF'l'. c THIS TE)(THANDLINGsGIEovTINE IS UsED INmSTAND AtoNEMoDE C ONLY. C cmmN/sRIPT/SuB,SuPER,wR DIMRiSION R(ICHR),WRRL(ICHR),WRKD(ICHR),DIG(lO),WRKU(ICHR) DATA DIG/lH1,1H2,1H3,1H4,1H5,lH6,lH7,l!+8,1H9,1HO/ Ml'A E3LK/lH/ IF wm.4.0) ~mum w 100 I=l,ICHR wRm(1)=E&K WRKU(I)=ELK wmD(1)=J3LK 100 amTImlE J=l I=1 IF (1.4.m~) Gum 205 200 IF ((R(I).4.BACK).AND.(R(I+1).4.SUB))TIB? I=I+l IF (J.NE.1)J-J-1 Gum 310 E!NDIF IF ((R(I).EQ.BACK).AND.(R(I+1).4.SUPER)) 'IHEtN I=I+l IF (J.NE.l)J-J-1 Gmo 320 ENDIF 205 IF (R(I).4.SLB) GQID 310 IF (R(I).4.SUPEW GOPJ 320

C C

Aninteractivecomputerprogram

13

C

PUT tXWVXER IN MAIN LINE OF TEXT WRKL(J)+t(I) mm 500 cPmCEsTHEsUBSCR1m 310 1=x*1 IE'(I.GT.ICHR)GOTO 600 IF (R(I).EP.SUB)GQIQ 400 cPLAmClaRam1NMTHEsUBSCR1PT 315 wRKD(J)=R(I) J=J+l GOTO 310 cPRccEsTHEsupERscIlIPT 320 I=I+l II?(I.Gr.ICHR)Gmo 600 IF (R(I).EQ.SUPER)QYlQ 400 cPLAaCHAmcmR1mmsU!?ERScRIm 325 WRKU(J)=R(I) J=J+l Gem 320 400 J=J-1 500 J=J+l I=I+l IF (J.m.20) W-!XI600 IF (I.LE.ICl-IR) GOTO 200 600 Em *******+*t********************************************************** C SUBROLWINE PJWST2(STRING,ICHR) .9UBPRCGFaMToREvERm THE DIRFQTION OF ACHENICAL EWWLA, C EQR AN EXAMPIX, Cl0H21LI1=>LIlH21C10. C C T?iIssUBPRtxmM ISUSH)IN'I'+EBA'ICH@%ZiXONLY. DIMENSION STRING(ICHR),WEUW(80) DIMENSION DIG(10) IXTA DIG/lHl,lH2,lH3,lH4,1H5,1H6,1H7,lH8,lH9,1HO/ Ice0 NF=ICHR IFLA&O Do 100 11=1CHR,1,-1 Do 150 f=l,lO IF{STRING(fl).EQ.DIG(J)) Go To 160 150 cxmwUE IFLAG= GO l-o100 160 IF(IFLAG.m.0) GO 'lQ100 NI=Il+l D3 170 12=NI,NP,l I[Iw=Im+l 170 WRKS(IDW)=STRING(I2) 1J?LAG=0 t+F=NI-1 100 CoNrINUE Do 180 I=l,NF IDw=Iw+1 180 WRKS(IDW)=STRING(I) DO 200 I=l,Ic!IiR 200 STRIffi(I)=wRKs(I) m ****************************************************************** SUBRWIXNE PI#~'(OX,OY,IT,JT,DANG,FBARL,E~BARL,CMIFP,TCTR,@~TR, + CTRSIZ,RADIUS,TR,WIR,FRSIZ,BRSIZ,IW)IR,IPCDB) C THIS PRoGRAM 1sCAT&EDBYSmmPANoPmmPlrl PEPJmRMPwrrING. DIMENSION DANG(~),ETR(~),TR(~,~~),IRDIR(~),TX~IT(~~),I~B(~) DIMENSION N'rR(C),R(80) CALL FATQM(OX,OY,CIMIZ,TC'I'R,tVEl'R, Do 300 I=l,IT W 310 K=l,NTR(I) 310 R(K)=TR(I,K) C

J.KAO and L. W~rr HIDBAR=O. IF(CTRSIZ.NF.O.)HIDBAR=CI'RSIZ+l. 300 CALL DSP321(OX,OY,HIDEAR,FBARL,DANG(I),FRSIZ,R,NfR(I),IRDIR(I), f IFGDB(I)) DELTAx=O. DELTAY=O. W 500 I=l,IT DANG(I)=AMDD(DANG(I),360.) DO 500 J=l,JT KK=IT+J CMMG(KK)=AEIOD(DANG(KK),360.) DELTAA=DANG(KK)-DANG(I) ABSANG=AE!S(DELT?+A) IF(AEsAs.GT.10.) al m 500 D!&TAA=DEtTAA*Pl/l80. RANG=DANG(KK)*PI/180. DELTAX=CISHIFT*COS(RhNG)+DELTAX DELTAY=CSHIFT*SIN(RANG)+DELTAY 500ccxm1NuE OX=OX+DELTAX OY=OY+DELTAY CALL Enm(ox,oY,RADIus) Do 600 I=l,JT

KK=I?yI D3 610 K=l,NTR(KK) 610 R(K)=TR(KK,K) 600 CALL DSP321(OX,OY,PADIUS,BBARL,DANG(KK),EmSIZ,R,NTR(RK), + IRDIR(KK),IFGDB (KK) ) 0x=0X-DELTAX OY=oY-DELTAY C

C

C C

END ********t***************t*+*+*t***t**t***~**********~*~~~*~~~*~*~~~***** SuBmmmE EQINAM CCMBN /MM!&/ IDEVIC,I~,m;,PW,~IN,S,~,S)(TXT,SCIXT, + SFGTXT,FBARL,R4DIUS,@GTXT,BBAKt,FANG,BA%,IFU0R CXr4.m /TLIST/ ImI?S(17,62),PWAG(17) slmuPI9puIv7umrPAmMEImNAMm. IDEVIC*FDVAL(l) IOplwDvAL(2) pL=PDvAL(3) pw=PDvAL(4) FGRMN-pDVAL(5) SMIXT=HIvAL(6) SsTXT=pDvAL(7) SXmP=FmmL(S) mm(g) sFGTXT=mvAL(10) FBARbPDvAL(11) RADIUS=PDvAL(12) SBmXT=PDVAL(13) BEmL!=FDv7&(14) FAm=Pmv4L(15) BANG=PrmL(16) IFGCoR=pwAL(17) Em *******************t*t********t*+*t*+tt*~~~~~~~~~~~~~~~~~~~~~*~~~~ SuBIxx?rINEpImNp PRaJEmIoNS. SUBpRCGRAMTUDRAWoRAw COMMON ,'UDATA/IT,JT,ORIGX,ORIGY,lVl'IT(8O),~,'TSTIT~80),~TXT, + ~xLEG[~~,~~),IxPxT(~O),~,TG(~,~O),~(~)~ + Il%DIR(6),TC(6),LCTXT,IFGNPGrIFGCAP,I~D,I~B(6) OxlMo~ /LDATA/ IDEVIC,IOFT,PL,PW,PC;RAIN,S~VXT,SSTXT,SXIXP,SCTXT, + SffiTXT,FBARL,RADIUS,SBGTXT,BBARL,FANG,BANG,IFCCOR ON /SDATA/ PI,AINC(3),OSHIFT CCMMON /C?&'FN/FILEN(6) ooMEIDN/MDDE/IBATCH DIMENSION DANG(6),R(8O),WRXL(80),WRKD(80),WlUU(80)

75

Aninteractivecomputcr program CALLcmPBN

IF(IFCNPG.NE.l)Go To 100 IF (IDEVIC.NE.-1)CA-ILNERWAG CALL wINDcw(0.,PL,0.,Pw) CALL VwPDKr(O.,PL,O.,Pw) 100 IF(IFQZAP.lQ.0)Go To 200 CAILOPNCAP(FILEN) 200 CotwINUE CGHIFl?=O.4*RADIUS x=sm Y=Pw-o.5*sMrXT CALLTXICUR(7) CALL MovE(X,Y) CA& TXSIzE(O,SMrXT,sNTxT) 'Z+LLTEXT(lMIXT,'IMIIT) IF (IBATCH.EQ.l)QYIO 250 x=SMrXT Y=Y-2.o*ssTXr CALL M(xIE(X,Y) C&L TXSIZE(O,SSTXT,SSTXT) CALL TEXI(LSTXT,TSTIT) 250 IF(IT.EQ.0)Go To 610 DO 300 I=l,IT 300 DANG(I)=FANG+FlGAT(I-l)*AIM:(IT) w 400 I=l,JT RK=IT+I 400 DANG(KK)=BANG+FLOAT(I-l)*AINC(JT) IF(IFGIW.FQ.1) Go TO 600 00 500 I=l,IT+JT ITCI)IR(I)=O IToIR(I)=l 500 IF(DANG(I).GT.90.AND.DANG(I).LT.270) 600 COMTIRUE CALL PLOT(ORTQC,ORIGY,IT,JT,DANG,FBARL,B~,~I~,~,~, SCTXT,RADIUS,~,LGTXT,SFGT2tT,SBGTXT ,ITWIR,IFGDB) 6lO+SMAX=ABAXl(.SFGTXI,SBGTXT) lx4AX=AM?hX1(FBARL,BE!ARL) IMFX=MAX~(IXTXT(~) ,MTXT(~) ,rxnCr(3) &XTXT(~) ,iXTm(5) ,urrxT(6)1 Y=ORIGY-RADIUS-BMAX-l.S*SMAX-2.0 X=ORIGX-0.5*FfOAT(IMAX)*SX'I'XI Do 700 I=l,NXTXT ICBR=LXTXT(I) DO 710 JJ=l,ICHR 710 R(JJ)=TXLEG(I,JJ) CALL KwE(X,Y) CALL TXSIZE(O,SXTXT,SXIXT) IF (IEWKtH.4.0) CALL SEF’AN(R,WRl&WlWD,h’RKU,ICHR) IF (IBATCH.ll4.1) CALL SEPAN2(R,WRXL.WRKD.ICRR)

C

C C

IMlEDIATELYAETERABLANRWILLBETREA~AS~. SEPARATION ISUSEFULFORRANDLINGCBl!MICALFORJ4ULA9. THIS TExTRANDLINGEIDuTINE IS USED INTHEBVICH~EONLY. DIMENSION R(ICRR),WRKL(ICHR),WREN(ICRR),DIG(10) RATA DIG/lHl,lH2,1li3,1H4,lH5,1H6,1H7,lH8,lH9,1HO/ DATA BM/lH / ISA=0 IF (ICBR.GT.20)ICHR=20

THIS

J.KAO andL. WATT DO 100 I=l,ICHR WRKL(I)=BLK 100 WIWN(I)=BLK MIWIXI THE SEPARATICN. Do 300 I=l,ICHR Do 310 .J=l,lO IF(R(I).EQ.DIG(J)) Go To 320 310 CONTINUE ISA=1 IF(R(I).EQ.BLK)ISA=0 315 WRfX.(I)=R(I) Go To 300 320 IF(ISA.EQ.0)M) To 315 WRKN(I)=DrG(J) =(I)=BLK 300 coImmuE

C

C SUBROUTINERnrsTR(STRING,ICHR) SUBPROZRAMT0REVER5ETHE DIRECPION OF AcXEXICALFOIU~LA FOR AN EXAMPLE, C1OH21LI1=>LI1H21C10. THIS RCUNTINE IS USEJ INTHESTANDALCNEMDDEONLY. ccmm/~Im/suB,suPm,BACK DIMENSION STRING(ICHT+,wRKs (80) IFLAcE=IcHR UST=ICHR

C C C

N=l

10 IPLAcE=IPLAc!E-L N=N+l IF (N.(;T.ICHR) GOI 300 IF (STRIffi(N).q;).SUB) GCVID100 IF (STRING(N).iQ.SUPER) GUT0 200 IF (STRfffi(N).NE.EW!K) CXYICI 300 aYm 10 100 N=N+l IPLmz=IPLACE-1 IF (STRING(N).NFi.SUB) m 100 GOTO 10 200 N=N+l IFLAcE=IpLAcE-1 IF (STRING(N) GOT0 10

.NF..SUPEFt)

GOM

200

300 TCouNT=LAST-IPW Do 350 I=N-ICOUNT,N-1 IPuc!E=IPLAcmI wRKS(IPLAcJq=STRIm(I) 350 CoNTINuE Li%ST=LAsT-ICDrJNT IPLAcE=Lmr IF (N.LE.ICHR)GO7?310 DD 500 I=I,ICHR srRrffi(I)=wRKS(f) 500 CONTINUE C C C :

END ****t**********X********X**********~**************************** FumTImCHwrN(sTRIm,ICHR) THIS FlJtXTIONEXAMIN&SASTRINGOFLENGTH ICHR,= INTHE STANDAtGNEiCJDE,AND~S~I~~~~~bF'i% TExTsTR1NGNm c.xuNTINGW occuRRENcEsOF '%I, '$' AND 'A' SIGNS. DIMENSIONSTRING(ICHR) SUB='% supER='$' BACK='#' cTtwnI=0 Do 10 I=l,ICHR IF (sTRING(I).lQ.sm)0 10

An interactive computer program IF (STRING(I).4.SUPER)I3XO 10 iF (STRING(I).4.BXK) CHTUX'N=CHRCIN-2 10

C C C C

CCMMON/SCRIFT/SUB, SUFER,EWK ~N/IOUNIT/IR,IW,IFIL1,IFIL2,IFIL3 DIMENhON tiNG(IhiR) lERR=O N=l IF (ICHR.4.0) RElURN IF ((sTRING(1).NE.suB).AND.(sTRING(1).NE.supER).AND. *(STFuNG(1).m.E!ACK)) cum 10 WRITE (IW,lOl) 101 FOR+lAT('FIRST m CAN NOT BE %, $, OR 1. EM'ER TEXT l AGAIN.') IERR= 10 N=N+l IF (N.Gl'.ICHR) m IF (STRING(N).4.SUB)tax, 20 IF (SI'RING(N).4.SUPER) G(yro30 IF (STRING(N).4.BACK)'MEN IF (N.~.I~R) cam 300 *g ((sTRIw(N+1).~.supw).AM).(~NG(N+1).NE.suB)) aYm 10 20 N=Ml IF (N.GT.ICHR)GOTO 100 IF (STRIffi(N).4.SUB) QXQ 10 IF (STRING(N).4.SUPER)m 100 IF (STF.Iffi(N).4Q.BACK) COT0 100 mm 20 30 N=N+l IF (N-6.1-) 03To 200 IF (SI'RItG(N).EQ.S~) c37IQ10 IF (STRING(N) .4.sVe) CXYIU200 IF (STRING(N).EQ.BACK) GOTO 200 GO-IO30 100 IERR=l WRIT5 (IW,102) 102 EORMAT (' UNMA'IXXEDPAIR OF "%", 200 IERR=l WRITE (IW,103) 103 EQRMAT (' uNMA?tMED PAIR OF "$".

EXVIERm

=

m

300

-IN.')

TEXT AGAIN.')

300 IERR=l WRITE(IW,104) A "I" CAN OCCUR CNLY BEEORE A SUBSZRIPT OR', 104 E-OR&?AT(' *' .5mmsCRIrn.') C stmmrm

lTGIN) C C C C C C

B~~TCIUINDE~,I~I~PT,IN~T,I~UT,F~UXXN,MNGIN,HEAD,TITIN,

suBEmxRAMTHuACTSASmE1NTExFACE VACALLING -AND THIS PRXRAMTHATDRAWS B -IONS. MANYOF THEP_ ~BYTHEUSWINTHESTAM)AIONEMXEARJZ sfiToDEFAuLT~MRTHEBATcHM3DE.~trsmIN~8n?M MoDETmCALLING PRCGRAM MJST SpeCIE’Y ?HEMuc;H ‘IVE ARGuMeJT LIST Tim GRAPHIC DEVICE AND OPTION (INDEw,INoFT),THE PRojEcTIoN

J.KAO andL. WAIT

78

c C : C

C C C C

TYPE (INIT,IN.JT), THE ANGLES PEIWEZWTHEFRONTANDBACK FUNZTICNALGWXJPS AND ?HE X-AXIS fFAWIN.BANGIN). THE U44EL KIRTHEHEADA~(HEAD),THETITLEFOR~DISPLAY (TITIN).AND ?HE LABELS FOR m E'O'ETICNAL GROUPSVl'GIN). '%E FIi&iT!?OUR ARGmmTSAREI~,THENExTtiAREREAL,ANll THELASTmmEEARE CHAMCERSTRINGS WI!EfAlmRh?AT. THESTRINGS ARE 8Om BUTONLY 20 ~AREUSEDFOREXHGRUIP IhEmL,ANDONLY6 ~~USTZDFOR~~OF?HE:HEAD ATM. THIS SUBPROZRAM ISNOTUSEOINTHE~ANDALCNEMODE. CCMCN/UDATA/ IT,JT,ORIGX,ORIGY,'IT(8O),WTXT,'ISTIT(8O),Wl"XT, * ~(10,80),~(10),~,~(6,80),~(6), l ITcaIR(6),'fC(6),WI'XT,IFGNFG,IFGcAp,IEGIGD,IFQlB(6) CC&MN/MODE/fBATCd COEIMIN/LDnTA/IDEVIC,IOFT,PL,PW,FGRAIN,SMl7Q,SSTXf,~,~, l ~,FBARI.,RADIUS,SBorxT,BBARI;,FANG,BANG,IFocoR DIMENSION l-GIN(6,80),lGINL(6),TITfN(80) ,HEAD(SO) DATA BLK/lH / IBATCH=l CALL DEFAUL IDEvIc=1NDEw IoFI=Imm CALL INITGF IT=INIT JWINJT FANG-FAGIN BAW=BANGIN DO 3 1=1,80 ~IT(I)&LK 3 owlmuE LSTXT-0

Do 10 I-l.10 LmxT(I)-0 co 5 J-1,80 lXLEGII.J~=BLK -0

20

25 27

28 30

Lm!XT980 Do 20 I-1,60 'IMTIT(I)-TITIN(1) CtXITNtE Do 25 I-80,1,-1 IF ('IWl'IT(I).NE.BLK) CKm) 27 Kbnxr=m1 CONTINUE 00 30 I-1.6 umT(I)=i30 Do 28 J-l.80 TG(I,J)-'IkN(I,J) CGNTIMJE CoNTIm Do 50 I-l,6 co 40 5=80,1,-l IF (l'G(I,J).NE.BLK) GZD 50 LmJcT(I)=mmr(I)-1 CONTINUE CONTINUE Do 60 111.6

60 Do 70 1=6,1,-l IF (TZ(I).NF,.BLK) GPlQ 80 IfzTm=KcTxT-1 CONIXNUE cALLPuxmP C?U&L~ CALLGRSTOP

An interactive computer program

C C

R**t+**********~*****~~~~***1******1**~~~~*~~~~~~*~~~~~~~~~~~~~ s~ImDEFvm SUB~TOSEl'lXFAULTVALUESMSCMEOFTHEVARIABLE. REAL*8 FILMM CloMMoN /UDATA/ IT,JT,ORIGX,ORIGY,TP?~'I~'(~O),LNPXT,TSTIT(~?~),LSTXT, + ~(10,~0),~(1~),~,~(6,8O),LQIxp(6), + I'IGoIR(~),~=(~),L~~T,IEGNPG,IF~AP,I~,I~B(~) DIMENSION D'MPIT(80),MSTIT(80),DTXI&(10,80),MG(6,80),D'IC(6), lIUZ'XT(6),IDEQIR(6) DATA (DlMCIT(I),I=1,6)/1HN,1HE,1HW,1HM,1HA,1HN/ DATA (D'J.STIT(I),I=1,4),'1HT,lHE,lHS,1~/ aATA (DTXLEG(1,I),I=1,6)/lHL,1HE-lHG,lHE,lHN,lHD/ DATA (DTG(l,I),I=1,2)/1HR,lHl/ DATA (DTG(2,I),I=l,2)/lHR,lH2/ DATA (DTG(3,1),1=1,2)/1HR,l.H3/ t44TA (lXG(4,1),1=1,2)/lHR,lH4/ DATA (tYE(5,1),1=1,2)/1HR,lH5/ DATA (lXE(6,I),I=l,2)/lH~,lH6/ DATA D?c(l)/lHc/ LL4TA ILGl'XT/2,2,2,2,2,2/ DATA IDEllIR,'6*0./ RATA lXXUGX/6O./,DORIG!t/6D./ DO 10 1=1,80 lMI'IT(I)=MMTIT(I) TSTIT(I)=DTSTIT(I) 00 5 J=l,lO T%LEG(J,I)=IyIxI;B(J,I) 5 CONTINUE 10 CONl-INUE Do 20 1=1,6 Do 15 J=1,80 '=(I,J)=DTG(IrJ) 15 C~INUE Tc(I)=DTc(I) LGTxT(1) =ILGTxT(I) Il-GDIR(I)=ICWDIR(I) 20 CONTINUES ORIGX=DoRIGX ORIGY=DDRIGY

79