From 9cd3bcc7a07fdb8414cd3e9bd3403b9c4613d358 Mon Sep 17 00:00:00 2001 From: Justin Lemkul Date: Wed, 19 Jun 2013 09:07:58 -0400 Subject: [PATCH] Minor tweaks to qm_orca.c Formatting fixes for readability and better screen output. Also replaced gmx_call() by gmx_fatal() for more sensible error reporting. Change-Id: I7669fe2b1c83c6bf8fb5d24760d8acdb0919c46c --- src/mdlib/qm_orca.c | 51 +++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/mdlib/qm_orca.c b/src/mdlib/qm_orca.c index 45f789ab49..2816d2d041 100644 --- a/src/mdlib/qm_orca.c +++ b/src/mdlib/qm_orca.c @@ -71,9 +71,9 @@ void init_orca(t_commrec *cr, t_QMrec *qm, t_MMrec *mm) { - char - *buf; + char *buf; snew(buf, 200); + /* ORCA settings on the system */ buf = getenv("BASENAME"); if (buf) @@ -83,13 +83,12 @@ void init_orca(t_commrec *cr, t_QMrec *qm, t_MMrec *mm) } else { - gmx_fatal(FARGS, "no $BASENAME\n"); + gmx_fatal(FARGS, "$BASENAME not set\n"); } /* ORCA directory on the system */ snew(buf, 200); buf = getenv("ORCA_PATH"); - fprintf(stderr, "%s", buf); if (buf) { @@ -98,11 +97,11 @@ void init_orca(t_commrec *cr, t_QMrec *qm, t_MMrec *mm) } else { - gmx_fatal(FARGS, "no $ORCA_PATH, check manual\n"); + gmx_fatal(FARGS, "$ORCA_PATH not set, check manual\n"); } - fprintf(stderr, "%s...\n", qm->orca_dir); - fprintf(stderr, "orca initialised...\n"); + fprintf(stderr, "Setting ORCA path to: %s...\n", qm->orca_dir); + fprintf(stderr, "ORCA initialised...\n\n"); /* since we append the output to the BASENAME.out file, we should delete an existent old out-file here. */ sprintf(buf, "%s.out", qm->orca_basename); @@ -112,24 +111,24 @@ void init_orca(t_commrec *cr, t_QMrec *qm, t_MMrec *mm) void write_orca_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm) { - int - i; - t_QMMMrec - *QMMMrec; - FILE - *out, *pcFile, *addInputFile, *LJCoeff; - char - *buf, *orcaInput, *addInputFilename, *LJCoeffFilename, - *pcFilename, *exclInName, *exclOutName; + int i; + t_QMMMrec *QMMMrec; + FILE *out, *pcFile, *addInputFile, *LJCoeff; + char *buf, *orcaInput, *addInputFilename, *LJCoeffFilename, *pcFilename, *exclInName, *exclOutName; + QMMMrec = fr->qr; + /* write the first part of the input-file */ snew(orcaInput, 200); sprintf(orcaInput, "%s.inp", qm->orca_basename); out = fopen(orcaInput, "w"); + snew(addInputFilename, 200); sprintf(addInputFilename, "%s.ORCAINFO", qm->orca_basename); addInputFile = fopen(addInputFilename, "r"); - fprintf(out, "#input-file generated by gromacs\n"); + + fprintf(out, "#input-file generated by GROMACS\n"); + if (qm->bTS) { fprintf(out, "!QMMMOpt TightSCF\n"); @@ -143,6 +142,7 @@ void write_orca_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm) { fprintf(out, "!EnGrad TightSCF\n"); } + /* here we include the insertion of the additional orca-input */ snew(buf, 200); if (addInputFile != NULL) @@ -157,10 +157,11 @@ void write_orca_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm) } else { - fprintf(stderr, "No information on the calculation given in <%s>\n", addInputFilename); - gmx_call("qm_orca.c"); + gmx_fatal(FARGS, "No information on the calculation given in %s\n", addInputFilename); } + fclose(addInputFile); + if (qm->bTS || qm->bOPT) { /* freeze the frontier QM atoms and Link atoms. This is @@ -223,11 +224,11 @@ void write_orca_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm) fclose(LJCoeff); } } - /* write charge and multiplicity - */ + + /* write charge and multiplicity */ fprintf(out, "*xyz %2d%2d\n", qm->QMcharge, qm->multiplicity); - /* write the QM coordinates - */ + + /* write the QM coordinates */ for (i = 0; i < qm->nrQMatoms; i++) { int atomNr; @@ -254,8 +255,8 @@ void write_orca_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm) #endif } fprintf(out, "*\n"); - /* write the MM point charge data - */ + + /* write the MM point charge data */ if (QMMMrec->QMMMscheme != eQMMMschemeoniom && mm->nrMMatoms) { /* name of the point charge file */ -- 2.22.0