| 1 | 
 | 
|---|
| 2 | #ifndef _mpqcin_h
 | 
|---|
| 3 | #define _mpqcin_h
 | 
|---|
| 4 | 
 | 
|---|
| 5 | #include <vector>
 | 
|---|
| 6 | #include <iostream>
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #include <util/keyval/keyval.h>
 | 
|---|
| 9 | #include <chemistry/molecule/molecule.h>
 | 
|---|
| 10 | 
 | 
|---|
| 11 | class MPQCInFlexLexer;
 | 
|---|
| 12 | 
 | 
|---|
| 13 | namespace sc {
 | 
|---|
| 14 | 
 | 
|---|
| 15 | class IPV2;
 | 
|---|
| 16 | 
 | 
|---|
| 17 | template <class T>
 | 
|---|
| 18 | class MPQCInDatum {
 | 
|---|
| 19 |     int set_;
 | 
|---|
| 20 |     T val_;
 | 
|---|
| 21 |   public:
 | 
|---|
| 22 |     MPQCInDatum(const T&v): val_(v), set_(0) {}
 | 
|---|
| 23 |     const T &operator =(const T&v) { set_ = 1; val_ = v; return val_; }
 | 
|---|
| 24 |     void reset(const T &val) { set_ = 0; val_ = val; }
 | 
|---|
| 25 |     int set() const { return set_; }
 | 
|---|
| 26 |     T val() const { return val_; }
 | 
|---|
| 27 | };
 | 
|---|
| 28 | 
 | 
|---|
| 29 | class MPQCIn {
 | 
|---|
| 30 |     MPQCInFlexLexer *lexer_;
 | 
|---|
| 31 |     Ref<Molecule> mol_;
 | 
|---|
| 32 |     MPQCInDatum<int> gradient_;
 | 
|---|
| 33 |     MPQCInDatum<int> frequencies_;
 | 
|---|
| 34 |     MPQCInDatum<int> optimize_;
 | 
|---|
| 35 |     MPQCInDatum<int> mult_;
 | 
|---|
| 36 |     MPQCInDatum<int> redund_coor_;
 | 
|---|
| 37 |     MPQCInDatum<int> opt_type_;
 | 
|---|
| 38 |     MPQCInDatum<int> restart_;
 | 
|---|
| 39 |     MPQCInDatum<int> checkpoint_;
 | 
|---|
| 40 |     MPQCInDatum<int> charge_;
 | 
|---|
| 41 |     MPQCInDatum<int> atom_charge_;
 | 
|---|
| 42 |     MPQCInDatum<int> molecule_bohr_;
 | 
|---|
| 43 |     MPQCInDatum<char *> basis_;
 | 
|---|
| 44 |     MPQCInDatum<char *> auxbasis_;
 | 
|---|
| 45 |     MPQCInDatum<char *> method_;
 | 
|---|
| 46 |     MPQCInDatum<char *> method_xc_;
 | 
|---|
| 47 |     MPQCInDatum<char *> method_grid_;
 | 
|---|
| 48 |     MPQCInDatum<char *> symmetry_;
 | 
|---|
| 49 |     MPQCInDatum<char *> memory_;
 | 
|---|
| 50 |     MPQCInDatum<std::vector<int> *> alpha_;
 | 
|---|
| 51 |     MPQCInDatum<std::vector<int> *> beta_;
 | 
|---|
| 52 |     MPQCInDatum<std::vector<int> *> docc_;
 | 
|---|
| 53 |     MPQCInDatum<std::vector<int> *> socc_;
 | 
|---|
| 54 |     MPQCInDatum<std::vector<int> *> frozen_docc_;
 | 
|---|
| 55 |     MPQCInDatum<std::vector<int> *> frozen_uocc_;
 | 
|---|
| 56 |     MPQCInDatum<const char *> method_ebc_;
 | 
|---|
| 57 |     MPQCInDatum<const char *> method_gbc_;
 | 
|---|
| 58 |     MPQCInDatum<const char *> method_absmethod_;
 | 
|---|
| 59 | 
 | 
|---|
| 60 |     int nirrep_;
 | 
|---|
| 61 | 
 | 
|---|
| 62 |     void write_energy_object(std::ostream&, const char *keyword,
 | 
|---|
| 63 |                              const char *method,
 | 
|---|
| 64 |                              const char *basis, int coor,
 | 
|---|
| 65 |                              bool &need_cints);
 | 
|---|
| 66 |     void write_basis_object(std::ostream&, const char *keyword,
 | 
|---|
| 67 |                             const char *basis);
 | 
|---|
| 68 |     void write_vector(std::ostream &ostrs,
 | 
|---|
| 69 |                       const char *keyvalname,
 | 
|---|
| 70 |                       const char *name,
 | 
|---|
| 71 |                       MPQCInDatum<std::vector<int> *>&vec,
 | 
|---|
| 72 |                       int require_nirrep);
 | 
|---|
| 73 | 
 | 
|---|
| 74 |     static int checking_;
 | 
|---|
| 75 |   public:
 | 
|---|
| 76 |     MPQCIn();
 | 
|---|
| 77 |     ~MPQCIn();
 | 
|---|
| 78 | 
 | 
|---|
| 79 |     char *parse_string(const char *s);
 | 
|---|
| 80 |     int check_string(const char *s);
 | 
|---|
| 81 | 
 | 
|---|
| 82 |     int ylex();
 | 
|---|
| 83 |     int yparse();
 | 
|---|
| 84 |     void error(const char* s);
 | 
|---|
| 85 |     void error2(const char* s, const char* s2);
 | 
|---|
| 86 |     void yerror(const char* s);
 | 
|---|
| 87 |     void yerror2(const char* s, const char *);
 | 
|---|
| 88 | 
 | 
|---|
| 89 |     void begin_molecule();
 | 
|---|
| 90 |     void end_molecule();
 | 
|---|
| 91 |     void add_atom(char *, char *, char *, char *);
 | 
|---|
| 92 |     void set_charge(char *);
 | 
|---|
| 93 |     void set_method(char *);
 | 
|---|
| 94 |     void set_basis(char *);
 | 
|---|
| 95 |     void set_auxbasis(char *);
 | 
|---|
| 96 |     void set_multiplicity(char *);
 | 
|---|
| 97 |     void set_memory(char *);
 | 
|---|
| 98 |     void set_optimize(int);
 | 
|---|
| 99 |     void set_opt_type(int);
 | 
|---|
| 100 |     void set_atom_charge(char *);
 | 
|---|
| 101 |     void set_molecule_unit(char *);
 | 
|---|
| 102 |     void set_method_xc(char *);
 | 
|---|
| 103 |     void set_method_grid(char *);
 | 
|---|
| 104 |     void set_symmetry(char *);
 | 
|---|
| 105 |     void set_redund_coor(int);
 | 
|---|
| 106 |     void set_gradient(int);
 | 
|---|
| 107 |     void set_frequencies(int);
 | 
|---|
| 108 |     void set_restart(int);
 | 
|---|
| 109 |     void set_checkpoint(int);
 | 
|---|
| 110 |     void set_molecule_bohr(int);
 | 
|---|
| 111 |     void set_docc(std::vector<int> *);
 | 
|---|
| 112 |     void set_socc(std::vector<int> *);
 | 
|---|
| 113 |     void set_alpha(std::vector<int> *);
 | 
|---|
| 114 |     void set_beta(std::vector<int> *);
 | 
|---|
| 115 |     void set_frozen_docc(std::vector<int> *);
 | 
|---|
| 116 |     void set_frozen_uocc(std::vector<int> *);
 | 
|---|
| 117 |     std::vector<int> *make_nnivec(std::vector<int> *, char *);
 | 
|---|
| 118 |     void set_method_absmethod(const char *);
 | 
|---|
| 119 |     void set_method_ebc(const char *);
 | 
|---|
| 120 |     void set_method_gbc(const char *);
 | 
|---|
| 121 | 
 | 
|---|
| 122 |     static int checking() { return checking_; }
 | 
|---|
| 123 | };
 | 
|---|
| 124 | 
 | 
|---|
| 125 | }
 | 
|---|
| 126 | 
 | 
|---|
| 127 | #endif
 | 
|---|