Ignore:
Timestamp:
Feb 24, 2011, 7:48:13 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:
9dba5f
Parents:
6a465e
git-author:
Frederik Heber <heber@…> (02/24/11 12:48:45)
git-committer:
Frederik Heber <heber@…> (02/24/11 19:48:13)
Message:

Added multiple time steps to PcpParser::OutputAtoms().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PcpParser.cpp

    r6a465e rfcac72  
    548548  *file << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
    549549  map<int, int> ZtoCountMap;
     550  map<atom *, int> AtomtoCountMap;
    550551  pair <   map<int, int>::iterator, bool > Inserter;
    551   int nr = 0;
    552   for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    553     Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) );
    554     if (!Inserter.second)
    555       Inserter.first->second += 1;
    556     const int Z = (*AtomRunner)->getType()->getAtomicNumber();
    557     *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint;
    558     *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2);
    559     *file << "\t" << (int)((*AtomRunner)->getFixedIon());
    560     if ((*AtomRunner)->getAtomicVelocity().Norm() > MYEPSILON)
    561       *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->getAtomicVelocity()[0] << "\t" << (*AtomRunner)->getAtomicVelocity()[1] << "\t" << (*AtomRunner)->getAtomicVelocity()[2] << "\t";
    562     *file << " # molecule nr " << nr++ << endl;
    563   }
     552  bool ContinueStatus = true;
     553  bool AddNewLine = false;
     554  size_t step = 0;
     555  do {
     556    int nr = 0;
     557    ContinueStatus = false;
     558    for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
     559      if ((*AtomRunner)->getTrajectorySize() > step) {
     560        if (step == 0) {  // fill list only on first step
     561          Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) );
     562          if (!Inserter.second)
     563            Inserter.first->second += 1;
     564          AtomtoCountMap.insert( make_pair((*AtomRunner), Inserter.first->second) );
     565        }
     566        if (AddNewLine) {
     567          AddNewLine = false;
     568          *file << endl;
     569        }
     570        const int Z = (*AtomRunner)->getType()->getAtomicNumber();
     571        *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << AtomtoCountMap[(*AtomRunner)] << "\t"  << fixed << setprecision(9) << showpoint;
     572        *file << (*AtomRunner)->atStep(0, step)
     573            << "\t" << (*AtomRunner)->atStep(1,step)
     574            << "\t" << (*AtomRunner)->atStep(2,step);
     575        *file << "\t" << (int)((*AtomRunner)->getFixedIon());
     576        if ((*AtomRunner)->getAtomicVelocityAtStep(step).Norm() > MYEPSILON)
     577          *file << "\t" << scientific << setprecision(6)
     578              << (*AtomRunner)->getAtomicVelocityAtStep(step)[0] << "\t"
     579              << (*AtomRunner)->getAtomicVelocityAtStep(step)[1] << "\t"
     580              << (*AtomRunner)->getAtomicVelocityAtStep(step)[2] << "\t";
     581        *file << " # molecule nr " << nr++ << endl;
     582        ContinueStatus = true;  // as long as a single atom still has trajectory points, continue
     583      }
     584    }
     585    ++step;
     586    if (ContinueStatus)
     587      AddNewLine = true;
     588  } while (ContinueStatus);
    564589}
    565590
Note: See TracChangeset for help on using the changeset viewer.