funkalicious 0.1

func_header.c

Go to the documentation of this file.
00001 /*
00002  *func_header
00003  *Outputs the header from a wavefunction output by Craig Pryor's dotcode.
00004  
00005     Copyright (C) 2009 Joseph Pingenot
00006 
00007     This program is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU Affero General Public License as published by
00009     the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU Affero General Public License for more details.
00016 
00017     You should have received a copy of the GNU Affero General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 #include <glib-2.0/glib.h>
00025 #include <libdotcode/function_parser.h>
00026 #include "config.h"
00027 #include "common.h"
00028 
00029 #define EV_PER_HARTREE 27.2113834
00030 #define NM_PER_BOHR 0.05291772083
00031 
00032 int main(int argv, char* argc[]) {
00033   g_type_init();
00034   int i;
00035   struct wavefunc_header header;
00036   double *matrix;
00037   int err;
00038   int retval;
00039   if(argv == 1) {
00040     fprintf(stderr, "Umm, you probably want to pass me a file or space-separated list of files to read.\n");
00041     exit(1);
00042   }
00043   for(i=1; i<argv; i++) {
00044     printf("file: %s\n", argc[i]);
00045     retval = read_wavefunction(argc[i], &header, &matrix, &err);
00046     printf("\tretval=%d err=%d, format=%s, endian=%c le=%d, version_string=%s=%d Nc=%d Nx=%d Ny=%d Nz=%d; dx=%gBohr=%gnm dy=%gBohr=%gnm dz=%gBohr=%gnm energy=%gHartree=%geV\n", retval, err, 
00047      header.format,
00048      header.endian,
00049      header.little_endian,
00050      header.version_string,
00051      header.version, 
00052      header.Nc,
00053      header.Nx,
00054      header.Ny,
00055      header.Nz,
00056      header.dx,
00057      header.dx*NM_PER_BOHR,
00058      header.dy,
00059      header.dy*NM_PER_BOHR,
00060      header.dz,
00061      header.dz*NM_PER_BOHR,
00062      header.energy,
00063      header.energy*EV_PER_HARTREE);
00064   }
00065   exit(0);
00066 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines