Changeset ce70d25 for src/Actions


Ignore:
Timestamp:
Sep 9, 2016, 8:21:34 AM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, 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, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
27e6a7
Parents:
945797
git-author:
Frederik Heber <heber@…> (09/01/16 20:30:45)
git-committer:
Frederik Heber <heber@…> (09/09/16 08:21:34)
Message:

Added some asserts and checks in context of SaturatedFragment and appendToHomologies().

  • appendToHomologies() now gives boolean return value which results in failure or success of the action, namely all asserts are now ifs (because if we mark the regression tests as XFAIL then debug and release must fail).
  • TESTFIX: Marked all AnalyseFragmentationResults regression test as XFAIL for the moment.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp

    r945797 rce70d25  
    288288#endif
    289289
    290 void appendToHomologies(
     290bool appendToHomologies(
    291291    const FragmentationShortRangeResults &shortrangeresults,
    292292#if defined(HAVE_JOBMARKET) && defined(HAVE_VMG)
     
    317317    LOG(2, "DEBUG: Created graph " << graph << ".");
    318318    const IndexSet::ptr &index = *iter;
     319    if (!(**forceiter).contains(**iter)) {
     320      // this caught an error with faulty KeySetsContainer::insert().
     321      // indexset and forceindexset need to be in same order and differ
     322      // only in forceindexset contains extra indices for saturation hydrogens
     323      ELOG(1, "appendToHomologies() - force index set " << (**forceiter)
     324          << " does not contain index set " << (**iter) << ".");
     325      return false;
     326    }
    319327
    320328    /// we fill the value structure
     
    324332    std::map<IndexSet::ptr, std::pair< MPQCDataFragmentMap_t, MPQCDataFragmentMap_t> >::const_iterator fragmentiter
    325333        = shortrangeresults.Result_perIndexSet_Fragment.find(index);
    326     ASSERT( fragmentiter != shortrangeresults.Result_perIndexSet_Fragment.end(),
    327         "appendToHomologyFile() - cannot find index "+toString(*index)
    328         +" in FragmentResults.");
     334    if (fragmentiter == shortrangeresults.Result_perIndexSet_Fragment.end()) {
     335      ELOG(1, "appendToHomologyFile() - cannot find index " << (*index)
     336          << " in FragmentResults.");
     337      return false;
     338    }
    329339    value.fragment = boost::fusion::at_key<MPQCDataFused::fragment>(fragmentiter->second.first);
    330340
     
    332342    std::map<IndexSet::ptr, std::pair< MPQCDataEnergyMap_t, MPQCDataEnergyMap_t> >::const_iterator energyiter
    333343        = shortrangeresults.Result_perIndexSet_Energy.find(index);
    334     ASSERT( energyiter != shortrangeresults.Result_perIndexSet_Energy.end(),
    335         "appendToHomologyFile() - cannot find index "+toString(*index)
    336         +" in FragmentResults.");
     344    if (energyiter == shortrangeresults.Result_perIndexSet_Energy.end()) {
     345      ELOG(1, "appendToHomologyFile() - cannot find index " << (*index)
     346          << " in FragmentResults.");
     347      return false;
     348    }
    337349    value.energy = boost::fusion::at_key<MPQCDataFused::energy_total>(energyiter->second.second); // contributions
    338350
     
    343355      std::map<IndexSet::ptr, std::pair< MPQCDataGridMap_t, MPQCDataGridMap_t> >::const_iterator chargeiter
    344356          = longrangeresults.Result_perIndexSet_Grid.find(index);
    345       ASSERT( chargeiter != longrangeresults.Result_perIndexSet_Grid.end(),
    346           "appendToHomologyFile() - cannot find index "+toString(*index)
    347           +" in FragmentResults.");
     357      if (chargeiter == longrangeresults.Result_perIndexSet_Grid.end()) {
     358        ELOG(1, "appendToHomologyFile() - cannot find index " << (*index)
     359            << " in FragmentResults.");
     360        return false;
     361      }
    348362      value.charge_distribution = boost::fusion::at_key<MPQCDataFused::sampled_grid>(chargeiter->second.second); // contributions
    349363
     
    351365      std::map<IndexSet::ptr, std::pair< VMGDataGridMap_t, VMGDataGridMap_t> >::const_iterator potentialiter
    352366          = longrangeresults.Result_perIndexSet_LongRange_Grid.find(index);
    353       ASSERT( potentialiter != longrangeresults.Result_perIndexSet_LongRange_Grid.end(),
    354           "appendToHomologyFile() - cannot find index "+toString(*index)
    355           +" in FragmentResults.");
     367      if (potentialiter == longrangeresults.Result_perIndexSet_LongRange_Grid.end()) {
     368        ELOG(1, "appendToHomologyFile() - cannot find index " << (*index)
     369            << " in FragmentResults.");
     370        return false;
     371      }
    356372      // add e+n potentials
    357373      value.potential_distribution =
     
    369385//        *iter -= offset;
    370386#else
    371       ELOG(1, "Long-range information in homology desired but long-range analysis capability not compiled in.");
     387      ELOG(2, "Long-range information in homology desired but long-range analysis capability not compiled in.");
    372388#endif
    373389    }
     
    404420    }
    405421  }
     422
     423  return true;
    406424}
    407425
     
    561579
    562580ActionState::ptr FragmentationAnalyseFragmentationResultsAction::performCall() {
     581  bool status=true;
    563582
    564583  /// if file is given, parse from file into ResultsContainer
     
    575594    } else {
    576595      ELOG(1, "Given file" << resultsfile.string() << " does not exist.");
     596      STATUS("AnalyseFragmentResultsAction failed: missing results file.");
     597      return Action::failure;
    577598    }
    578599  }
     
    715736
    716737    // append all keysets to homology file
    717     appendToHomologies(shortrangeresults, longrangeresults, params.DoStoreGrids.get());
     738    status = appendToHomologies(shortrangeresults, longrangeresults, params.DoStoreGrids.get());
    718739  } else {
    719740    // append all keysets to homology file with short-range info only (without grids)
     
    721742    FragmentationLongRangeResults longrangeresults(
    722743        shortrangedata, longrangeData, keysets, forcekeysets);
    723     appendToHomologies(shortrangeresults, longrangeresults, false);
     744    status = appendToHomologies(shortrangeresults, longrangeresults, false);
    724745  }
    725746#else
     
    729750
    730751  // append all keysets to homology file with short-range info only (without grids)
    731   appendToHomologies(shortrangeresults, false);
     752  status = appendToHomologies(shortrangeresults, false);
    732753#endif
    733754
     
    735756//  container.clear();
    736757
    737   return Action::success;
     758  if (status)
     759    return Action::success;
     760  else {
     761    STATUS("AnalyseFragmentResultsAction failed: invalid results, failed to append to homologies.");
     762    return Action::failure;
     763  }
    738764}
    739765
Note: See TracChangeset for help on using the changeset viewer.