stable
        v1.7.0
      
      
        
          | 
            Last change
 on this file was             9259c3, checked in by Frederik Heber <frederik.heber@…>, 7 weeks ago           | 
        
        
          | 
             
MPQC_OPEN: Fixes unit tests. 
 
- several unit tests programs actually need arguments.
Those have been copnverted to autotest test cases.
 - half of these new test cases are expected to fail because
modules cannot be properly loaded.
  
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [0b990d] | 1 | 
 | 
|---|
 | 2 | #include <util/misc/formio.h>
 | 
|---|
 | 3 | #include <chemistry/qc/psi/psiwfn.h>
 | 
|---|
 | 4 | #include <math/optimize/opt.h>
 | 
|---|
 | 5 | #include <util/keyval/keyval.h>
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | #include <chemistry/qc/psi/linkage.h>
 | 
|---|
 | 8 | #include <math/optimize/linkage.h>
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | using namespace std;
 | 
|---|
 | 11 | using namespace sc;
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | void die()
 | 
|---|
 | 14 | {
 | 
|---|
 | 15 |   fprintf(stderr,"die\n");
 | 
|---|
 | 16 |   abort();
 | 
|---|
 | 17 | }
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | main(int argc, char**argv)
 | 
|---|
 | 20 | {
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 |   set_new_handler(die);
 | 
|---|
 | 23 |   
 | 
|---|
 | 24 |   // the output stream is standard out
 | 
|---|
 | 25 |   ostream& o = cout;
 | 
|---|
 | 26 | 
 | 
|---|
 | 27 |   ParsedKeyVal* pkv;
 | 
|---|
 | 28 |   Ref<KeyVal> rpkv(pkv = new ParsedKeyVal());
 | 
|---|
 | 29 |   pkv->read( SRCDIR "/psi.in");
 | 
|---|
 | 30 |   pkv = 0; // should only use rpkv
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 |   int i, do_grad = 1;
 | 
|---|
 | 33 | 
 | 
|---|
 | 34 |   for (i=0; rpkv->exists("mole",i); i++) {
 | 
|---|
 | 35 |       Ref<MolecularEnergy> mole;
 | 
|---|
 | 36 |       mole << rpkv->describedclassvalue("mole",i);
 | 
|---|
 | 37 |       if (do_grad)
 | 
|---|
 | 38 |         mole->do_gradient(1);
 | 
|---|
 | 39 |       else
 | 
|---|
 | 40 |         mole->do_gradient(0);
 | 
|---|
 | 41 | 
 | 
|---|
 | 42 |       if (mole.nonnull()) {
 | 
|---|
 | 43 |           mole->print(o);
 | 
|---|
 | 44 | 
 | 
|---|
 | 45 |           o << "energy = " << mole->energy() << endl;
 | 
|---|
 | 46 |           if (do_grad) {
 | 
|---|
 | 47 |               o << "gradient:\n";
 | 
|---|
 | 48 |               o << incindent; mole->gradient().print(o); o << decindent;
 | 
|---|
 | 49 |           }
 | 
|---|
 | 50 |         }
 | 
|---|
 | 51 |       else {
 | 
|---|
 | 52 |           o << "mole[" << i << "] is null\n";
 | 
|---|
 | 53 |         }
 | 
|---|
 | 54 |     }
 | 
|---|
 | 55 | 
 | 
|---|
 | 56 |   for (i=0; rpkv->exists("opt",i); i++) {
 | 
|---|
 | 57 |       Ref<Optimize> opt;
 | 
|---|
 | 58 |       opt << rpkv->describedclassvalue("opt",i);
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 |       if (opt.nonnull()) {
 | 
|---|
 | 61 |           //opt->print(o);
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 |           opt->optimize();
 | 
|---|
 | 64 |         }
 | 
|---|
 | 65 |       else {
 | 
|---|
 | 66 |           o << "opt[" << i << "] is null\n";
 | 
|---|
 | 67 |         }
 | 
|---|
 | 68 |       opt->function()->print();
 | 
|---|
 | 69 |     }
 | 
|---|
 | 70 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.