Changeset 14d4d4


Ignore:
Timestamp:
Jun 16, 2008, 2:09:27 PM (17 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:
d427bd
Parents:
edb650
Message:

BUGFIX: If other databases could not be loaded, no error was produced, resulting in strange behaviour of the fragmentation routine.

Now an error message is produced, though we still continue. The problem was the switch in handling const char * and a huge mess in LoadPeriodenTafel() with strncat and strncpy.

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    redb650 r14d4d4  
    805805      cout << Verbose(0) << "Element list loaded successfully." << endl;
    806806      periode->Output((ofstream *)&cout);
    807     } else
     807    } else {
    808808      cout << Verbose(0) << "Element list loading failed." << endl;
     809      return 1;
     810    }
    809811   
    810812    // 3. Find config file name and parse if possible
  • src/moleculelist.cpp

    redb650 r14d4d4  
    240240    *out << endl;
    241241    // prepare output of config file
    242     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     242    sprintf(FragmentName, "%s/%s%s.conf", PathBackup, FRAGMENTPREFIX, FragmentNumber);
    243243    outputFragment.open(FragmentName, ios::out);
    244     strcpy(PathBackup, configuration->configpath);
    245     sprintf(FragmentName, "%s/%s%s/", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     244    //strcpy(PathBackup, configuration->configpath);
     245    sprintf(FragmentName, "%s/%s%s/", PathBackup, FRAGMENTPREFIX, FragmentNumber);
    246246   
    247247    // center on edge
  • src/molecules.cpp

    redb650 r14d4d4  
    15731573            for(j=0;j<NumberOfBondsPerAtom[Walker->nr];j++)
    15741574              NoBonds += ListOfBondsPerAtom[Walker->nr][j]->BondDegree;
    1575                   //*out << Verbose(3) << "Walker: " << (int)Walker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
     1575                  *out << Verbose(3) << "Walker: " << (int)Walker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    15761576                  if ((int)(Walker->type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check NoBonds of other atom
    15771577                    // count valence of second partner
     
    15791579              for(j=0;j<NumberOfBondsPerAtom[OtherWalker->nr];j++)
    15801580                NoBonds += ListOfBondsPerAtom[OtherWalker->nr][j]->BondDegree;
    1581               //*out << Verbose(3) << "OtherWalker: " << (int)OtherWalker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
     1581              *out << Verbose(3) << "OtherWalker: " << (int)OtherWalker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    15821582                    if ((int)(OtherWalker->type->NoValenceOrbitals) > NoBonds) // increase bond degree by one
    15831583                ListOfBondsPerAtom[Walker->nr][i]->BondDegree++;
     
    15911591          *out << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << bonddistance << "." << endl;
    15921592               
    1593 //        // output bonds for debugging (if bond chain list was correctly installed)
    1594 //        *out << Verbose(1) << endl << "From contents of bond chain list:";
    1595 //        bond *Binder = first;
    1596 //    while(Binder->next != last) {
    1597 //      Binder = Binder->next;
    1598 //                      *out << *Binder << "\t" << endl;
    1599 //    }
    1600 //    *out << endl;
     1593          // output bonds for debugging (if bond chain list was correctly installed)
     1594          *out << Verbose(1) << endl << "From contents of bond chain list:";
     1595          bond *Binder = first;
     1596    while(Binder->next != last) {
     1597      Binder = Binder->next;
     1598                        *out << *Binder << "\t" << endl;
     1599    }
     1600    *out << endl;
    16011601  } else
    16021602        *out << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl;
     
    31313131//          *out << ", who has no son in this fragment molecule." << endl;
    31323132#ifdef ADDHYDROGEN
    3133 //          *out << Verbose(3) << "Adding Hydrogen to " << Runner->Name << " and a bond in between." << endl;
     3133          //*out << Verbose(3) << "Adding Hydrogen to " << Runner->Name << " and a bond in between." << endl;
    31343134          Leaf->AddHydrogenReplacementAtom(out, ListOfBondsPerAtom[FatherOfRunner->nr][i], Runner, FatherOfRunner, OtherFather, ListOfBondsPerAtom[FatherOfRunner->nr],NumberOfBondsPerAtom[FatherOfRunner->nr], IsAngstroem);
    31353135#endif
  • src/periodentafel.cpp

    redb650 r14d4d4  
    217217
    218218  // fill valence DB per element
    219   strncat(filename, path, MAXSTRINGSIZE);
    220   strncpy(filename, STANDARDVALENCEDB, MAXSTRINGSIZE-strlen(filename));
     219  strncpy(filename, path, MAXSTRINGSIZE);
     220  strncat(filename, "/", MAXSTRINGSIZE-strlen(filename));
     221  strncat(filename, STANDARDVALENCEDB, MAXSTRINGSIZE-strlen(filename));
    221222  infile.open(filename);
    222223  if (infile != NULL) {
     
    226227        infile >> FindElement((int)tmp)->Valence;
    227228        infile >> ws;
    228         //cout << Verbose(3) << "Element " << (int)tmp << " has " << find_element((int)tmp)->Valence << " valence electrons." << endl;
     229        //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->Valence << " valence electrons." << endl;
    229230    }
    230231    infile.close();
     
    234235
    235236  // fill valence DB per element
    236   strncat(filename, path, MAXSTRINGSIZE);
    237   strncpy(filename, STANDARDORBITALDB, MAXSTRINGSIZE-strlen(filename));
     237  strncpy(filename, path, MAXSTRINGSIZE);
     238  strncat(filename, "/", MAXSTRINGSIZE-strlen(filename));
     239  strncat(filename, STANDARDORBITALDB, MAXSTRINGSIZE-strlen(filename));
    238240  infile.open(filename);
    239241  if (infile != NULL) {
     
    243245      infile >> FindElement((int)tmp)->NoValenceOrbitals;
    244246      infile >> ws;
    245       //cout << Verbose(3) << "Element " << (int)tmp << " has " << find_element((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
     247      //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
    246248    }
    247249    infile.close();
     
    251253 
    252254  // fill H-BondDistance DB per element
    253   strncat(filename, path, MAXSTRINGSIZE);
    254   strncpy(filename, STANDARDHBONDDISTANCEDB, MAXSTRINGSIZE-strlen(filename));
     255  strncpy(filename, path, MAXSTRINGSIZE);
     256  strncat(filename, "/", MAXSTRINGSIZE-strlen(filename));
     257  strncat(filename, STANDARDHBONDDISTANCEDB, MAXSTRINGSIZE-strlen(filename));
    255258  infile.open(filename);
    256259  if (infile != NULL) {
     
    263266      infile >> ptr->HBondDistance[2];
    264267        infile >> ws;
    265       //cout << Verbose(3) << "Element " << (int)tmp << " has " << find_element((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl;
     268      //cout << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl;
    266269    }
    267270    infile.close();
     
    271274 
    272275  // fill H-BondAngle DB per element
    273   strncat(filename, path, MAXSTRINGSIZE);
    274   strncpy(filename, STANDARDHBONDANGLEDB, MAXSTRINGSIZE-strlen(filename));
     276  strncpy(filename, path, MAXSTRINGSIZE);
     277  strncat(filename, "/", MAXSTRINGSIZE-strlen(filename));
     278  strncat(filename, STANDARDHBONDANGLEDB, MAXSTRINGSIZE-strlen(filename));
    275279  infile.open(filename);
    276280  if (infile != NULL) {
     
    288292  } else
    289293    otherstatus = false;
     294 
     295  if (!otherstatus)
     296    cerr << "ERROR: Something went wrong while parsing the databases!" << endl;
    290297 
    291298  return status;
Note: See TracChangeset for help on using the changeset viewer.