Changeset f7c19e for src/parser.cpp


Ignore:
Timestamp:
Oct 6, 2011, 9:09:56 AM (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:
81c980b
Parents:
dc8827
git-author:
Frederik Heber <heber@…> (08/09/11 16:39:43)
git-committer:
Frederik Heber <heber@…> (10/06/11 09:09:56)
Message:

Some fixes to parsing files.

  • MpqcParser::save() does not store all atoms but those given in the parameters.
  • FIX: MoleculeListClass::AddHydrogenCorrection() and FilePresent() check with bad() and eof() whether file is missing or has ended.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/parser.cpp

    rdc8827 rf7c19e  
    4545
    4646  input.open(filename, ios::in);
    47   if (input == NULL) {
     47  if (input.fail()) {
    4848    if (!test)
    4949      DoLog(0) && (Log() << Verbose(0) << endl << "FilePresent: Unable to open " << filename << ", is the directory correct?" << endl);
     
    204204  char filename[1023];
    205205
    206   //Log() << Verbose(1) << "Opening " << name << " ... "  << input << endl;
    207   if (input.bad()) {
     206  if (input.fail()) {
    208207    DoeLog(1) && (eLog()<< Verbose(1) << endl << "MatrixContainer::ParseMatrix: Unable to parse istream." << endl);
    209208    //performCriticalExit();
     
    327326  file << name << FRAGMENTPREFIX << KEYSETFILE;
    328327  input.open(file.str().c_str(), ios::in);
    329   if (input == NULL) {
     328  if (input.bad()) {
    330329    DoLog(0) && (Log() << Verbose(0) << endl << "MatrixContainer::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
    331330    return false;
     
    360359    file << name << FRAGMENTPREFIX << FragmentNumber << prefix << suffix;
    361360    std::ifstream input(file.str().c_str());
     361    DoLog(0) &&( Log() << Verbose(0) << "Opening " << file.str() << " ... " << endl);
    362362    if (!ParseMatrix(input, skiplines, skipcolumns, i)) {
    363363      input.close();
     
    704704  input.open(line.str().c_str(), ios::in);
    705705  //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
    706   if (input == NULL) {
     706  if (input.fail()) {
    707707    DoLog(0) && (Log() << Verbose(0) << endl << "ForceMatrix::ParseIndices: Unable to open " << line.str() << ", is the directory correct?" << endl);
    708708    return false;
     
    783783    file << name << FRAGMENTPREFIX << KEYSETFILE;
    784784    input.open(file.str().c_str(), ios::in);
    785     if (input == NULL) {
     785    if (input.fail()) {
    786786      DoLog(0) && (Log() << Verbose(0) << endl << "ForceMatrix::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
    787787      return false;
     
    844844  input.open(line.str().c_str(), ios::in);
    845845  //Log() << Verbose(0) << "Opening " << line.str() << " ... "  << input << endl;
    846   if (input == NULL) {
     846  if (input.fail()) {
    847847    DoLog(0) && (Log() << Verbose(0) << endl << "HessianMatrix::ParseIndices: Unable to open " << line.str() << ", is the directory correct?" << endl);
    848848    return false;
     
    10151015    file << name << FRAGMENTPREFIX << KEYSETFILE;
    10161016    input.open(file.str().c_str(), ios::in);
    1017     if (input == NULL) {
     1017    if (input.fail()) {
    10181018      DoLog(0) && (Log() << Verbose(0) << endl << "HessianMatrix::ParseFragmentMatrix: Unable to open " << file.str() << ", is the directory correct?" << endl);
    10191019      return false;
     
    11011101  file << name << FRAGMENTPREFIX << KEYSETFILE;
    11021102  input.open(file.str().c_str(), ios::in);
    1103   if (input == NULL) {
     1103  if (input.fail()) {
    11041104    DoLog(0) && (Log() << Verbose(0) << endl << "KeySetsContainer::ParseKeySets: Unable to open " << file.str() << ", is the directory correct?" << endl);
    11051105    return false;
Note: See TracChangeset for help on using the changeset viewer.