Ignore:
Timestamp:
Oct 20, 2011, 10:42:16 PM (14 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:
f94953
Parents:
fa9d1d (diff), 752bb4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Frederik Heber <heber@…> (10/20/11 22:40:59)
git-committer:
Frederik Heber <heber@…> (10/20/11 22:42:16)
Message:

Merge branch 'Adding_Psi3Parser' into stable

Conflicts:

src/Parser/FormatParser.hpp
src/Parser/unittests/ParserTremoloUnitTest.cpp

Issues:

  • Element and periodentafel have been moved to folder src/Element.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Parser/unittests/ParserTremoloUnitTest.cpp

    rfa9d1d r360c8b  
    2727#include "Descriptors/AtomTypeDescriptor.hpp"
    2828#include "Element/element.hpp"
    29 #include "Parser/MpqcParser.hpp"
    30 #include "Parser/PdbParser.hpp"
    31 #include "Parser/PcpParser.hpp"
     29#include "Element/periodentafel.hpp"
    3230#include "Parser/TremoloParser.hpp"
    33 #include "Parser/XyzParser.hpp"
    34 #include "Element/periodentafel.hpp"
     31#include "Parser/ChangeTracker.hpp"
    3532#include "World.hpp"
    3633#include "WorldTime.hpp"
     
    8582  World::getInstance();
    8683
     84  parser = new FormatParser<tremolo>();
     85
    8786  // we need hydrogens and oxygens in the following tests
    8887  CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(1) != NULL);
     
    9089}
    9190
    92 void ParserTremoloUnitTest::tearDown() {
     91void ParserTremoloUnitTest::tearDown()
     92{
     93  delete parser;
    9394  ChangeTracker::purgeInstance();
    9495  World::purgeInstance();
     
    99100void ParserTremoloUnitTest::readTremoloPreliminaryCommentsTest() {
    100101  cout << "Testing the tremolo parser." << endl;
    101   TremoloParser* testParser = new TremoloParser();
    102102  stringstream input, output;
    103103
     
    105105  {
    106106    input << Tremolo_Atomdata1;
    107     testParser->load(&input);
    108     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
    109     testParser->save(&output, atoms);
     107    parser->load(&input);
     108    std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     109    parser->save(&output, atoms);
    110110//    std::cout << output.str() << std::endl;
    111111//    std::cout << Tremolo_Atomdata1 << std::endl;
     
    118118  {
    119119    input << Tremolo_Atomdata2;
    120     testParser->load(&input);
    121     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
    122     testParser->save(&output, atoms);
     120    parser->load(&input);
     121    std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     122    parser->save(&output, atoms);
    123123    std::cout << output.str() << std::endl;
    124124    CPPUNIT_ASSERT(output.str().find("hydrogen") != string::npos);
     
    129129  // Invalid key in Atomdata line
    130130  input << Tremolo_invalidkey;
    131   testParser->load(&input);
     131  parser->load(&input);
    132132  //TODO: prove invalidity
    133133  input.clear();
     
    135135
    136136void ParserTremoloUnitTest::readTremoloCoordinatesTest() {
    137   TremoloParser* testParser = new TremoloParser();
    138137  stringstream input;
    139138
    140139  // One simple data line
    141140  input << Tremolo_Atomdata2;
    142   testParser->load(&input);
     141  parser->load(&input);
    143142  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->at(0) == 3.0);
    144143  input.clear();
     
    146145
    147146void ParserTremoloUnitTest::readTremoloVelocityTest() {
    148   TremoloParser* testParser = new TremoloParser();
    149147  stringstream input;
    150148
    151149  // One simple data line
    152150  input << Tremolo_velocity;
    153   testParser->load(&input);
     151  parser->load(&input);
    154152  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->getAtomicVelocity()[0] == 3.0);
    155153  input.clear();
     
    157155
    158156void ParserTremoloUnitTest::readTremoloNeighborInformationTest() {
    159   TremoloParser* testParser = new TremoloParser();
    160157  stringstream input;
    161158
    162159  // Neighbor data
    163160  input << Tremolo_neighbours;
    164   testParser->load(&input);
     161  parser->load(&input);
    165162
    166163  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     
    171168
    172169void ParserTremoloUnitTest::readAndWriteTremoloImprDataInformationTest() {
    173   TremoloParser* testParser = new TremoloParser();
    174170  stringstream input, output;
    175171
     
    177173  {
    178174    input << Tremolo_improper;
    179     testParser->load(&input);
    180     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
    181     testParser->save(&output, atoms);
     175    parser->load(&input);
     176    std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     177    parser->save(&output, atoms);
    182178    CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
    183179    std::cout << output.str() << std::endl;
     
    189185
    190186void ParserTremoloUnitTest::readAndWriteTremoloTorsionInformationTest() {
    191   TremoloParser* testParser = new TremoloParser();
    192187  stringstream input, output;
    193188
     
    195190  {
    196191    input << Tremolo_torsion;
    197     testParser->load(&input);
    198     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
    199     testParser->save(&output, atoms);
     192    parser->load(&input);
     193    std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     194    parser->save(&output, atoms);
    200195    CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
    201196    std::cout << output.str() << std::endl;
     
    207202
    208203void ParserTremoloUnitTest::writeTremoloTest() {
    209   TremoloParser* testParser = new TremoloParser();
    210204  stringstream output;
    211205
     
    214208    atom* newAtom = World::getInstance().createAtom();
    215209    newAtom->setType(1);
    216     testParser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");
    217     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
    218     testParser->save(&output, atoms);
     210    parser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");
     211    std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     212    parser->save(&output, atoms);
    219213    CPPUNIT_ASSERT(output.str() == Tremolo_full);
    220214  }
     
    222216  cout << "testing the tremolo parser is done" << endl;
    223217}
     218
Note: See TracChangeset for help on using the changeset viewer.