00001
00002 #ifndef _mpqcin_h
00003 #define _mpqcin_h
00004
00005 #include <iostream>
00006
00007 #include <util/keyval/keyval.h>
00008 #include <chemistry/molecule/molecule.h>
00009
00010 class IPV2;
00011
00012 template <class T>
00013 class MPQCInDatum {
00014 int set_;
00015 T val_;
00016 public:
00017 MPQCInDatum(const T&v): val_(v), set_(0) {}
00018 const T &operator =(const T&v) { set_ = 1; val_ = v; return val_; }
00019 void reset(const T &val) { set_ = 0; val_ = val; }
00020 int set() const { return set_; }
00021 T val() const { return val_; }
00022 };
00023
00024 class MPQCInFlexLexer;
00025 class MPQCIn {
00026 MPQCInFlexLexer *lexer_;
00027 Ref<Molecule> mol_;
00028 MPQCInDatum<int> gradient_;
00029 MPQCInDatum<int> frequencies_;
00030 MPQCInDatum<int> optimize_;
00031 MPQCInDatum<int> mult_;
00032 MPQCInDatum<int> redund_coor_;
00033 MPQCInDatum<int> opt_type_;
00034 MPQCInDatum<int> restart_;
00035 MPQCInDatum<int> checkpoint_;
00036 MPQCInDatum<int> charge_;
00037 MPQCInDatum<int> atom_charge_;
00038 MPQCInDatum<int> molecule_bohr_;
00039 MPQCInDatum<char *> basis_;
00040 MPQCInDatum<char *> method_;
00041 MPQCInDatum<char *> method_xc_;
00042 MPQCInDatum<char *> method_grid_;
00043 MPQCInDatum<char *> symmetry_;
00044 MPQCInDatum<Arrayint *> alpha_;
00045 MPQCInDatum<Arrayint *> beta_;
00046 MPQCInDatum<Arrayint *> docc_;
00047 MPQCInDatum<Arrayint *> socc_;
00048 MPQCInDatum<Arrayint *> frozen_docc_;
00049 MPQCInDatum<Arrayint *> frozen_uocc_;
00050
00051 int nirrep_;
00052
00053 void write_energy_object(std::ostream&, const char *keyword,
00054 const char *method,
00055 const char *basis, int coor);
00056 void write_basis_object(std::ostream&, const char *keyword,
00057 const char *basis);
00058 void write_vector(std::ostream &ostrs,
00059 const char *keyvalname,
00060 const char *name,
00061 MPQCInDatum<Arrayint *>&vec,
00062 int require_nirrep);
00063
00064 static int checking_;
00065 public:
00066 MPQCIn();
00067 ~MPQCIn();
00068
00069 char *parse_string(const char *s);
00070 int check_string(const char *s);
00071
00072 int ylex();
00073 int yparse();
00074 void error(const char* s);
00075 void error2(const char* s, const char* s2);
00076 void yerror(const char* s);
00077 void yerror2(const char* s, const char *);
00078
00079 void begin_molecule();
00080 void end_molecule();
00081 void add_atom(char *, char *, char *, char *);
00082 void set_charge(char *);
00083 void set_method(char *);
00084 void set_basis(char *);
00085 void set_multiplicity(char *);
00086 void set_optimize(int);
00087 void set_opt_type(int);
00088 void set_atom_charge(char *);
00089 void set_molecule_unit(char *);
00090 void set_method_xc(char *);
00091 void set_method_grid(char *);
00092 void set_symmetry(char *);
00093 void set_redund_coor(int);
00094 void set_gradient(int);
00095 void set_frequencies(int);
00096 void set_restart(int);
00097 void set_checkpoint(int);
00098 void set_molecule_bohr(int);
00099 void set_docc(Arrayint *);
00100 void set_socc(Arrayint *);
00101 void set_alpha(Arrayint *);
00102 void set_beta(Arrayint *);
00103 void set_frozen_docc(Arrayint *);
00104 void set_frozen_uocc(Arrayint *);
00105 Arrayint *make_nnivec(Arrayint *, char *);
00106
00107 static int checking() { return checking_; }
00108 };
00109
00110 #endif