Changeset 154a45


Ignore:
Timestamp:
Oct 17, 2011, 4:56:37 PM (13 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
f758dd
Parents:
1bef07
git-author:
Frederik Heber <heber@…> (10/05/11 15:17:27)
git-committer:
Frederik Heber <heber@…> (10/17/11 16:56:37)
Message:

ParserPsi3UnitTest::ParameterCloneTest() is working.

Location:
src/Parser/unittests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/unittests/ParserPsi3UnitTest.cpp

    r1bef07 r154a45  
    125125  parser = new FormatParser<psi3>();
    126126
     127  params = &parser->getParams();
     128
    127129  World::getInstance();
    128130
     
    135137void ParserPsi3UnitTest::tearDown()
    136138{
     139  params = NULL;
    137140  delete parser;
    138141  ChangeTracker::purgeInstance();
     
    143146
    144147void ParserPsi3UnitTest::ParameterDefaultTest() {
    145   Psi3Parser_Parameters &params = parser->getParams();
    146148  // check default values
    147   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::labelParam) == std::string("unknown job"));
    148   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::jobtypeParam) == params.ValidJobtypes[Psi3Parser_Parameters::SP]);
    149   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::wavefunctionParam) == params.ValidWavefunction[Psi3Parser_Parameters::SCF]);
    150   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("80"));
    151   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::referenceParam) == params.ValidReference[Psi3Parser_Parameters::RHF]);
    152   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::basisParam) == std::string("cc-pVTZ"));
    153   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::freeze_coreParam) == params.ValidFreezeCore[Psi3Parser_Parameters::YES]);
    154   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::unitsParam) == params.ValidUnits[Psi3Parser_Parameters::angstrom]);
    155   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::dertypeParam) == params.ValidDerivativeType[Psi3Parser_Parameters::NONE]);
    156   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::originParam) == std::string("(0.0\t0.0\t0.0)"));
    157   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::multipParam) == std::string("1"));
    158   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::chargeParam) == std::string("0"));
    159   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::soccParam) == std::string("()"));
    160   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::doccParam) == std::string("()"));
    161   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::subgroupParam) == std::string(""));
    162   CPPUNIT_ASSERT(params.getParameter(Psi3Parser_Parameters::unique_axisParam) == params.ValidUniqueAxis[Psi3Parser_Parameters::X]);
     149  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::labelParam) == std::string("unknown job"));
     150  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
     151  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::wavefunctionParam) == params->ValidWavefunction[Psi3Parser_Parameters::SCF]);
     152  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("80"));
     153  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::referenceParam) == params->ValidReference[Psi3Parser_Parameters::RHF]);
     154  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::basisParam) == std::string("cc-pVTZ"));
     155  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::freeze_coreParam) == params->ValidFreezeCore[Psi3Parser_Parameters::YES]);
     156  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unitsParam) == params->ValidUnits[Psi3Parser_Parameters::angstrom]);
     157  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::dertypeParam) == params->ValidDerivativeType[Psi3Parser_Parameters::NONE]);
     158  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::originParam) == std::string("(0.0\t0.0\t0.0)"));
     159  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::multipParam) == std::string("1"));
     160  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::chargeParam) == std::string("0"));
     161  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::soccParam) == std::string("()"));
     162  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::doccParam) == std::string("()"));
     163  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::subgroupParam) == std::string(""));
     164  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::unique_axisParam) == params->ValidUniqueAxis[Psi3Parser_Parameters::X]);
    163165}
    164166
    165167void ParserPsi3UnitTest::ParameterCloneTest() {
    166   FormatParser_Parameters *clone = parser->getParams().clone();
    167 //  CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("MBPT2"));
    168 //  std::stringstream setvalue("theory = CLHF");
    169 //  setvalue >> parser->getParams();
    170 //  CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF"));
    171 //  parser->getParams().makeClone(*clone);
    172 //  CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("MBPT2"));
     168  FormatParser_Parameters *clone = params->clone();
     169  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
     170  std::stringstream setvalue(params->ParamNames[Psi3Parser_Parameters::jobtypeParam]+"="+params->ValidJobtypes[Psi3Parser_Parameters::OPT]);
     171  setvalue >> *params;
     172  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::OPT]);
     173  params->makeClone(*clone);
     174  CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::jobtypeParam) == params->ValidJobtypes[Psi3Parser_Parameters::SP]);
    173175}
    174176
     
    179181//    setvalue >> parser->getParams();
    180182////    std::cout << "integration method is "
    181 ////        << parser->getParams().getString(Psi3Parser_Parameters::theoryParam) << std::endl;
    182 //    CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF"));
     183////        << params->getString(Psi3Parser_Parameters::theoryParam) << std::endl;
     184//    CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::theoryParam) == std::string("CLHF"));
    183185//  }
    184186//  // test a bool
     
    187189//    setvalue >> parser->getParams();
    188190////    std::cout << "Hessian is "
    189 ////        << parser->getParams().getString(Psi3Parser_Parameters::hessianParam) << std::endl;
    190 //    CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes"));
     191////        << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl;
     192//    CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes"));
    191193//  }
    192194//  // test int
     
    195197//    setvalue >> parser->getParams();
    196198////    std::cout << "maxiter is "
    197 ////        << parser->getParams().getString(Psi3Parser_Parameters::maxiterParam) << std::endl;
    198 //    CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500"));
     199////        << params->getString(Psi3Parser_Parameters::maxiterParam) << std::endl;
     200//    CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::maxiterParam) == std::string("500"));
    199201//  }
    200202//  // test whether unknown key fails
     
    209211//#endif
    210212////    std::cout << "Hessian is still "
    211 ////        << parser->getParams().getString(Psi3Parser_Parameters::hessianParam) << std::endl;
    212 //    CPPUNIT_ASSERT(parser->getParams().getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes"));
     213////        << params->getString(Psi3Parser_Parameters::hessianParam) << std::endl;
     214//    CPPUNIT_ASSERT(params->getParameter(Psi3Parser_Parameters::hessianParam) == std::string("yes"));
    213215//  }
    214216}
     
    216218void ParserPsi3UnitTest::readPsi3Test() {
    217219//  stringstream input(waterPsi3_CLHF);
    218 //  parser->getParams().setParameter(
     220//  params->setParameter(
    219221//      Psi3Parser_Parameters::theoryParam,
    220 //      parser->getParams().getTheoryName(Psi3Parser_Parameters::CLHF)
     222//      params->getTheoryName(Psi3Parser_Parameters::CLHF)
    221223//          );
    222224//  parser->load(&input);
     
    247249//    // compare both configs for CLHF
    248250//    stringstream output;
    249 //    parser->getParams().setParameter(
     251//    params->setParameter(
    250252//        Psi3Parser_Parameters::theoryParam,
    251 //        parser->getParams().getTheoryName(Psi3Parser_Parameters::CLHF)
     253//        params->getTheoryName(Psi3Parser_Parameters::CLHF)
    252254//            );
    253255//    parser->save(&output, atoms);
     
    261263//    // compare both configs for CLKS
    262264//    stringstream output;
    263 //    parser->getParams().setParameter(
     265//    params->setParameter(
    264266//        Psi3Parser_Parameters::theoryParam,
    265 //        parser->getParams().getTheoryName(Psi3Parser_Parameters::CLKS)
     267//        params->getTheoryName(Psi3Parser_Parameters::CLKS)
    266268//            );
    267269//    stringstream input(waterPsi3_CLKS);
     
    274276//    // compare both configs for MBPT2
    275277//    stringstream output;
    276 //    parser->getParams().setParameter(
     278//    params->setParameter(
    277279//        Psi3Parser_Parameters::theoryParam,
    278 //        parser->getParams().getTheoryName(Psi3Parser_Parameters::MBPT2)
     280//        params->getTheoryName(Psi3Parser_Parameters::MBPT2)
    279281//            );
    280282//    stringstream input(waterPsi3_MBPT2);
     
    287289//    // compare both configs for MBPT2_R12
    288290//    stringstream output;
    289 //    parser->getParams().setParameter(
     291//    params->setParameter(
    290292//        Psi3Parser_Parameters::theoryParam,
    291 //        parser->getParams().getTheoryName(Psi3Parser_Parameters::MBPT2_R12)
     293//        params->getTheoryName(Psi3Parser_Parameters::MBPT2_R12)
    292294//            );
    293295//    stringstream input(waterPsi3_MBPT2_R12);
  • src/Parser/unittests/ParserPsi3UnitTest.hpp

    r1bef07 r154a45  
    1717#include <cppunit/extensions/HelperMacros.h>
    1818#include <string>
     19
     20class Psi3Parser_Parameters;
    1921
    2022class ParserPsi3UnitTest :  public CppUnit::TestFixture
     
    4042private:
    4143  FormatParser<psi3> *parser;
     44  Psi3Parser_Parameters *params;
    4245};
    4346
Note: See TracChangeset for help on using the changeset viewer.