/* Copyright (C) 2008 Jiri Pittner or This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include #include #include #define EPSPRINT .05 #include "la.h" #include "fourindex.h" #include "nonclass.h" #include "basic.h" #include "sifs.h" using namespace LA; int main(int argc, char **argv) { sigtraceback(SIGSEGV,1); sigtraceback(SIGABRT,1); sigtraceback(SIGBUS,1); sigtraceback(SIGFPE,1); cout.setf(ios::fixed); cout.precision(12); print_version(argc,argv,cout); if(argc<2) { cout <<"Usage: readsifs [-1] file\n"; cout <<"Stores one-electron as NRSMat (with dimensions) in file.itypea.itypeb and S,H without dimensions for tinyscf\n"; cout <<"and converts the two-electron integrals to fourindex_ext format\n"; exit(1); } --argc; ++argv; bool oneonly=false; if(!strcmp(*argv,"-1")) { ++argv; --argc; oneonly=true; } int f=open(*argv,O_RDONLY|O_LARGEFILE); if(f<=0) {perror("open:"); laerror("cannot open file for reading");} sifs sif(f); cout <<"SIFS headers\n"; cout < x; NRSMat s; NRSMat h(0.,sif.header.nbas); int itypea,itypeb,last; REAL fcore; int res; do{ res=read_sifs_onel(sif,x,itypea,itypeb,last,fcore); //cout <0) { char name[256]; sprintf(name,"%s.%d.%d",*argv,itypea,itypeb); int g=open(name,O_WRONLY|O_LARGEFILE|O_CREAT,0666); x.put(g,true); close(g); if(itypea==0 && itypeb==0) s=x; if(itypea==0 && (itypeb==1 || itypeb==2)) h+=x; } } while (res>0); { char name[256]; sprintf(name,"%s1S",*argv); int g=open(name,O_WRONLY|O_LARGEFILE|O_CREAT,0666); s.put(g,false); close(g); sprintf(name,"%s1H",*argv); g=open(name,O_WRONLY|O_LARGEFILE|O_CREAT,0666); h.put(g,false); close(g); } if(oneonly) exit(0); //read 2-el integrals if(sif.infos[0]==2) { close(f); char name[256]; sprintf(name,"%s2",*argv); f=open(name,O_RDONLY|O_LARGEFILE); if(f<=0) {perror("open:"); laerror("cannot open file for reading");} cout << "continuing from file "< twoel(sif); //cout < twoel2(g,twoelectronrealmullikan,twoel.size()); fourindex_sifs::iterator it=twoel.begin(); while(it!=twoel.end()) { twoel2.put(*it); ++it; } close(g); close(f); }