/* Main program */ MAIN__(void) { /* Initialized data */ static doublereal sfac = 9.765625e-4; /* Format strings */ static char fmt_99999[] = "(\002 Complex BLAS Test Program Results\002,/" "1x)"; static char fmt_99998[] = "(\002 ----" "- PASS -----\002)"; /* Builtin functions */ integer s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ extern /* Subroutine */ int check1_(doublereal *), check2_(doublereal *); static integer ic; extern /* Subroutine */ int header_(void); /* Fortran I/O blocks */ static cilist io___2 = { 0, 6, 0, fmt_99999, 0 }; static cilist io___4 = { 0, 6, 0, fmt_99998, 0 }; /* Test program for the COMPLEX*16 Level 1 BLAS. Based upon the original BLAS test routine together with: F06GAF Example Program Text */ s_wsfe(&io___2); e_wsfe(); for (ic = 1; ic <= 10; ++ic) { combla_1.icase = ic; header_(); /* Initialize PASS, INCX, INCY, and MODE for a new case. The value 9999 for INCX, INCY or MODE will appear in the detailed output, if any, for cases that do not involve these parameters. */ combla_1.pass = TRUE_; combla_1.incx = 9999; combla_1.incy = 9999; combla_1.mode = 9999; if (combla_1.icase <= 5) { check2_(&sfac); } else if (combla_1.icase >= 6) { check1_(&sfac); } /* -- Print */ if (combla_1.pass) { s_wsfe(&io___4); e_wsfe(); } /* L20: */ } s_stop("", (ftnlen)0); return 0; } /* MAIN__
void display_information(int sig) { print_log(INFO,"\n-----------------------------SERVER iNFO-----------------------------"); print_log(ERROR,"\nCURRENT LOG LEVELS : ERROR"); print_log(WARNING,",WARNING"); print_log(INFO,",INFO"); print_log(DEBUG,",DEBUG"); print_log(INFO,"\nDocument Root : %s",path_root); print_log(INFO,"\nPort No : %d",port_number); print_log(INFO,"\nResponse Strategy : %s",strategy_name); if(strstr(strategy_name,"Fork")) { print_log(INFO,"\n---------------------------------------------------------------------\n"); return; } if(strcmp(strategy_name,"Thread Pool")==0) { print_log(INFO,"\nThread Pool Size : %d",worker_max); print_log(INFO,"\nWorker Size : %d",buffer_max); } print_log(INFO,"\nTotal Requests handled : %d",show_total_requests()); print_log(INFO,"\nTotal amount of data transferred : %d bytes",show_total_size()); s_stop(&total_uptime); get_time_difference(&total_uptime); print_log(INFO,"\nTotal uptime : %s",show_time_difference(&total_uptime)); print_log(INFO,"\nTotal time spent serving requets : %s",show_total_time_difference(&requests_time)); print_log(INFO,"\nAvg time spent serving requests : %s",show_average_time(&requests_time,show_total_requests())); print_log(INFO,"\n---------------------------------------------------------------------\n"); }
/* Subroutine */ int check0_(doublereal *sfac) { /* Initialized data */ static doublereal ds1[8] = { .8,.6,.8,-.6,.8,0.,1.,0. }; static doublereal datrue[8] = { .5,.5,.5,-.5,-.5,0.,1.,1. }; static doublereal dbtrue[8] = { 0.,.6,0.,-.6,0.,0.,1.,0. }; static doublereal da1[8] = { .3,.4,-.3,-.4,-.3,0.,0.,1. }; static doublereal db1[8] = { .4,.3,.4,.3,-.4,0.,1.,0. }; static doublereal dc1[8] = { .6,.8,-.6,.8,.6,1.,0.,1. }; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ static integer k; extern /* Subroutine */ int drotg_(doublereal *, doublereal *, doublereal *, doublereal *), stest1_(doublereal *, doublereal *, doublereal * , doublereal *); static doublereal sa, sb, sc, ss; /* Fortran I/O blocks */ static cilist io___19 = { 0, 6, 0, 0, 0 }; /* Compute true values which cannot be prestored in decimal notation */ dbtrue[0] = 1.6666666666666667; dbtrue[2] = -1.6666666666666667; dbtrue[4] = 1.6666666666666667; for (k = 1; k <= 8; ++k) { combla_1.n = k; if (combla_1.icase == 3) { if (k > 8) { goto L40; } sa = da1[k - 1]; sb = db1[k - 1]; drotg_(&sa, &sb, &sc, &ss); stest1_(&sa, &datrue[k - 1], &datrue[k - 1], sfac); stest1_(&sb, &dbtrue[k - 1], &dbtrue[k - 1], sfac); stest1_(&sc, &dc1[k - 1], &dc1[k - 1], sfac); stest1_(&ss, &ds1[k - 1], &ds1[k - 1], sfac); } else { s_wsle(&io___19); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK0", (ftnlen)28); e_wsle(); s_stop("", (ftnlen)0); } /* L20: */ } L40: return 0; } /* check0_
int __main() #endif #if defined(__linux__) || defined(__hppa) { #ifdef __linux__ /* Subroutine */ int s_stop(); s_stop("", 0L); #endif return(0); }
/* * *************************************************************************** */ /* Main program */ int MAIN__(void) { /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Fortran I/O blocks */ static cilist io___1 = { 0, 6, 0, 0, 0 }; s_wsle(&io___1); do_lio(&c__9, &c__1, "Hello, Word!", (ftnlen)12); e_wsle(); s_stop("", (ftnlen)0); return 0; } /* MAIN__ */
static void manage_single_request(int peer_sfd) { s_start(&requests_time); http_request_t *request = (http_request_t*)malloc(sizeof(http_request_t)); http_response_t *response = (http_response_t*)malloc(sizeof(http_response_t)); strcpy(response->resource_path,path_root); next_request(peer_sfd, request); build_response(request, response); send_response(peer_sfd, response); clear_responses(response); free(request); free(response); s_stop(&requests_time); get_time_difference(&requests_time); }
int/* Main program */ MAIN__() { /* System generated locals */ integer i__1; /* Builtin functions */ /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ extern /* Subroutine */ int tnbc_(integer *, integer *, doublereal *, doublereal *, doublereal *, doublereal *, integer *, U_fp, doublereal *, doublereal *, integer *); extern /* Subroutine */ int sfun_(integer *, doublereal *, doublereal *, doublereal *); doublereal f, g[50]; integer i__, n; doublereal w[700], x[50]; integer lw; doublereal up[50]; integer ierror, ipivot[50]; doublereal low[50]; /* DEFINE SUBROUTINE PARAMETERS */ /* N - NUMBER OF VARIABLES */ /* X - INITIAL ESTIMATE OF THE SOLUTION */ /* LOW - LOWER BOUNDS */ /* UP - UPPER BOUNDS */ /* F - ROUGH ESTIMATE OF FUNCTION VALUE AT SOLUTION */ /* LW - DECLARED LENGTH OF THE ARRAY W */ n = 10; i__1 = n; for (i__ = 1; i__ <= i__1; ++i__) { low[i__ - 1] = 0.; up[i__ - 1] = 6.; x[i__ - 1] = i__ / (real) (n + 1); /* L10: */ } f = 1.; lw = 700; tnbc_(&ierror, &n, x, &f, g, w, &lw, (U_fp)sfun_, low, up, ipivot); s_stop("", (ftnlen)0); return 0; } /* MAIN__ */
Subroutine */ int igraphxerbla_(char *srname, integer *info, ftnlen srname_len) { /* Format strings */ static char fmt_9999[] = "(\002 ** On entry to \002,a,\002 parameter num" "ber \002,i2,\002 had \002,\002an illegal value\002)"; /* Builtin functions */ integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ extern integer igraphlen_trim__(char *, ftnlen); /* Fortran I/O blocks */ static cilist io___1 = { 0, 6, 0, fmt_9999, 0 }; /* -- LAPACK auxiliary routine (version 3.4.0) -- -- LAPACK is a software package provided by Univ. of Tennessee, -- -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- November 2011 ===================================================================== */ s_wsfe(&io___1); do_fio(&c__1, srname, igraphlen_trim__(srname, srname_len)); do_fio(&c__1, (char *)&(*info), (ftnlen)sizeof(integer)); e_wsfe(); s_stop("", (ftnlen)0); /* End of XERBLA */ return 0; } /* igraphxerbla_ */
/* DECK XERHLT */ /* Subroutine */ int xerhlt_(char *messg, ftnlen messg_len) { /* ***BEGIN PROLOGUE XERHLT */ /* ***SUBSIDIARY */ /* ***PURPOSE Abort program execution and print error message. */ /* ***LIBRARY SLATEC (XERROR) */ /* ***CATEGORY R3C */ /* ***TYPE ALL (XERHLT-A) */ /* ***KEYWORDS ABORT PROGRAM EXECUTION, ERROR, XERROR */ /* ***AUTHOR Jones, R. E., (SNLA) */ /* ***DESCRIPTION */ /* Abstract */ /* ***Note*** machine dependent routine */ /* XERHLT aborts the execution of the program. */ /* The error message causing the abort is given in the calling */ /* sequence, in case one needs it for printing on a dayfile, */ /* for example. */ /* Description of Parameters */ /* MESSG is as in XERMSG. */ /* ***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC */ /* Error-handling Package, SAND82-0800, Sandia */ /* Laboratories, 1982. */ /* ***ROUTINES CALLED (NONE) */ /* ***REVISION HISTORY (YYMMDD) */ /* 790801 DATE WRITTEN */ /* 861211 REVISION DATE from Version 3.2 */ /* 891214 Prologue converted to Version 4.0 format. (BAB) */ /* 900206 Routine changed from user-callable to subsidiary. (WRB) */ /* 900510 Changed calling sequence to delete length of character */ /* and changed routine name from XERABT to XERHLT. (RWC) */ /* 920501 Reformatted the REFERENCES section. (WRB) */ /* ***END PROLOGUE XERHLT */ /* ***FIRST EXECUTABLE STATEMENT XERHLT */ s_stop("", (ftnlen)0); return 0; } /* xerhlt_ */
/* Subroutine */ int paths_() { /* Initialized data */ static char type__[10*3+1] = "ANGSTROMS DEGREES DEGREES "; /* System generated locals */ integer i__1; doublereal d__1, d__2, d__3, d__4; /* Builtin functions */ integer i_indx(), s_wsfe(), do_fio(), e_wsfe(); /* Subroutine */ int s_stop(); /* Local variables */ static integer mdfp[20]; static doublereal xdfp[20], delf0, delf1; static integer i__; extern /* Subroutine */ int flepo_(); static doublereal funct, rnord, c3, xlast[360], x3, funct1, gd[360]; extern doublereal second_(); extern /* Subroutine */ int dfpsav_(); static doublereal cc1, cc2, cb1, totime, cb2, aconst, bconst, cconst; extern /* Subroutine */ int writmo_(); static integer lpr; /* Fortran I/O blocks */ static cilist io___8 = { 0, 6, 0, "(//10X,' RESTARTING AT POINT',I3)", 0 } ; static cilist io___9 = { 0, 6, 0, "(' ABOUT TO ENTER FLEPO FROM PATH')", 0 }; static cilist io___11 = { 0, 6, 0, "(' OPTIMIZED VALUES OF PARAMETERS, \ INITIAL POINT')", 0 }; static cilist io___14 = { 0, 6, 0, "(1X,16('*****')//17X,'REACTION COORD\ INATE = ' ,F12.4,2X,A10,19X//1X,16('*****'))", 0 }; static cilist io___16 = { 0, 6, 0, "(1X,16('*****')//19X,'REACTION COORD\ INATE = ' ,F12.4,2X,A10,19X//1X,16('*****'))", 0 }; static cilist io___28 = { 0, 6, 0, "(' GEOMETRY TOO UNSTABLE FOR EXTRAPO\ LATION TO BE USED'/ ,' - THE LAST GEOMETRY IS BEING USED TO START THE NEXT' \ ,' CALCULATION')", 0 }; /* COMDECK SIZES */ /* *********************************************************************** */ /* THIS FILE CONTAINS ALL THE ARRAY SIZES FOR USE IN MOPAC. */ /* THERE ARE ONLY 5 PARAMETERS THAT THE PROGRAMMER NEED SET: */ /* MAXHEV = MAXIMUM NUMBER OF HEAVY ATOMS (HEAVY: NON-HYDROGEN ATOMS) */ /* MAXLIT = MAXIMUM NUMBER OF HYDROGEN ATOMS. */ /* MAXTIM = DEFAULT TIME FOR A JOB. (SECONDS) */ /* MAXDMP = DEFAULT TIME FOR AUTOMATIC RESTART FILE GENERATION (SECS) */ /* ISYBYL = 1 IF MOPAC IS TO BE USED IN THE SYBYL PACKAGE, =0 OTHERWISE */ /* SEE ALSO NMECI, NPULAY AND MESP AT THE END OF THIS FILE */ /* *********************************************************************** */ /* THE FOLLOWING CODE DOES NOT NEED TO BE ALTERED BY THE PROGRAMMER */ /* *********************************************************************** */ /* ALL OTHER PARAMETERS ARE DERIVED FUNCTIONS OF THESE TWO PARAMETERS */ /* NAME DEFINITION */ /* NUMATM MAXIMUM NUMBER OF ATOMS ALLOWED. */ /* MAXORB MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXPAR MAXIMUM NUMBER OF PARAMETERS FOR OPTIMISATION. */ /* N2ELEC MAXIMUM NUMBER OF TWO ELECTRON INTEGRALS ALLOWED. */ /* MPACK AREA OF LOWER HALF TRIANGLE OF DENSITY MATRIX. */ /* MORB2 SQUARE OF THE MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXHES AREA OF HESSIAN MATRIX */ /* MAXALL LARGER THAN MAXORB OR MAXPAR. */ /* *********************************************************************** */ /* *********************************************************************** */ /* DECK MOPAC */ /* ***** Modified by Jiro Toyoda at 1994-05-25 ***** */ /* COMMON /TIME / TIME0 */ /* ***************************** at 1994-05-25 ***** */ /* *********************************************************************** */ /* PATH FOLLOWS A REACTION COORDINATE. THE REACTION COORDINATE IS ON */ /* ATOM LATOM, AND IS A DISTANCE IF LPARAM=1, */ /* AN ANGLE IF LPARAM=2, */ /* AN DIHEDRALIF LPARAM=3. */ /* *********************************************************************** */ alparm_1.iloop = 1; if (i_indx(keywrd_1.keywrd, "RESTAR", (ftnlen)241, (ftnlen)6) != 0) { mdfp[8] = 0; dfpsav_(&totime, geovar_1.xparam, gd, xlast, &funct1, mdfp, xdfp); s_wsfe(&io___8); do_fio(&c__1, (char *)&alparm_1.iloop, (ftnlen)sizeof(integer)); e_wsfe(); } if (alparm_1.iloop > 1) { goto L10; } s_wsfe(&io___9); e_wsfe(); timec_1.time0 = second_(); flepo_(geovar_1.xparam, &geovar_1.nvar, &funct); s_wsfe(&io___11); e_wsfe(); writmo_(&timec_1.time0, &funct); timec_1.time0 = second_(); L10: if (alparm_1.iloop > 2) { goto L40; } geom_1.geo[path_1.lparam + path_1.latom * 3 - 4] = path_1.react[1]; if (alparm_1.iloop == 1) { alparm_1.x0 = path_1.react[0]; alparm_1.x1 = alparm_1.x0; alparm_1.x2 = path_1.react[1]; if (alparm_1.x2 < -100.) { s_stop("", (ftnlen)0); } i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { alparm_1.alparm[i__ * 3 - 2] = geovar_1.xparam[i__ - 1]; /* L20: */ alparm_1.alparm[i__ * 3 - 3] = geovar_1.xparam[i__ - 1]; } alparm_1.iloop = 2; } flepo_(geovar_1.xparam, &geovar_1.nvar, &funct); rnord = path_1.react[1]; if (path_1.lparam > 1) { rnord *= 57.29577951; } s_wsfe(&io___14); do_fio(&c__1, (char *)&rnord, (ftnlen)sizeof(doublereal)); do_fio(&c__1, type__ + (path_1.lparam - 1) * 10, (ftnlen)10); e_wsfe(); writmo_(&timec_1.time0, &funct); timec_1.time0 = second_(); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L30: */ alparm_1.alparm[i__ * 3 - 1] = geovar_1.xparam[i__ - 1]; } /* NOW FOR THE MAIN INTERPOLATION ROUTE */ if (alparm_1.iloop == 2) { alparm_1.iloop = 3; } L40: lpr = alparm_1.iloop; for (alparm_1.iloop = lpr; alparm_1.iloop <= 100; ++alparm_1.iloop) { if (path_1.react[alparm_1.iloop - 1] < -100.) { return 0; } rnord = path_1.react[alparm_1.iloop - 1]; if (path_1.lparam > 1) { rnord *= 57.29577951; } s_wsfe(&io___16); do_fio(&c__1, (char *)&rnord, (ftnlen)sizeof(doublereal)); do_fio(&c__1, type__ + (path_1.lparam - 1) * 10, (ftnlen)10); e_wsfe(); x3 = path_1.react[alparm_1.iloop - 1]; /* Computing 2nd power */ d__1 = alparm_1.x0; /* Computing 2nd power */ d__2 = alparm_1.x1; /* Computing 2nd power */ d__3 = alparm_1.x1; /* Computing 2nd power */ d__4 = alparm_1.x2; c3 = (d__1 * d__1 - d__2 * d__2) * (alparm_1.x1 - alparm_1.x2) - ( d__3 * d__3 - d__4 * d__4) * (alparm_1.x0 - alparm_1.x1); /* WRITE(6,'('' C3:'',F13.7)')C3 */ if (abs(c3) < 1e-8) { /* WE USE A LINEAR INTERPOLATION */ cc1 = 0.; cc2 = 0.; } else { /* WE DO A QUADRATIC INTERPOLATION */ cc1 = (alparm_1.x1 - alparm_1.x2) / c3; cc2 = (alparm_1.x0 - alparm_1.x1) / c3; } cb1 = 1. / (alparm_1.x1 - alparm_1.x2); /* Computing 2nd power */ d__1 = alparm_1.x1; /* Computing 2nd power */ d__2 = alparm_1.x2; cb2 = (d__1 * d__1 - d__2 * d__2) * cb1; /* NOW TO CALCULATE THE INTERPOLATED COORDINATES */ i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { delf0 = alparm_1.alparm[i__ * 3 - 3] - alparm_1.alparm[i__ * 3 - 2]; delf1 = alparm_1.alparm[i__ * 3 - 2] - alparm_1.alparm[i__ * 3 - 1]; aconst = cc1 * delf0 - cc2 * delf1; bconst = cb1 * delf1 - aconst * cb2; /* Computing 2nd power */ d__1 = alparm_1.x2; cconst = alparm_1.alparm[i__ * 3 - 1] - bconst * alparm_1.x2 - aconst * (d__1 * d__1); /* Computing 2nd power */ d__1 = x3; geovar_1.xparam[i__ - 1] = cconst + bconst * x3 + aconst * (d__1 * d__1); alparm_1.alparm[i__ * 3 - 3] = alparm_1.alparm[i__ * 3 - 2]; /* L50: */ alparm_1.alparm[i__ * 3 - 2] = alparm_1.alparm[i__ * 3 - 1]; } /* NOW TO CHECK THAT THE GUESSED GEOMETRY IS NOT TOO ABSURD */ i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L60: */ if ((d__1 = geovar_1.xparam[i__ - 1] - alparm_1.alparm[i__ * 3 - 1], abs(d__1)) > (float).2) { goto L70; } } goto L90; L70: s_wsfe(&io___28); e_wsfe(); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L80: */ geovar_1.xparam[i__ - 1] = alparm_1.alparm[i__ * 3 - 1]; } L90: alparm_1.x0 = alparm_1.x1; alparm_1.x1 = alparm_1.x2; alparm_1.x2 = x3; geom_1.geo[path_1.lparam + path_1.latom * 3 - 4] = path_1.react[ alparm_1.iloop - 1]; flepo_(geovar_1.xparam, &geovar_1.nvar, &funct); writmo_(&timec_1.time0, &funct); timec_1.time0 = second_(); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L100: */ alparm_1.alparm[i__ * 3 - 1] = geovar_1.xparam[i__ - 1]; } /* L110: */ } } /* paths_ */
/* ----------------------------------------------------------------------| */ /* Subroutine */ int zgexpv(integer *n, integer *m, doublereal *t, doublecomplex *v, doublecomplex *w, doublereal *tol, doublereal * anorm, doublecomplex *wsp, integer *lwsp, integer *iwsp, integer * liwsp, S_fp matvec, void *matvecdata, integer *itrace, integer *iflag) { /* System generated locals */ integer i__1, i__2, i__3; doublereal d__1; complex q__1; doublecomplex z__1; /* Builtin functions */ /* Subroutine */ int s_stop(char *, ftnlen); double sqrt(doublereal), d_sign(doublereal *, doublereal *), pow_di( doublereal *, integer *), pow_dd(doublereal *, doublereal *), d_lg10(doublereal *); integer i_dnnt(doublereal *); double d_int(doublereal *); integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(); double z_abs(doublecomplex *); /* Local variables */ static integer ibrkflag; static doublereal step_min__, step_max__; static integer i__, j; static doublereal break_tol__; static integer k1; static doublereal p1, p2, p3; static integer ih, mh, iv, ns, mx; static doublereal xm; static integer j1v; static doublecomplex hij; static doublereal sgn, eps, hj1j, sqr1, beta, hump; static integer ifree, lfree; static doublereal t_old__; static integer iexph; static doublereal t_new__; static integer nexph; extern /* Double Complex */ VOID zdotc_(doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *); static doublereal t_now__; extern /* Subroutine */ int zgemv_(char *, integer *, integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, doublecomplex *, integer *, ftnlen); static integer nstep; static doublereal t_out__; static integer nmult; static doublereal vnorm; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zaxpy_(integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *); extern doublereal dznrm2_(integer *, doublecomplex *, integer *); static integer nscale; static doublereal rndoff; extern /* Subroutine */ int zdscal_(integer *, doublereal *, doublecomplex *, integer *), zgpadm_(integer *, integer *, doublereal *, doublecomplex *, integer *, doublecomplex *, integer *, integer *, integer *, integer *, integer *), znchbv_( integer *, doublereal *, doublecomplex *, integer *, doublecomplex *, doublecomplex *); static doublereal t_step__, avnorm; static integer ireject; static doublereal err_loc__; static integer nreject, mbrkdwn; static doublereal tbrkdwn, s_error__, x_error__; /* Fortran I/O blocks */ static cilist io___40 = { 0, 6, 0, 0, 0 }; static cilist io___48 = { 0, 6, 0, 0, 0 }; static cilist io___49 = { 0, 6, 0, 0, 0 }; static cilist io___50 = { 0, 6, 0, 0, 0 }; static cilist io___51 = { 0, 6, 0, 0, 0 }; static cilist io___52 = { 0, 6, 0, 0, 0 }; static cilist io___53 = { 0, 6, 0, 0, 0 }; static cilist io___54 = { 0, 6, 0, 0, 0 }; static cilist io___55 = { 0, 6, 0, 0, 0 }; static cilist io___56 = { 0, 6, 0, 0, 0 }; static cilist io___57 = { 0, 6, 0, 0, 0 }; static cilist io___58 = { 0, 6, 0, 0, 0 }; static cilist io___59 = { 0, 6, 0, 0, 0 }; /* -----Purpose----------------------------------------------------------| */ /* --- ZGEXPV computes w = exp(t*A)*v */ /* for a Zomplex (i.e., complex double precision) matrix A */ /* It does not compute the matrix exponential in isolation but */ /* instead, it computes directly the action of the exponential */ /* operator on the operand vector. This way of doing so allows */ /* for addressing large sparse problems. */ /* The method used is based on Krylov subspace projection */ /* techniques and the matrix under consideration interacts only */ /* via the external routine `matvec' performing the matrix-vector */ /* product (matrix-free method). */ /* -----Arguments--------------------------------------------------------| */ /* n : (input) order of the principal matrix A. */ /* m : (input) maximum size for the Krylov basis. */ /* t : (input) time at wich the solution is needed (can be < 0). */ /* v(n) : (input) given operand vector. */ /* w(n) : (output) computed approximation of exp(t*A)*v. */ /* tol : (input/output) the requested accuracy tolerance on w. */ /* If on input tol=0.0d0 or tol is too small (tol.le.eps) */ /* the internal value sqrt(eps) is used, and tol is set to */ /* sqrt(eps) on output (`eps' denotes the machine epsilon). */ /* (`Happy breakdown' is assumed if h(j+1,j) .le. anorm*tol) */ /* anorm : (input) an approximation of some norm of A. */ /* wsp(lwsp): (workspace) lwsp .ge. n*(m+1)+n+(m+2)^2+4*(m+2)^2+ideg+1 */ /* +---------+-------+---------------+ */ /* (actually, ideg=6) V H wsp for PADE */ /* iwsp(liwsp): (workspace) liwsp .ge. m+2 */ /* matvec : external subroutine for matrix-vector multiplication. */ /* synopsis: matvec( x, y ) */ /* complex*16 x(*), y(*) */ /* computes: y(1:n) <- A*x(1:n) */ /* where A is the principal matrix. */ /* itrace : (input) running mode. 0=silent, 1=print step-by-step info */ /* iflag : (output) exit flag. */ /* <0 - bad input arguments */ /* 0 - no problem */ /* 1 - maximum number of steps reached without convergence */ /* 2 - requested tolerance was too high */ /* -----Accounts on the computation--------------------------------------| */ /* Upon exit, an interested user may retrieve accounts on the */ /* computations. They are located in the workspace arrays wsp and */ /* iwsp as indicated below: */ /* location mnemonic description */ /* -----------------------------------------------------------------| */ /* iwsp(1) = nmult, number of matrix-vector multiplications used */ /* iwsp(2) = nexph, number of Hessenberg matrix exponential evaluated */ /* iwsp(3) = nscale, number of repeated squaring involved in Pade */ /* iwsp(4) = nstep, number of integration steps used up to completion */ /* iwsp(5) = nreject, number of rejected step-sizes */ /* iwsp(6) = ibrkflag, set to 1 if `happy breakdown' and 0 otherwise */ /* iwsp(7) = mbrkdwn, if `happy brkdown', basis-size when it occured */ /* -----------------------------------------------------------------| */ /* wsp(1) = step_min, minimum step-size used during integration */ /* wsp(2) = step_max, maximum step-size used during integration */ /* wsp(3) = x_round, maximum among all roundoff errors (lower bound) */ /* wsp(4) = s_round, sum of roundoff errors (lower bound) */ /* wsp(5) = x_error, maximum among all local truncation errors */ /* wsp(6) = s_error, global sum of local truncation errors */ /* wsp(7) = tbrkdwn, if `happy breakdown', time when it occured */ /* wsp(8) = t_now, integration domain successfully covered */ /* wsp(9) = hump, i.e., max||exp(sA)||, s in [0,t] (or [t,0] if t<0) */ /* wsp(10) = ||w||/||v||, scaled norm of the solution w. */ /* -----------------------------------------------------------------| */ /* The `hump' is a measure of the conditioning of the problem. The */ /* matrix exponential is well-conditioned if hump = 1, whereas it is */ /* poorly-conditioned if hump >> 1. However the solution can still be */ /* relatively fairly accurate even when the hump is large (the hump */ /* is an upper bound), especially when the hump and the scaled norm */ /* of w [this is also computed and returned in wsp(10)] are of the */ /* same order of magnitude (further details in reference below). */ /* ----------------------------------------------------------------------| */ /* -----The following parameters may also be adjusted herein-------------| */ /* mxstep : maximum allowable number of integration steps. */ /* The value 0 means an infinite number of steps. */ /* mxreject: maximum allowable number of rejections at each step. */ /* The value 0 means an infinite number of rejections. */ /* ideg : the Pade approximation of type (ideg,ideg) is used as */ /* an approximation to exp(H). The value 0 switches to the */ /* uniform rational Chebyshev approximation of type (14,14) */ /* delta : local truncation error `safety factor' */ /* gamma : stepsize `shrinking factor' */ /* ----------------------------------------------------------------------| */ /* Roger B. Sidje ([email protected]) */ /* EXPOKIT: Software Package for Computing Matrix Exponentials. */ /* ACM - Transactions On Mathematical Software, 24(1):130-156, 1998 */ /* ----------------------------------------------------------------------| */ /* --- check restrictions on input parameters ... */ /* Parameter adjustments */ --w; --v; --wsp; --iwsp; /* Function Body */ *iflag = 0; /* Computing 2nd power */ i__1 = *m + 2; if (*lwsp < *n * (*m + 2) + i__1 * i__1 * 5 + 7) { *iflag = -1; } if (*liwsp < *m + 2) { *iflag = -2; } if (*m >= *n || *m <= 0) { *iflag = -3; } if (*iflag != 0) { s_stop("bad sizes (in input of ZGEXPV)", (ftnlen)30); } /* --- initialisations ... */ k1 = 2; mh = *m + 2; iv = 1; ih = iv + *n * (*m + 1) + *n; ifree = ih + mh * mh; lfree = *lwsp - ifree + 1; ibrkflag = 0; mbrkdwn = *m; nmult = 0; nreject = 0; nexph = 0; nscale = 0; t_out__ = abs(*t); tbrkdwn = 0.; step_min__ = t_out__; step_max__ = 0.; nstep = 0; s_error__ = 0.; x_error__ = 0.; t_now__ = 0.; t_new__ = 0.; p1 = 1.3333333333333333; L1: p2 = p1 - 1.; p3 = p2 + p2 + p2; eps = (d__1 = p3 - 1., abs(d__1)); if (eps == 0.) { goto L1; } if (*tol <= eps) { *tol = sqrt(eps); } rndoff = eps * *anorm; break_tol__ = 1e-7; /* >>> break_tol = tol */ /* >>> break_tol = anorm*tol */ sgn = d_sign(&c_b6, t); zcopy_(n, &v[1], &c__1, &w[1], &c__1); beta = dznrm2_(n, &w[1], &c__1); vnorm = beta; hump = beta; /* --- obtain the very first stepsize ... */ sqr1 = sqrt(.1); xm = 1. / (doublereal) (*m); d__1 = (*m + 1) / 2.72; i__1 = *m + 1; p2 = *tol * pow_di(&d__1, &i__1) * sqrt((*m + 1) * 6.2800000000000002); d__1 = p2 / (beta * 4. * *anorm); t_new__ = 1. / *anorm * pow_dd(&d__1, &xm); d__1 = d_lg10(&t_new__) - sqr1; i__1 = i_dnnt(&d__1) - 1; p1 = pow_di(&c_b10, &i__1); d__1 = t_new__ / p1 + .55; t_new__ = d_int(&d__1) * p1; /* --- step-by-step integration ... */ L100: if (t_now__ >= t_out__) { goto L500; } ++nstep; /* Computing MIN */ d__1 = t_out__ - t_now__; t_step__ = min(d__1,t_new__); p1 = 1. / beta; i__1 = *n; for (i__ = 1; i__ <= i__1; ++i__) { i__2 = iv + i__ - 1; i__3 = i__; z__1.r = p1 * w[i__3].r, z__1.i = p1 * w[i__3].i; wsp[i__2].r = z__1.r, wsp[i__2].i = z__1.i; } i__1 = mh * mh; for (i__ = 1; i__ <= i__1; ++i__) { i__2 = ih + i__ - 1; wsp[i__2].r = 0., wsp[i__2].i = 0.; } /* --- Arnoldi loop ... */ j1v = iv + *n; i__1 = *m; for (j = 1; j <= i__1; ++j) { ++nmult; (*matvec)(matvecdata, &wsp[j1v - *n], &wsp[j1v]); i__2 = j; for (i__ = 1; i__ <= i__2; ++i__) { zdotc_(&z__1, n, &wsp[iv + (i__ - 1) * *n], &c__1, &wsp[j1v], & c__1); hij.r = z__1.r, hij.i = z__1.i; z__1.r = -hij.r, z__1.i = -hij.i; zaxpy_(n, &z__1, &wsp[iv + (i__ - 1) * *n], &c__1, &wsp[j1v], & c__1); i__3 = ih + (j - 1) * mh + i__ - 1; wsp[i__3].r = hij.r, wsp[i__3].i = hij.i; } hj1j = dznrm2_(n, &wsp[j1v], &c__1); /* --- if `happy breakdown' go straightforward at the end ... */ if (hj1j <= break_tol__) { s_wsle(&io___40); do_lio(&c__9, &c__1, "happy breakdown: mbrkdwn =", (ftnlen)26); do_lio(&c__3, &c__1, (char *)&j, (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, " h =", (ftnlen)4); do_lio(&c__5, &c__1, (char *)&hj1j, (ftnlen)sizeof(doublereal)); e_wsle(); k1 = 0; ibrkflag = 1; mbrkdwn = j; tbrkdwn = t_now__; t_step__ = t_out__ - t_now__; goto L300; } i__2 = ih + (j - 1) * mh + j; q__1.r = hj1j, q__1.i = (float)0.; wsp[i__2].r = q__1.r, wsp[i__2].i = q__1.i; d__1 = 1. / hj1j; zdscal_(n, &d__1, &wsp[j1v], &c__1); j1v += *n; /* L200: */ } ++nmult; (*matvec)(matvecdata, &wsp[j1v - *n], &wsp[j1v]); avnorm = dznrm2_(n, &wsp[j1v], &c__1); /* --- set 1 for the 2-corrected scheme ... */ L300: i__1 = ih + *m * mh + *m + 1; wsp[i__1].r = 1., wsp[i__1].i = 0.; /* --- loop while ireject<mxreject until the tolerance is reached ... */ ireject = 0; L401: /* --- compute w = beta*V*exp(t_step*H)*e1 ... */ ++nexph; mx = mbrkdwn + k1; if (TRUE_) { /* --- irreducible rational Pade approximation ... */ d__1 = sgn * t_step__; zgpadm_(&c__6, &mx, &d__1, &wsp[ih], &mh, &wsp[ifree], &lfree, &iwsp[ 1], &iexph, &ns, iflag); iexph = ifree + iexph - 1; nscale += ns; } else { /* --- uniform rational Chebyshev approximation ... */ iexph = ifree; i__1 = mx; for (i__ = 1; i__ <= i__1; ++i__) { i__2 = iexph + i__ - 1; wsp[i__2].r = 0., wsp[i__2].i = 0.; } i__1 = iexph; wsp[i__1].r = 1., wsp[i__1].i = 0.; d__1 = sgn * t_step__; znchbv_(&mx, &d__1, &wsp[ih], &mh, &wsp[iexph], &wsp[ifree + mx]); } /* L402: */ /* --- error estimate ... */ if (k1 == 0) { err_loc__ = *tol; } else { p1 = z_abs(&wsp[iexph + *m]) * beta; p2 = z_abs(&wsp[iexph + *m + 1]) * beta * avnorm; if (p1 > p2 * 10.) { err_loc__ = p2; xm = 1. / (doublereal) (*m); } else if (p1 > p2) { err_loc__ = p1 * p2 / (p1 - p2); xm = 1. / (doublereal) (*m); } else { err_loc__ = p1; xm = 1. / (doublereal) (*m - 1); } } /* --- reject the step-size if the error is not acceptable ... */ if (k1 != 0 && err_loc__ > t_step__ * 1.2 * *tol) { t_old__ = t_step__; d__1 = t_step__ * *tol / err_loc__; t_step__ = t_step__ * .9 * pow_dd(&d__1, &xm); d__1 = d_lg10(&t_step__) - sqr1; i__1 = i_dnnt(&d__1) - 1; p1 = pow_di(&c_b10, &i__1); d__1 = t_step__ / p1 + .55; t_step__ = d_int(&d__1) * p1; if (*itrace != 0) { s_wsle(&io___48); do_lio(&c__9, &c__1, "t_step =", (ftnlen)8); do_lio(&c__5, &c__1, (char *)&t_old__, (ftnlen)sizeof(doublereal)) ; e_wsle(); s_wsle(&io___49); do_lio(&c__9, &c__1, "err_loc =", (ftnlen)9); do_lio(&c__5, &c__1, (char *)&err_loc__, (ftnlen)sizeof( doublereal)); e_wsle(); s_wsle(&io___50); do_lio(&c__9, &c__1, "err_required =", (ftnlen)14); d__1 = t_old__ * 1.2 * *tol; do_lio(&c__5, &c__1, (char *)&d__1, (ftnlen)sizeof(doublereal)); e_wsle(); s_wsle(&io___51); do_lio(&c__9, &c__1, "stepsize rejected, stepping down to:", ( ftnlen)36); do_lio(&c__5, &c__1, (char *)&t_step__, (ftnlen)sizeof(doublereal) ); e_wsle(); } ++ireject; ++nreject; if (FALSE_) { s_wsle(&io___52); do_lio(&c__9, &c__1, "Failure in ZGEXPV: ---", (ftnlen)22); e_wsle(); s_wsle(&io___53); do_lio(&c__9, &c__1, "The requested tolerance is too high.", ( ftnlen)36); e_wsle(); s_wsle(&io___54); do_lio(&c__9, &c__1, "Rerun with a smaller value.", (ftnlen)27); e_wsle(); *iflag = 2; return 0; } goto L401; } /* --- now update w = beta*V*exp(t_step*H)*e1 and the hump ... */ /* Computing MAX */ i__1 = 0, i__2 = k1 - 1; mx = mbrkdwn + max(i__1,i__2); q__1.r = beta, q__1.i = (float)0.; hij.r = q__1.r, hij.i = q__1.i; zgemv_("n", n, &mx, &hij, &wsp[iv], n, &wsp[iexph], &c__1, &c_b1, &w[1], & c__1, (ftnlen)1); beta = dznrm2_(n, &w[1], &c__1); hump = max(hump,beta); /* --- suggested value for the next stepsize ... */ d__1 = t_step__ * *tol / err_loc__; t_new__ = t_step__ * .9 * pow_dd(&d__1, &xm); d__1 = d_lg10(&t_new__) - sqr1; i__1 = i_dnnt(&d__1) - 1; p1 = pow_di(&c_b10, &i__1); d__1 = t_new__ / p1 + .55; t_new__ = d_int(&d__1) * p1; err_loc__ = max(err_loc__,rndoff); /* --- update the time covered ... */ t_now__ += t_step__; /* --- display and keep some information ... */ if (*itrace != 0) { s_wsle(&io___55); do_lio(&c__9, &c__1, "integration", (ftnlen)11); do_lio(&c__3, &c__1, (char *)&nstep, (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, "---------------------------------", (ftnlen)33); e_wsle(); s_wsle(&io___56); do_lio(&c__9, &c__1, "scale-square =", (ftnlen)14); do_lio(&c__3, &c__1, (char *)&ns, (ftnlen)sizeof(integer)); e_wsle(); s_wsle(&io___57); do_lio(&c__9, &c__1, "step_size =", (ftnlen)11); do_lio(&c__5, &c__1, (char *)&t_step__, (ftnlen)sizeof(doublereal)); e_wsle(); s_wsle(&io___58); do_lio(&c__9, &c__1, "err_loc =", (ftnlen)11); do_lio(&c__5, &c__1, (char *)&err_loc__, (ftnlen)sizeof(doublereal)); e_wsle(); s_wsle(&io___59); do_lio(&c__9, &c__1, "next_step =", (ftnlen)11); do_lio(&c__5, &c__1, (char *)&t_new__, (ftnlen)sizeof(doublereal)); e_wsle(); } step_min__ = min(step_min__,t_step__); step_max__ = max(step_max__,t_step__); s_error__ += err_loc__; x_error__ = max(x_error__,err_loc__); if (nstep < 500) { goto L100; } *iflag = 1; L500: iwsp[1] = nmult; iwsp[2] = nexph; iwsp[3] = nscale; iwsp[4] = nstep; iwsp[5] = nreject; iwsp[6] = ibrkflag; iwsp[7] = mbrkdwn; q__1.r = step_min__, q__1.i = (float)0.; wsp[1].r = q__1.r, wsp[1].i = q__1.i; q__1.r = step_max__, q__1.i = (float)0.; wsp[2].r = q__1.r, wsp[2].i = q__1.i; wsp[3].r = (float)0., wsp[3].i = (float)0.; wsp[4].r = (float)0., wsp[4].i = (float)0.; q__1.r = x_error__, q__1.i = (float)0.; wsp[5].r = q__1.r, wsp[5].i = q__1.i; q__1.r = s_error__, q__1.i = (float)0.; wsp[6].r = q__1.r, wsp[6].i = q__1.i; q__1.r = tbrkdwn, q__1.i = (float)0.; wsp[7].r = q__1.r, wsp[7].i = q__1.i; d__1 = sgn * t_now__; q__1.r = d__1, q__1.i = (float)0.; wsp[8].r = q__1.r, wsp[8].i = q__1.i; d__1 = hump / vnorm; q__1.r = d__1, q__1.i = (float)0.; wsp[9].r = q__1.r, wsp[9].i = q__1.i; d__1 = beta / vnorm; q__1.r = d__1, q__1.i = (float)0.; wsp[10].r = q__1.r, wsp[10].i = q__1.i; return 0; } /* zgexpv_ */
/* $Procedure VERSION ( Print library version information ) */ /* Main program */ MAIN__(void) { /* System generated locals */ address a__1[2], a__2[4]; integer i__1[2], i__2, i__3[4], i__4; doublereal d__1; char ch__1[25], ch__2[99]; /* Builtin functions */ /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen), s_copy(char *, char *, ftnlen, ftnlen); integer s_rnge(char *, integer, char *, integer); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ char line[80], vrsn[6]; extern /* Subroutine */ int zzplatfm_(char *, char *, ftnlen, ftnlen); integer i__; extern /* Subroutine */ int ucase_(char *, char *, ftnlen, ftnlen); extern doublereal dpmin_(void); extern /* Subroutine */ int repmd_(char *, char *, doublereal *, integer * , char *, ftnlen, ftnlen, ftnlen); extern doublereal dpmax_(void); char fform[80]; extern /* Subroutine */ int repmi_(char *, char *, integer *, char *, ftnlen, ftnlen, ftnlen); char cmplr[80]; extern integer wdcnt_(char *, ftnlen); char tform[80]; extern integer rtrim_(char *, ftnlen); char os[80]; extern /* Subroutine */ int getcml_(char *, ftnlen), byebye_(char *, ftnlen); extern integer intmin_(void), intmax_(void); char linout[80*6]; extern /* Subroutine */ int tostdo_(char *, ftnlen), tkvrsn_(char *, char *, ftnlen, ftnlen); extern integer pos_(char *, char *, integer *, ftnlen, ftnlen); char sys[80]; /* $ Abstract */ /* This program prints to standard output the current SPICE */ /* distribution version number, hardware system ID, operating */ /* system ID, compiler name, the format of double precision */ /* numbers for the hardware architecture, and the max and min */ /* values for double precision and integer numbers. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keyword */ /* VERSION */ /* UTILITY */ /* $ Parameters */ /* LINELN length of line output string, set to 80. */ /* DATEID update version time string, set to 20. */ /* $ Exceptions */ /* None. */ /* $ Files */ /* None. */ /* $ Particulars */ /* The version utility may use 3 different command line arguments. */ /* The default (no arguments) returns the Toolkit version string. */ /* Usage: $ version [OPTION] */ /* $ Description */ /* None. */ /* $ Examples */ /* Default behavior: */ /* $ version */ /* N0051 */ /* Display all (-a) information: */ /* $version -a */ /* Toolkit version : N0051 */ /* System : PC */ /* Operating System : LINUX */ /* Compiler : LINUX G77 */ /* File Format : LTL-IEEE */ /* MAX DP : 1.7976931348623E+308 */ /* MIN DP : -1.7976931348623E+308 */ /* MAX INT : 2147483647 */ /* MIN INT : -2147483647 */ /* Display version (-v) information: */ /* $version -v */ /* Version Utility for SPICE Toolkit edition N0051, */ /* last update: 1.1.0, 05-OCT-2001 */ /* Display help (-h) information: */ /* $version -h */ /* Usage: version [OPTION] */ /* no arguments output only the SPICE toolkit version string. */ /* -a(ll) output all environment variables; SPICE toolkit */ /* version, system ID, operating system, compiler, */ /* binary file format, max and min values for */ /* double precision and integer numbers. */ /* -v(ersion) output the version of the utility. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* W.L. Taber (JPL) */ /* F.S. Turner (JPL) */ /* E.D. Wright (JPL) */ /* $ Version */ /* SPICELIB Version 1.1.0 26-SEP-2001 (FST) (EDW) */ /* Added TEXT_FORMAT output. */ /* Included options for SYSTEM, O/S, COMPILER, FILE_FORMAT, */ /* max/min DPs & integers, outputs, version, and help. */ /* Added proper SPICE header. */ /* SPICELIB Version 1.0.0 13-NOV-2001 (WLT) */ /* First version, Thu NOV 13 10:04:41 PST 1997 W.L. Taber */ /* -& */ /* SPICELIB functions. */ /* Local Parameters. */ /* Local Variables. */ /* Get command line. */ getcml_(line, (ftnlen)80); ucase_(line, line, (ftnlen)80, (ftnlen)80); tkvrsn_("TOOLKIT", vrsn, (ftnlen)7, (ftnlen)6); /* Parse the command line for arguments. Appropriately respond. */ if (wdcnt_(line, (ftnlen)80) == 0) { /* No arguments, default to the toolkit version string. */ tostdo_(vrsn, rtrim_(vrsn, (ftnlen)6)); } else if (pos_(line, "-A", &c__1, (ftnlen)80, (ftnlen)2) == 1) { /* All. Output everything. */ tostdo_(" ", (ftnlen)1); /* Writing concatenation */ i__1[0] = 19, a__1[0] = "Toolkit version : "; i__1[1] = 6, a__1[1] = vrsn; s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)25); tostdo_(ch__1, (ftnlen)25); zzplatfm_("SYSTEM", sys, (ftnlen)6, (ftnlen)80); /* Writing concatenation */ i__1[0] = 19, a__1[0] = "System : "; i__1[1] = 80, a__1[1] = sys; s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99); tostdo_(ch__2, (ftnlen)99); zzplatfm_("O/S", os, (ftnlen)3, (ftnlen)80); /* Writing concatenation */ i__1[0] = 19, a__1[0] = "Operating System : "; i__1[1] = 80, a__1[1] = os; s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99); tostdo_(ch__2, (ftnlen)99); zzplatfm_("COMPILER", cmplr, (ftnlen)8, (ftnlen)80); /* Writing concatenation */ i__1[0] = 19, a__1[0] = "Compiler : "; i__1[1] = 80, a__1[1] = cmplr; s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99); tostdo_(ch__2, (ftnlen)99); zzplatfm_("FILE_FORMAT", fform, (ftnlen)11, (ftnlen)80); /* Writing concatenation */ i__1[0] = 19, a__1[0] = "File Format : "; i__1[1] = 80, a__1[1] = fform; s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99); tostdo_(ch__2, (ftnlen)99); zzplatfm_("TEXT_FORMAT", tform, (ftnlen)11, (ftnlen)80); /* Writing concatenation */ i__1[0] = 19, a__1[0] = "Text File Format : "; i__1[1] = 80, a__1[1] = tform; s_cat(ch__2, a__1, i__1, &c__2, (ftnlen)99); tostdo_(ch__2, (ftnlen)99); s_copy(linout, "MAX DP : #", (ftnlen)80, (ftnlen)21); d__1 = dpmax_(); repmd_(linout, "#", &d__1, &c__23, linout, (ftnlen)80, (ftnlen)1, ( ftnlen)80); tostdo_(linout, (ftnlen)80); s_copy(linout + 80, "MIN DP : #", (ftnlen)80, (ftnlen)20); d__1 = dpmin_(); repmd_(linout + 80, "#", &d__1, &c__23, linout + 80, (ftnlen)80, ( ftnlen)1, (ftnlen)80); tostdo_(linout + 80, (ftnlen)80); s_copy(linout + 160, "MAX INT : #", (ftnlen)80, (ftnlen)21); i__2 = intmax_(); repmi_(linout + 160, "#", &i__2, linout + 160, (ftnlen)80, (ftnlen)1, (ftnlen)80); tostdo_(linout + 160, (ftnlen)80); s_copy(linout + 240, "MIN INT : #", (ftnlen)80, (ftnlen)20); i__2 = intmin_(); repmi_(linout + 240, "#", &i__2, linout + 240, (ftnlen)80, (ftnlen)1, (ftnlen)80); tostdo_(linout + 240, (ftnlen)80); tostdo_(" ", (ftnlen)1); } else if (pos_(line, "-V", &c__1, (ftnlen)80, (ftnlen)2) == 1) { /* Version. Output the utility version string. */ /* Writing concatenation */ i__3[0] = 42, a__2[0] = "Version Utility for SPICE Toolkit edition "; i__3[1] = rtrim_(vrsn, (ftnlen)6), a__2[1] = vrsn; i__3[2] = 15, a__2[2] = ", last update: "; i__3[3] = 18, a__2[3] = "1.1.0, 07-JAN-2002 "; s_cat(linout, a__2, i__3, &c__4, (ftnlen)80); tostdo_(" ", (ftnlen)1); tostdo_(linout, (ftnlen)80); tostdo_(" ", (ftnlen)1); } else if (pos_(line, "-H", &c__1, (ftnlen)80, (ftnlen)2) == 1) { /* Help. How does does one use this perplexing routine? */ s_copy(linout, "Usage: version [OPTION]", (ftnlen)80, (ftnlen)23); s_copy(linout + 80, " no arguments output only the SPICE toolkit v" "ersion string.", (ftnlen)80, (ftnlen)61); s_copy(linout + 160, " -a(ll) output all environment variabl" "es; SPICE toolkit version, system", (ftnlen)80, (ftnlen)79); s_copy(linout + 240, " ID, operating system, compiler" ", and binary file format, ", (ftnlen)80, (ftnlen)72); s_copy(linout + 320, " max and min values for double " "precision and integer numbers.", (ftnlen)80, (ftnlen)76); s_copy(linout + 400, " -v(ersion) output the version of the util" "ity.", (ftnlen)80, (ftnlen)50); tostdo_(" ", (ftnlen)1); for (i__ = 1; i__ <= 6; ++i__) { tostdo_(linout + ((i__2 = i__ - 1) < 6 && 0 <= i__2 ? i__2 : s_rnge("linout", i__2, "version_", (ftnlen)272)) * 80, rtrim_(linout + ((i__4 = i__ - 1) < 6 && 0 <= i__4 ? i__4 : s_rnge("linout", i__4, "version_", (ftnlen)272)) * 80, ( ftnlen)80)); } tostdo_(" ", (ftnlen)1); } else { /* The user put something on the command line, but nothing */ /* known. Return the toolkit version string. */ tostdo_(vrsn, rtrim_(vrsn, (ftnlen)6)); } /* Done. Indicate as much. Say bye. */ byebye_("SUCCESS", (ftnlen)7); s_stop("", (ftnlen)0); return 0; } /* MAIN__ */
/* Subroutine */ int getgeg_(integer *iread, integer *labels, doublereal *geo, integer *na, integer *nb, integer *nc, doublereal *ams, integer * natoms, logical *int__) { /* Initialized data */ static char elemnt[2*107] = " H" "HE" "LI" "BE" " B" " C" " N" " O" " F" "NE" "NA" "MG" "AL" "SI" " P" " S" "CL" "AR" "K " "CA" "SC" "TI" " V" "CR" "MN" "FE" "CO" "NI" "CU" "ZN" "GA" "GE" "AS" "SE" "BR" "KR" "RB" "SR" " Y" "ZR" "NB" "MO" "TC" "RU" "RH" "PD" "AG" "CD" "IN" "SN" "SB" "TE" " I" "XE" "CS" "BA" "LA" "CE" "PR" "ND" "PM" "SM" "EU" "GD" "TB" "DY" "HO" "ER" "TM" "YB" "LU" "HF" "TA" " W" "RE" "OS" "IR" "PT" "AU" "HG" "TL" "PB" "BI" "PO" "AT" "RN" "FR" "RA" "AC" "TH" "PA" "U " "NP" "PU" "AM" "CM" "BK" "CF" "XX" "FM" "MD" "CB" "++" " +" "--" " -" "TV"; /* System generated locals */ address a__1[2], a__2[2]; integer i__1, i__2, i__3[2], i__4[2]; char ch__1[81], ch__2[3], ch__3[29]; /* Builtin functions */ integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void), s_cmp(char *, char *, ftnlen, ftnlen), i_indx(char *, char *, ftnlen, ftnlen); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen), s_cat(char *, char **, integer *, integer *, ftnlen); integer s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); double asin(doublereal); /* Local variables */ static integer i__, j, k, l, n; static doublereal sum; static integer lgeo[300] /* was [3][100] */; static char line[80], tgeo[12*3*100]; static integer ivar, kerr, merr, nerr, lerr; extern doublereal reada_(char *, integer *, ftnlen); static integer iline, numat; static doublereal degree; static logical leadsp; extern /* Subroutine */ int getval_(char *, doublereal *, char *, ftnlen, ftnlen); static integer nvalue, istart[20]; static char string[80]; static integer maxtxt; /* Fortran I/O blocks */ static cilist io___5 = { 1, 0, 1, "(A)", 0 }; static cilist io___15 = { 0, 6, 0, "(2A)", 0 }; static cilist io___16 = { 0, 6, 0, "(' FOR ATOM',I4,' ISOTOPIC MASS:' " " ,F15.5)", 0 }; static cilist io___21 = { 1, 0, 1, "(A)", 0 }; static cilist io___27 = { 0, 6, 0, "(A)", 0 }; static cilist io___28 = { 0, 6, 0, "(A)", 0 }; static cilist io___29 = { 0, 6, 0, "(2A)", 0 }; static cilist io___30 = { 0, 6, 0, "(2A)", 0 }; static cilist io___31 = { 0, 6, 0, "(2A)", 0 }; static cilist io___32 = { 0, 6, 0, "(I4,A)", 0 }; static cilist io___33 = { 0, 6, 0, "(A,I3,A)", 0 }; /* COMDECK SIZES */ /* *********************************************************************** */ /* THIS FILE CONTAINS ALL THE ARRAY SIZES FOR USE IN MOPAC. */ /* THERE ARE ONLY 5 PARAMETERS THAT THE PROGRAMMER NEED SET: */ /* MAXHEV = MAXIMUM NUMBER OF HEAVY ATOMS (HEAVY: NON-HYDROGEN ATOMS) */ /* MAXLIT = MAXIMUM NUMBER OF HYDROGEN ATOMS. */ /* MAXTIM = DEFAULT TIME FOR A JOB. (SECONDS) */ /* MAXDMP = DEFAULT TIME FOR AUTOMATIC RESTART FILE GENERATION (SECS) */ /* ISYBYL = 1 IF MOPAC IS TO BE USED IN THE SYBYL PACKAGE, =0 OTHERWISE */ /* SEE ALSO NMECI, NPULAY AND MESP AT THE END OF THIS FILE */ /* *********************************************************************** */ /* THE FOLLOWING CODE DOES NOT NEED TO BE ALTERED BY THE PROGRAMMER */ /* *********************************************************************** */ /* ALL OTHER PARAMETERS ARE DERIVED FUNCTIONS OF THESE TWO PARAMETERS */ /* NAME DEFINITION */ /* NUMATM MAXIMUM NUMBER OF ATOMS ALLOWED. */ /* MAXORB MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXPAR MAXIMUM NUMBER OF PARAMETERS FOR OPTIMISATION. */ /* N2ELEC MAXIMUM NUMBER OF TWO ELECTRON INTEGRALS ALLOWED. */ /* MPACK AREA OF LOWER HALF TRIANGLE OF DENSITY MATRIX. */ /* MORB2 SQUARE OF THE MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXHES AREA OF HESSIAN MATRIX */ /* MAXALL LARGER THAN MAXORB OR MAXPAR. */ /* *********************************************************************** */ /* *********************************************************************** */ /* DECK MOPAC */ /* Parameter adjustments */ --ams; --nc; --nb; --na; geo -= 4; --labels; /* Function Body */ nerr = 0; *int__ = TRUE_; numat = 0; na[1] = 0; nb[1] = 0; nc[1] = 0; nb[2] = 0; nc[2] = 0; nc[3] = 0; maxtxt = 0; for (*natoms = 1; *natoms <= 100; ++(*natoms)) { io___5.ciunit = *iread; i__1 = s_rsfe(&io___5); if (i__1 != 0) { goto L70; } i__1 = do_fio(&c__1, line, (ftnlen)80); if (i__1 != 0) { goto L70; } i__1 = e_rsfe(); if (i__1 != 0) { goto L70; } if (s_cmp(line, " ", (ftnlen)80, (ftnlen)1) == 0) { goto L70; } /* SEE IF TEXT IS ASSOCIATED WITH THIS ELEMENT */ i__ = i_indx(line, "(", (ftnlen)80, (ftnlen)1); if (i__ != 0) { /* YES, ELEMENT IS LABELLED. */ k = i_indx(line, ")", (ftnlen)80, (ftnlen)1); s_copy(atomtx_1.txtatm + (*natoms - 1 << 3), line + (i__ - 1), ( ftnlen)8, k - (i__ - 1)); /* Computing MAX */ i__1 = maxtxt, i__2 = k - i__ + 1; maxtxt = max(i__1,i__2); i__1 = k; /* Writing concatenation */ i__3[0] = i__ - 1, a__1[0] = line; i__3[1] = 80 - i__1, a__1[1] = line + i__1; s_cat(string, a__1, i__3, &c__2, (ftnlen)80); s_copy(line, string, (ftnlen)80, (ftnlen)80); } else { s_copy(atomtx_1.txtatm + (*natoms - 1 << 3), " ", (ftnlen)8, ( ftnlen)1); } /* *********************************************************************** */ for (i__ = 1; i__ <= 80; ++i__) { iline = *(unsigned char *)&line[i__ - 1]; if (iline >= 'a' && iline <= 'z') { *(unsigned char *)&line[i__ - 1] = (char) (iline + 'A' - 'a'); } /* L10: */ } /* *********************************************************************** */ nvalue = 0; leadsp = TRUE_; for (i__ = 1; i__ <= 80; ++i__) { if (leadsp && *(unsigned char *)&line[i__ - 1] != ' ') { ++nvalue; istart[nvalue - 1] = i__; } leadsp = *(unsigned char *)&line[i__ - 1] == ' '; /* L20: */ } for (j = 1; j <= 107; ++j) { /* L30: */ i__1 = istart[0] - 1; /* Writing concatenation */ i__3[0] = 1, a__1[0] = " "; i__3[1] = istart[0] + 2 - i__1, a__1[1] = line + i__1; s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)81); /* Writing concatenation */ i__4[0] = 2, a__2[0] = elemnt + (j - 1 << 1); i__4[1] = 1, a__2[1] = " "; s_cat(ch__2, a__2, i__4, &c__2, (ftnlen)3); if (i_indx(ch__1, ch__2, istart[0] + 2 - i__1 + 1, (ftnlen)3) != 0) { goto L40; } } i__1 = istart[0] - 1; /* Writing concatenation */ i__3[0] = 1, a__1[0] = " "; i__3[1] = istart[0] + 2 - i__1, a__1[1] = line + i__1; s_cat(ch__1, a__1, i__3, &c__2, (ftnlen)81); if (i_indx(ch__1, " X", istart[0] + 2 - i__1 + 1, (ftnlen)2) != 0) { j = 99; goto L40; } s_wsfe(&io___15); do_fio(&c__1, " ELEMENT NOT RECOGNIZED: ", (ftnlen)25); i__1 = istart[0] - 1; do_fio(&c__1, line + i__1, istart[0] + 2 - i__1); e_wsfe(); ++nerr; L40: labels[*natoms] = j; if (j != 99) { ++numat; /* Computing MAX */ i__1 = istart[1] - 1; atmass_1.atmass[numat - 1] = reada_(line, istart, (max(i__1,1))); if (atmass_1.atmass[numat - 1] > 1e-15) { s_wsfe(&io___16); do_fio(&c__1, (char *)&(*natoms), (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&atmass_1.atmass[numat - 1], (ftnlen) sizeof(doublereal)); e_wsfe(); } else { atmass_1.atmass[numat - 1] = ams[j]; } /* # WRITE(6,*)NATOMS,NUMAT,ATMASS(NUMAT) */ } s_copy(tgeo + (*natoms * 3 - 3) * 12, " ", (ftnlen)12, (ftnlen)1); s_copy(tgeo + (*natoms * 3 - 2) * 12, " ", (ftnlen)12, (ftnlen)1); s_copy(tgeo + (*natoms * 3 - 1) * 12, " ", (ftnlen)12, (ftnlen)1); if (*natoms == 1) { goto L50; } na[*natoms] = (integer) reada_(line, &istart[1], (ftnlen)80); i__1 = istart[2] - 1; getval_(line + i__1, &geo[*natoms * 3 + 1], tgeo + (*natoms * 3 - 3) * 12, 80 - i__1, (ftnlen)12); if (*natoms == 2) { goto L50; } nb[*natoms] = (integer) reada_(line, &istart[3], (ftnlen)80); i__1 = istart[4] - 1; getval_(line + i__1, &geo[*natoms * 3 + 2], tgeo + (*natoms * 3 - 2) * 12, 80 - i__1, (ftnlen)12); if (*natoms == 3) { goto L50; } nc[*natoms] = (integer) reada_(line, &istart[5], (ftnlen)80); i__1 = istart[6] - 1; getval_(line + i__1, &geo[*natoms * 3 + 3], tgeo + (*natoms * 3 - 1) * 12, 80 - i__1, (ftnlen)12); L50: /* L60: */ ; } L70: --(*natoms); i__1 = *natoms; for (i__ = 1; i__ <= i__1; ++i__) { for (j = 1; j <= 3; ++j) { /* L80: */ lgeo[j + i__ * 3 - 4] = -1; } } ivar = -1; geovar_1.nvar = 0; geosym_1.ndep = 0; kerr = 0; L90: io___21.ciunit = *iread; i__1 = s_rsfe(&io___21); if (i__1 != 0) { goto L180; } i__1 = do_fio(&c__1, line, (ftnlen)80); if (i__1 != 0) { goto L180; } i__1 = e_rsfe(); if (i__1 != 0) { goto L180; } if (s_cmp(line, " ", (ftnlen)80, (ftnlen)1) == 0) { if (ivar == -1) { merr = 0; i__1 = *natoms; for (i__ = 1; i__ <= i__1; ++i__) { for (j = 1; j <= 3; ++j) { /* L100: */ if (geo[j + i__ * 3] < -998.) { ++merr; } } /* L110: */ } /* IF ALL SYMBOLS ARE DEFINED, THEN DO NOT READ 'FIXED' SYMBOLS */ if (merr == 0) { goto L180; } ivar = geovar_1.nvar; goto L90; } else { goto L180; } } /* *********************************************************************** */ for (i__ = 1; i__ <= 80; ++i__) { iline = *(unsigned char *)&line[i__ - 1]; if (iline >= 'a' && iline <= 'z') { *(unsigned char *)&line[i__ - 1] = (char) (iline + 'A' - 'a'); } /* L120: */ } /* *********************************************************************** */ for (i__ = 1; i__ <= 80; ++i__) { /* L130: */ if (*(unsigned char *)&line[i__ - 1] != ' ') { goto L140; } } L140: i__1 = i__ + 12; for (l = i__; l <= i__1; ++l) { /* L150: */ if (*(unsigned char *)&line[l - 1] == ' ') { goto L160; } } L160: sum = reada_(line, &l, (ftnlen)80); n = 0; lerr = 0; i__1 = *natoms; for (j = 1; j <= i__1; ++j) { for (k = 1; k <= 3; ++k) { if (s_cmp(tgeo + (k + j * 3 - 4) * 12, line + (i__ - 1), (ftnlen) 12, l - (i__ - 1)) == 0 || s_cmp(tgeo + ((k + j * 3 - 4) * 12 + 1), line + (i__ - 1), (ftnlen)11, l - (i__ - 1)) == 0 && *(unsigned char *)&tgeo[(k + j * 3 - 4) * 12] == '-') { if (lgeo[k + j * 3 - 4] != -1) { lerr = 1; } ++lgeo[k + j * 3 - 4]; ++n; geo[k + j * 3] = sum; if (n == 1) { ++geovar_1.nvar; geovar_1.loc[(geovar_1.nvar << 1) - 2] = j; geovar_1.loc[(geovar_1.nvar << 1) - 1] = k; geovar_1.xparam[geovar_1.nvar - 1] = sum; s_copy(simbol_1.simbol + (geovar_1.nvar - 1) * 10, tgeo + (k + j * 3 - 4) * 12, (ftnlen)10, (ftnlen)12); if (*(unsigned char *)&simbol_1.simbol[(geovar_1.nvar - 1) * 10] == '-') { s_wsfe(&io___27); do_fio(&c__1, " NEGATIVE SYMBOLICS MUST BE PRECEEDED" " BY THE POSITIVE EQUIVALENT", (ftnlen)65); e_wsfe(); s_wsfe(&io___28); /* Writing concatenation */ i__3[0] = 19, a__1[0] = " FAULTY SYMBOLIC: "; i__3[1] = 10, a__1[1] = simbol_1.simbol + ( geovar_1.nvar - 1) * 10; s_cat(ch__3, a__1, i__3, &c__2, (ftnlen)29); do_fio(&c__1, ch__3, (ftnlen)29); e_wsfe(); s_stop("", (ftnlen)0); } } if (n > 1) { ++geosym_1.ndep; geosym_1.locpar[geosym_1.ndep - 1] = geovar_1.loc[( geovar_1.nvar << 1) - 2]; geosym_1.idepfn[geosym_1.ndep - 1] = geovar_1.loc[( geovar_1.nvar << 1) - 1]; if (*(unsigned char *)&tgeo[(k + j * 3 - 4) * 12] == '-') { geosym_1.idepfn[geosym_1.ndep - 1] = 14; if (geovar_1.loc[(geovar_1.nvar << 1) - 1] != 3) { ++kerr; s_wsfe(&io___29); do_fio(&c__1, " ONLY DIHEDRAL SYMBOLICS CAN BE P" "RECEEDED BY A \"-\" SIGN", (ftnlen)55); e_wsfe(); } } geosym_1.locdep[geosym_1.ndep - 1] = j; } } /* L170: */ } } kerr += lerr; if (lerr == 1) { s_wsfe(&io___30); do_fio(&c__1, " THE FOLLOWING SYMBOL HAS BEEN DEFINED MORE THAN ONCE:" , (ftnlen)54); do_fio(&c__1, line + (i__ - 1), l - (i__ - 1)); e_wsfe(); ++nerr; } if (n == 0) { s_wsfe(&io___31); do_fio(&c__1, " THE FOLLOWING SYMBOLIC WAS NOT USED:", (ftnlen)37); do_fio(&c__1, line + (i__ - 1), l - (i__ - 1)); e_wsfe(); ++nerr; } goto L90; L180: merr = 0; i__1 = *natoms; for (i__ = 1; i__ <= i__1; ++i__) { for (j = 1; j <= 3; ++j) { /* L190: */ if (geo[j + i__ * 3] < -998.) { ++merr; } } /* # WRITE(6,'(2X,A,3F12.6,3I4)')ELEMNT(LABELS(I)), */ /* # 1(GEO(J,I),J=1,3), NA(I), NB(I), NC(I) */ /* L200: */ } if (merr != 0) { s_wsfe(&io___32); do_fio(&c__1, (char *)&merr, (ftnlen)sizeof(integer)); do_fio(&c__1, " GEOMETRY VARIABLES WERE NOT DEFINED", (ftnlen)36); e_wsfe(); } if (merr + kerr + nerr != 0) { s_wsfe(&io___33); do_fio(&c__1, " THE GEOMETRY DATA-SET CONTAINED", (ftnlen)32); i__1 = merr + kerr + nerr; do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer)); do_fio(&c__1, " ERRORS", (ftnlen)7); e_wsfe(); s_stop("", (ftnlen)0); } /* SORT PARAMETERS TO BE OPTIMIZED INTO INCREASING ORDER OF ATOMS */ if (ivar != -1) { geovar_1.nvar = ivar; } i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { j = 100000; i__2 = geovar_1.nvar; for (l = i__; l <= i__2; ++l) { if (j > (geovar_1.loc[(l << 1) - 2] << 2) + geovar_1.loc[(l << 1) - 1]) { k = l; j = (geovar_1.loc[(l << 1) - 2] << 2) + geovar_1.loc[(l << 1) - 1]; } /* L210: */ } s_copy(string, simbol_1.simbol + (i__ - 1) * 10, (ftnlen)10, (ftnlen) 10); s_copy(simbol_1.simbol + (i__ - 1) * 10, simbol_1.simbol + (k - 1) * 10, (ftnlen)10, (ftnlen)10); s_copy(simbol_1.simbol + (k - 1) * 10, string, (ftnlen)10, (ftnlen)80) ; sum = geovar_1.xparam[i__ - 1]; geovar_1.xparam[i__ - 1] = geovar_1.xparam[k - 1]; geovar_1.xparam[k - 1] = sum; for (j = 1; j <= 2; ++j) { l = geovar_1.loc[j + (i__ << 1) - 3]; geovar_1.loc[j + (i__ << 1) - 3] = geovar_1.loc[j + (k << 1) - 3]; /* L220: */ geovar_1.loc[j + (k << 1) - 3] = l; } /* L230: */ } /* # IF(NVAR.NE.0)WRITE(6,'(//,'' PARAMETERS TO BE OPTIMIZED'')') */ degree = asin(1.) / 90; i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* # WRITE(6,'(2I6,F12.6)')LOC(1,I),LOC(2,I),XPARAM(I) */ /* L240: */ if (geovar_1.loc[(i__ << 1) - 1] != 1) { geovar_1.xparam[i__ - 1] *= degree; } } /* # IF(NDEP.NE.0)WRITE(6,'(//,'' SYMMETRY FUNCTIONS '')') */ /* # DO 28 I=1,NDEP */ /* # 28 WRITE(6,'(3I6)')LOCPAR(I),IDEPFN(I),LOCDEP(I) */ *(unsigned char *)atomtx_1.ltxt = (char) maxtxt; return 0; } /* getgeg_ */
/* Main program */ int MAIN__(void) { /* Initialized data */ static real sfac = 9.765625e-4f; /* Format strings */ static char fmt_99999[] = "(\002 Real BLAS Test Program Results\002,/1x)"; static char fmt_99998[] = "(\002 ----" "- PASS -----\002)"; /* Builtin functions */ integer s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ integer ic; extern /* Subroutine */ int check0_(real *), check1_(real *), check2_( real *), check3_(real *), header_(void); /* Fortran I/O blocks */ static cilist io___2 = { 0, 6, 0, fmt_99999, 0 }; static cilist io___4 = { 0, 6, 0, fmt_99998, 0 }; /* Test program for the REAL Level 1 BLAS. */ /* Based upon the original BLAS test routine together with: */ /* F06EAF Example Program Text */ /* .. Parameters .. */ /* .. Scalars in Common .. */ /* .. Local Scalars .. */ /* .. External Subroutines .. */ /* .. Common blocks .. */ /* .. Data statements .. */ /* .. Executable Statements .. */ s_wsfe(&io___2); e_wsfe(); for (ic = 1; ic <= 10; ++ic) { combla_1.icase = ic; header_(); /* .. Initialize PASS, INCX, INCY, and MODE for a new case. .. */ /* .. the value 9999 for INCX, INCY or MODE will appear in the .. */ /* .. detailed output, if any, for cases that do not involve .. */ /* .. these parameters .. */ combla_1.pass = TRUE_; combla_1.incx = 9999; combla_1.incy = 9999; combla_1.mode = 9999; if (combla_1.icase == 3) { check0_(&sfac); } else if (combla_1.icase == 7 || combla_1.icase == 8 || combla_1.icase == 9 || combla_1.icase == 10) { check1_(&sfac); } else if (combla_1.icase == 1 || combla_1.icase == 2 || combla_1.icase == 5 || combla_1.icase == 6) { check2_(&sfac); } else if (combla_1.icase == 4) { check3_(&sfac); } /* -- Print */ if (combla_1.pass) { s_wsfe(&io___4); e_wsfe(); } /* L20: */ } s_stop("", (ftnlen)0); return 0; } /* MAIN__ */
/* Subroutine */ int check0_(real *sfac) { /* Initialized data */ static real ds1[8] = { .8f,.6f,.8f,-.6f,.8f,0.f,1.f,0.f }; static real datrue[8] = { .5f,.5f,.5f,-.5f,-.5f,0.f,1.f,1.f }; static real dbtrue[8] = { 0.f,.6f,0.f,-.6f,0.f,0.f,1.f,0.f }; static real da1[8] = { .3f,.4f,-.3f,-.4f,-.3f,0.f,0.f,1.f }; static real db1[8] = { .4f,.3f,.4f,.3f,-.4f,0.f,1.f,0.f }; static real dc1[8] = { .6f,.8f,-.6f,.8f,.6f,1.f,0.f,1.f }; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ integer k; real sa, sb, sc, ss; extern /* Subroutine */ int srotg_(real *, real *, real *, real *), stest1_(real *, real *, real *, real *); /* Fortran I/O blocks */ static cilist io___19 = { 0, 6, 0, 0, 0 }; /* .. Parameters .. */ /* .. Scalar Arguments .. */ /* .. Scalars in Common .. */ /* .. Local Scalars .. */ /* .. Local Arrays .. */ /* .. External Subroutines .. */ /* .. Common blocks .. */ /* .. Data statements .. */ /* .. Executable Statements .. */ /* Compute true values which cannot be prestored */ /* in decimal notation */ dbtrue[0] = 1.6666666666666667f; dbtrue[2] = -1.6666666666666667f; dbtrue[4] = 1.6666666666666667f; for (k = 1; k <= 8; ++k) { /* .. Set N=K for identification in output if any .. */ combla_1.n = k; if (combla_1.icase == 3) { /* .. SROTG .. */ if (k > 8) { goto L40; } sa = da1[k - 1]; sb = db1[k - 1]; srotg_(&sa, &sb, &sc, &ss); stest1_(&sa, &datrue[k - 1], &datrue[k - 1], sfac); stest1_(&sb, &dbtrue[k - 1], &dbtrue[k - 1], sfac); stest1_(&sc, &dc1[k - 1], &dc1[k - 1], sfac); stest1_(&ss, &ds1[k - 1], &ds1[k - 1], sfac); } else { s_wsle(&io___19); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK0", (ftnlen)28); e_wsle(); s_stop("", (ftnlen)0); } /* L20: */ } L40: return 0; } /* check0_ */
/* Subroutine */ int xerbla_(char *srname, integer *info, ftnlen srname_len) { /* Format strings */ static char fmt_9999[] = "(\002 ** ON ENTRY TO \002,a6,\002 PARAMETER NU" "MBER \002,i2,\002 HAD \002,\002AN ILLEGAL VALUE\002)"; /* Builtin functions */ integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ #define iw ((integer *)&chanel_1 + 5) /* Fortran I/O blocks */ static cilist io___2 = { 0, 0, 0, fmt_9999, 0 }; /* -- LAPACK AUXILIARY ROUTINE (VERSION 1.0B) -- */ /* UNIV. OF TENNESSEE, UNIV. OF CALIFORNIA BERKELEY, NAG LTD., */ /* COURANT INSTITUTE, ARGONNE NATIONAL LAB, AND RICE UNIVERSITY */ /* FEBRUARY 29, 1992 */ /* .. SCALAR ARGUMENTS .. */ /* MOPAC CHANGE */ /* END OF MOPAC CHANGE */ /* .. */ /* PURPOSE */ /* ======= */ /* XERBLA IS AN ERROR HANDLER FOR THE LAPACK ROUTINES. */ /* IT IS CALLED BY AN LAPACK ROUTINE IF AN INPUT PARAMETER HAS AN */ /* INVALID VALUE. A MESSAGE IS PRINTED AND EXECUTION STOPS. */ /* INSTALLERS MAY CONSIDER MODIFYING THE STOP STATEMENT IN ORDER TO */ /* CALL SYSTEM-SPECIFIC EXCEPTION-HANDLING FACILITIES. */ /* ARGUMENTS */ /* ========= */ /* SRNAME (INPUT) CHARACTER*6 */ /* THE NAME OF THE ROUTINE WHICH CALLED XERBLA. */ /* INFO (INPUT) INTEGER */ /* THE POSITION OF THE INVALID PARAMETER IN THE PARAMETER LIST */ /* OF THE CALLING ROUTINE. */ /* .. EXECUTABLE STATEMENTS .. */ /* MOPAC CHANGE */ /* WRITE( *, FMT = 9999 )SRNAME, INFO */ io___2.ciunit = *iw; s_wsfe(&io___2); do_fio(&c__1, srname, (ftnlen)6); do_fio(&c__1, (char *)&(*info), (ftnlen)sizeof(integer)); e_wsfe(); /* END OF MOPAC CHANGE */ s_stop("", (ftnlen)0); /* END OF XERBLA */ return 0; } /* xerbla_ */
/* Subroutine */ int check1_(doublereal *sfac) { /* Initialized data */ static doublereal strue2[5] = { 0.,.5,.6,.7,.7 }; static doublereal strue4[5] = { 0.,.7,1.,1.3,1.7 }; static doublecomplex ctrue5[80] /* was [8][5][2] */ = { {.1,.1},{ 1., 2. },{1.,2.},{1.,2.},{1.,2.},{1.,2.},{1.,2.},{1.,2.},{-.16,-.37},{ 3.,4. },{3.,4.},{3.,4.},{3.,4.},{3.,4.},{3.,4.},{3.,4.},{-.17,-.19} ,{.13,-.39},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{ .11, -.03 },{-.17,.46},{-.17,-.19},{7.,8.},{7.,8.},{7.,8.},{7.,8.},{ 7., 8. },{.19,-.17},{.32,.09},{.23,-.24},{.18,.01},{2.,3.},{2.,3.},{ 2., 3. },{2.,3.},{.1,.1},{4.,5.},{4.,5.},{4.,5.},{4.,5.},{4.,5.},{ 4., 5. },{4.,5.},{-.16,-.37},{6.,7.},{6.,7.},{6.,7.},{6.,7.},{6.,7.},{ 6.,7. },{6.,7.},{-.17,-.19},{8.,9.},{.13,-.39},{2.,5.},{2.,5.},{ 2., 5. },{2.,5.},{2.,5.},{.11,-.03},{3.,6.},{-.17,.46},{4.,7.},{ -.17, -.19 },{7.,2.},{7.,2.},{7.,2.},{.19,-.17},{5.,8.},{.32,.09},{6.,9.} ,{.23,-.24},{8.,3.},{.18,.01},{9.,4.} }; static doublecomplex ctrue6[80] /* was [8][5][2] */ = { {.1,.1},{ 1., 2. },{1.,2.},{1.,2.},{1.,2.},{1.,2.},{1.,2.},{1.,2.},{.09,-.12},{ 3.,4. },{3.,4.},{3.,4.},{3.,4.},{3.,4.},{3.,4.},{3.,4.},{.03,-.09}, {.15,-.03},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{.03, .03 },{-.18,.03},{.03,-.09},{7.,8.},{7.,8.},{7.,8.},{7.,8.},{7.,8.} ,{.09,.03},{.03,.12},{.12,.03},{.03,.06},{2.,3.},{2.,3.},{2.,3.},{ 2.,3. },{.1,.1},{4.,5.},{4.,5.},{4.,5.},{4.,5.},{4.,5.},{4.,5.},{ 4.,5. },{.09,-.12},{6.,7.},{6.,7.},{6.,7.},{6.,7.},{6.,7.},{6.,7.}, {6.,7.},{.03,-.09},{8.,9.},{.15,-.03},{2.,5.},{2.,5.},{2.,5.},{2., 5. },{2.,5.},{.03,.03},{3.,6.},{-.18,.03},{4.,7.},{.03,-.09},{ 7., 2. },{7.,2.},{7.,2.},{.09,.03},{5.,8.},{.03,.12},{6.,9.},{.12,.03}, {8.,3.},{.03,.06},{9.,4.} }; static integer itrue3[5] = { 0,1,2,2,2 }; static doublereal sa = .3; static doublecomplex ca = {.4,-.7}; static doublecomplex cv[80] /* was [8][5][2] */ = { {.1,.1},{1.,2.},{ 1., 2. },{1.,2.},{1.,2.},{1.,2.},{1.,2.},{1.,2.},{.3,-.4},{3.,4.},{ 3., 4. },{3.,4.},{3.,4.},{3.,4.},{3.,4.},{3.,4.},{.1,-.3},{.5,-.1},{ 5., 6. },{5.,6.},{5.,6.},{5.,6.},{5.,6.},{5.,6.},{.1,.1},{-.6,.1},{ .1, -.3 },{7.,8.},{7.,8.},{7.,8.},{7.,8.},{7.,8.},{.3,.1},{.1,.4},{ .4, .1 },{.1,.2},{2.,3.},{2.,3.},{2.,3.},{2.,3.},{.1,.1},{4.,5.},{ 4., 5. },{4.,5.},{4.,5.},{4.,5.},{4.,5.},{4.,5.},{.3,-.4},{6.,7.},{ 6., 7. },{6.,7.},{6.,7.},{6.,7.},{6.,7.},{6.,7.},{.1,-.3},{8.,9.},{ .5, -.1 },{2.,5.},{2.,5.},{2.,5.},{2.,5.},{2.,5.},{.1,.1},{3.,6.},{ -.6, .1 },{4.,7.},{.1,-.3},{7.,2.},{7.,2.},{7.,2.},{.3,.1},{5.,8.},{ .1, .4 },{6.,9.},{.4,.1},{8.,3.},{.1,.2},{9.,4.} }; /* System generated locals */ integer i__1, i__2, i__3; doublereal d__1; doublecomplex z__1; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ static integer i__; extern /* Subroutine */ int zscal_(integer *, doublecomplex *, doublecomplex *, integer *), ctest_(integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublereal *); static doublecomplex mwpcs[5], mwpct[5]; extern /* Subroutine */ int itest1_(integer *, integer *); extern doublereal dznrm2_(integer *, doublecomplex *, integer *); extern /* Subroutine */ int stest1_(doublereal *, doublereal *, doublereal *, doublereal *); static doublecomplex cx[8]; extern /* Subroutine */ int zdscal_(integer *, doublereal *, doublecomplex *, integer *); extern integer izamax_(integer *, doublecomplex *, integer *); extern doublereal dzasum_(integer *, doublecomplex *, integer *); static integer np1, len; /* Fortran I/O blocks */ static cilist io___19 = { 0, 6, 0, 0, 0 }; #define ctrue5_subscr(a_1,a_2,a_3) ((a_3)*5 + (a_2))*8 + a_1 - 49 #define ctrue5_ref(a_1,a_2,a_3) ctrue5[ctrue5_subscr(a_1,a_2,a_3)] #define ctrue6_subscr(a_1,a_2,a_3) ((a_3)*5 + (a_2))*8 + a_1 - 49 #define ctrue6_ref(a_1,a_2,a_3) ctrue6[ctrue6_subscr(a_1,a_2,a_3)] #define cv_subscr(a_1,a_2,a_3) ((a_3)*5 + (a_2))*8 + a_1 - 49 #define cv_ref(a_1,a_2,a_3) cv[cv_subscr(a_1,a_2,a_3)] for (combla_1.incx = 1; combla_1.incx <= 2; ++combla_1.incx) { for (np1 = 1; np1 <= 5; ++np1) { combla_1.n = np1 - 1; len = max(combla_1.n,1) << 1; i__1 = len; for (i__ = 1; i__ <= i__1; ++i__) { i__2 = i__ - 1; i__3 = cv_subscr(i__, np1, combla_1.incx); cx[i__2].r = cv[i__3].r, cx[i__2].i = cv[i__3].i; /* L20: */ } if (combla_1.icase == 6) { d__1 = dznrm2_(&combla_1.n, cx, &combla_1.incx); stest1_(&d__1, &strue2[np1 - 1], &strue2[np1 - 1], sfac); } else if (combla_1.icase == 7) { d__1 = dzasum_(&combla_1.n, cx, &combla_1.incx); stest1_(&d__1, &strue4[np1 - 1], &strue4[np1 - 1], sfac); } else if (combla_1.icase == 8) { zscal_(&combla_1.n, &ca, cx, &combla_1.incx); ctest_(&len, cx, &ctrue5_ref(1, np1, combla_1.incx), & ctrue5_ref(1, np1, combla_1.incx), sfac); } else if (combla_1.icase == 9) { zdscal_(&combla_1.n, &sa, cx, &combla_1.incx); ctest_(&len, cx, &ctrue6_ref(1, np1, combla_1.incx), & ctrue6_ref(1, np1, combla_1.incx), sfac); } else if (combla_1.icase == 10) { i__1 = izamax_(&combla_1.n, cx, &combla_1.incx); itest1_(&i__1, &itrue3[np1 - 1]); } else { s_wsle(&io___19); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK1", (ftnlen) 28); e_wsle(); s_stop("", (ftnlen)0); } /* L40: */ } /* L60: */ } combla_1.incx = 1; if (combla_1.icase == 8) { /* ZSCAL Add a test for alpha equal to zero. */ ca.r = 0., ca.i = 0.; for (i__ = 1; i__ <= 5; ++i__) { i__1 = i__ - 1; mwpct[i__1].r = 0., mwpct[i__1].i = 0.; i__1 = i__ - 1; mwpcs[i__1].r = 1., mwpcs[i__1].i = 1.; /* L80: */ } zscal_(&c__5, &ca, cx, &combla_1.incx); ctest_(&c__5, cx, mwpct, mwpcs, sfac); } else if (combla_1.icase == 9) { /* ZDSCAL Add a test for alpha equal to zero. */ sa = 0.; for (i__ = 1; i__ <= 5; ++i__) { i__1 = i__ - 1; mwpct[i__1].r = 0., mwpct[i__1].i = 0.; i__1 = i__ - 1; mwpcs[i__1].r = 1., mwpcs[i__1].i = 1.; /* L100: */ } zdscal_(&c__5, &sa, cx, &combla_1.incx); ctest_(&c__5, cx, mwpct, mwpcs, sfac); /* Add a test for alpha equal to one. */ sa = 1.; for (i__ = 1; i__ <= 5; ++i__) { i__1 = i__ - 1; i__2 = i__ - 1; mwpct[i__1].r = cx[i__2].r, mwpct[i__1].i = cx[i__2].i; i__1 = i__ - 1; i__2 = i__ - 1; mwpcs[i__1].r = cx[i__2].r, mwpcs[i__1].i = cx[i__2].i; /* L120: */ } zdscal_(&c__5, &sa, cx, &combla_1.incx); ctest_(&c__5, cx, mwpct, mwpcs, sfac); /* Add a test for alpha equal to minus one. */ sa = -1.; for (i__ = 1; i__ <= 5; ++i__) { i__1 = i__ - 1; i__2 = i__ - 1; z__1.r = -cx[i__2].r, z__1.i = -cx[i__2].i; mwpct[i__1].r = z__1.r, mwpct[i__1].i = z__1.i; i__1 = i__ - 1; i__2 = i__ - 1; z__1.r = -cx[i__2].r, z__1.i = -cx[i__2].i; mwpcs[i__1].r = z__1.r, mwpcs[i__1].i = z__1.i; /* L140: */ } zdscal_(&c__5, &sa, cx, &combla_1.incx); ctest_(&c__5, cx, mwpct, mwpcs, sfac); } return 0; } /* check1_ */
/* Subroutine */ int check1_(real *sfac) { /* Initialized data */ static real sa[10] = { .3f,-1.f,0.f,1.f,.3f,.3f,.3f,.3f,.3f,.3f }; static real dv[80] /* was [8][5][2] */ = { .1f,2.f,2.f,2.f,2.f,2.f,2.f, 2.f,.3f,3.f,3.f,3.f,3.f,3.f,3.f,3.f,.3f,-.4f,4.f,4.f,4.f,4.f,4.f, 4.f,.2f,-.6f,.3f,5.f,5.f,5.f,5.f,5.f,.1f,-.3f,.5f,-.1f,6.f,6.f, 6.f,6.f,.1f,8.f,8.f,8.f,8.f,8.f,8.f,8.f,.3f,9.f,9.f,9.f,9.f,9.f, 9.f,9.f,.3f,2.f,-.4f,2.f,2.f,2.f,2.f,2.f,.2f,3.f,-.6f,5.f,.3f,2.f, 2.f,2.f,.1f,4.f,-.3f,6.f,-.5f,7.f,-.1f,3.f }; static real dtrue1[5] = { 0.f,.3f,.5f,.7f,.6f }; static real dtrue3[5] = { 0.f,.3f,.7f,1.1f,1.f }; static real dtrue5[80] /* was [8][5][2] */ = { .1f,2.f,2.f,2.f,2.f, 2.f,2.f,2.f,-.3f,3.f,3.f,3.f,3.f,3.f,3.f,3.f,0.f,0.f,4.f,4.f,4.f, 4.f,4.f,4.f,.2f,-.6f,.3f,5.f,5.f,5.f,5.f,5.f,.03f,-.09f,.15f, -.03f,6.f,6.f,6.f,6.f,.1f,8.f,8.f,8.f,8.f,8.f,8.f,8.f,.09f,9.f, 9.f,9.f,9.f,9.f,9.f,9.f,.09f,2.f,-.12f,2.f,2.f,2.f,2.f,2.f,.06f, 3.f,-.18f,5.f,.09f,2.f,2.f,2.f,.03f,4.f,-.09f,6.f,-.15f,7.f,-.03f, 3.f }; static integer itrue2[5] = { 0,1,2,2,3 }; /* System generated locals */ integer i__1; real r__1; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ integer i__; real sx[8]; integer np1, len; extern doublereal snrm2_(integer *, real *, integer *); extern /* Subroutine */ int sscal_(integer *, real *, real *, integer *); real stemp[1]; extern doublereal sasum_(integer *, real *, integer *); real strue[8]; extern /* Subroutine */ int stest_(integer *, real *, real *, real *, real *), itest1_(integer *, integer *), stest1_(real *, real *, real *, real *); extern integer isamax_(integer *, real *, integer *); /* Fortran I/O blocks */ static cilist io___32 = { 0, 6, 0, 0, 0 }; /* .. Parameters .. */ /* .. Scalar Arguments .. */ /* .. Scalars in Common .. */ /* .. Local Scalars .. */ /* .. Local Arrays .. */ /* .. External Functions .. */ /* .. External Subroutines .. */ /* .. Intrinsic Functions .. */ /* .. Common blocks .. */ /* .. Data statements .. */ /* .. Executable Statements .. */ for (combla_1.incx = 1; combla_1.incx <= 2; ++combla_1.incx) { for (np1 = 1; np1 <= 5; ++np1) { combla_1.n = np1 - 1; len = max(combla_1.n,1) << 1; /* .. Set vector arguments .. */ i__1 = len; for (i__ = 1; i__ <= i__1; ++i__) { sx[i__ - 1] = dv[i__ + (np1 + combla_1.incx * 5 << 3) - 49]; /* L20: */ } if (combla_1.icase == 7) { /* .. SNRM2 .. */ stemp[0] = dtrue1[np1 - 1]; r__1 = snrm2_(&combla_1.n, sx, &combla_1.incx); stest1_(&r__1, stemp, stemp, sfac); } else if (combla_1.icase == 8) { /* .. SASUM .. */ stemp[0] = dtrue3[np1 - 1]; r__1 = sasum_(&combla_1.n, sx, &combla_1.incx); stest1_(&r__1, stemp, stemp, sfac); } else if (combla_1.icase == 9) { /* .. SSCAL .. */ sscal_(&combla_1.n, &sa[(combla_1.incx - 1) * 5 + np1 - 1], sx, &combla_1.incx); i__1 = len; for (i__ = 1; i__ <= i__1; ++i__) { strue[i__ - 1] = dtrue5[i__ + (np1 + combla_1.incx * 5 << 3) - 49]; /* L40: */ } stest_(&len, sx, strue, strue, sfac); } else if (combla_1.icase == 10) { /* .. ISAMAX .. */ i__1 = isamax_(&combla_1.n, sx, &combla_1.incx); itest1_(&i__1, &itrue2[np1 - 1]); } else { s_wsle(&io___32); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK1", (ftnlen) 28); e_wsle(); s_stop("", (ftnlen)0); } /* L60: */ } /* L80: */ } return 0; } /* check1_ */
/* Subroutine */ int check2_(doublereal *sfac) { /* Initialized data */ static doublecomplex ca = {.4,-.7}; static integer incxs[4] = { 1,2,-2,-1 }; static integer incys[4] = { 1,-2,1,-2 }; static integer lens[8] /* was [4][2] */ = { 1,1,2,4,1,1,3,7 }; static integer ns[4] = { 0,1,2,4 }; static doublecomplex cx1[7] = { {.7,-.8},{-.4,-.7},{-.1,-.9},{.2,-.8},{ -.9,-.4 },{.1,.4},{-.6,.6} }; static doublecomplex cy1[7] = { {.6,-.6},{-.9,.5},{.7,-.6},{.1,-.5},{ -.1, -.2 },{-.5,-.3},{.8,-.7} }; static doublecomplex ct8[112] /* was [7][4][4] */ = { {.6,-.6},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.32,-1.41},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.32,-1.41},{-1.55,.5},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.32,-1.41},{-1.55,.5},{ .03, -.89 },{-.38,-.96},{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{0.,0.},{0.,0.} ,{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.32,-1.41},{0.,0.},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{-.07,-.89},{-.9,.5},{.42,-1.41},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{.78,.06},{-.9,.5},{.06,-.13},{.1,-.5} ,{-.77,-.49},{-.5,-.3},{.52,-1.51},{.6,-.6},{0.,0.},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{.32,-1.41},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{-.07,-.89},{-1.18,-.31},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{.78,.06},{-1.54,.97},{.03,-.89},{ -.18, -1.31 },{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{.32,-1.41},{0.,0.},{0.,0.},{0.,0.},{0.,0.} ,{0.,0.},{0.,0.},{.32,-1.41},{-.9,.5},{.05,-.6},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{.32,-1.41},{-.9,.5},{.05,-.6},{.1,-.5},{-.77,-.49} ,{-.5,-.3},{.32,-1.16} }; static doublecomplex ct7[16] /* was [4][4] */ = { {0.,0.},{ -.06, -.9 },{.65,-.47},{-.34,-1.22},{0.,0.},{-.06,-.9},{-.59,-1.46},{ -1.04,-.04 },{0.,0.},{-.06,-.9},{-.83,.59},{.07,-.37},{0.,0.},{ -.06,-.9 },{-.76,-1.15},{-1.33,-1.82} }; static doublecomplex ct6[16] /* was [4][4] */ = { {0.,0.},{.9,.06}, {.91,-.77},{1.8,-.1},{0.,0.},{.9,.06},{1.45,.74},{.2,.9},{0.,0.},{ .9,.06 },{-.55,.23},{.83,-.39},{0.,0.},{.9,.06},{1.04,.79},{ 1.95, 1.22 } }; static doublecomplex ct10x[112] /* was [7][4][4] */ = { {.7,-.8},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{-.9,.5},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{-.9,.5},{.7,-.6},{.1,-.5},{ 0.,0. },{0.,0.},{0.,0.},{.7,-.8},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{.6,-.6},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{.7,-.6},{-.4,-.7},{.6,-.6},{0.,0.},{0.,0.},{0.,0.},{0.,0.} ,{.8,-.7},{-.4,-.7},{-.1,-.2},{.2,-.8},{.7,-.6},{.1,.4},{.6,-.6},{ .7,-.8 },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{-.9,.5},{-.4,-.7}, {.6,-.6},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.1,-.5},{-.4,-.7},{.7, -.6 },{.2,-.8},{-.9,.5},{.1,.4},{.6,-.6},{.7,-.8},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{.6,-.6},{.7,-.6},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{.6,-.6},{.7,-.6},{-.1,-.2},{.8,-.7},{0.,0.},{ 0., 0. },{0.,0.} }; static doublecomplex ct10y[112] /* was [7][4][4] */ = { {.6,-.6},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.7,-.8},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.7,-.8},{-.4,-.7},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{.7,-.8},{-.4,-.7},{-.1,-.9},{ .2, -.8 },{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{0.,0.},{0.,0.},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{.7,-.8},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{ 0., 0. },{0.,0.},{-.1,-.9},{-.9,.5},{.7,-.8},{0.,0.},{0.,0.},{0.,0.},{ 0.,0. },{-.6,.6},{-.9,.5},{-.9,-.4},{.1,-.5},{-.1,-.9},{-.5,-.3},{ .7,-.8 },{.6,-.6},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{ .7,-.8 },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{-.1,-.9}, {.7,-.8},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.},{-.6,.6},{-.9, -.4 },{-.1,-.9},{.7,-.8},{0.,0.},{0.,0.},{0.,0.},{.6,-.6},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{.7,-.8},{0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{.7,-.8},{-.9,.5},{-.4,-.7},{0.,0.} ,{0.,0.},{0.,0.},{0.,0.},{.7,-.8},{-.9,.5},{-.4,-.7},{.1,-.5},{ -.1,-.9 },{-.5,-.3},{.2,-.8} }; static doublecomplex csize1[4] = { {0.,0.},{.9,.9},{1.63,1.73},{2.9,2.78} }; static doublecomplex csize3[14] = { {0.,0.},{0.,0.},{0.,0.},{0.,0.},{ 0., 0. },{0.,0.},{0.,0.},{1.17,1.17},{1.17,1.17},{1.17,1.17},{ 1.17, 1.17 },{1.17,1.17},{1.17,1.17},{1.17,1.17} }; static doublecomplex csize2[14] /* was [7][2] */ = { {0.,0.},{0.,0.},{ 0.,0. },{0.,0.},{0.,0.},{0.,0.},{0.,0.},{1.54,1.54},{1.54,1.54},{ 1.54,1.54 },{1.54,1.54},{1.54,1.54},{1.54,1.54},{1.54,1.54} }; /* System generated locals */ integer i__1, i__2; doublecomplex z__1; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ static doublecomplex cdot[1]; static integer lenx, leny, i__; extern /* Subroutine */ int ctest_(integer *, doublecomplex *, doublecomplex *, doublecomplex *, doublereal *); extern /* Double Complex */ VOID zdotc_(doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *); static integer ksize; extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, integer *); extern /* Double Complex */ VOID zdotu_(doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *); extern /* Subroutine */ int zswap_(integer *, doublecomplex *, integer *, doublecomplex *, integer *), zaxpy_(integer *, doublecomplex *, doublecomplex *, integer *, doublecomplex *, integer *); static integer ki, kn; static doublecomplex cx[7], cy[7]; static integer mx, my; /* Fortran I/O blocks */ static cilist io___48 = { 0, 6, 0, 0, 0 }; #define ct10x_subscr(a_1,a_2,a_3) ((a_3)*4 + (a_2))*7 + a_1 - 36 #define ct10x_ref(a_1,a_2,a_3) ct10x[ct10x_subscr(a_1,a_2,a_3)] #define ct10y_subscr(a_1,a_2,a_3) ((a_3)*4 + (a_2))*7 + a_1 - 36 #define ct10y_ref(a_1,a_2,a_3) ct10y[ct10y_subscr(a_1,a_2,a_3)] #define lens_ref(a_1,a_2) lens[(a_2)*4 + a_1 - 5] #define csize2_subscr(a_1,a_2) (a_2)*7 + a_1 - 8 #define csize2_ref(a_1,a_2) csize2[csize2_subscr(a_1,a_2)] #define ct6_subscr(a_1,a_2) (a_2)*4 + a_1 - 5 #define ct6_ref(a_1,a_2) ct6[ct6_subscr(a_1,a_2)] #define ct7_subscr(a_1,a_2) (a_2)*4 + a_1 - 5 #define ct7_ref(a_1,a_2) ct7[ct7_subscr(a_1,a_2)] #define ct8_subscr(a_1,a_2,a_3) ((a_3)*4 + (a_2))*7 + a_1 - 36 #define ct8_ref(a_1,a_2,a_3) ct8[ct8_subscr(a_1,a_2,a_3)] for (ki = 1; ki <= 4; ++ki) { combla_1.incx = incxs[ki - 1]; combla_1.incy = incys[ki - 1]; mx = abs(combla_1.incx); my = abs(combla_1.incy); for (kn = 1; kn <= 4; ++kn) { combla_1.n = ns[kn - 1]; ksize = min(2,kn); lenx = lens_ref(kn, mx); leny = lens_ref(kn, my); for (i__ = 1; i__ <= 7; ++i__) { i__1 = i__ - 1; i__2 = i__ - 1; cx[i__1].r = cx1[i__2].r, cx[i__1].i = cx1[i__2].i; i__1 = i__ - 1; i__2 = i__ - 1; cy[i__1].r = cy1[i__2].r, cy[i__1].i = cy1[i__2].i; /* L20: */ } if (combla_1.icase == 1) { zdotc_(&z__1, &combla_1.n, cx, &combla_1.incx, cy, & combla_1.incy); cdot[0].r = z__1.r, cdot[0].i = z__1.i; ctest_(&c__1, cdot, &ct6_ref(kn, ki), &csize1[kn - 1], sfac); } else if (combla_1.icase == 2) { zdotu_(&z__1, &combla_1.n, cx, &combla_1.incx, cy, & combla_1.incy); cdot[0].r = z__1.r, cdot[0].i = z__1.i; ctest_(&c__1, cdot, &ct7_ref(kn, ki), &csize1[kn - 1], sfac); } else if (combla_1.icase == 3) { zaxpy_(&combla_1.n, &ca, cx, &combla_1.incx, cy, & combla_1.incy); ctest_(&leny, cy, &ct8_ref(1, kn, ki), &csize2_ref(1, ksize), sfac); } else if (combla_1.icase == 4) { zcopy_(&combla_1.n, cx, &combla_1.incx, cy, &combla_1.incy); ctest_(&leny, cy, &ct10y_ref(1, kn, ki), csize3, &c_b43); } else if (combla_1.icase == 5) { zswap_(&combla_1.n, cx, &combla_1.incx, cy, &combla_1.incy); ctest_(&lenx, cx, &ct10x_ref(1, kn, ki), csize3, &c_b43); ctest_(&leny, cy, &ct10y_ref(1, kn, ki), csize3, &c_b43); } else { s_wsle(&io___48); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK2", (ftnlen) 28); e_wsle(); s_stop("", (ftnlen)0); } /* L40: */ } /* L60: */ } return 0; } /* check2_ */
/* Subroutine */ int check2_(real *sfac) { /* Initialized data */ static real sa = .3f; static integer incxs[4] = { 1,2,-2,-1 }; static integer incys[4] = { 1,-2,1,-2 }; static integer lens[8] /* was [4][2] */ = { 1,1,2,4,1,1,3,7 }; static integer ns[4] = { 0,1,2,4 }; static real dx1[7] = { .6f,.1f,-.5f,.8f,.9f,-.3f,-.4f }; static real dy1[7] = { .5f,-.9f,.3f,.7f,-.6f,.2f,.8f }; static real dt7[16] /* was [4][4] */ = { 0.f,.3f,.21f,.62f,0.f,.3f,-.07f, .85f,0.f,.3f,-.79f,-.74f,0.f,.3f,.33f,1.27f }; static real dt8[112] /* was [7][4][4] */ = { .5f,0.f,0.f,0.f,0.f, 0.f,0.f,.68f,0.f,0.f,0.f,0.f,0.f,0.f,.68f,-.87f,0.f,0.f,0.f,0.f, 0.f,.68f,-.87f,.15f,.94f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f, .68f,0.f,0.f,0.f,0.f,0.f,0.f,.35f,-.9f,.48f,0.f,0.f,0.f,0.f,.38f, -.9f,.57f,.7f,-.75f,.2f,.98f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.68f,0.f, 0.f,0.f,0.f,0.f,0.f,.35f,-.72f,0.f,0.f,0.f,0.f,0.f,.38f,-.63f, .15f,.88f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.68f,0.f,0.f, 0.f,0.f,0.f,0.f,.68f,-.9f,.33f,0.f,0.f,0.f,0.f,.68f,-.9f,.33f,.7f, -.75f,.2f,1.04f }; static real dt10x[112] /* was [7][4][4] */ = { .6f,0.f,0.f,0.f,0.f, 0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.5f,-.9f,0.f,0.f,0.f,0.f,0.f, .5f,-.9f,.3f,.7f,0.f,0.f,0.f,.6f,0.f,0.f,0.f,0.f,0.f,0.f,.5f,0.f, 0.f,0.f,0.f,0.f,0.f,.3f,.1f,.5f,0.f,0.f,0.f,0.f,.8f,.1f,-.6f,.8f, .3f,-.3f,.5f,.6f,0.f,0.f,0.f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f, 0.f,-.9f,.1f,.5f,0.f,0.f,0.f,0.f,.7f,.1f,.3f,.8f,-.9f,-.3f,.5f, .6f,0.f,0.f,0.f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.5f,.3f, 0.f,0.f,0.f,0.f,0.f,.5f,.3f,-.6f,.8f,0.f,0.f,0.f }; static real dt10y[112] /* was [7][4][4] */ = { .5f,0.f,0.f,0.f,0.f, 0.f,0.f,.6f,0.f,0.f,0.f,0.f,0.f,0.f,.6f,.1f,0.f,0.f,0.f,0.f,0.f, .6f,.1f,-.5f,.8f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.6f,0.f, 0.f,0.f,0.f,0.f,0.f,-.5f,-.9f,.6f,0.f,0.f,0.f,0.f,-.4f,-.9f,.9f, .7f,-.5f,.2f,.6f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.6f,0.f,0.f,0.f,0.f, 0.f,0.f,-.5f,.6f,0.f,0.f,0.f,0.f,0.f,-.4f,.9f,-.5f,.6f,0.f,0.f, 0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.6f,0.f,0.f,0.f,0.f,0.f,0.f,.6f, -.9f,.1f,0.f,0.f,0.f,0.f,.6f,-.9f,.1f,.7f,-.5f,.2f,.8f }; static real ssize1[4] = { 0.f,.3f,1.6f,3.2f }; static real ssize2[28] /* was [14][2] */ = { 0.f,0.f,0.f,0.f,0.f,0.f, 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,1.17f,1.17f,1.17f,1.17f,1.17f, 1.17f,1.17f,1.17f,1.17f,1.17f,1.17f,1.17f,1.17f,1.17f }; /* System generated locals */ integer i__1; real r__1; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ integer i__, j, ki, kn, mx, my; real sx[7], sy[7], stx[7], sty[7]; integer lenx, leny; extern doublereal sdot_(integer *, real *, integer *, real *, integer *); integer ksize; extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *, integer *), sswap_(integer *, real *, integer *, real *, integer * ), stest_(integer *, real *, real *, real *, real *), saxpy_( integer *, real *, real *, integer *, real *, integer *), stest1_( real *, real *, real *, real *); /* Fortran I/O blocks */ static cilist io___63 = { 0, 6, 0, 0, 0 }; /* .. Parameters .. */ /* .. Scalar Arguments .. */ /* .. Scalars in Common .. */ /* .. Local Scalars .. */ /* .. Local Arrays .. */ /* .. External Functions .. */ /* .. External Subroutines .. */ /* .. Intrinsic Functions .. */ /* .. Common blocks .. */ /* .. Data statements .. */ /* .. Executable Statements .. */ for (ki = 1; ki <= 4; ++ki) { combla_1.incx = incxs[ki - 1]; combla_1.incy = incys[ki - 1]; mx = abs(combla_1.incx); my = abs(combla_1.incy); for (kn = 1; kn <= 4; ++kn) { combla_1.n = ns[kn - 1]; ksize = min(2,kn); lenx = lens[kn + (mx << 2) - 5]; leny = lens[kn + (my << 2) - 5]; /* .. Initialize all argument arrays .. */ for (i__ = 1; i__ <= 7; ++i__) { sx[i__ - 1] = dx1[i__ - 1]; sy[i__ - 1] = dy1[i__ - 1]; /* L20: */ } if (combla_1.icase == 1) { /* .. SDOT .. */ r__1 = sdot_(&combla_1.n, sx, &combla_1.incx, sy, & combla_1.incy); stest1_(&r__1, &dt7[kn + (ki << 2) - 5], &ssize1[kn - 1], sfac); } else if (combla_1.icase == 2) { /* .. SAXPY .. */ saxpy_(&combla_1.n, &sa, sx, &combla_1.incx, sy, & combla_1.incy); i__1 = leny; for (j = 1; j <= i__1; ++j) { sty[j - 1] = dt8[j + (kn + (ki << 2)) * 7 - 36]; /* L40: */ } stest_(&leny, sy, sty, &ssize2[ksize * 14 - 14], sfac); } else if (combla_1.icase == 5) { /* .. SCOPY .. */ for (i__ = 1; i__ <= 7; ++i__) { sty[i__ - 1] = dt10y[i__ + (kn + (ki << 2)) * 7 - 36]; /* L60: */ } scopy_(&combla_1.n, sx, &combla_1.incx, sy, &combla_1.incy); stest_(&leny, sy, sty, ssize2, &c_b34); } else if (combla_1.icase == 6) { /* .. SSWAP .. */ sswap_(&combla_1.n, sx, &combla_1.incx, sy, &combla_1.incy); for (i__ = 1; i__ <= 7; ++i__) { stx[i__ - 1] = dt10x[i__ + (kn + (ki << 2)) * 7 - 36]; sty[i__ - 1] = dt10y[i__ + (kn + (ki << 2)) * 7 - 36]; /* L80: */ } stest_(&lenx, sx, stx, ssize2, &c_b34); stest_(&leny, sy, sty, ssize2, &c_b34); } else { s_wsle(&io___63); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK2", (ftnlen) 28); e_wsle(); s_stop("", (ftnlen)0); } /* L100: */ } /* L120: */ } return 0; } /* check2_ */
/* ********** */ /* Main program */ int MAIN__(void) { /* Initialized data */ static integer nread = 5; static integer nwrite = 6; static doublereal one = 1.; static doublereal ten = 10.; /* Format strings */ static char fmt_50[] = "(3i5)"; static char fmt_60[] = "(////5x,\002 PROBLEM\002,i5,5x,\002 DIMENSION" "\002,i5,5x//)"; static char fmt_70[] = "(5x,\002 INITIAL L2 NORM OF THE RESIDUALS\002,d1" "5.7//5x,\002 FINAL L2 NORM OF THE RESIDUALS \002,d15.7//5x,\002" " NUMBER OF FUNCTION EVALUATIONS \002,i10//5x,\002 EXIT PARAMETER" "\002,18x,i10//5x,\002 FINAL APPROXIMATE SOLUTION\002//(5x,5d15.7" "))"; static char fmt_80[] = "(\0021SUMMARY OF \002,i3,\002 CALLS TO HYBRD1" "\002/)"; static char fmt_90[] = "(\002 NPROB N NFEV INFO FINAL L2 NORM\002" "/)"; static char fmt_100[] = "(i4,i6,i7,i6,1x,d15.7)"; /* System generated locals */ integer i__1, i__2; /* Builtin functions */ double sqrt(doublereal); integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void), s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ static integer i__, k, n; static doublereal x[40]; static integer ic, na[60], nf[60]; static doublereal wa[2660]; static integer np[60], nx[60]; extern /* Subroutine */ int fcn_(); static doublereal fnm[60]; static integer lwa; static doublereal tol, fvec[40]; static integer info; extern doublereal enorm_(integer *, doublereal *); extern /* Subroutine */ int hybrd1_(U_fp, integer *, doublereal *, doublereal *, doublereal *, integer *, doublereal *, integer *); static doublereal fnorm1, fnorm2; extern /* Subroutine */ int vecfcn_(integer *, doublereal *, doublereal *, integer *); static doublereal factor; extern doublereal dpmpar_(integer *); static integer ntries; extern /* Subroutine */ int initpt_(integer *, doublereal *, integer *, doublereal *); /* Fortran I/O blocks */ static cilist io___8 = { 0, 0, 0, fmt_50, 0 }; static cilist io___16 = { 0, 0, 0, fmt_60, 0 }; static cilist io___25 = { 0, 0, 0, fmt_70, 0 }; static cilist io___27 = { 0, 0, 0, fmt_80, 0 }; static cilist io___28 = { 0, 0, 0, fmt_90, 0 }; static cilist io___29 = { 0, 0, 0, fmt_100, 0 }; /* LOGICAL INPUT UNIT IS ASSUMED TO BE NUMBER 5. */ /* LOGICAL OUTPUT UNIT IS ASSUMED TO BE NUMBER 6. */ tol = sqrt(dpmpar_(&c__1)); lwa = 2660; ic = 0; L10: io___8.ciunit = nread; s_rsfe(&io___8); do_fio(&c__1, (char *)&refnum_1.nprob, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&ntries, (ftnlen)sizeof(integer)); e_rsfe(); if (refnum_1.nprob <= 0) { goto L30; } factor = one; i__1 = ntries; for (k = 1; k <= i__1; ++k) { ++ic; initpt_(&n, x, &refnum_1.nprob, &factor); vecfcn_(&n, x, fvec, &refnum_1.nprob); fnorm1 = enorm_(&n, fvec); io___16.ciunit = nwrite; s_wsfe(&io___16); do_fio(&c__1, (char *)&refnum_1.nprob, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer)); e_wsfe(); refnum_1.nfev = 0; hybrd1_((U_fp)fcn_, &n, x, fvec, &tol, &info, wa, &lwa); fnorm2 = enorm_(&n, fvec); np[ic - 1] = refnum_1.nprob; na[ic - 1] = n; nf[ic - 1] = refnum_1.nfev; nx[ic - 1] = info; fnm[ic - 1] = fnorm2; io___25.ciunit = nwrite; s_wsfe(&io___25); do_fio(&c__1, (char *)&fnorm1, (ftnlen)sizeof(doublereal)); do_fio(&c__1, (char *)&fnorm2, (ftnlen)sizeof(doublereal)); do_fio(&c__1, (char *)&refnum_1.nfev, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&info, (ftnlen)sizeof(integer)); i__2 = n; for (i__ = 1; i__ <= i__2; ++i__) { do_fio(&c__1, (char *)&x[i__ - 1], (ftnlen)sizeof(doublereal)); } e_wsfe(); factor = ten * factor; /* L20: */ } goto L10; L30: io___27.ciunit = nwrite; s_wsfe(&io___27); do_fio(&c__1, (char *)&ic, (ftnlen)sizeof(integer)); e_wsfe(); io___28.ciunit = nwrite; s_wsfe(&io___28); e_wsfe(); i__1 = ic; for (i__ = 1; i__ <= i__1; ++i__) { io___29.ciunit = nwrite; s_wsfe(&io___29); do_fio(&c__1, (char *)&np[i__ - 1], (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&na[i__ - 1], (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&nf[i__ - 1], (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&nx[i__ - 1], (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&fnm[i__ - 1], (ftnlen)sizeof(doublereal)); e_wsfe(); /* L40: */ } s_stop("", (ftnlen)0); /* LAST CARD OF DRIVER. */ return 0; } /* MAIN__ */
/* Subroutine */ int check3_(real *sfac) { /* Initialized data */ static integer incxs[4] = { 1,2,-2,-1 }; static integer incys[4] = { 1,-2,1,-2 }; static integer lens[8] /* was [4][2] */ = { 1,1,2,4,1,1,3,7 }; static integer ns[4] = { 0,1,2,4 }; static real dx1[7] = { .6f,.1f,-.5f,.8f,.9f,-.3f,-.4f }; static real dy1[7] = { .5f,-.9f,.3f,.7f,-.6f,.2f,.8f }; static real sc = .8f; static real ss = .6f; static real dt9x[112] /* was [7][4][4] */ = { .6f,0.f,0.f,0.f,0.f, 0.f,0.f,.78f,0.f,0.f,0.f,0.f,0.f,0.f,.78f,-.46f,0.f,0.f,0.f,0.f, 0.f,.78f,-.46f,-.22f,1.06f,0.f,0.f,0.f,.6f,0.f,0.f,0.f,0.f,0.f, 0.f,.78f,0.f,0.f,0.f,0.f,0.f,0.f,.66f,.1f,-.1f,0.f,0.f,0.f,0.f, .96f,.1f,-.76f,.8f,.9f,-.3f,-.02f,.6f,0.f,0.f,0.f,0.f,0.f,0.f, .78f,0.f,0.f,0.f,0.f,0.f,0.f,-.06f,.1f,-.1f,0.f,0.f,0.f,0.f,.9f, .1f,-.22f,.8f,.18f,-.3f,-.02f,.6f,0.f,0.f,0.f,0.f,0.f,0.f,.78f, 0.f,0.f,0.f,0.f,0.f,0.f,.78f,.26f,0.f,0.f,0.f,0.f,0.f,.78f,.26f, -.76f,1.12f,0.f,0.f,0.f }; static real dt9y[112] /* was [7][4][4] */ = { .5f,0.f,0.f,0.f,0.f, 0.f,0.f,.04f,0.f,0.f,0.f,0.f,0.f,0.f,.04f,-.78f,0.f,0.f,0.f,0.f, 0.f,.04f,-.78f,.54f,.08f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f, .04f,0.f,0.f,0.f,0.f,0.f,0.f,.7f,-.9f,-.12f,0.f,0.f,0.f,0.f,.64f, -.9f,-.3f,.7f,-.18f,.2f,.28f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.04f,0.f, 0.f,0.f,0.f,0.f,0.f,.7f,-1.08f,0.f,0.f,0.f,0.f,0.f,.64f,-1.26f, .54f,.2f,0.f,0.f,0.f,.5f,0.f,0.f,0.f,0.f,0.f,0.f,.04f,0.f,0.f,0.f, 0.f,0.f,0.f,.04f,-.9f,.18f,0.f,0.f,0.f,0.f,.04f,-.9f,.18f,.7f, -.18f,.2f,.16f }; static real ssize2[28] /* was [14][2] */ = { 0.f,0.f,0.f,0.f,0.f,0.f, 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,1.17f,1.17f,1.17f,1.17f,1.17f, 1.17f,1.17f,1.17f,1.17f,1.17f,1.17f,1.17f,1.17f,1.17f }; /* Builtin functions */ integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ integer i__, k, ki, kn, mx, my; real sx[7], sy[7], stx[7], sty[7]; integer lenx, leny; real mwpc[11]; integer mwpn[11]; real mwps[11]; extern /* Subroutine */ int srot_(integer *, real *, integer *, real *, integer *, real *, real *); real mwpx[5], mwpy[5]; integer ksize; real copyx[5], copyy[5]; extern /* Subroutine */ int stest_(integer *, real *, real *, real *, real *); real mwptx[55] /* was [11][5] */, mwpty[55] /* was [11][5] */; integer mwpinx[11], mwpiny[11]; real mwpstx[5], mwpsty[5]; /* Fortran I/O blocks */ static cilist io___88 = { 0, 6, 0, 0, 0 }; /* .. Parameters .. */ /* .. Scalar Arguments .. */ /* .. Scalars in Common .. */ /* .. Local Scalars .. */ /* .. Local Arrays .. */ /* .. External Subroutines .. */ /* .. Intrinsic Functions .. */ /* .. Common blocks .. */ /* .. Data statements .. */ /* .. Executable Statements .. */ for (ki = 1; ki <= 4; ++ki) { combla_1.incx = incxs[ki - 1]; combla_1.incy = incys[ki - 1]; mx = abs(combla_1.incx); my = abs(combla_1.incy); for (kn = 1; kn <= 4; ++kn) { combla_1.n = ns[kn - 1]; ksize = min(2,kn); lenx = lens[kn + (mx << 2) - 5]; leny = lens[kn + (my << 2) - 5]; if (combla_1.icase == 4) { /* .. SROT .. */ for (i__ = 1; i__ <= 7; ++i__) { sx[i__ - 1] = dx1[i__ - 1]; sy[i__ - 1] = dy1[i__ - 1]; stx[i__ - 1] = dt9x[i__ + (kn + (ki << 2)) * 7 - 36]; sty[i__ - 1] = dt9y[i__ + (kn + (ki << 2)) * 7 - 36]; /* L20: */ } srot_(&combla_1.n, sx, &combla_1.incx, sy, &combla_1.incy, & sc, &ss); stest_(&lenx, sx, stx, &ssize2[ksize * 14 - 14], sfac); stest_(&leny, sy, sty, &ssize2[ksize * 14 - 14], sfac); } else { s_wsle(&io___88); do_lio(&c__9, &c__1, " Shouldn't be here in CHECK3", (ftnlen) 28); e_wsle(); s_stop("", (ftnlen)0); } /* L40: */ } /* L60: */ } mwpc[0] = 1.f; for (i__ = 2; i__ <= 11; ++i__) { mwpc[i__ - 1] = 0.f; /* L80: */ } mwps[0] = 0.f; for (i__ = 2; i__ <= 6; ++i__) { mwps[i__ - 1] = 1.f; /* L100: */ } for (i__ = 7; i__ <= 11; ++i__) { mwps[i__ - 1] = -1.f; /* L120: */ } mwpinx[0] = 1; mwpinx[1] = 1; mwpinx[2] = 1; mwpinx[3] = -1; mwpinx[4] = 1; mwpinx[5] = -1; mwpinx[6] = 1; mwpinx[7] = 1; mwpinx[8] = -1; mwpinx[9] = 1; mwpinx[10] = -1; mwpiny[0] = 1; mwpiny[1] = 1; mwpiny[2] = -1; mwpiny[3] = -1; mwpiny[4] = 2; mwpiny[5] = 1; mwpiny[6] = 1; mwpiny[7] = -1; mwpiny[8] = -1; mwpiny[9] = 2; mwpiny[10] = 1; for (i__ = 1; i__ <= 11; ++i__) { mwpn[i__ - 1] = 5; /* L140: */ } mwpn[4] = 3; mwpn[9] = 3; for (i__ = 1; i__ <= 5; ++i__) { mwpx[i__ - 1] = (real) i__; mwpy[i__ - 1] = (real) i__; mwptx[i__ * 11 - 11] = (real) i__; mwpty[i__ * 11 - 11] = (real) i__; mwptx[i__ * 11 - 10] = (real) i__; mwpty[i__ * 11 - 10] = (real) (-i__); mwptx[i__ * 11 - 9] = (real) (6 - i__); mwpty[i__ * 11 - 9] = (real) (i__ - 6); mwptx[i__ * 11 - 8] = (real) i__; mwpty[i__ * 11 - 8] = (real) (-i__); mwptx[i__ * 11 - 6] = (real) (6 - i__); mwpty[i__ * 11 - 6] = (real) (i__ - 6); mwptx[i__ * 11 - 5] = (real) (-i__); mwpty[i__ * 11 - 5] = (real) i__; mwptx[i__ * 11 - 4] = (real) (i__ - 6); mwpty[i__ * 11 - 4] = (real) (6 - i__); mwptx[i__ * 11 - 3] = (real) (-i__); mwpty[i__ * 11 - 3] = (real) i__; mwptx[i__ * 11 - 1] = (real) (i__ - 6); mwpty[i__ * 11 - 1] = (real) (6 - i__); /* L160: */ } mwptx[4] = 1.f; mwptx[15] = 3.f; mwptx[26] = 5.f; mwptx[37] = 4.f; mwptx[48] = 5.f; mwpty[4] = -1.f; mwpty[15] = 2.f; mwpty[26] = -2.f; mwpty[37] = 4.f; mwpty[48] = -3.f; mwptx[9] = -1.f; mwptx[20] = -3.f; mwptx[31] = -5.f; mwptx[42] = 4.f; mwptx[53] = 5.f; mwpty[9] = 1.f; mwpty[20] = 2.f; mwpty[31] = 2.f; mwpty[42] = 4.f; mwpty[53] = 3.f; for (i__ = 1; i__ <= 11; ++i__) { combla_1.incx = mwpinx[i__ - 1]; combla_1.incy = mwpiny[i__ - 1]; for (k = 1; k <= 5; ++k) { copyx[k - 1] = mwpx[k - 1]; copyy[k - 1] = mwpy[k - 1]; mwpstx[k - 1] = mwptx[i__ + k * 11 - 12]; mwpsty[k - 1] = mwpty[i__ + k * 11 - 12]; /* L180: */ } srot_(&mwpn[i__ - 1], copyx, &combla_1.incx, copyy, &combla_1.incy, & mwpc[i__ - 1], &mwps[i__ - 1]); stest_(&c__5, copyx, mwpstx, mwpstx, sfac); stest_(&c__5, copyy, mwpsty, mwpsty, sfac); /* L200: */ } return 0; } /* check3_ */
integer i1mach_(integer *i__) { /* Initialized data */ static integer t3e[3] = { 9777664,5323660,46980 }; static integer sc = 0; /* Format strings */ static char fmt_9010[] = "(/\002 Adjust autodoubled I1MACH by uncommenti" "ng data\002/\002 statements appropriate for your machine and set" "ting\002/\002 IMACH(I) = IMACH(I+3) for I = 11, 12, and 13.\002)"; static char fmt_9020[] = "(/\002 Adjust I1MACH by uncommenting data stat" "ements\002/\002 appropriate for your machine.\002)"; /* System generated locals */ integer ret_val; static integer equiv_0[16]; static real equiv_1[2]; /* Builtin functions */ integer s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Local variables */ static integer j, k, i3; #define imach (equiv_0) #define rmach (equiv_1) extern /* Subroutine */ int i1mcr1_(integer *, integer *, integer *, integer *, integer *); #define small ((integer *)equiv_1) #define output (equiv_0 + 3) /* Fortran I/O blocks */ static cilist io___7 = { 0, 6, 0, fmt_9010, 0 }; static cilist io___11 = { 0, 6, 0, fmt_9020, 0 }; static cilist io___12 = { 0, 6, 0, 0, 0 }; /* I1MACH( 1) = THE STANDARD INPUT UNIT. */ /* I1MACH( 2) = THE STANDARD OUTPUT UNIT. */ /* I1MACH( 3) = THE STANDARD PUNCH UNIT. */ /* I1MACH( 4) = THE STANDARD ERROR MESSAGE UNIT. */ /* I1MACH( 5) = THE NUMBER OF BITS PER INTEGER STORAGE UNIT. */ /* I1MACH( 6) = THE NUMBER OF CHARACTERS PER CHARACTER STORAGE UNIT. */ /* INTEGERS HAVE FORM SIGN ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) ) */ /* I1MACH( 7) = A, THE BASE. */ /* I1MACH( 8) = S, THE NUMBER OF BASE-A DIGITS. */ /* I1MACH( 9) = A**S - 1, THE LARGEST MAGNITUDE. */ /* FLOATS HAVE FORM SIGN (B**E)*( (X(1)/B) + ... + (X(T)/B**T) ) */ /* WHERE EMIN .LE. E .LE. EMAX. */ /* I1MACH(10) = B, THE BASE. */ /* SINGLE-PRECISION */ /* I1MACH(11) = T, THE NUMBER OF BASE-B DIGITS. */ /* I1MACH(12) = EMIN, THE SMALLEST EXPONENT E. */ /* I1MACH(13) = EMAX, THE LARGEST EXPONENT E. */ /* DOUBLE-PRECISION */ /* I1MACH(14) = T, THE NUMBER OF BASE-B DIGITS. */ /* I1MACH(15) = EMIN, THE SMALLEST EXPONENT E. */ /* I1MACH(16) = EMAX, THE LARGEST EXPONENT E. */ /* THIS VERSION ADAPTS AUTOMATICALLY TO MOST CURRENT MACHINES, */ /* INCLUDING AUTO-DOUBLE COMPILERS. */ /* TO COMPILE ON OLDER MACHINES, ADD A C IN COLUMN 1 */ /* ON THE NEXT LINE */ /* AND REMOVE THE C FROM COLUMN 1 IN ONE OF THE SECTIONS BELOW. */ /* CONSTANTS FOR EVEN OLDER MACHINES CAN BE OBTAINED BY */ /* mail [email protected] */ /* send old1mach from blas */ /* PLEASE SEND CORRECTIONS TO dmg OR [email protected]. */ /* MACHINE CONSTANTS FOR THE HONEYWELL DPS 8/70 SERIES. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 43 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 35 / */ /* DATA IMACH( 9) / O377777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 27 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 63 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SC/987/ */ /* MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING */ /* 32-BIT INTEGER ARITHMETIC. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / 2147483647 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 56 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SC/987/ */ /* MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES. */ /* NOTE THAT THE PUNCH UNIT, I1MACH(3), HAS BEEN SET TO 7 */ /* WHICH IS APPROPRIATE FOR THE UNIVAC-FOR SYSTEM. */ /* IF YOU HAVE THE UNIVAC-FTN SYSTEM, SET IT TO 1. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 6 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 35 / */ /* DATA IMACH( 9) / O377777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 27 / */ /* DATA IMACH(12) / -128 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 60 / */ /* DATA IMACH(15) /-1024 / */ /* DATA IMACH(16) / 1023 /, SC/987/ */ if (sc != 987) { /* *** CHECK FOR AUTODOUBLE *** */ small[1] = 0; *rmach = 1e13f; if (small[1] != 0) { /* *** AUTODOUBLED *** */ if (small[0] == 1117925532 && small[1] == -448790528 || small[1] == 1117925532 && small[0] == -448790528) { /* *** IEEE *** */ imach[9] = 2; imach[13] = 53; imach[14] = -1021; imach[15] = 1024; } else if (small[0] == -2065213935 && small[1] == 10752) { /* *** VAX WITH D_FLOATING *** */ imach[9] = 2; imach[13] = 56; imach[14] = -127; imach[15] = 127; } else if (small[0] == 1267827943 && small[1] == 704643072) { /* *** IBM MAINFRAME *** */ imach[9] = 16; imach[13] = 14; imach[14] = -64; imach[15] = 63; } else { s_wsfe(&io___7); e_wsfe(); s_stop("777", (ftnlen)3); } imach[10] = imach[13]; imach[11] = imach[14]; imach[12] = imach[15]; } else { *rmach = 1234567.f; if (small[0] == 1234613304) { /* *** IEEE *** */ imach[9] = 2; imach[10] = 24; imach[11] = -125; imach[12] = 128; imach[13] = 53; imach[14] = -1021; imach[15] = 1024; sc = 987; } else if (small[0] == -1271379306) { /* *** VAX *** */ imach[9] = 2; imach[10] = 24; imach[11] = -127; imach[12] = 127; imach[13] = 56; imach[14] = -127; imach[15] = 127; sc = 987; } else if (small[0] == 1175639687) { /* *** IBM MAINFRAME *** */ imach[9] = 16; imach[10] = 6; imach[11] = -64; imach[12] = 63; imach[13] = 14; imach[14] = -64; imach[15] = 63; sc = 987; } else if (small[0] == 1251390520) { /* *** CONVEX C-1 *** */ imach[9] = 2; imach[10] = 24; imach[11] = -128; imach[12] = 127; imach[13] = 53; imach[14] = -1024; imach[15] = 1023; } else { for (i3 = 1; i3 <= 3; ++i3) { j = small[0] / 10000000; k = small[0] - j * 10000000; if (k != t3e[i3 - 1]) { goto L20; } small[0] = j; /* L10: */ } /* *** CRAY T3E *** */ imach[0] = 5; imach[1] = 6; imach[2] = 0; imach[3] = 0; imach[4] = 64; imach[5] = 8; imach[6] = 2; imach[7] = 63; i1mcr1_(&imach[8], &k, &c__32767, &c_b8, &c_b8); imach[9] = 2; imach[10] = 53; imach[11] = -1021; imach[12] = 1024; imach[13] = 53; imach[14] = -1021; imach[15] = 1024; goto L35; L20: i1mcr1_(&j, &k, &c__16405, &c_b12, &c__0); if (small[0] != j) { s_wsfe(&io___11); e_wsfe(); s_stop("777", (ftnlen)3); } /* *** CRAY 1, XMP, 2, AND 3 *** */ imach[0] = 5; imach[1] = 6; imach[2] = 102; imach[3] = 6; imach[4] = 46; imach[5] = 8; imach[6] = 2; imach[7] = 45; i1mcr1_(&imach[8], &k, &c__0, &c_b18, &c_b8); imach[9] = 2; imach[10] = 47; imach[11] = -8188; imach[12] = 8189; imach[13] = 94; imach[14] = -8141; imach[15] = 8189; goto L35; } } imach[0] = 5; imach[1] = 6; imach[2] = 7; imach[3] = 6; imach[4] = 32; imach[5] = 4; imach[6] = 2; imach[7] = 31; imach[8] = 2147483647; L35: sc = 987; } if (*i__ < 1 || *i__ > 16) { goto L40; } ret_val = imach[*i__ - 1]; return ret_val; L40: s_wsle(&io___12); do_lio(&c__9, &c__1, "I1MACH(I): I =", (ftnlen)14); do_lio(&c__3, &c__1, (char *)&(*i__), (ftnlen)sizeof(integer)); do_lio(&c__9, &c__1, " is out of bounds.", (ftnlen)18); e_wsle(); s_stop("", (ftnlen)0); /* /+ C source for I1MACH -- remove the * in column 1 +/ */ /* /+ Note that some values may need changing. +/ */ /* #include <stdio.h> */ /* #include <float.h> */ /* #include <limits.h> */ /* #include <math.h> */ /* long i1mach_(long *i) */ /* { */ /* switch(*i){ */ /* case 1: return 5; /+ standard input +/ */ /* case 2: return 6; /+ standard output +/ */ /* case 3: return 7; /+ standard punch +/ */ /* case 4: return 0; /+ standard error +/ */ /* case 5: return 32; /+ bits per integer +/ */ /* case 6: return sizeof(int); */ /* case 7: return 2; /+ base for integers +/ */ /* case 8: return 31; /+ digits of integer base +/ */ /* case 9: return LONG_MAX; */ /* case 10: return FLT_RADIX; */ /* case 11: return FLT_MANT_DIG; */ /* case 12: return FLT_MIN_EXP; */ /* case 13: return FLT_MAX_EXP; */ /* case 14: return DBL_MANT_DIG; */ /* case 15: return DBL_MIN_EXP; */ /* case 16: return DBL_MAX_EXP; */ /* } */ /* fprintf(stderr, "invalid argument: i1mach(%ld)\n", *i); */ /* exit(1);return 0; /+ some compilers demand return values +/ */ /* } */ return ret_val; } /* i1mach_ */
/* Subroutine */ int consts_(doublereal *coord) { /* System generated locals */ integer i__1, i__2, i__3, i__4; doublereal d__1, d__2, d__3, d__4; /* Builtin functions */ double sqrt(doublereal); integer s_wsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_wsle(void); /* Subroutine */ int s_stop(char *, ftnlen); double cos(doublereal), pow_dd(doublereal *, doublereal *); /* Local variables */ static integer i__, j, k, l; static doublereal r__, x; static integer i0, j1, j2, n0[2]; static doublereal x1, x2, x3, y1, y2, y3, aa; static integer ii; static doublereal ds, xa[3], ri, rj; #define iw ((integer *)&chanel_1 + 5) static doublereal xi[3], xj[3]; static integer ix; static doublereal sp, xx[3]; static integer nn1, nn2, nn3; static doublereal aij; static logical din[1082]; static integer ipm, ips, jps; static doublereal spm; #define xsp ((doublereal *)&solv_1 + 161325) static doublereal c2ds; static integer nps0, nps3, nara, nari, narj, info, jmax; static doublereal sdis, dist; static integer ipiv[400], nset[64920]; static logical isup; static doublereal sdis0, dist1, dist2, dist3, fdiag; static integer narea, nsetf[400], inset; extern /* Subroutine */ int dgetrf_(integer *, integer *, doublereal *, integer *, integer *, integer *), dgetri_(integer *, doublereal *, integer *, integer *, doublereal *, integer *, integer *); static integer nsetfi, nsetfj, maxnps; static doublereal sininv; /* Fortran I/O blocks */ static cilist io___6 = { 0, 0, 0, 0, 0 }; static cilist io___43 = { 0, 0, 0, 0, 0 }; static cilist io___65 = { 0, 6, 0, 0, 0 }; static cilist io___66 = { 0, 6, 0, 0, 0 }; /* THIS ROUTINE CONSTRUCTS OR UPDATES THE SOLVENT-ACCESSIBLE */ /* SURFACE (SAS) */ /* COMDECK SIZES */ /* *********************************************************************** */ /* THIS FILE CONTAINS ALL THE ARRAY SIZES FOR USE IN MOPAC. */ /* THERE ARE ONLY 5 PARAMETERS THAT THE PROGRAMMER NEED SET: */ /* MAXHEV = MAXIMUM NUMBER OF HEAVY ATOMS (HEAVY: NON-HYDROGEN ATOMS) */ /* MAXLIT = MAXIMUM NUMBER OF HYDROGEN ATOMS. */ /* MAXTIM = DEFAULT TIME FOR A JOB. (SECONDS) */ /* MAXDMP = DEFAULT TIME FOR AUTOMATIC RESTART FILE GENERATION (SECS) */ /* ISYBYL = 1 IF MOPAC IS TO BE USED IN THE SYBYL PACKAGE, =0 OTHERWISE */ /* SEE ALSO NMECI, NPULAY AND MESP AT THE END OF THIS FILE */ /* *********************************************************************** */ /* THE FOLLOWING CODE DOES NOT NEED TO BE ALTERED BY THE PROGRAMMER */ /* *********************************************************************** */ /* ALL OTHER PARAMETERS ARE DERIVED FUNCTIONS OF THESE TWO PARAMETERS */ /* NAME DEFINITION */ /* NUMATM MAXIMUM NUMBER OF ATOMS ALLOWED. */ /* MAXORB MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXPAR MAXIMUM NUMBER OF PARAMETERS FOR OPTIMISATION. */ /* N2ELEC MAXIMUM NUMBER OF TWO ELECTRON INTEGRALS ALLOWED. */ /* MPACK AREA OF LOWER HALF TRIANGLE OF DENSITY MATRIX. */ /* MORB2 SQUARE OF THE MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXHES AREA OF HESSIAN MATRIX */ /* MAXALL LARGER THAN MAXORB OR MAXPAR. */ /* *********************************************************************** */ /* *********************************************************************** */ /* DECK MOPAC */ /* Parameter adjustments */ coord -= 4; /* Function Body */ solv_1.nps = solvps_1.npsx; solv_1.nps2 = solvps_1.nps2x; isup = solv_1.nps > 0; n0[0] = solv_1.nps2; n0[1] = -solv_1.nps; maxnps = sqrt(324000.25099999999f) - solv_1.nden - .5f; maxnps = min(maxnps,400); if (maxnps < molkst_1.numat * 3) { io___6.ciunit = *iw; s_wsle(&io___6); do_lio(&c__9, &c__1, " PARAMETER LENABC MUST BE INCREASED FOR THIS S" "YSTEM", (ftnlen)51); e_wsle(); s_stop(" PARAMETER LENABC MUST BE INCREASED FOR THIS SYSTEM", (ftnlen) 51); } if (isup) { nps3 = 400 - solv_1.nps; for (i__ = solv_1.nps; i__ >= 1; --i__) { solvi_1.iatsp[nps3 + i__ - 1] = solvi_1.iatsp[i__ - 1]; for (ix = 1; ix <= 3; ++ix) { solv_1.cosurf[ix + (nps3 + i__) * 3 - 4] = solv_1.cosurf[ix + i__ * 3 - 4]; /* L10: */ } } ++nps3; } sdis = 0.; fdiag = sqrt(1082.) * 1.05; inset = 1; solvi_1.iatsp[400] = 0; solv_1.nps = 0; areavd_1.area = 0.; i__1 = molkst_1.numat; for (i__ = 1; i__ <= i__1; ++i__) { ds = sqrt(4. / solv_1.nspa); if (molkst_1.nat[i__ - 1] == 1) { ds *= 2; } c2ds = cos(ds * 2.); r__ = solv_1.srad[i__ - 1]; ri = r__ - solv_1.rds; for (ix = 1; ix <= 3; ++ix) { /* L20: */ xa[ix - 1] = coord[ix + i__ * 3]; } nps0 = solv_1.nps + 1; if (isup) { if (solv_1.nps >= nps3) { s_stop("NPS .GT. NPS3", (ftnlen)13); } solv_1.nps2 = nps3; /* IF (IATSP(NPS0) .NE. I) GO TO 340 */ for (ips = solv_1.nps2; ips <= 401; ++ips) { /* L30: */ if (solvi_1.iatsp[ips - 1] != i__) { goto L40; } } L40: nps3 = ips; /* TRANSFORM COSURF ACCORDING TO TM(INV) */ i__2 = nps3 - 1; for (j = solv_1.nps2; j <= i__2; ++j) { xx[0] = solv_1.cosurf[j * 3 - 3]; xx[1] = solv_1.cosurf[j * 3 - 2]; xx[2] = solv_1.cosurf[j * 3 - 1]; solv_1.cosurf[j * 3 - 3] = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 12] + xx[2] * solv_1.tm[(i__ * 3 + 3) * 3 - 12]; solv_1.cosurf[j * 3 - 2] = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 11] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 3) * 3 - 11]; solv_1.cosurf[j * 3 - 1] = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 10] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 10] + xx[2] * solv_1.tm[(i__ * 3 + 3) * 3 - 10]; /* L50: */ } nn1 = dirvec_1.nn[i__ * 3 - 3]; nn2 = dirvec_1.nn[i__ * 3 - 2]; nn3 = dirvec_1.nn[i__ * 3 - 1]; } else { /* SEARCH FOR 3 NEAREST NEIGHBOR ATOMS */ dist1 = 1e20; dist2 = 1e20; dist3 = 1e20; nn1 = 0; nn2 = 0; nn3 = 0; i__2 = molkst_1.numat; for (j = 1; j <= i__2; ++j) { if (j == i__) { goto L70; } dist = 0.; for (ix = 1; ix <= 3; ++ix) { /* L60: */ /* Computing 2nd power */ d__1 = xa[ix - 1] - coord[ix + j * 3]; dist += d__1 * d__1; } if (dist + .05 < dist3) { dist3 = dist; nn3 = j; } if (dist3 + .05 < dist2) { dist = dist2; dist2 = dist3; dist3 = dist; nn3 = nn2; nn2 = j; } if (dist2 + .05 < dist1) { dist = dist1; dist1 = dist2; dist2 = dist; nn2 = nn1; nn1 = j; } L70: ; } dirvec_1.nn[i__ * 3 - 3] = nn1; dirvec_1.nn[i__ * 3 - 2] = nn2; dirvec_1.nn[i__ * 3 - 1] = nn3; } /* BUILD NEW TRANSFORMATION MATRIX */ if (nn1 == 0) { solv_1.tm[(i__ * 3 + 1) * 3 - 12] = 1.; solv_1.tm[(i__ * 3 + 2) * 3 - 12] = 0.; solv_1.tm[(i__ * 3 + 3) * 3 - 12] = 0.; } else { dist1 = 0.; for (ix = 1; ix <= 3; ++ix) { /* L80: */ /* Computing 2nd power */ d__1 = xa[ix - 1] - coord[ix + nn1 * 3]; dist1 += d__1 * d__1; } dist = 1. / sqrt(dist1); solv_1.tm[(i__ * 3 + 1) * 3 - 12] = (coord[nn1 * 3 + 1] - xa[0]) * dist; solv_1.tm[(i__ * 3 + 2) * 3 - 12] = (coord[nn1 * 3 + 2] - xa[1]) * dist; solv_1.tm[(i__ * 3 + 3) * 3 - 12] = (coord[nn1 * 3 + 3] - xa[2]) * dist; } L90: if (nn2 == 0) { /* Computing 2nd power */ d__1 = solv_1.tm[(i__ * 3 + 3) * 3 - 12]; /* Computing 2nd power */ d__2 = solv_1.tm[(i__ * 3 + 2) * 3 - 12]; /* Computing 2nd power */ d__3 = solv_1.tm[(i__ * 3 + 1) * 3 - 12]; dist = sqrt(d__1 * d__1 + d__2 * d__2 + d__3 * d__3); solv_1.tm[(i__ * 3 + 1) * 3 - 11] = -solv_1.tm[(i__ * 3 + 2) * 3 - 12] / dist; solv_1.tm[(i__ * 3 + 2) * 3 - 11] = solv_1.tm[(i__ * 3 + 1) * 3 - 12] / dist; solv_1.tm[(i__ * 3 + 3) * 3 - 11] = 0.; } else { dist2 = 0.; for (ix = 1; ix <= 3; ++ix) { /* L100: */ /* Computing 2nd power */ d__1 = xa[ix - 1] - coord[ix + nn2 * 3]; dist2 += d__1 * d__1; } dist = 1. / sqrt(dist2); xx[0] = (coord[nn2 * 3 + 1] - xa[0]) * dist; xx[1] = (coord[nn2 * 3 + 2] - xa[1]) * dist; xx[2] = (coord[nn2 * 3 + 3] - xa[2]) * dist; sp = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 12] + xx[2] * solv_1.tm[( i__ * 3 + 3) * 3 - 12]; if (sp * sp > .99) { nn2 = nn3; nn3 = 0; dist2 = dist3; goto L90; } sininv = 1. / sqrt(1. - sp * sp); solv_1.tm[(i__ * 3 + 1) * 3 - 11] = (xx[0] - sp * solv_1.tm[(i__ * 3 + 1) * 3 - 12]) * sininv; solv_1.tm[(i__ * 3 + 2) * 3 - 11] = (xx[1] - sp * solv_1.tm[(i__ * 3 + 2) * 3 - 12]) * sininv; solv_1.tm[(i__ * 3 + 3) * 3 - 11] = (xx[2] - sp * solv_1.tm[(i__ * 3 + 3) * 3 - 12]) * sininv; } solv_1.tm[(i__ * 3 + 1) * 3 - 10] = solv_1.tm[(i__ * 3 + 2) * 3 - 12] * solv_1.tm[(i__ * 3 + 3) * 3 - 11] - solv_1.tm[(i__ * 3 + 2) * 3 - 11] * solv_1.tm[(i__ * 3 + 3) * 3 - 12]; solv_1.tm[(i__ * 3 + 2) * 3 - 10] = solv_1.tm[(i__ * 3 + 3) * 3 - 12] * solv_1.tm[(i__ * 3 + 1) * 3 - 11] - solv_1.tm[(i__ * 3 + 3) * 3 - 11] * solv_1.tm[(i__ * 3 + 1) * 3 - 12]; solv_1.tm[(i__ * 3 + 3) * 3 - 10] = solv_1.tm[(i__ * 3 + 1) * 3 - 12] * solv_1.tm[(i__ * 3 + 2) * 3 - 11] - solv_1.tm[(i__ * 3 + 1) * 3 - 11] * solv_1.tm[(i__ * 3 + 2) * 3 - 12]; /* TRANSFORM DIRVEC ACCORDING TO TM */ for (j = 1; j <= 1082; ++j) { xx[0] = dirvec_1.dirvec[j * 3 - 3]; xx[1] = dirvec_1.dirvec[j * 3 - 2]; xx[2] = dirvec_1.dirvec[j * 3 - 1]; for (ix = 1; ix <= 3; ++ix) { x = xx[0] * solv_1.tm[(ix + i__ * 3) * 3 - 12] + xx[1] * solv_1.tm[(ix + i__ * 3) * 3 - 11] + xx[2] * solv_1.tm[(ix + i__ * 3) * 3 - 10]; solv_1.dirtm[ix + j * 3 - 4] = x; /* L110: */ } } /* FIND THE POINTS OF THE BASIC GRID ON THE SAS */ narea = 0; for (j = 1; j <= 1082; ++j) { din[j - 1] = FALSE_; for (ix = 1; ix <= 3; ++ix) { xx[ix - 1] = xa[ix - 1] + solv_1.dirtm[ix + j * 3 - 4] * r__; /* L130: */ } i__2 = molkst_1.numat; for (k = 1; k <= i__2; ++k) { if (k == i__) { goto L150; } dist = 0.; for (ix = 1; ix <= 3; ++ix) { /* Computing 2nd power */ d__1 = xx[ix - 1] - coord[ix + k * 3]; dist += d__1 * d__1; /* L140: */ } dist = sqrt(dist) - solv_1.srad[k - 1]; if (dist < 0.) { goto L160; } L150: ; } ++narea; din[j - 1] = TRUE_; L160: ; } if (narea == 0) { goto L340; } areavd_1.area += narea * ri * ri; if (isup) { i__2 = nps3 - 1; for (j = solv_1.nps2; j <= i__2; ++j) { ++solv_1.nps; solvi_1.iatsp[solv_1.nps - 1] = i__; xx[0] = solv_1.cosurf[j * 3 - 3]; xx[1] = solv_1.cosurf[j * 3 - 2]; xx[2] = solv_1.cosurf[j * 3 - 1]; solv_1.cosurf[solv_1.nps * 3 - 3] = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 1) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 1) * 3 - 10]; solv_1.cosurf[solv_1.nps * 3 - 2] = xx[0] * solv_1.tm[(i__ * 3 + 2) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 2) * 3 - 10]; solv_1.cosurf[solv_1.nps * 3 - 1] = xx[0] * solv_1.tm[(i__ * 3 + 3) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 3) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 3) * 3 - 10]; /* L120: */ } } else { i0 = 2 - 1 / molkst_1.nat[i__ - 1]; jmax = n0[i0 - 1]; i0 = (i0 - 1) * 3246 - 3; i__2 = jmax; for (j = 1; j <= i__2; ++j) { ++solv_1.nps; solvi_1.iatsp[solv_1.nps - 1] = i__; xx[0] = solv_1.abcmat[i0 + j * 3]; xx[1] = solv_1.abcmat[i0 + j * 3 + 1]; xx[2] = solv_1.abcmat[i0 + j * 3 + 2]; solv_1.cosurf[solv_1.nps * 3 - 3] = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 1) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 1) * 3 - 10]; solv_1.cosurf[solv_1.nps * 3 - 2] = xx[0] * solv_1.tm[(i__ * 3 + 2) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 2) * 3 - 10]; solv_1.cosurf[solv_1.nps * 3 - 1] = xx[0] * solv_1.tm[(i__ * 3 + 3) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 3) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 3) * 3 - 10]; /* L45: */ } } L200: sdis0 = sdis; i__2 = solv_1.nps; for (ips = nps0; ips <= i__2; ++ips) { solvi_1.nar[ips - 1] = 0; xsp[ips * 3 - 3] = 0.; xsp[ips * 3 - 2] = 0.; xsp[ips * 3 - 1] = 0.; /* L210: */ } for (j = 1; j <= 1082; ++j) { if (! din[j - 1]) { goto L250; } spm = -1.; x1 = solv_1.dirtm[j * 3 - 3]; x2 = solv_1.dirtm[j * 3 - 2]; x3 = solv_1.dirtm[j * 3 - 1]; i__2 = solv_1.nps; for (ips = nps0; ips <= i__2; ++ips) { sp = x1 * solv_1.cosurf[ips * 3 - 3] + x2 * solv_1.cosurf[ips * 3 - 2] + x3 * solv_1.cosurf[ips * 3 - 1]; if (sp < spm) { goto L220; } spm = sp; ipm = ips; L220: ; } if (spm < c2ds) { ++solv_1.nps; if (solv_1.nps > maxnps) { io___43.ciunit = *iw; s_wsle(&io___43); do_lio(&c__9, &c__1, "NPS IS GREATER THAN MAXNPS-USE SMA" "LLER NSPA", (ftnlen)43); e_wsle(); s_stop("NPS GREATER THAN MAXNPS", (ftnlen)23); } for (ix = 1; ix <= 3; ++ix) { /* L230: */ solv_1.cosurf[ix + solv_1.nps * 3 - 4] = solv_1.dirtm[ix + j * 3 - 4]; } solvi_1.iatsp[solv_1.nps - 1] = i__; goto L200; } ++solvi_1.nar[ipm - 1]; for (ix = 1; ix <= 3; ++ix) { /* L240: */ xsp[ix + ipm * 3 - 4] += solv_1.dirtm[ix + j * 3 - 4]; } L250: ; } sdis = 0.; ips = nps0 - 1; if (solv_1.nps < ips) { goto L200; } L260: ++ips; L352: if (solvi_1.nar[ips - 1] == 0) { --solv_1.nps; if (solv_1.nps < ips) { goto L200; } i__2 = solv_1.nps; for (jps = ips; jps <= i__2; ++jps) { solvi_1.nar[jps - 1] = solvi_1.nar[jps]; xsp[jps * 3 - 3] = xsp[(jps + 1) * 3 - 3]; xsp[jps * 3 - 2] = xsp[(jps + 1) * 3 - 2]; /* L369: */ xsp[jps * 3 - 1] = xsp[(jps + 1) * 3 - 1]; } goto L352; } dist = 0.; for (ix = 1; ix <= 3; ++ix) { x = xsp[ix + ips * 3 - 4]; dist += x * x; /* L280: */ } sdis += dist; dist = 1. / sqrt(dist); for (ix = 1; ix <= 3; ++ix) { /* L290: */ solv_1.cosurf[ix + ips * 3 - 4] = xsp[ix + ips * 3 - 4] * dist; } if (ips < solv_1.nps) { goto L260; } if ((d__1 = sdis - sdis0, abs(d__1)) > 1e-5) { goto L200; } i__2 = solv_1.nps; for (ips = nps0; ips <= i__2; ++ips) { nsetf[ips - 1] = inset; inset += solvi_1.nar[ips - 1]; solvi_1.nar[ips - 1] = 0; for (ix = 1; ix <= 3; ++ix) { /* L300: */ xsp[ix + ips * 3 - 4] = xa[ix - 1] + solv_1.cosurf[ix + ips * 3 - 4] * ri; } /* L310: */ } for (j = 1; j <= 1082; ++j) { if (! din[j - 1]) { goto L330; } spm = -1.; x1 = solv_1.dirtm[j * 3 - 3]; x2 = solv_1.dirtm[j * 3 - 2]; x3 = solv_1.dirtm[j * 3 - 1]; i__2 = solv_1.nps; for (ips = nps0; ips <= i__2; ++ips) { sp = x1 * solv_1.cosurf[ips * 3 - 3] + x2 * solv_1.cosurf[ips * 3 - 2] + x3 * solv_1.cosurf[ips * 3 - 1]; if (sp < spm) { goto L320; } spm = sp; ipm = ips; L320: ; } if (spm < c2ds) { goto L330; } nara = solvi_1.nar[ipm - 1]; nset[nsetf[ipm - 1] + nara - 1] = j; solvi_1.nar[ipm - 1] = nara + 1; L330: ; } L340: ; } areavd_1.area = areavd_1.area * 4. * 3.14159 / 1082; /* FILLING AAMAT */ i__1 = solv_1.nps; for (ips = 1; ips <= i__1; ++ips) { i__ = solvi_1.iatsp[ips - 1]; ri = solv_1.srad[i__ - 1] - solv_1.rds; nari = solvi_1.nar[ips - 1]; nsetfi = nsetf[ips - 1]; aa = 0.; i__2 = nsetfi + nari - 1; for (k = nsetfi; k <= i__2; ++k) { j1 = nset[k - 1]; aa += fdiag; x1 = dirvec_1.dirvec[j1 * 3 - 3]; x2 = dirvec_1.dirvec[j1 * 3 - 2]; x3 = dirvec_1.dirvec[j1 * 3 - 1]; i__3 = k - 1; for (l = nsetfi; l <= i__3; ++l) { j2 = nset[l - 1]; /* Computing 2nd power */ d__1 = x1 - dirvec_1.dirvec[j2 * 3 - 3]; /* Computing 2nd power */ d__2 = x2 - dirvec_1.dirvec[j2 * 3 - 2]; /* Computing 2nd power */ d__3 = x3 - dirvec_1.dirvec[j2 * 3 - 1]; aa += 2. / sqrt(d__1 * d__1 + d__2 * d__2 + d__3 * d__3); /* L350: */ } } /* Computing 2nd power */ i__3 = nari; aa = aa / ri / (i__3 * i__3); solv_1.abcmat[ips + (ips - 1) * solv_1.nps - 1] = aa; for (ix = 1; ix <= 3; ++ix) { xi[ix - 1] = coord[ix + i__ * 3]; /* L360: */ xa[ix - 1] = xsp[ix + ips * 3 - 4]; } i__3 = solv_1.nps; for (jps = ips + 1; jps <= i__3; ++jps) { narj = solvi_1.nar[jps - 1]; nsetfj = nsetf[jps - 1]; j = solvi_1.iatsp[jps - 1]; dist = 0.; for (ix = 1; ix <= 3; ++ix) { xj[ix - 1] = coord[ix + j * 3] - xi[ix - 1]; /* L370: */ /* Computing 2nd power */ d__1 = xsp[ix + jps * 3 - 4] - xa[ix - 1]; dist += d__1 * d__1; } if (dist < solv_1.disex2) { rj = solv_1.srad[j - 1] - solv_1.rds; aij = 0.; i__2 = nsetfi + nari - 1; for (k = nsetfi; k <= i__2; ++k) { j1 = nset[k - 1]; for (ix = 1; ix <= 3; ++ix) { /* L380: */ xx[ix - 1] = dirvec_1.dirvec[ix + j1 * 3 - 4] * ri; } if (i__ != j) { x1 = xx[0] * solv_1.tm[(i__ * 3 + 1) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 1) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 1) * 3 - 10] - xj[0]; x2 = xx[0] * solv_1.tm[(i__ * 3 + 2) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 2) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 2) * 3 - 10] - xj[1]; x3 = xx[0] * solv_1.tm[(i__ * 3 + 3) * 3 - 12] + xx[1] * solv_1.tm[(i__ * 3 + 3) * 3 - 11] + xx[2] * solv_1.tm[(i__ * 3 + 3) * 3 - 10] - xj[2]; i__4 = nsetfj + narj - 1; for (l = nsetfj; l <= i__4; ++l) { j2 = nset[l - 1]; for (ix = 1; ix <= 3; ++ix) { /* L390: */ xx[ix - 1] = dirvec_1.dirvec[ix + j2 * 3 - 4] * rj; } y1 = xx[0] * solv_1.tm[(j * 3 + 1) * 3 - 12] + xx[ 1] * solv_1.tm[(j * 3 + 1) * 3 - 11] + xx[ 2] * solv_1.tm[(j * 3 + 1) * 3 - 10] - x1; y2 = xx[0] * solv_1.tm[(j * 3 + 2) * 3 - 12] + xx[ 1] * solv_1.tm[(j * 3 + 2) * 3 - 11] + xx[ 2] * solv_1.tm[(j * 3 + 2) * 3 - 10] - x2; y3 = xx[0] * solv_1.tm[(j * 3 + 3) * 3 - 12] + xx[ 1] * solv_1.tm[(j * 3 + 3) * 3 - 11] + xx[ 2] * solv_1.tm[(j * 3 + 3) * 3 - 10] - x3; aij += 1. / sqrt(y1 * y1 + y2 * y2 + y3 * y3); /* L400: */ } } else { /* L410: */ i__4 = nsetfj + narj - 1; for (l = nsetfj; l <= i__4; ++l) { j2 = nset[l - 1]; /* AA=((DIRVEC(1,J2)*RJ-XX(1))**2+(DIRVEC(2,J2)*RJ */ /* & -XX(2))**2+(DIRVEC(3,J2)*RJ-XX(3))**2) */ /* ***** Modified by Jiro Toyoda at 1994-05-25 ***** */ /* AIJ=AIJ+((DIRVEC(1,J2)*RJ-XX(1))**2+(DIRVEC(2,J2 */ /* 1)*RJ -XX(2))**2+(DIRVEC(3,J2)*RJ-XX(3))**2)**-.5 */ /* 2D0 */ /* Computing 2nd power */ d__2 = dirvec_1.dirvec[j2 * 3 - 3] * rj - xx[0]; /* Computing 2nd power */ d__3 = dirvec_1.dirvec[j2 * 3 - 2] * rj - xx[1]; /* Computing 2nd power */ d__4 = dirvec_1.dirvec[j2 * 3 - 1] * rj - xx[2]; d__1 = d__2 * d__2 + d__3 * d__3 + d__4 * d__4; aij += pow_dd(&d__1, &c_b55); /* ***************************** at 1994-05-25 ***** */ /* L420: */ } } /* L430: */ } aij = aij / nari / narj; } else { aij = 1. / sqrt(dist); } solv_1.abcmat[ips + (jps - 1) * solv_1.nps - 1] = aij; solv_1.abcmat[jps + (ips - 1) * solv_1.nps - 1] = aij; /* L440: */ } /* L450: */ } /* INVERT A-MATRIX */ dgetrf_(&solv_1.nps, &solv_1.nps, solv_1.abcmat, &solv_1.nps, ipiv, &info) ; if (info != 0) { s_wsle(&io___65); do_lio(&c__9, &c__1, " DGETRF FAILED WITH ERROR CODE ", (ftnlen)31); do_lio(&c__3, &c__1, (char *)&info, (ftnlen)sizeof(integer)); e_wsle(); s_stop("CONSTS", (ftnlen)6); } dgetri_(&solv_1.nps, solv_1.abcmat, &solv_1.nps, ipiv, xsp, &c__1200, & info); if (info != 0) { s_wsle(&io___66); do_lio(&c__9, &c__1, " DGETRI FAILED WITH ERROR CODE ", (ftnlen)31); do_lio(&c__3, &c__1, (char *)&info, (ftnlen)sizeof(integer)); e_wsle(); s_stop("CONSTS", (ftnlen)6); } /* STORE INV. A-MATRIX AS LOWER TRIANGLE */ ii = 0; i__1 = solv_1.nps; for (i__ = 1; i__ <= i__1; ++i__) { i__3 = i__; for (j = 1; j <= i__3; ++j) { ++ii; solv_1.abcmat[ii - 1] = solv_1.abcmat[j + (i__ - 1) * solv_1.nps - 1]; /* L460: */ } } solv_1.nps2 = ii; return 0; } /* consts_ */
/* Subroutine */ int getgeo_(integer *iread, integer *labels, doublereal *geo, integer *lopt, integer *na, integer *nb, integer *nc, doublereal * ams, integer *natoms, logical *int__) { /* Initialized data */ static char elemnt[2*107] = "H " "HE" "LI" "BE" "B " "C " "N " "O " "F " "NE" "NA" "MG" "AL" "SI" "P " "S " "CL" "AR" "K " "CA" "SC" "TI" "V " "CR" "MN" "FE" "CO" "NI" "CU" "ZN" "GA" "GE" "AS" "SE" "BR" "KR" "RB" "SR" "Y " "ZR" "NB" "MO" "TC" "RU" "RH" "PD" "AG" "CD" "IN" "SN" "SB" "TE" "I " "XE" "CS" "BA" "LA" "CE" "PR" "ND" "PM" "SM" "EU" "GD" "TB" "DY" "HO" "ER" "TM" "YB" "LU" "HF" "TA" "W " "RE" "OS" "IR" "PT" "AU" "HG" "TL" "PB" "BI" "PO" "AT" "RN" "FR" "RA" "AC" "TH" "PA" "U " "NP" "PU" "AM" "CM" "BK" "CF" "XX" "FM" "MD" "CB" "++" "+ " "--" "- " "TV"; static char comma[1] = ","; static char space[1] = " "; static char nine[1] = "9"; static char zero[1] = "0"; /* Format strings */ static char fmt_260[] = "(i4,2x,3(f10.5,2x,i2,2x),3(i2,1x))"; /* System generated locals */ address a__1[2]; integer i__1, i__2, i__3[2]; doublereal d__1, d__2; /* Builtin functions */ integer i_indx(char *, char *, ftnlen, ftnlen); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void), s_cmp(char *, char *, ftnlen, ftnlen); /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); integer s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); double sqrt(doublereal), d_sign(doublereal *, doublereal *), asin( doublereal); /* Local variables */ static integer i__, j, k, l; static doublereal ca, sa; static integer jj; static char ele[2], tab[1]; static doublereal xyz[360] /* was [3][120] */; static integer itab; static doublereal real__; static integer khar; static char line[80]; static integer ndmy; static char turn[1]; static doublereal temp1, temp2; extern doublereal reada_(char *, integer *, ftnlen); static integer icapa, label, iline, icapz, ilowa; static doublereal value[40]; extern /* Subroutine */ int geout_(integer *); static integer numat, iserr; static doublereal const__; static integer ilowz; static doublereal degree; static integer icomma; static logical ircdrc, leadsp; extern /* Subroutine */ int nuchar_(char *, doublereal *, integer *, ftnlen); static integer nvalue; static doublereal weight; static integer istart[40]; static char string[80]; static integer maxtxt; extern /* Subroutine */ int xyzint_(doublereal *, integer *, integer *, integer *, integer *, doublereal *, doublereal *); /* Fortran I/O blocks */ static cilist io___16 = { 1, 0, 1, "(A)", 0 }; static cilist io___29 = { 0, 6, 0, "(' ILLEGAL ATOMIC NUMBER')", 0 }; static cilist io___32 = { 0, 6, 0, "(' UNRECOGNIZED ELEMENT NAME: (',A," "')')", 0 }; static cilist io___33 = { 0, 6, 0, "(' FOR ATOM',I4,' ISOTOPIC MASS:' " " ,F15.5)", 0 }; static cilist io___34 = { 0, 6, 0, "(//10X,'**** MAX. NUMBER OF ATOMS A" "LLOWED:',I4)", 0 }; static cilist io___36 = { 0, 6, 0, "(A)", 0 }; static cilist io___38 = { 0, 6, 0, "(A)", 0 }; static cilist io___41 = { 0, 6, 0, "(//10X,' WARNING: INTERNAL COORDINAT" "ES ARE ASSUMED -',/10X,' FOR THREE-ATOM SYSTEMS ',//)", 0 }; static cilist io___42 = { 0, 6, 0, "(A)", 0 }; static cilist io___43 = { 0, 5, 0, "(A)", 0 }; static cilist io___46 = { 0, 6, 0, "(/10X,A)", 0 }; static cilist io___53 = { 0, 6, 0, "(A)", 0 }; static cilist io___54 = { 0, 6, 0, "(//10X,' AN UNOPTIMIZABLE GEOMETRIC " "PARAMETER HAS',/10X,' BEEN MARKED FOR OPTIMIZATION. THIS IS A NO" "N-FATAL ' ,'ERROR')", 0 }; static cilist io___55 = { 0, 6, 0, "( ' ERROR DURING READ AT ATOM NUMBER" " ', I3 )", 0 }; static cilist io___56 = { 0, 6, 0, "(' DATA CURRENTLY READ IN ARE ')", 0 } ; static cilist io___57 = { 0, 6, 0, fmt_260, 0 }; /* COMDECK SIZES */ /* *********************************************************************** */ /* THIS FILE CONTAINS ALL THE ARRAY SIZES FOR USE IN MOPAC. */ /* THERE ARE ONLY 5 PARAMETERS THAT THE PROGRAMMER NEED SET: */ /* MAXHEV = MAXIMUM NUMBER OF HEAVY ATOMS (HEAVY: NON-HYDROGEN ATOMS) */ /* MAXLIT = MAXIMUM NUMBER OF HYDROGEN ATOMS. */ /* MAXTIM = DEFAULT TIME FOR A JOB. (SECONDS) */ /* MAXDMP = DEFAULT TIME FOR AUTOMATIC RESTART FILE GENERATION (SECS) */ /* ISYBYL = 1 IF MOPAC IS TO BE USED IN THE SYBYL PACKAGE, =0 OTHERWISE */ /* SEE ALSO NMECI, NPULAY AND MESP AT THE END OF THIS FILE */ /* *********************************************************************** */ /* THE FOLLOWING CODE DOES NOT NEED TO BE ALTERED BY THE PROGRAMMER */ /* *********************************************************************** */ /* ALL OTHER PARAMETERS ARE DERIVED FUNCTIONS OF THESE TWO PARAMETERS */ /* NAME DEFINITION */ /* NUMATM MAXIMUM NUMBER OF ATOMS ALLOWED. */ /* MAXORB MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXPAR MAXIMUM NUMBER OF PARAMETERS FOR OPTIMISATION. */ /* N2ELEC MAXIMUM NUMBER OF TWO ELECTRON INTEGRALS ALLOWED. */ /* MPACK AREA OF LOWER HALF TRIANGLE OF DENSITY MATRIX. */ /* MORB2 SQUARE OF THE MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXHES AREA OF HESSIAN MATRIX */ /* MAXALL LARGER THAN MAXORB OR MAXPAR. */ /* *********************************************************************** */ /* *********************************************************************** */ /* DECK MOPAC */ /* *********************************************************************** */ /* GETGEO READS IN THE GEOMETRY. THE ELEMENT IS SPECIFIED BY IT'S */ /* CHEMICAL SYMBOL, OR, OPTIONALLY, BY IT'S ATOMIC NUMBER. */ /* ON INPUT IREAD = CHANNEL NUMBER FOR READ, NORMALLY 5 */ /* AMS = DEFAULT ATOMIC MASSES. */ /* ON OUTPUT LABELS = ATOMIC NUMBERS OF ALL ATOMS, INCLUDING DUMMIES. */ /* GEO = INTERNAL COORDINATES, IN ANGSTROMS, AND DEGREES. */ /* LOPT = INTEGER ARRAY, A '1' MEANS OPTIMIZE THIS PARAMETER, */ /* '0' MEANS DO NOT OPTIMIZE, AND A '-1' LABELS THE */ /* REACTION COORDINATE. */ /* NA = INTEGER ARRAY OF ATOMS (SEE DATA INPUT) */ /* NB = INTEGER ARRAY OF ATOMS (SEE DATA INPUT) */ /* NC = INTEGER ARRAY OF ATOMS (SEE DATA INPUT) */ /* ATMASS = ATOMIC MASSES OF ATOMS. */ /* *********************************************************************** */ /* Parameter adjustments */ --ams; --nc; --nb; --na; lopt -= 4; geo -= 4; --labels; /* Function Body */ *(unsigned char *)tab = '\t'; ircdrc = i_indx(keywrd_1.keywrd, "IRC", (ftnlen)241, (ftnlen)3) + i_indx( keywrd_1.keywrd, "DRC", (ftnlen)241, (ftnlen)3) != 0; ilowa = 'a'; ilowz = 'z'; icapa = 'A'; icapz = 'Z'; maxtxt = 0; *natoms = 0; numat = 0; iserr = 0; for (i__ = 1; i__ <= 360; ++i__) { /* L10: */ s_copy(simbol_1.simbol + (i__ - 1) * 10, "---", (ftnlen)10, (ftnlen)3) ; } L20: io___16.ciunit = *iread; i__1 = s_rsfe(&io___16); if (i__1 != 0) { goto L100001; } i__1 = do_fio(&c__1, line, (ftnlen)80); if (i__1 != 0) { goto L100001; } i__1 = e_rsfe(); L100001: if (i__1 < 0) { goto L130; } if (i__1 > 0) { goto L230; } if (s_cmp(line, " ", (ftnlen)80, (ftnlen)1) == 0) { goto L130; } ++(*natoms); /* SEE IF TEXT IS ASSOCIATED WITH THIS ELEMENT */ i__ = i_indx(line, "(", (ftnlen)80, (ftnlen)1); if (i__ != 0) { /* YES, ELEMENT IS LABELLED. */ k = i_indx(line, ")", (ftnlen)80, (ftnlen)1); s_copy(atomtx_1.txtatm + (*natoms - 1 << 3), line + (i__ - 1), ( ftnlen)8, k - (i__ - 1)); /* Computing MAX */ i__1 = maxtxt, i__2 = k - i__ + 1; maxtxt = max(i__1,i__2); i__1 = k; /* Writing concatenation */ i__3[0] = i__ - 1, a__1[0] = line; i__3[1] = 80 - i__1, a__1[1] = line + i__1; s_cat(string, a__1, i__3, &c__2, (ftnlen)80); s_copy(line, string, (ftnlen)80, (ftnlen)80); } else { s_copy(atomtx_1.txtatm + (*natoms - 1 << 3), " ", (ftnlen)8, (ftnlen) 1); } /* CLEAN THE INPUT DATA */ /* *********************************************************************** */ for (i__ = 1; i__ <= 80; ++i__) { iline = *(unsigned char *)&line[i__ - 1]; if (iline >= ilowa && iline <= ilowz) { *(unsigned char *)&line[i__ - 1] = (char) (iline + icapa - ilowa); } /* L30: */ } /* *********************************************************************** */ icomma = *(unsigned char *)&comma[0]; itab = *(unsigned char *)tab; for (i__ = 1; i__ <= 80; ++i__) { khar = *(unsigned char *)&line[i__ - 1]; if (khar == icomma || khar == itab) { *(unsigned char *)&line[i__ - 1] = *(unsigned char *)&space[0]; } /* L40: */ } /* INITIALIZE ISTART TO INTERPRET BLANKS AS ZERO'S */ for (i__ = 1; i__ <= 10; ++i__) { /* L50: */ istart[i__ - 1] = 80; } /* FIND INITIAL DIGIT OF ALL NUMBERS, CHECK FOR LEADING SPACES FOLLOWED */ /* BY A CHARACTER AND STORE IN ISTART */ leadsp = TRUE_; nvalue = 0; for (i__ = 1; i__ <= 80; ++i__) { if (leadsp && *(unsigned char *)&line[i__ - 1] != *(unsigned char *)& space[0]) { ++nvalue; istart[nvalue - 1] = i__; } leadsp = *(unsigned char *)&line[i__ - 1] == *(unsigned char *)&space[ 0]; /* L60: */ } /* ESTABLISH THE ELEMENT'S NAME AND ISOTOPE, CHECK FOR ERRORS OR E.O.DATA */ weight = 0.; i__1 = istart[0] - 1; s_copy(string, line + i__1, (ftnlen)80, istart[1] - 1 - i__1); if (*(unsigned char *)string >= *(unsigned char *)&zero[0] && *(unsigned char *)string <= *(unsigned char *)&nine[0]) { /* ATOMIC NUMBER USED: NO ISOTOPE ALLOWED */ label = (integer) reada_(string, &c__1, (ftnlen)80); if (label == 0) { goto L120; } if (label < 0 || label > 107) { s_wsfe(&io___29); e_wsfe(); goto L240; } goto L80; } /* ATOMIC SYMBOL USED */ real__ = (d__1 = reada_(string, &c__1, (ftnlen)80), abs(d__1)); if (real__ < 1e-15) { /* NO ISOTOPE */ s_copy(ele, string, (ftnlen)2, (ftnlen)2); } else { weight = real__; if (*(unsigned char *)&string[1] >= *(unsigned char *)&zero[0] && *( unsigned char *)&string[1] <= *(unsigned char *)&nine[0]) { s_copy(ele, string, (ftnlen)2, (ftnlen)1); } else { s_copy(ele, string, (ftnlen)2, (ftnlen)2); } } /* CHECK FOR ERROR IN ATOMIC SYMBOL */ if (*(unsigned char *)ele == '-' && *(unsigned char *)&ele[1] != '-') { *(unsigned char *)&ele[1] = ' '; } for (i__ = 1; i__ <= 107; ++i__) { if (s_cmp(ele, elemnt + (i__ - 1 << 1), (ftnlen)2, (ftnlen)2) == 0) { label = i__; goto L80; } /* L70: */ } if (*(unsigned char *)ele == 'X') { label = 99; goto L80; } s_wsfe(&io___32); do_fio(&c__1, ele, (ftnlen)2); e_wsfe(); goto L240; /* ALL O.K. */ L80: if (label != 99) { ++numat; } if (weight != 0.) { s_wsfe(&io___33); do_fio(&c__1, (char *)&(*natoms), (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&weight, (ftnlen)sizeof(doublereal)); e_wsfe(); atmass_1.atmass[numat - 1] = weight; } else { if (label != 99) { atmass_1.atmass[numat - 1] = ams[label]; } } if (*natoms > 120) { s_wsfe(&io___34); do_fio(&c__1, (char *)&c__120, (ftnlen)sizeof(integer)); e_wsfe(); s_stop("", (ftnlen)0); } labels[*natoms] = label; geo[*natoms * 3 + 1] = reada_(line, &istart[1], (ftnlen)80); geo[*natoms * 3 + 2] = reada_(line, &istart[3], (ftnlen)80); geo[*natoms * 3 + 3] = reada_(line, &istart[5], (ftnlen)80); if (ircdrc) { i__1 = istart[2] - 1; s_copy(turn, line + i__1, (ftnlen)1, istart[2] - i__1); if (*(unsigned char *)turn == 'T') { lopt[*natoms * 3 + 1] = 1; if (*natoms == 1) { s_wsfe(&io___36); do_fio(&c__1, " IN DRC MONITOR POTENTIAL ENERGY TURNING POIN" "TS", (ftnlen)47); e_wsfe(); } } else { lopt[*natoms * 3 + 1] = 0; } i__1 = istart[4] - 1; s_copy(turn, line + i__1, (ftnlen)1, istart[4] - i__1); if (*(unsigned char *)turn == 'T') { lopt[*natoms * 3 + 2] = 1; } else { lopt[*natoms * 3 + 2] = 0; } i__1 = istart[6] - 1; s_copy(turn, line + i__1, (ftnlen)1, istart[6] - i__1); if (*(unsigned char *)turn == 'T') { lopt[*natoms * 3 + 3] = 1; } else { lopt[*natoms * 3 + 3] = 0; } } else { lopt[*natoms * 3 + 1] = (integer) reada_(line, &istart[2], (ftnlen)80) ; lopt[*natoms * 3 + 2] = (integer) reada_(line, &istart[4], (ftnlen)80) ; lopt[*natoms * 3 + 3] = (integer) reada_(line, &istart[6], (ftnlen)80) ; for (i__ = 3; i__ <= 7; i__ += 2) { i__1 = istart[i__ - 1] - 1; i__2 = istart[i__ - 1] - 1; if (*(unsigned char *)&line[i__1] >= icapa && *(unsigned char *)& line[i__2] <= icapz) { iserr = 1; } /* L90: */ } } na[*natoms] = (integer) reada_(line, &istart[7], (ftnlen)80); nb[*natoms] = (integer) reada_(line, &istart[8], (ftnlen)80); nc[*natoms] = (integer) reada_(line, &istart[9], (ftnlen)80); /* SPECIAL CASE OF USERS FORGETTING TO ADD DIHEDRAL DATA FOR ATOM 3 */ if (*natoms == 3) { if (lopt[12] == 2) { na[3] = 1; nb[3] = 2; geo[12] = 0.; lopt[12] = 0; } else if (lopt[12] == 1 && (d__1 = geo[12] - 2., abs(d__1)) < 1e-4) { na[3] = 2; nb[3] = 1; geo[12] = 0.; lopt[12] = 0; } } if (lopt[*natoms * 3 + 1] > 1 || lopt[*natoms * 3 + 2] > 1 || lopt[* natoms * 3 + 3] > 1) { iserr = 1; } if (iserr == 1) { /* MUST BE GAUSSIAN GEOMETRY INPUT */ i__1 = *natoms; for (i__ = 2; i__ <= i__1; ++i__) { for (k = 1; k <= 3; ++k) { j = (integer) (geo[k + i__ * 3] + .4); if ((d__1 = geo[k + i__ * 3] - j, abs(d__1)) > 1e-5) { /* GEOMETRY CANNOT BE GAUSSIAN */ s_wsfe(&io___38); do_fio(&c__1, " GEOMETRY IS FAULTY. GEOMETRY READ IN IS", (ftnlen)41); e_wsfe(); const__ = .017453292519988887; i__2 = *natoms; for (l = 1; l <= i__2; ++l) { geo[l * 3 + 2] *= const__; /* L100: */ geo[l * 3 + 3] *= const__; } geout_(&c__6); s_stop("", (ftnlen)0); } /* L110: */ } } *natoms = -1; return 0; } goto L20; /* ALL DATA READ IN, CLEAN UP AND RETURN */ L120: --(*natoms); L130: na[2] = 1; *(unsigned char *)atomtx_1.ltxt = (char) maxtxt; if (*natoms > 3) { *int__ = na[4] != 0; } else { if (geo[11] < 10. && *natoms == 3) { s_wsfe(&io___41); e_wsfe(); } *int__ = TRUE_; } if (*int__) { geo[8] = 0.; } /* READ IN VELOCITY VECTOR, IF PRESENT */ if (i_indx(keywrd_1.keywrd, "VELO", (ftnlen)241, (ftnlen)4) > 0) { if (*int__) { s_wsfe(&io___42); do_fio(&c__1, " COORDINATES MUST BE CARTESIAN WHEN VELOCITY VECT" "OR IS USED.", (ftnlen)60); e_wsfe(); s_stop("", (ftnlen)0); } /* # WRITE(6,'(/10X,A)')'INITIAL VELOCITY VECTOR FOR DRC' */ i__1 = *natoms; for (i__ = 1; i__ <= i__1; ++i__) { s_rsfe(&io___43); do_fio(&c__1, line, (ftnlen)80); e_rsfe(); nuchar_(line, value, &ndmy, (ftnlen)80); if (ndmy != 3) { s_wsfe(&io___46); do_fio(&c__1, " THERE MUST BE EXACTLY THREE VELOCITY DATA P" "ER LINE", (ftnlen)52); e_wsfe(); s_stop("", (ftnlen)0); } for (j = 1; j <= 3; ++j) { /* L140: */ path_1.react[j + (i__ + 2) * 3 - 4] = value[j - 1]; } /* # WRITE(6,'(2X,A2,2X,3F13.5)')ELEMNT(LABELS(I)),(VALUE(J),J=1,3) */ /* L150: */ } for (i__ = 1; i__ <= 3; ++i__) { for (j = 1; j <= 2; ++j) { /* L160: */ path_1.react[i__ + j * 3 - 4] = geo[i__ + (j + 1) * 3] - geo[ i__ + 3]; } } /* NOW TO ROTATE VELOCITY VECTOR TO SUIT INTERNAL COORDINATE DEFINITION */ /* ROTATE AROUND THE 1-2 X-AXIS TO AS TO ELIMINATE REACT(3,2) */ /* (PUT ATOM 2 IN X-Y PLANE) */ /* Computing 2nd power */ d__1 = path_1.react[1]; /* Computing 2nd power */ d__2 = path_1.react[2]; sa = path_1.react[2] / sqrt(d__1 * d__1 + d__2 * d__2 + 1e-20); /* Computing 2nd power */ d__2 = sa; d__1 = sqrt(1. - d__2 * d__2); ca = d_sign(&d__1, &path_1.react[1]); /* # LABELS(NATOMS+1)=1 */ /* # LABELS(NATOMS+2)=1 */ /* # WRITE(6,*)' FIRST ROTATION, ABOUT 1-2 X-AXIS' */ i__1 = *natoms + 2; for (i__ = 1; i__ <= i__1; ++i__) { temp1 = path_1.react[i__ * 3 - 2] * ca + path_1.react[i__ * 3 - 1] * sa; temp2 = -path_1.react[i__ * 3 - 2] * sa + path_1.react[i__ * 3 - 1] * ca; path_1.react[i__ * 3 - 2] = temp1; path_1.react[i__ * 3 - 1] = temp2; /* # WRITE(6,'(2X,A2,2X,3F13.5)')ELEMNT(LABELS(I)),(REACT(J,I),J=1,3) */ /* L170: */ } /* ROTATE AROUND THE 1-2 Z-AXIS TO AS TO ELIMINATE REACT(2,2) */ /* (PUT ATOM 2 ON X AXIS) */ /* Computing 2nd power */ d__1 = path_1.react[1]; /* Computing 2nd power */ d__2 = path_1.react[0]; ca = path_1.react[0] / sqrt(d__1 * d__1 + d__2 * d__2 + 1e-20); /* Computing 2nd power */ d__2 = ca; d__1 = sqrt(1. - d__2 * d__2); sa = d_sign(&d__1, &path_1.react[1]); /* # WRITE(6,*)' SECOND ROTATION, ABOUT 1-2 Z-AXIS' */ i__1 = *natoms + 2; for (i__ = 1; i__ <= i__1; ++i__) { temp1 = path_1.react[i__ * 3 - 3] * ca + path_1.react[i__ * 3 - 2] * sa; temp2 = -path_1.react[i__ * 3 - 3] * sa + path_1.react[i__ * 3 - 2] * ca; path_1.react[i__ * 3 - 3] = temp1; path_1.react[i__ * 3 - 2] = temp2; /* # WRITE(6,'(2X,A2,2X,3F13.5)')ELEMNT(LABELS(I)),(REACT(J,I),J=1,3) */ /* L180: */ } /* ROTATE AROUND THE 2-3 X-AXIS TO AS TO ELIMINATE REACT(3,3) */ /* (PUT ATOM 3 ON X-Y PLANE) */ /* Computing 2nd power */ d__1 = path_1.react[4]; /* Computing 2nd power */ d__2 = path_1.react[5]; sa = path_1.react[5] / sqrt(d__1 * d__1 + d__2 * d__2 + 1e-20); /* Computing 2nd power */ d__2 = sa; d__1 = sqrt(1. - d__2 * d__2); ca = d_sign(&d__1, &path_1.react[4]); /* # WRITE(6,*)' THIRD ROTATION, ABOUT 2-3 X-AXIS' */ i__1 = *natoms + 2; for (i__ = 1; i__ <= i__1; ++i__) { temp1 = path_1.react[i__ * 3 - 2] * ca + path_1.react[i__ * 3 - 1] * sa; temp2 = -path_1.react[i__ * 3 - 2] * sa + path_1.react[i__ * 3 - 1] * ca; path_1.react[i__ * 3 - 2] = temp1; path_1.react[i__ * 3 - 1] = temp2; /* # WRITE(6,'(2X,A2,2X,3F13.5)')ELEMNT(LABELS(I)),(REACT(J,I),J=1,3) */ /* L190: */ } /* STRIP OFF FIRST TWO COORDINATES; THESE WERE THE COORDINATE AXIS */ /* DEFINITIONS */ i__1 = *natoms; for (i__ = 1; i__ <= i__1; ++i__) { for (j = 1; j <= 3; ++j) { /* L200: */ path_1.react[j + i__ * 3 - 4] = path_1.react[j + (i__ + 2) * 3 - 4]; } } } if (! (*int__)) { i__1 = *natoms; for (i__ = 1; i__ <= i__1; ++i__) { for (j = 1; j <= 3; ++j) { /* L210: */ xyz[j + i__ * 3 - 4] = geo[j + i__ * 3]; } } degree = 90. / asin(1.); xyzint_(xyz, natoms, &na[1], &nb[1], &nc[1], °ree, &geo[4]); if (i_indx(keywrd_1.keywrd, " XYZ", (ftnlen)241, (ftnlen)4) == 0) { /* UNCONDITIONALLY SET FLAGS FOR INTERNAL COORDINATES */ for (i__ = 1; i__ <= 3; ++i__) { for (j = i__; j <= 3; ++j) { /* L220: */ lopt[j + i__ * 3] = 0; } } } if ((d__1 = geo[11] - 180., abs(d__1)) < 1e-4 || abs(geo[11]) < 1e-4) { s_wsfe(&io___53); do_fio(&c__1, " DUE TO PROGRAM BUG, THE FIRST THREE ATOMS MUST N" "OT LIE IN A STRAIGHT LINE.", (ftnlen)75); e_wsfe(); s_stop("", (ftnlen)0); } } else if (! ircdrc) { lopt[8] = 0; if (lopt[4] + lopt[5] + lopt[6] + lopt[9] + lopt[12] > 0) { lopt[4] = 0; lopt[5] = 0; lopt[6] = 0; lopt[9] = 0; lopt[12] = 0; s_wsfe(&io___54); e_wsfe(); } } if (na[3] == 0) { nb[3] = 1; na[3] = 2; } return 0; /* ERROR CONDITIONS */ L230: if (*iread == 5) { s_wsfe(&io___55); do_fio(&c__1, (char *)&(*natoms), (ftnlen)sizeof(integer)); e_wsfe(); } else { *natoms = 0; return 0; } L240: j = *natoms - 1; s_wsfe(&io___56); e_wsfe(); i__1 = j; for (k = 1; k <= i__1; ++k) { /* L250: */ s_wsfe(&io___57); do_fio(&c__1, (char *)&labels[k], (ftnlen)sizeof(integer)); for (jj = 1; jj <= 3; ++jj) { do_fio(&c__1, (char *)&geo[jj + k * 3], (ftnlen)sizeof(doublereal) ); do_fio(&c__1, (char *)&lopt[jj + k * 3], (ftnlen)sizeof(integer)); } do_fio(&c__1, (char *)&na[k], (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&nb[k], (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&nc[k], (ftnlen)sizeof(integer)); e_wsfe(); } s_stop("", (ftnlen)0); return 0; } /* getgeo_ */
integer i1mach_(integer *i__) { /* Initialized data */ static integer sanity = 987; static struct { integer e_1[16]; } equiv_0 = {{ 5, 6, 7, 6, 32, 4, 2, 31, 2147483647, 2, 24, -125, 128, 53, -1021, 1024 }}; /* Format strings */ static char fmt_1999[] = "(\002 I1MACH - I OUT OF BOUNDS\002,i10)"; /* System generated locals */ integer ret_val=0; /* Builtin functions */ /* Subroutine */ int s_stop(char *, ftnlen); integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Local variables */ #define imach ((integer *)&equiv_0) #define output ((integer *)&equiv_0 + 3) /* Fortran I/O blocks */ static cilist io___14 = { 0, 0, 0, fmt_1999, 0 }; /* I/O UNIT NUMBERS. */ /* I1MACH( 1) = THE STANDARD INPUT UNIT. */ /* I1MACH( 2) = THE STANDARD OUTPUT UNIT. */ /* I1MACH( 3) = THE STANDARD PUNCH UNIT. */ /* I1MACH( 4) = THE STANDARD ERROR MESSAGE UNIT. */ /* WORDS. */ /* I1MACH( 5) = THE NUMBER OF BITS PER INTEGER STORAGE UNIT. */ /* I1MACH( 6) = THE NUMBER OF CHARACTERS PER CHARACTER STORAGE UNIT. */ /* FOR FORTRAN 77, THIS IS ALWAYS 1. FOR FORTRAN 66, */ /* CHARACTER STORAGE UNIT = INTEGER STORAGE UNIT. */ /* INTEGERS. */ /* ASSUME INTEGERS ARE REPRESENTED IN THE S-DIGIT, BASE-A FORM */ /* SIGN ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) ) */ /* WHERE 0 .LE. X(I) .LT. A FOR I=0,...,S-1. */ /* I1MACH( 7) = A, THE BASE. */ /* I1MACH( 8) = S, THE NUMBER OF BASE-A DIGITS. */ /* I1MACH( 9) = A**S - 1, THE LARGEST MAGNITUDE. */ /* FLOATING-POINT NUMBERS. */ /* ASSUME FLOATING-POINT NUMBERS ARE REPRESENTED IN THE T-DIGIT, */ /* BASE-B FORM */ /* SIGN (B**E)*( (X(1)/B) + ... + (X(T)/B**T) ) */ /* WHERE 0 .LE. X(I) .LT. B FOR I=1,...,T, */ /* 0 .LT. X(1), AND EMIN .LE. E .LE. EMAX. */ /* I1MACH(10) = B, THE BASE. */ /* SINGLE-PRECISION */ /* I1MACH(11) = T, THE NUMBER OF BASE-B DIGITS. */ /* I1MACH(12) = EMIN, THE SMALLEST EXPONENT E. */ /* I1MACH(13) = EMAX, THE LARGEST EXPONENT E. */ /* DOUBLE-PRECISION */ /* I1MACH(14) = T, THE NUMBER OF BASE-B DIGITS. */ /* I1MACH(15) = EMIN, THE SMALLEST EXPONENT E. */ /* I1MACH(16) = EMAX, THE LARGEST EXPONENT E. */ /* TO ALTER THIS FUNCTION FOR A PARTICULAR ENVIRONMENT, */ /* THE DESIRED SET OF DATA STATEMENTS SHOULD BE ACTIVATED BY */ /* REMOVING THE C FROM COLUMN 1. ALSO, THE VALUES OF */ /* I1MACH(1) - I1MACH(4) SHOULD BE CHECKED FOR CONSISTENCY */ /* WITH THE LOCAL OPERATING SYSTEM. FOR FORTRAN 77, YOU MAY WISH */ /* TO ADJUST THE DATA STATEMENT SO IMACH(6) IS SET TO 1, AND */ /* THEN TO COMMENT OUT THE EXECUTABLE TEST ON I .EQ. 6 BELOW. */ /* ON RARE MACHINES A STATIC STATEMENT MAY NEED TO BE ADDED. */ /* (BUT PROBABLY MORE SYSTEMS PROHIBIT IT THAN REQUIRE IT.) */ /* FOR IEEE-ARITHMETIC MACHINES (BINARY STANDARD), THE FIRST */ /* SET OF CONSTANTS BELOW SHOULD BE APPROPRIATE, EXCEPT PERHAPS */ /* FOR IMACH(1) - IMACH(4). */ /* MACHINE CONSTANTS FOR IEEE ARITHMETIC MACHINES, SUCH AS THE AT&T */ /* 3B SERIES, MOTOROLA 68000 BASED MACHINES (E.G. SUN 3 AND AT&T */ /* PC 7300), AND 8087 BASED MICROS (E.G. IBM PC AND AT&T 6300). */ /* MACHINE CONSTANTS FOR AMDAHL MACHINES. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / 2147483647 / */ /* DATA IMACH(10) / 16 / */ /* DATA IMACH(11) / 6 / */ /* DATA IMACH(12) / -64 / */ /* DATA IMACH(13) / 63 / */ /* DATA IMACH(14) / 14 / */ /* DATA IMACH(15) / -64 / */ /* DATA IMACH(16) / 63 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM. */ /* DATA IMACH( 1) / 7 / */ /* DATA IMACH( 2) / 2 / */ /* DATA IMACH( 3) / 2 / */ /* DATA IMACH( 4) / 2 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 33 / */ /* DATA IMACH( 9) / Z1FFFFFFFF / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -256 / */ /* DATA IMACH(13) / 255 / */ /* DATA IMACH(14) / 60 / */ /* DATA IMACH(15) / -256 / */ /* DATA IMACH(16) / 255 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 48 / */ /* DATA IMACH( 6) / 6 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 39 / */ /* DATA IMACH( 9) / O0007777777777777 / */ /* DATA IMACH(10) / 8 / */ /* DATA IMACH(11) / 13 / */ /* DATA IMACH(12) / -50 / */ /* DATA IMACH(13) / 76 / */ /* DATA IMACH(14) / 26 / */ /* DATA IMACH(15) / -50 / */ /* DATA IMACH(16) / 76 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 48 / */ /* DATA IMACH( 6) / 6 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 39 / */ /* DATA IMACH( 9) / O0007777777777777 / */ /* DATA IMACH(10) / 8 / */ /* DATA IMACH(11) / 13 / */ /* DATA IMACH(12) / -50 / */ /* DATA IMACH(13) / 76 / */ /* DATA IMACH(14) / 26 / */ /* DATA IMACH(15) / -32754 / */ /* DATA IMACH(16) / 32780 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR FTN4 ON THE CDC 6000/7000 SERIES. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 60 / */ /* DATA IMACH( 6) / 10 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 48 / */ /* DATA IMACH( 9) / 00007777777777777777B / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 47 / */ /* DATA IMACH(12) / -929 / */ /* DATA IMACH(13) / 1070 / */ /* DATA IMACH(14) / 94 / */ /* DATA IMACH(15) / -929 / */ /* DATA IMACH(16) / 1069 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR FTN5 ON THE CDC 6000/7000 SERIES. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 60 / */ /* DATA IMACH( 6) / 10 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 48 / */ /* DATA IMACH( 9) / O"00007777777777777777" / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 47 / */ /* DATA IMACH(12) / -929 / */ /* DATA IMACH(13) / 1070 / */ /* DATA IMACH(14) / 94 / */ /* DATA IMACH(15) / -929 / */ /* DATA IMACH(16) / 1069 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR CONVEX C-1. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / 2147483647 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -128 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 53 / */ /* DATA IMACH(15) /-1024 / */ /* DATA IMACH(16) / 1023 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE CRAY 1, XMP, 2, AND 3. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 102 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 64 / */ /* DATA IMACH( 6) / 8 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 63 / */ /* DATA IMACH( 9) / 777777777777777777777B / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 47 / */ /* DATA IMACH(12) / -8189 / */ /* DATA IMACH(13) / 8190 / */ /* DATA IMACH(14) / 94 / */ /* DATA IMACH(15) / -8099 / */ /* DATA IMACH(16) / 8190 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200. */ /* DATA IMACH( 1) / 11 / */ /* DATA IMACH( 2) / 12 / */ /* DATA IMACH( 3) / 8 / */ /* DATA IMACH( 4) / 10 / */ /* DATA IMACH( 5) / 16 / */ /* DATA IMACH( 6) / 2 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 15 / */ /* DATA IMACH( 9) /32767 / */ /* DATA IMACH(10) / 16 / */ /* DATA IMACH(11) / 6 / */ /* DATA IMACH(12) / -64 / */ /* DATA IMACH(13) / 63 / */ /* DATA IMACH(14) / 14 / */ /* DATA IMACH(15) / -64 / */ /* DATA IMACH(16) / 63 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE HARRIS SLASH 6 AND SLASH 7. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 0 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 24 / */ /* DATA IMACH( 6) / 3 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 23 / */ /* DATA IMACH( 9) / 8388607 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 23 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 38 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE HONEYWELL DPS 8/70 SERIES. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 43 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 35 / */ /* DATA IMACH( 9) / O377777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 27 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 63 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE IBM 360/370 SERIES, */ /* THE XEROX SIGMA 5/7/9 AND THE SEL SYSTEMS 85/86. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / Z7FFFFFFF / */ /* DATA IMACH(10) / 16 / */ /* DATA IMACH(11) / 6 / */ /* DATA IMACH(12) / -64 / */ /* DATA IMACH(13) / 63 / */ /* DATA IMACH(14) / 14 / */ /* DATA IMACH(15) / -64 / */ /* DATA IMACH(16) / 63 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE INTERDATA 8/32 */ /* WITH THE UNIX SYSTEM FORTRAN 77 COMPILER. */ /* FOR THE INTERDATA FORTRAN VII COMPILER REPLACE */ /* THE Z'S SPECIFYING HEX CONSTANTS WITH Y'S. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 6 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / Z'7FFFFFFF' / */ /* DATA IMACH(10) / 16 / */ /* DATA IMACH(11) / 6 / */ /* DATA IMACH(12) / -64 / */ /* DATA IMACH(13) / 62 / */ /* DATA IMACH(14) / 14 / */ /* DATA IMACH(15) / -64 / */ /* DATA IMACH(16) / 62 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR). */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 5 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 35 / */ /* DATA IMACH( 9) / "377777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 27 / */ /* DATA IMACH(12) / -128 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 54 / */ /* DATA IMACH(15) / -101 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR). */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 5 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 35 / */ /* DATA IMACH( 9) / "377777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 27 / */ /* DATA IMACH(12) / -128 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 62 / */ /* DATA IMACH(15) / -128 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING */ /* 32-BIT INTEGER ARITHMETIC. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / 2147483647 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 56 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR PDP-11 FORTRANS SUPPORTING */ /* 16-BIT INTEGER ARITHMETIC. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 16 / */ /* DATA IMACH( 6) / 2 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 15 / */ /* DATA IMACH( 9) / 32767 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 56 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE PRIME 50 SERIES SYSTEMS */ /* WTIH 32-BIT INTEGERS AND 64V MODE INSTRUCTIONS, */ /* SUPPLIED BY IGOR BRAY. */ /* DATA IMACH( 1) / 1 / */ /* DATA IMACH( 2) / 1 / */ /* DATA IMACH( 3) / 2 / */ /* DATA IMACH( 4) / 1 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / :17777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 23 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / +127 / */ /* DATA IMACH(14) / 47 / */ /* DATA IMACH(15) / -32895 / */ /* DATA IMACH(16) / +32637 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE SEQUENT BALANCE 8000. */ /* DATA IMACH( 1) / 0 / */ /* DATA IMACH( 2) / 0 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 0 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 1 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / 2147483647 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -125 / */ /* DATA IMACH(13) / 128 / */ /* DATA IMACH(14) / 53 / */ /* DATA IMACH(15) / -1021 / */ /* DATA IMACH(16) / 1024 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES. */ /* NOTE THAT THE PUNCH UNIT, I1MACH(3), HAS BEEN SET TO 7 */ /* WHICH IS APPROPRIATE FOR THE UNIVAC-FOR SYSTEM. */ /* IF YOU HAVE THE UNIVAC-FTN SYSTEM, SET IT TO 1. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 36 / */ /* DATA IMACH( 6) / 6 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 35 / */ /* DATA IMACH( 9) / O377777777777 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 27 / */ /* DATA IMACH(12) / -128 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 60 / */ /* DATA IMACH(15) /-1024 / */ /* DATA IMACH(16) / 1023 /, SANITY/987/ */ /* MACHINE CONSTANTS FOR VAX. */ /* DATA IMACH( 1) / 5 / */ /* DATA IMACH( 2) / 6 / */ /* DATA IMACH( 3) / 7 / */ /* DATA IMACH( 4) / 6 / */ /* DATA IMACH( 5) / 32 / */ /* DATA IMACH( 6) / 4 / */ /* DATA IMACH( 7) / 2 / */ /* DATA IMACH( 8) / 31 / */ /* DATA IMACH( 9) / 2147483647 / */ /* DATA IMACH(10) / 2 / */ /* DATA IMACH(11) / 24 / */ /* DATA IMACH(12) / -127 / */ /* DATA IMACH(13) / 127 / */ /* DATA IMACH(14) / 56 / */ /* DATA IMACH(15) / -127 / */ /* DATA IMACH(16) / 127 /, SANITY/987/ */ /* *** ISSUE STOP 777 IF ALL DATA STATEMENTS ARE COMMENTED... */ if(sanity != 987) { s_stop("777", (ftnlen)3); } if(*i__ < 1 || *i__ > 16) { goto L10; } ret_val = imach[*i__ - 1]; /* /6S */ /* /7S */ if(*i__ == 6) { ret_val = 1; } /* / */ return ret_val; L10: io___14.ciunit = *output; s_wsfe(&io___14); do_fio(&c__1, (char *)&(*i__), (ftnlen)sizeof(integer)); e_wsfe(); s_stop("", (ftnlen)0); return ret_val; } /* i1mach_ */
/* Subroutine */ int deriv_(doublereal *geo, doublereal *grad) { /* Initialized data */ static integer icalcn = 0; /* System generated locals */ integer i__1, i__2, i__3, i__4; doublereal d__1, d__2; char ch__1[80]; olist o__1; alist al__1; /* Builtin functions */ integer i_indx(char *, char *, ftnlen, ftnlen), f_open(olist *), f_rew( alist *), s_rsfe(cilist *), do_fio(integer *, char *, ftnlen), e_rsfe(void), s_wsfe(cilist *), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); integer s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), e_rsle(void); double pow_di(doublereal *, integer *), sqrt(doublereal); integer s_wsle(cilist *), e_wsle(void); /* Local variables */ static integer i__, j; static logical ci; static integer ii, ij, il, jl, kl, ll, kk; static logical aic; extern doublereal dot_(doublereal *, doublereal *, integer *); static logical int__; extern /* Subroutine */ int mxm_(doublereal *, integer *, doublereal *, integer *, doublereal *, integer *); static doublereal sum; static logical scf1; static char line[80]; static integer ncol; static doublereal xjuc[3], step; static logical slow; static integer icapa; static logical halfe, debug; extern /* Subroutine */ int dcart_(doublereal *, doublereal *); static integer iline; static logical geook; static doublereal grlim; static integer ilowa; static doublereal gnorm; extern /* Subroutine */ int geout_(integer *); static integer ilowz; static doublereal change[3], aidref[360]; static integer idelta; extern /* Character */ VOID getnam_(char *, ftnlen, char *, ftnlen); static logical precis, noanci, aifrst; extern /* Subroutine */ int dernvo_(doublereal *, doublereal *), jcarin_( doublereal *, doublereal *, doublereal *, logical *, doublereal *, integer *), gmetry_(doublereal *, doublereal *), deritr_( doublereal *, doublereal *), symtry_(void); /* Fortran I/O blocks */ static cilist io___14 = { 0, 5, 0, "(A)", 0 }; static cilist io___17 = { 1, 5, 1, "(A)", 0 }; static cilist io___19 = { 0, 6, 0, "(//,A)", 0 }; static cilist io___20 = { 0, 6, 0, "(A)", 0 }; static cilist io___21 = { 0, 6, 0, "(//,A)", 0 }; static cilist io___22 = { 0, 6, 0, "(A)", 0 }; static cilist io___23 = { 0, 6, 0, "(6F12.6)", 0 }; static cilist io___25 = { 1, 5, 1, 0, 0 }; static cilist io___26 = { 0, 6, 0, "(/,A,/)", 0 }; static cilist io___27 = { 0, 6, 0, "(5F12.6)", 0 }; static cilist io___28 = { 0, 6, 0, "(/,A,/)", 0 }; static cilist io___29 = { 0, 6, 0, "(5F12.6)", 0 }; static cilist io___31 = { 0, 6, 0, "(/,A,/)", 0 }; static cilist io___32 = { 0, 6, 0, "(5F12.6)", 0 }; static cilist io___37 = { 0, 6, 0, "(' GEO AT START OF DERIV')", 0 }; static cilist io___38 = { 0, 6, 0, "(F19.5,2F12.5)", 0 }; static cilist io___42 = { 0, 6, 0, 0, 0 }; static cilist io___43 = { 0, 6, 0, 0, 0 }; static cilist io___54 = { 0, 6, 0, "(//,3(A,/),I3,A)", 0 }; static cilist io___55 = { 0, 6, 0, "(//,A)", 0 }; static cilist io___56 = { 0, 6, 0, 0, 0 }; static cilist io___57 = { 0, 6, 0, "(' GRADIENTS')", 0 }; static cilist io___58 = { 0, 6, 0, "(10F8.3)", 0 }; static cilist io___59 = { 0, 6, 0, "(' ERROR FUNCTION')", 0 }; static cilist io___60 = { 0, 6, 0, "(10F8.3)", 0 }; static cilist io___61 = { 0, 6, 0, "(' COSINE OF SEARCH DIRECTION =',F30" ".6)", 0 }; /* COMDECK SIZES */ /* *********************************************************************** */ /* THIS FILE CONTAINS ALL THE ARRAY SIZES FOR USE IN MOPAC. */ /* THERE ARE ONLY 5 PARAMETERS THAT THE PROGRAMMER NEED SET: */ /* MAXHEV = MAXIMUM NUMBER OF HEAVY ATOMS (HEAVY: NON-HYDROGEN ATOMS) */ /* MAXLIT = MAXIMUM NUMBER OF HYDROGEN ATOMS. */ /* MAXTIM = DEFAULT TIME FOR A JOB. (SECONDS) */ /* MAXDMP = DEFAULT TIME FOR AUTOMATIC RESTART FILE GENERATION (SECS) */ /* ISYBYL = 1 IF MOPAC IS TO BE USED IN THE SYBYL PACKAGE, =0 OTHERWISE */ /* SEE ALSO NMECI, NPULAY AND MESP AT THE END OF THIS FILE */ /* *********************************************************************** */ /* THE FOLLOWING CODE DOES NOT NEED TO BE ALTERED BY THE PROGRAMMER */ /* *********************************************************************** */ /* ALL OTHER PARAMETERS ARE DERIVED FUNCTIONS OF THESE TWO PARAMETERS */ /* NAME DEFINITION */ /* NUMATM MAXIMUM NUMBER OF ATOMS ALLOWED. */ /* MAXORB MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXPAR MAXIMUM NUMBER OF PARAMETERS FOR OPTIMISATION. */ /* N2ELEC MAXIMUM NUMBER OF TWO ELECTRON INTEGRALS ALLOWED. */ /* MPACK AREA OF LOWER HALF TRIANGLE OF DENSITY MATRIX. */ /* MORB2 SQUARE OF THE MAXIMUM NUMBER OF ORBITALS ALLOWED. */ /* MAXHES AREA OF HESSIAN MATRIX */ /* MAXALL LARGER THAN MAXORB OR MAXPAR. */ /* *********************************************************************** */ /* *********************************************************************** */ /* DECK MOPAC */ /* *********************************************************************** */ /* DERIV CALCULATES THE DERIVATIVES OF THE ENERGY WITH RESPECT TO THE */ /* INTERNAL COORDINATES. THIS IS DONE BY FINITE DIFFERENCES. */ /* THE MAIN ARRAYS IN DERIV ARE: */ /* LOC INTEGER ARRAY, LOC(1,I) CONTAINS THE ADDRESS OF THE ATOM */ /* INTERNAL COORDINATE LOC(2,I) IS TO BE USED IN THE */ /* DERIVATIVE CALCULATION. */ /* GEO ARRAY \GEO\ HOLDS THE INTERNAL COORDINATES. */ /* GRAD ON EXIT, CONTAINS THE DERIVATIVES */ /* *********************************************************************** */ /* Parameter adjustments */ --grad; geo -= 4; /* Function Body */ if (icalcn != numcal_1.numcal) { aifrst = i_indx(keywrd_1.keywrd, "RESTART", (ftnlen)241, (ftnlen)7) == 0; debug = i_indx(keywrd_1.keywrd, "DERIV", (ftnlen)241, (ftnlen)5) != 0; precis = i_indx(keywrd_1.keywrd, "PREC", (ftnlen)241, (ftnlen)4) != 0; int__ = i_indx(keywrd_1.keywrd, " XYZ", (ftnlen)241, (ftnlen)4) == 0; geook = i_indx(keywrd_1.keywrd, "GEO-OK", (ftnlen)241, (ftnlen)6) != 0; ci = i_indx(keywrd_1.keywrd, "C.I.", (ftnlen)241, (ftnlen)4) != 0; scf1 = i_indx(keywrd_1.keywrd, "1SCF", (ftnlen)241, (ftnlen)4) != 0; aic = i_indx(keywrd_1.keywrd, "AIDER", (ftnlen)241, (ftnlen)5) != 0; icapa = 'A'; ilowa = 'a'; ilowz = 'z'; if (aic && aifrst) { o__1.oerr = 0; o__1.ounit = 5; o__1.ofnmlen = 80; getnam_(ch__1, (ftnlen)80, "FOR005", (ftnlen)6); o__1.ofnm = ch__1; o__1.orl = 0; o__1.osta = "OLD"; o__1.oacc = 0; o__1.ofm = 0; o__1.oblnk = "ZERO"; f_open(&o__1); al__1.aerr = 0; al__1.aunit = 5; f_rew(&al__1); /* ISOK IS SET FALSE: ONLY ONE SYSTEM ALLOWED */ okmany_1.isok = FALSE_; for (i__ = 1; i__ <= 3; ++i__) { /* L10: */ s_rsfe(&io___14); do_fio(&c__1, line, (ftnlen)80); e_rsfe(); } for (j = 1; j <= 1000; ++j) { i__1 = s_rsfe(&io___17); if (i__1 != 0) { goto L40; } i__1 = do_fio(&c__1, line, (ftnlen)80); if (i__1 != 0) { goto L40; } i__1 = e_rsfe(); if (i__1 != 0) { goto L40; } /* *********************************************************************** */ for (i__ = 1; i__ <= 80; ++i__) { iline = *(unsigned char *)&line[i__ - 1]; if (iline >= ilowa && iline <= ilowz) { *(unsigned char *)&line[i__ - 1] = (char) (iline + icapa - ilowa); } /* L20: */ } /* *********************************************************************** */ /* L30: */ if (i_indx(line, "AIDER", (ftnlen)80, (ftnlen)5) != 0) { goto L60; } } L40: s_wsfe(&io___19); do_fio(&c__1, " KEYWORD \"AIDER\" SPECIFIED, BUT NOT", (ftnlen)35) ; e_wsfe(); s_wsfe(&io___20); do_fio(&c__1, " PRESENT AFTER Z-MATRIX. JOB STOPPED", (ftnlen)37) ; e_wsfe(); s_stop("", (ftnlen)0); L50: s_wsfe(&io___21); do_fio(&c__1, " FAULT IN READ OF AB INITIO DERIVATIVES", (ftnlen) 40); e_wsfe(); s_wsfe(&io___22); do_fio(&c__1, " DERIVATIVES READ IN ARE AS FOLLOWS", (ftnlen)36); e_wsfe(); s_wsfe(&io___23); i__1 = i__; for (j = 1; j <= i__1; ++j) { do_fio(&c__1, (char *)&aidref[j - 1], (ftnlen)sizeof( doublereal)); } e_wsfe(); s_stop("", (ftnlen)0); L60: if (geokst_1.natoms > 2) { j = geokst_1.natoms * 3 - 6; } else { j = 1; } i__1 = s_rsle(&io___25); if (i__1 != 0) { goto L50; } i__2 = j; for (i__ = 1; i__ <= i__2; ++i__) { i__1 = do_lio(&c__5, &c__1, (char *)&aidref[i__ - 1], (ftnlen) sizeof(doublereal)); if (i__1 != 0) { goto L50; } } i__1 = e_rsle(); if (i__1 != 0) { goto L50; } s_wsfe(&io___26); do_fio(&c__1, " AB-INITIO DERIVATIVES IN KCAL/MOL/(ANGSTROM OR R" "ADIAN)", (ftnlen)55); e_wsfe(); s_wsfe(&io___27); i__1 = j; for (i__ = 1; i__ <= i__1; ++i__) { do_fio(&c__1, (char *)&aidref[i__ - 1], (ftnlen)sizeof( doublereal)); } e_wsfe(); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { if (geovar_1.loc[(i__ << 1) - 2] > 3) { j = geovar_1.loc[(i__ << 1) - 2] * 3 + geovar_1.loc[(i__ << 1) - 1] - 9; } else if (geovar_1.loc[(i__ << 1) - 2] == 3) { j = geovar_1.loc[(i__ << 1) - 1] + 1; } else { j = 1; } /* L70: */ aidref[i__ - 1] = aidref[j - 1]; } s_wsfe(&io___28); do_fio(&c__1, " AB-INITIO DERIVATIVES FOR VARIABLES", (ftnlen)36); e_wsfe(); s_wsfe(&io___29); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { do_fio(&c__1, (char *)&aidref[i__ - 1], (ftnlen)sizeof( doublereal)); } e_wsfe(); if (geosym_1.ndep != 0) { i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { sum = aidref[i__ - 1]; i__2 = geosym_1.ndep; for (j = 1; j <= i__2; ++j) { if (geovar_1.loc[(i__ << 1) - 2] == geosym_1.locpar[j - 1] && (geovar_1.loc[(i__ << 1) - 1] == geosym_1.idepfn[j - 1] || geovar_1.loc[(i__ << 1) - 1] == 3 && geosym_1.idepfn[j - 1] == 14) ) { aidref[i__ - 1] += sum; } /* L80: */ } /* L90: */ } s_wsfe(&io___31); do_fio(&c__1, " AB-INITIO DERIVATIVES AFTER SYMMETRY WEIGHTI" "NG", (ftnlen)47); e_wsfe(); s_wsfe(&io___32); i__1 = geovar_1.nvar; for (j = 1; j <= i__1; ++j) { do_fio(&c__1, (char *)&aidref[j - 1], (ftnlen)sizeof( doublereal)); } e_wsfe(); } } icalcn = numcal_1.numcal; if (i_indx(keywrd_1.keywrd, "RESTART", (ftnlen)241, (ftnlen)7) == 0) { i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L100: */ errfn_1.errfn[i__ - 1] = 0.; } } grlim = .01; if (precis) { grlim = 1e-4; } halfe = molkst_1.nopen > molkst_1.nclose && molkst_1.fract != 2. && molkst_1.fract != 0. || ci; idelta = -7; /* IDELTA IS A MACHINE-PRECISION DEPENDANT INTEGER */ change[0] = pow_di(&c_b70, &idelta); change[1] = pow_di(&c_b70, &idelta); change[2] = pow_di(&c_b70, &idelta); /* CHANGE(I) IS THE STEP SIZE USED IN CALCULATING THE DERIVATIVES. */ /* FOR "CARTESIAN" DERIVATIVES, CALCULATED USING DCART,AN */ /* INFINITESIMAL STEP, HERE 0.000001, IS ACCEPTABLE. IN THE */ /* HALF-ELECTRON METHOD A QUITE LARGE STEP IS NEEDED AS FULL SCF */ /* CALCULATIONS ARE NEEDED, AND THE DIFFERENCE BETWEEN THE TOTAL */ /* ENERGIES IS USED. THE STEP CANNOT BE VERY LARGE, AS THE SECOND */ /* DERIVITIVE IN FLEPO IS CALCULATED FROM THE DIFFERENCES OF TWO */ /* FIRST DERIVATIVES. CHANGE(1) IS FOR CHANGE IN BOND LENGTH, */ /* (2) FOR ANGLE, AND (3) FOR DIHEDRAL. */ } if (geovar_1.nvar == 0) { return 0; } if (debug) { s_wsfe(&io___37); e_wsfe(); s_wsfe(&io___38); i__1 = geokst_1.natoms; for (i__ = 1; i__ <= i__1; ++i__) { for (j = 1; j <= 3; ++j) { do_fio(&c__1, (char *)&geo[j + i__ * 3], (ftnlen)sizeof( doublereal)); } } e_wsfe(); } gnorm = 0.; i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { genral_1.gold[i__ - 1] = grad[i__]; genral_1.xparam[i__ - 1] = geo[geovar_1.loc[(i__ << 1) - 1] + geovar_1.loc[(i__ << 1) - 2] * 3]; /* L110: */ /* Computing 2nd power */ d__1 = grad[i__]; gnorm += d__1 * d__1; } gnorm = sqrt(gnorm); slow = FALSE_; noanci = FALSE_; if (halfe) { noanci = i_indx(keywrd_1.keywrd, "NOANCI", (ftnlen)241, (ftnlen)6) != 0 || molkst_1.nopen == molkst_1.norbs; slow = noanci && (gnorm < grlim || scf1); } if (geosym_1.ndep != 0) { symtry_(); } gmetry_(&geo[4], genral_1.coord); /* COORD NOW HOLDS THE CARTESIAN COORDINATES */ if (halfe && ! noanci) { if (debug) { s_wsle(&io___42); do_lio(&c__9, &c__1, "DOING ANALYTICAL C.I. DERIVATIVES", (ftnlen) 33); e_wsle(); } dernvo_(genral_1.coord, xyzgra_1.dxyz); } else { if (debug) { s_wsle(&io___43); do_lio(&c__9, &c__1, "DOING VARIATIONALLY OPIMIZED DERIVATIVES", ( ftnlen)40); e_wsle(); } dcart_(genral_1.coord, xyzgra_1.dxyz); } ij = 0; i__1 = molkst_1.numat; for (ii = 1; ii <= i__1; ++ii) { i__2 = ucell_1.l1u; for (il = ucell_1.l1l; il <= i__2; ++il) { i__3 = ucell_1.l2u; for (jl = ucell_1.l2l; jl <= i__3; ++jl) { i__4 = ucell_1.l3u; for (kl = ucell_1.l3l; kl <= i__4; ++kl) { /* $DOIT ASIS */ for (ll = 1; ll <= 3; ++ll) { /* L120: */ xjuc[ll - 1] = genral_1.coord[ll + ii * 3 - 4] + euler_1.tvec[ll - 1] * il + euler_1.tvec[ll + 2] * jl + euler_1.tvec[ll + 5] * kl; } ++ij; /* $DOIT ASIS */ for (kk = 1; kk <= 3; ++kk) { genral_1.cold[kk + ij * 3 - 4] = xjuc[kk - 1]; /* L130: */ } /* L140: */ } } } /* L150: */ } step = change[0]; jcarin_(genral_1.coord, genral_1.xparam, &step, &precis, work3_1.work2, & ncol); mxm_(work3_1.work2, &geovar_1.nvar, xyzgra_1.dxyz, &ncol, &grad[1], &c__1) ; if (precis) { step = .5 / step; } else { step = 1. / step; } i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L160: */ grad[i__] *= step; } /* NOW TO ENSURE THAT INTERNAL DERIVATIVES ACCURATELY REFLECT CARTESIAN */ /* DERIVATIVES */ if (int__ && ! geook && geovar_1.nvar >= molkst_1.numat * 3 - 6 && euler_1.id == 0) { /* NUMBER OF VARIABLES LOOKS O.K. */ sum = dot_(&grad[1], &grad[1], &geovar_1.nvar); i__1 = molkst_1.numat * 3; /* Computing MAX */ d__1 = 4., d__2 = sum * 4.; if (sum < 2. && dot_(xyzgra_1.dxyz, xyzgra_1.dxyz, &i__1) > max(d__1, d__2)) { /* OOPS, LOOKS LIKE AN ERROR. */ i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { j = (integer) (genral_1.xparam[i__ - 1] / 3.141); if (geovar_1.loc[(i__ << 1) - 1] == 2 && geovar_1.loc[(i__ << 1) - 2] > 3 && (d__1 = genral_1.xparam[i__ - 1] - j * 3.1415926, abs(d__1)) < .005) { /* ERROR LOCATED, BUT CANNOT CORRECT IN THIS RUN */ s_wsfe(&io___54); do_fio(&c__1, " INTERNAL COORDINATE DERIVATIVES DO NOT R" "EFLECT", (ftnlen)47); do_fio(&c__1, " CARTESIAN COORDINATE DERIVATIVES", ( ftnlen)33); do_fio(&c__1, " TO CORRECT ERROR, INCREASE DIHEDRAL OF A" "TOM", (ftnlen)44); do_fio(&c__1, (char *)&geovar_1.loc[(i__ << 1) - 2], ( ftnlen)sizeof(integer)); do_fio(&c__1, " BY 90 DEGREES", (ftnlen)14); e_wsfe(); s_wsfe(&io___55); do_fio(&c__1, " CURRENT GEOMETRY", (ftnlen)21); e_wsfe(); geout_(&c__6); s_stop("", (ftnlen)0); } /* L170: */ } } } /* THIS CODE IS ONLY USED IF THE KEYWORD NOANCI IS SPECIFIED */ if (slow) { if (debug) { s_wsle(&io___56); do_lio(&c__9, &c__1, "DOING FULL SCF DERIVATIVES", (ftnlen)26); e_wsle(); } deritr_(errfn_1.errfn, &geo[4]); /* THE ARRAY ERRFN HOLDS THE EXACT DERIVATIVES MINUS THE APPROXIMATE */ /* DERIVATIVES */ i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L180: */ errfn_1.errfn[i__ - 1] -= grad[i__]; } } gravec_1.cosine = dot_(&grad[1], genral_1.gold, &geovar_1.nvar) / sqrt( dot_(&grad[1], &grad[1], &geovar_1.nvar) * dot_(genral_1.gold, genral_1.gold, &geovar_1.nvar) + 1e-20); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L190: */ grad[i__] += errfn_1.errfn[i__ - 1]; } if (aic) { if (aifrst) { aifrst = FALSE_; i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L200: */ errfn_1.aicorr[i__ - 1] = -aidref[i__ - 1] - grad[i__]; } } /* # WRITE(6,'('' GRADIENTS BEFORE AI CORRECTION'')') */ /* # WRITE(6,'(10F8.3)')(GRAD(I),I=1,NVAR) */ i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { /* L210: */ grad[i__] += errfn_1.aicorr[i__ - 1]; } } /* L220: */ if (debug) { s_wsfe(&io___57); e_wsfe(); s_wsfe(&io___58); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { do_fio(&c__1, (char *)&grad[i__], (ftnlen)sizeof(doublereal)); } e_wsfe(); if (slow) { s_wsfe(&io___59); e_wsfe(); s_wsfe(&io___60); i__1 = geovar_1.nvar; for (i__ = 1; i__ <= i__1; ++i__) { do_fio(&c__1, (char *)&errfn_1.errfn[i__ - 1], (ftnlen)sizeof( doublereal)); } e_wsfe(); } } if (debug) { s_wsfe(&io___61); do_fio(&c__1, (char *)&gravec_1.cosine, (ftnlen)sizeof(doublereal)); e_wsfe(); } return 0; } /* deriv_ */
/* Subroutine */ int xerrwv_(char *msg, integer *nmes, integer *nerr, integer *level, integer *ni, integer *i1, integer *i2, integer *nr, doublereal *r1, doublereal *r2, ftnlen msg_len) { /* Format strings */ static char fmt_10[] = "(1x,80a1)"; static char fmt_20[] = "(6x,\002In above message, I1 =\002,i10)"; static char fmt_30[] = "(6x,\002In above message, I1 =\002,i10,3x,\002I" "2 =\002,i10)"; static char fmt_40[] = "(6x,\002In above message, R1 =\002,e21.13)"; static char fmt_50[] = "(6x,\002In above, R1 =\002,e21.13,3x,\002R2 " "=\002,e21.13)"; /* System generated locals */ integer i__1; /* Builtin functions */ integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ static integer i__, lunit, mesflg; /* Fortran I/O blocks */ static cilist io___5 = { 0, 0, 0, fmt_10, 0 }; static cilist io___7 = { 0, 0, 0, fmt_20, 0 }; static cilist io___8 = { 0, 0, 0, fmt_30, 0 }; static cilist io___9 = { 0, 0, 0, fmt_40, 0 }; static cilist io___10 = { 0, 0, 0, fmt_50, 0 }; /* ----------------------------------------------------------------------- */ /* Subroutine XERRWV, as given here, constitutes a simplified version of */ /* the SLATEC error handling package. */ /* Written by A. C. Hindmarsh and P. N. Brown at LLNL. */ /* Modified 1/8/90 by Clement Ulrich at LLNL. */ /* Version of 8 January, 1990. */ /* This version is in double precision. */ /* All arguments are input arguments. */ /* MSG = The message (character array). */ /* NMES = The length of MSG (number of characters). */ /* NERR = The error number (not used). */ /* LEVEL = The error level.. */ /* 0 or 1 means recoverable (control returns to caller). */ /* 2 means fatal (run is aborted--see note below). */ /* NI = Number of integers (0, 1, or 2) to be printed with message. */ /* I1,I2 = Integers to be printed, depending on NI. */ /* NR = Number of reals (0, 1, or 2) to be printed with message. */ /* R1,R2 = Reals to be printed, depending on NR. */ /* Note.. this routine is compatible with ANSI-77; however the */ /* following assumptions may not be valid for some machines: */ /* 1. The argument MSG is assumed to be of type CHARACTER, and */ /* the message is printed with a format of (1X,80A1). */ /* 2. The message is assumed to take only one line. */ /* Multi-line messages are generated by repeated calls. */ /* 3. If LEVEL = 2, control passes to the statement STOP */ /* to abort the run. For a different run-abort command, */ /* change the statement following statement 100 at the end. */ /* 4. R1 and R2 are assumed to be in double precision and are printed */ /* in E21.13 format. */ /* 5. The logical unit number 6 is standard output. */ /* For a different default logical unit number, change the assignment */ /* statement for LUNIT below. */ /* ----------------------------------------------------------------------- */ /* Subroutines called by XERRWV.. None */ /* Function routines called by XERRWV.. None */ /* ----------------------------------------------------------------------- */ /* Define message print flag and logical unit number. ------------------- */ /* Parameter adjustments */ --msg; /* Function Body */ mesflg = 1; lunit = 6; if(mesflg == 0) { goto L100; } /* Write the message. --------------------------------------------------- */ io___5.ciunit = lunit; s_wsfe(&io___5); i__1 = *nmes; for(i__ = 1; i__ <= i__1; ++i__) { do_fio(&c__1, msg + i__, (ftnlen)1); } e_wsfe(); if(*ni == 1) { io___7.ciunit = lunit; s_wsfe(&io___7); do_fio(&c__1, (char *)&(*i1), (ftnlen)sizeof(integer)); e_wsfe(); } if(*ni == 2) { io___8.ciunit = lunit; s_wsfe(&io___8); do_fio(&c__1, (char *)&(*i1), (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&(*i2), (ftnlen)sizeof(integer)); e_wsfe(); } if(*nr == 1) { io___9.ciunit = lunit; s_wsfe(&io___9); do_fio(&c__1, (char *)&(*r1), (ftnlen)sizeof(doublereal)); e_wsfe(); } if(*nr == 2) { io___10.ciunit = lunit; s_wsfe(&io___10); do_fio(&c__1, (char *)&(*r1), (ftnlen)sizeof(doublereal)); do_fio(&c__1, (char *)&(*r2), (ftnlen)sizeof(doublereal)); e_wsfe(); } /* Abort the run if LEVEL = 2. ------------------------------------------ */ L100: if(*level != 2) { return 0; } s_stop("", (ftnlen)0); /* ----------------------- End of Subroutine XERRWV ---------------------- */ return 0; } /* xerrwv_ */
/* Subroutine */ int xerrwv_(char *msg, integer *nmes, integer *nerr, integer *iert, integer *ni, integer *i1, integer *i2, integer *nr, real *r1, real *r2, ftnlen msg_len) { /* Initialized data */ static struct { char e_1[16]; integer fill_2[2]; char e_3[4]; integer fill_4[2]; char e_5[8]; integer fill_6[1]; char e_7[4]; } equiv_20 = { "( 1 X , ", {0}, "A ", {0}, ", A ", {0}, ") " }; #define nform ((integer *)&equiv_20) static integer ncpw = 4; static integer mesflg = 1; static integer lunit = 6; /* Format strings */ static char fmt_20[] = "(6x,\002IN ABOVE MESSAGE, I1 =\002,i10)"; static char fmt_30[] = "(6x,\002IN ABOVE MESSAGE, I1 =\002,i10,3x,\002I" "2 =\002,i10)"; static char fmt_40[] = "(6x,\002IN ABOVE MESSAGE, R1 =\002,d21.13)"; static char fmt_50[] = "(6x,\002IN ABOVE, R1 =\002,d21.13,3x,\002R2 " "=\002,d21.13)"; /* System generated locals */ integer i__1; /* Builtin functions */ integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Subroutine */ int s_stop(char *, ftnlen); /* Local variables */ static integer i__, nch, lun, nrem, nwds; extern /* Subroutine */ int s88fmt_(integer *, integer *, integer *); /* Fortran I/O blocks */ static cilist io___14 = { 0, 0, 0, (char *)nform, 0 }; static cilist io___16 = { 0, 0, 0, fmt_20, 0 }; static cilist io___17 = { 0, 0, 0, fmt_30, 0 }; static cilist io___18 = { 0, 0, 0, fmt_40, 0 }; static cilist io___19 = { 0, 0, 0, fmt_50, 0 }; /* ----------------------------------------------------------------------- */ /* Subroutine xerrwv, as given here, constitutes */ /* a simplified version of the slatec error handling package */ /* written by A. C. Hindmarsh at LLL. version of January 23, 1980, */ /* modified by L. R. Petzold, April 1982. */ /* All arguments are input arguments. */ /* msg = the message (Hollerith literal or integer array). */ /* nmes = the length of msg (number of characters). */ /* nerr = the error number (not used). */ /* iert = the error type.. */ /* 1 means recoverable (control returns to caller). */ /* 2 means fatal (run is aborted--see note below). */ /* ni = number of integers (0, 1, or 2) to be printed with message. */ /* i1,i2 = integers to be printed, depending on ni. */ /* nr = number of reals (0, 1, or 2) to be printed with message. */ /* r1,r2 = reals to be printed, depending on ni. */ /* note.. this routine is machine-dependent and specialized for use */ /* in limited context, in the following ways.. */ /* 1. the number of hollerith characters stored per word, denoted */ /* by ncpw below, is set in a data statement below. */ /* 2. the value of nmes is assumed to be at most 60. */ /* (multi-line messages are generated by repeated calls.) */ /* 3. if iert = 2, control passes to the statement stop */ /* to abort the run. this statement may be machine-dependent. */ /* 4. r1 and r2 are assumed to be in real and are printed */ /* in d21.13 format. */ /* 5. the data statement below contains default values of */ /* mesflg = print control flag.. */ /* 1 means print all messages (the default). */ /* 0 means no printing. */ /* lunit = logical unit number for messages. */ /* the default is 6 (machine-dependent). */ /* to change lunit, change the data statement */ /* below. */ /* ----------------------------------------------------------------------- */ /* The following are instructions for installing this routine */ /* in different machine environments. */ /* To change the default output unit, change the data statement */ /* below. */ /* For a different number of characters per word, change the */ /* data statement setting ncpw below. */ /* Alternatives for various computers are shown in comment */ /* cards. */ /* For a different run-abort command, change the statement following */ /* statement 100 at the end. */ /* ----------------------------------------------------------------------- */ /* The following value of ncpw is valid for the cdc-6600 and */ /* cdc-7600 computers. */ /* data ncpw/10/ */ /* The following is valid for the cray-1 computer. */ /* data ncpw/8/ */ /* The following is valid for the burroughs 6700 and 7800 computers. */ /* data ncpw/6/ */ /* The following is valid for the pdp-10 computer. */ /* data ncpw/5/ */ /* The following is valid for the vax computer with 4 bytes per integer, */ /* and for the ibm-360, ibm-303x, and ibm-43xx computers. */ /* data ncpw/4/ */ /* The following is valid for the pdp-11, or vax with 2-byte integers. */ /* data ncpw/2/ */ /* ---------------------------------------------------------------------- */ /* Parameter adjustments */ msg -= msg_len; /* Function Body */ /* This may have to be modified according to the information */ /* provided above */ if (mesflg == 0) { goto L100; } lun = lunit; nch = min(*nmes,60); nwds = nch / ncpw; s88fmt_(&c__2, &nwds, &nform[4]); s88fmt_(&c__2, &ncpw, &nform[7]); nrem = nch - nwds * ncpw; if (nrem > 0) { ++nwds; } if (nrem < 1) { nrem = 1; } s88fmt_(&c__1, &nrem, &nform[11]); io___14.ciunit = lun; s_wsfe(&io___14); i__1 = nwds; for (i__ = 1; i__ <= i__1; ++i__) { do_fio(&c__1, msg + i__ * msg_len, msg_len); } e_wsfe(); if (*ni == 1) { io___16.ciunit = lun; s_wsfe(&io___16); do_fio(&c__1, (char *)&(*i1), (ftnlen)sizeof(integer)); e_wsfe(); } if (*ni == 2) { io___17.ciunit = lun; s_wsfe(&io___17); do_fio(&c__1, (char *)&(*i1), (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&(*i2), (ftnlen)sizeof(integer)); e_wsfe(); } if (*nr == 1) { io___18.ciunit = lun; s_wsfe(&io___18); do_fio(&c__1, (char *)&(*r1), (ftnlen)sizeof(real)); e_wsfe(); } if (*nr == 2) { io___19.ciunit = lun; s_wsfe(&io___19); do_fio(&c__1, (char *)&(*r1), (ftnlen)sizeof(real)); do_fio(&c__1, (char *)&(*r2), (ftnlen)sizeof(real)); e_wsfe(); } L100: if (*iert != 2) { return 0; } s_stop("", (ftnlen)0); return 0; } /* xerrwv_ */
/* Subroutine */ int gettxt_() { /* System generated locals */ integer i__1; char ch__1[80]; olist o__1; alist al__1; /* Builtin functions */ /* Subroutine */ int s_copy(); integer s_rsfe(), do_fio(), e_rsfe(), i_indx(), f_open(), f_rew(), s_wsfe( ), e_wsfe(), s_cmp(); /* Subroutine */ int s_stop(); /* Local variables */ static integer i__, j; static char filen[50], ch[1]; static integer is[3]; extern /* Character */ VOID getnam_(); extern /* Subroutine */ int upcase_(); static char oldkey[80], ch2[1]; /* Fortran I/O blocks */ static cilist io___2 = { 1, 5, 1, "(A)", 0 }; static cilist io___7 = { 1, 4, 1, "(A)", 0 }; static cilist io___8 = { 1, 4, 1, "(A)", 0 }; static cilist io___9 = { 1, 5, 1, "(A)", 0 }; static cilist io___10 = { 1, 5, 1, "(A)", 0 }; static cilist io___11 = { 1, 4, 1, "(A)", 0 }; static cilist io___12 = { 1, 5, 1, "(A)", 0 }; static cilist io___13 = { 1, 5, 1, "(A)", 0 }; static cilist io___14 = { 1, 5, 1, "(A)", 0 }; static cilist io___15 = { 1, 4, 1, "(A)", 0 }; static cilist io___16 = { 1, 5, 1, "(A)", 0 }; static cilist io___17 = { 1, 5, 1, "(A)", 0 }; static cilist io___18 = { 1, 5, 1, "(A)", 0 }; static cilist io___19 = { 1, 5, 1, "(A)", 0 }; static cilist io___20 = { 0, 6, 0, "(A)", 0 }; static cilist io___23 = { 0, 6, 0, "(A,I2,A)", 0 }; static cilist io___24 = { 0, 6, 0, "(A)", 0 }; static cilist io___25 = { 0, 6, 0, "(A)", 0 }; is[0] = 161; is[1] = 81; is[2] = 1; s_copy(keywrd_1.keywrd, " ", (ftnlen)241, (ftnlen)1); s_copy(titles_1.koment, " NULL ", (ftnlen)81, (ftnlen)10); s_copy(titles_1.title, " NULL ", (ftnlen)81, (ftnlen)10); i__1 = s_rsfe(&io___2); if (i__1 != 0) { goto L100001; } i__1 = do_fio(&c__1, keywrd_1.keywrd, (ftnlen)80); if (i__1 != 0) { goto L100001; } i__1 = e_rsfe(); L100001: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } s_copy(oldkey, keywrd_1.keywrd, (ftnlen)80, (ftnlen)241); upcase_(keywrd_1.keywrd, (ftnlen)80); if (i_indx(keywrd_1.keywrd, "SETUP", (ftnlen)241, (ftnlen)5) != 0) { i__ = i_indx(keywrd_1.keywrd, "SETUP=", (ftnlen)241, (ftnlen)6); if (i__ != 0) { j = i_indx(keywrd_1.keywrd + (i__ - 1), " ", 241 - (i__ - 1), ( ftnlen)1); i__1 = i__ + 5; s_copy(filen, oldkey + i__1, (ftnlen)50, i__ + j - 1 - i__1); } else { s_copy(filen, "SETUP", (ftnlen)50, (ftnlen)5); } o__1.oerr = 0; o__1.ounit = 4; o__1.ofnmlen = 80; getnam_(ch__1, (ftnlen)80, filen, (ftnlen)50); o__1.ofnm = ch__1; o__1.orl = 0; o__1.osta = "UNKNOWN"; o__1.oacc = 0; o__1.ofm = "FORMATTED"; o__1.oblnk = 0; f_open(&o__1); al__1.aerr = 0; al__1.aunit = 4; f_rew(&al__1); i__1 = s_rsfe(&io___7); if (i__1 != 0) { goto L40; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 80, (ftnlen)80); if (i__1 != 0) { goto L40; } i__1 = e_rsfe(); if (i__1 != 0) { goto L40; } upcase_(keywrd_1.keywrd + 80, (ftnlen)80); i__1 = s_rsfe(&io___8); if (i__1 != 0) { goto L10; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 160, (ftnlen)80); if (i__1 != 0) { goto L10; } i__1 = e_rsfe(); if (i__1 != 0) { goto L10; } upcase_(keywrd_1.keywrd + 160, (ftnlen)80); L10: i__1 = s_rsfe(&io___9); if (i__1 != 0) { goto L100002; } i__1 = do_fio(&c__1, titles_1.koment, (ftnlen)81); if (i__1 != 0) { goto L100002; } i__1 = do_fio(&c__1, titles_1.title, (ftnlen)81); if (i__1 != 0) { goto L100002; } i__1 = e_rsfe(); L100002: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } } else if (i_indx(keywrd_1.keywrd, " +", (ftnlen)80, (ftnlen)2) != 0) { /* READ SECOND KEYWORD LINE */ i__1 = s_rsfe(&io___10); if (i__1 != 0) { goto L100003; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 80, (ftnlen)80); if (i__1 != 0) { goto L100003; } i__1 = e_rsfe(); L100003: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } s_copy(oldkey, keywrd_1.keywrd + 80, (ftnlen)80, (ftnlen)80); upcase_(keywrd_1.keywrd + 80, (ftnlen)80); if (i_indx(keywrd_1.keywrd + 80, "SETUP", (ftnlen)80, (ftnlen)5) != 0) { i__ = i_indx(keywrd_1.keywrd, "SETUP=", (ftnlen)241, (ftnlen)6); if (i__ != 0) { j = i_indx(keywrd_1.keywrd + (i__ - 1), " ", 241 - (i__ - 1), (ftnlen)1); i__1 = i__ - 75; s_copy(filen, oldkey + i__1, (ftnlen)50, i__ + j - 80 - i__1); } else { s_copy(filen, "SETUP", (ftnlen)50, (ftnlen)5); } o__1.oerr = 0; o__1.ounit = 4; o__1.ofnmlen = 80; getnam_(ch__1, (ftnlen)80, filen, (ftnlen)50); o__1.ofnm = ch__1; o__1.orl = 0; o__1.osta = "UNKNOWN"; o__1.oacc = 0; o__1.ofm = "FORMATTED"; o__1.oblnk = 0; f_open(&o__1); al__1.aerr = 0; al__1.aunit = 4; f_rew(&al__1); i__1 = s_rsfe(&io___11); if (i__1 != 0) { goto L20; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 160, (ftnlen)80); if (i__1 != 0) { goto L20; } i__1 = e_rsfe(); if (i__1 != 0) { goto L20; } upcase_(keywrd_1.keywrd + 160, (ftnlen)80); L20: ; } else if (i_indx(keywrd_1.keywrd + 80, " +", (ftnlen)80, (ftnlen)2) != 0) { /* READ THIRD KEYWORD LINE */ i__1 = s_rsfe(&io___12); if (i__1 != 0) { goto L100004; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 160, (ftnlen)80); if (i__1 != 0) { goto L100004; } i__1 = e_rsfe(); L100004: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } upcase_(keywrd_1.keywrd + 160, (ftnlen)80); } /* READ TITLE LINE */ i__1 = s_rsfe(&io___13); if (i__1 != 0) { goto L100005; } i__1 = do_fio(&c__1, titles_1.koment, (ftnlen)81); if (i__1 != 0) { goto L100005; } i__1 = do_fio(&c__1, titles_1.title, (ftnlen)81); if (i__1 != 0) { goto L100005; } i__1 = e_rsfe(); L100005: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } } else if (i_indx(keywrd_1.keywrd, "&", (ftnlen)80, (ftnlen)1) != 0) { i__1 = s_rsfe(&io___14); if (i__1 != 0) { goto L100006; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 80, (ftnlen)80); if (i__1 != 0) { goto L100006; } i__1 = e_rsfe(); L100006: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } s_copy(oldkey, keywrd_1.keywrd + 80, (ftnlen)80, (ftnlen)80); upcase_(keywrd_1.keywrd + 80, (ftnlen)80); if (i_indx(keywrd_1.keywrd + 80, "SETUP", (ftnlen)80, (ftnlen)5) != 0) { i__ = i_indx(keywrd_1.keywrd, "SETUP=", (ftnlen)241, (ftnlen)6); if (i__ != 0) { j = i_indx(keywrd_1.keywrd + (i__ - 1), " ", 241 - (i__ - 1), (ftnlen)1); i__1 = i__ - 75; s_copy(filen, oldkey + i__1, (ftnlen)50, i__ + j - 80 - i__1); /* write(*,*)' <'//FILEN//'>' */ /* stop */ } else { s_copy(filen, "SETUP", (ftnlen)50, (ftnlen)5); } o__1.oerr = 0; o__1.ounit = 4; o__1.ofnmlen = 80; getnam_(ch__1, (ftnlen)80, filen, (ftnlen)50); o__1.ofnm = ch__1; o__1.orl = 0; o__1.osta = "UNKNOWN"; o__1.oacc = 0; o__1.ofm = "FORMATTED"; o__1.oblnk = 0; f_open(&o__1); al__1.aerr = 0; al__1.aunit = 4; f_rew(&al__1); i__1 = s_rsfe(&io___15); if (i__1 != 0) { goto L30; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 160, (ftnlen)80); if (i__1 != 0) { goto L30; } i__1 = e_rsfe(); if (i__1 != 0) { goto L30; } upcase_(keywrd_1.keywrd + 160, (ftnlen)80); i__1 = s_rsfe(&io___16); if (i__1 != 0) { goto L100007; } i__1 = do_fio(&c__1, titles_1.title, (ftnlen)81); if (i__1 != 0) { goto L100007; } i__1 = e_rsfe(); L100007: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } L30: ; } else if (i_indx(keywrd_1.keywrd + 80, "&", (ftnlen)80, (ftnlen)1) != 0) { i__1 = s_rsfe(&io___17); if (i__1 != 0) { goto L100008; } i__1 = do_fio(&c__1, keywrd_1.keywrd + 160, (ftnlen)80); if (i__1 != 0) { goto L100008; } i__1 = e_rsfe(); L100008: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } } else { i__1 = s_rsfe(&io___18); if (i__1 != 0) { goto L100009; } i__1 = do_fio(&c__1, titles_1.title, (ftnlen)81); if (i__1 != 0) { goto L100009; } i__1 = e_rsfe(); L100009: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } } } else { i__1 = s_rsfe(&io___19); if (i__1 != 0) { goto L100010; } i__1 = do_fio(&c__1, titles_1.koment, (ftnlen)81); if (i__1 != 0) { goto L100010; } i__1 = do_fio(&c__1, titles_1.title, (ftnlen)81); if (i__1 != 0) { goto L100010; } i__1 = e_rsfe(); L100010: if (i__1 < 0) { goto L100; } if (i__1 > 0) { goto L90; } } goto L50; L40: s_wsfe(&io___20); do_fio(&c__1, " SETUP FILE MISSING OR CORRUPT", (ftnlen)30); e_wsfe(); L50: for (j = 1; j <= 3; ++j) { i__1 = is[j - 1] - 1; if (s_cmp(keywrd_1.keywrd + i__1, " ", is[j - 1] - i__1, (ftnlen)1) != 0) { i__1 = is[j - 1] - 1; s_copy(ch, keywrd_1.keywrd + i__1, (ftnlen)1, is[j - 1] - i__1); i__1 = is[j - 1] - 1; s_copy(keywrd_1.keywrd + i__1, " ", is[j - 1] - i__1, (ftnlen)1); for (i__ = is[j - 1] + 1; i__ <= 239; ++i__) { *(unsigned char *)ch2 = *(unsigned char *)&keywrd_1.keywrd[ i__ - 1]; *(unsigned char *)&keywrd_1.keywrd[i__ - 1] = *(unsigned char *)ch; *(unsigned char *)ch = *(unsigned char *)ch2; i__1 = i__; if (s_cmp(keywrd_1.keywrd + i__1, " ", i__ + 2 - i__1, ( ftnlen)2) == 0) { i__1 = i__; s_copy(keywrd_1.keywrd + i__1, ch, i__ + 1 - i__1, ( ftnlen)1); goto L70; } /* L60: */ } s_wsfe(&io___23); do_fio(&c__1, " LINE", (ftnlen)5); do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer)); do_fio(&c__1, " OF KEYWORDS DOES NOT HAVE ENOUGH", (ftnlen)33); e_wsfe(); s_wsfe(&io___24); do_fio(&c__1, " SPACES FOR PARSING. PLEASE CORRECT LINE.", ( ftnlen)42); e_wsfe(); s_stop("", (ftnlen)0); L70: ; } /* L80: */ } return 0; L90: s_wsfe(&io___25); do_fio(&c__1, " ERROR IN READ OF FIRST THREE LINES", (ftnlen)35); e_wsfe(); L100: s_stop("", (ftnlen)0); } /* gettxt_ */