Beispiel #1
0
void write_inpfile(const char *fn,int ninp,t_inpfile inp[],gmx_bool bHaltOnUnknown,
		   warninp_t wi)
{
  FILE *out;
  int  i;
  char warn_buf[STRLEN];

  sort_inp(ninp,inp);  
  out=gmx_fio_fopen(fn,"w");
  nice_header(out,fn);
  for(i=0; (i<ninp); i++) {
    if (inp[i].bSet) {
      if(inp[i].name[0]==';' || (strlen(inp[i].name)>2 && inp[i].name[1]==';'))
	fprintf(out,"%-24s\n",inp[i].name);
      else
	fprintf(out,"%-24s = %s\n",inp[i].name,inp[i].value ? inp[i].value : "");
    } else if (!inp[i].bObsolete) {
      sprintf(warn_buf,"Unknown left-hand '%s' in parameter file\n",
	      inp[i].name);
      if (bHaltOnUnknown) {
	warning_error(wi,warn_buf);
      } else {
	warning(wi,warn_buf);
      }
    }
  }
  gmx_fio_fclose(out);

  check_warning_error(wi,FARGS);
}
Beispiel #2
0
void write_inpfile(const char *fn, int ninp, t_inpfile inp[], gmx_bool bHaltOnUnknown,
                   warninp_t wi)
{
    FILE *out;
    int   i;
    char  warn_buf[STRLEN];

    sort_inp(ninp, inp);
    out = gmx_fio_fopen(fn, "w");
    nice_header(out, fn);
    try
    {
        gmx::BinaryInformationSettings settings;
        settings.generatedByHeader(true);
        settings.linePrefix(";\t");
        gmx::printBinaryInformation(out, gmx::getProgramContext(), settings);
    }
    GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;

    for (i = 0; (i < ninp); i++)
    {
        if (inp[i].bSet)
        {
            if (inp[i].name[0] == ';' || (strlen(inp[i].name) > 2 && inp[i].name[1] == ';'))
            {
                fprintf(out, "%-24s\n", inp[i].name);
            }
            else
            {
                fprintf(out, "%-24s = %s\n", inp[i].name, inp[i].value ? inp[i].value : "");
            }
        }
        else if (!inp[i].bObsolete)
        {
            sprintf(warn_buf, "Unknown left-hand '%s' in parameter file\n",
                    inp[i].name);
            if (bHaltOnUnknown)
            {
                warning_error(wi, warn_buf);
            }
            else
            {
                warning(wi, warn_buf);
            }
        }
    }
    gmx_fio_fclose(out);

    check_warning_error(wi, FARGS);
}
Beispiel #3
0
void print_top_comment(FILE *out,
                       const char *filename,
                       const char *generator,
                       const char *ffdir,
                       gmx_bool bITP)
{
  char tmp[256]; 
  char ffdir_parent[STRLEN];
  char *p;
        
  nice_header(out,filename);
  fprintf(out,";\tThis is a %s topology file\n;\n",bITP ? "include" : "standalone");
  fprintf(out,";\tIt was generated using program:\n;\t%s\n;\n",
          (NULL == generator) ? "unknown" : generator);
  fprintf(out,";\tCommand line was:\n;\t%s\n;\n",command_line());

  if(strchr(ffdir,'/')==NULL)
  {
      fprintf(out,";\tForce field was read from the standard Gromacs share directory.\n;\n\n");
  }
  else if(ffdir[0]=='.')
  {
      fprintf(out,";\tForce field was read from current directory or a relative path - path added.\n;\n\n");
  }
  else
  {
      strncpy(ffdir_parent,ffdir,STRLEN-1);
      p=strrchr(ffdir_parent,'/');

      *p='\0';
      
      fprintf(out,
              ";\tForce field data was read from:\n"
              ";\t%s\n"
              ";\n"
              ";\tNote:\n"
              ";\tThis might be a non-standard force field location. When you use this topology, the\n"
              ";\tforce field must either be present in the current directory, or the location\n"
              ";\tspecified in the GMXLIB path variable or with the 'include' mdp file option.\n;\n\n",
              ffdir_parent);
  }
}