Ignore:
Timestamp:
Oct 6, 2011, 9:16:19 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:
29daad
Parents:
81c980b
git-author:
Frederik Heber <heber@…> (08/11/11 14:20:59)
git-committer:
Frederik Heber <heber@…> (10/06/11 09:16:19)
Message:

Added color database to periodentafel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/periodentafel.cpp

    r81c980b r064178  
    8787        LoadHBondLengthsDatabase(input);
    8888    ASSERT(status, "HBond distance entry of element initialization failed");
     89  }
     90  {
     91    stringstream input(ColorDB,ios_base::in);
     92#ifndef NDEBUG
     93    bool status =
     94#endif
     95        LoadColorDatabase(input);
     96    ASSERT(status, "color entry of element initialization failed");
    8997  }
    9098};
     
    531539}
    532540
     541/** load the color info.
     542 * \param *input stream to parse from
     543 * \return true - parsing successful, false - something went wrong
     544 */
     545bool periodentafel::LoadColorDatabase(istream &input)
     546{
     547  char dummy[MAXSTRINGSIZE];
     548  if (!input.fail()) {
     549    input.getline(dummy, MAXSTRINGSIZE);
     550    while (!input.eof()) {
     551      atomicNumber_t Z;
     552      input >> Z;
     553      ASSERT(elements.count(Z), "Element not present");
     554      input >> ws;
     555      input >> dummy;
     556      {
     557        int tmpcolor;   // char here will only parse a single char (i.e. only "2" out of "255")
     558        for (int i=0;i<3;++i) {
     559          input >> ws;
     560          input >> tmpcolor;
     561          elements[Z]->color[i] = (unsigned char)tmpcolor;
     562        }
     563      }
     564      input >> ws;
     565      {
     566        const element * tmp = FindElement(Z);
     567//        DoLog(0) && (Log() << Verbose(0) << "Element " << tmp->getName() << " has ("
     568//            << (int)tmp->color[0] << "," << (int)tmp->color[1] << "," << (int)tmp->color[2]
     569//            << ") colors." << std::endl);
     570      }
     571    }
     572    return true;
     573  } else
     574    return false;
     575}
     576
    533577/** Stores element list to file.
    534578 */
Note: See TracChangeset for help on using the changeset viewer.