Changeset 5e0d1f for src/molecules.cpp


Ignore:
Timestamp:
Aug 6, 2008, 12:00:18 PM (16 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:
9e5a04d
Parents:
e9b8bb
Message:

config::Save() and config::Load() parse MD steps into and out of molecule::Trajectories. Tested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecules.cpp

    re9b8bb r5e0d1f  
    4747  link(first,last);
    4848  // other stuff
     49  MDSteps = 0;
    4950  last_atom = 0;
    5051  elemente = teil;
     
    983984  int i, Ion[2];
    984985  double a, IonMass;
     986  unsigned int size;
    985987
    986988  CountElements();  // make sure ElementsInMolecule is up to date
     
    10441046           
    10451047           
     1048            // check size of vectors
     1049            size = Trajectories[walker].R.size();
     1050            if (size <= (unsigned int)(MDSteps)) {
     1051              cout << "Increasing size for trajectory array of " << *walker << " to " << (size+10) << "." << endl;
     1052              Trajectories[walker].R.resize(size+10);
     1053              Trajectories[walker].U.resize(size+10);
     1054              Trajectories[walker].F.resize(size+10);
     1055            }
    10461056            // add trajectory point
    10471057
     
    12941304bool molecule::Output(ofstream *out)
    12951305{
    1296   element *runner = elemente->start;
     1306  element *runner;
    12971307  atom *walker = NULL;
    12981308  int ElementNo, AtomNo;
     
    13041314    *out << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
    13051315    ElementNo = 0;
     1316    runner = elemente->start;
    13061317    while (runner->next != elemente->end) { // go through every element
    13071318                runner = runner->next;
     
    13141325          if (walker->type == runner) { // if this atom fits to element
    13151326            AtomNo++;
    1316             walker->Output(ElementNo, AtomNo, out);
     1327            walker->Output(ElementNo, AtomNo, out); // removed due to trajectories
     1328          }
     1329        }
     1330      }
     1331    }
     1332    return true;
     1333  }
     1334};
     1335
     1336/** Prints molecule with all atomic trajectory positions to *out.
     1337 * \param *out output stream
     1338 */
     1339bool molecule::OutputTrajectories(ofstream *out)
     1340{
     1341  element *runner = NULL;
     1342  atom *walker = NULL;
     1343  int ElementNo, AtomNo;
     1344  CountElements();
     1345 
     1346  if (out == NULL) {
     1347    return false;
     1348  } else {
     1349    for (int step = 0; step < MDSteps; step++) {
     1350      if (step == 0) {
     1351        *out << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
     1352      } else {
     1353        *out << "# ====== MD step " << step << " =========" << endl;
     1354      }
     1355      ElementNo = 0;
     1356      runner = elemente->start;
     1357      while (runner->next != elemente->end) { // go through every element
     1358        runner = runner->next;
     1359        if (ElementsInMolecule[runner->Z]) { // if this element got atoms
     1360          ElementNo++;
     1361          AtomNo = 0;
     1362          walker = start;
     1363          while (walker->next != end) { // go through every atom of this element
     1364            walker = walker->next;
     1365            if (walker->type == runner) { // if this atom fits to element
     1366              AtomNo++;
     1367              *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t"  << fixed << setprecision(9) << showpoint;
     1368              *out << Trajectories[walker].R.at(step).x[0] << "\t" << Trajectories[walker].R.at(step).x[1] << "\t" << Trajectories[walker].R.at(step).x[2];
     1369              *out << "\t" << walker->FixedIon;
     1370              if (Trajectories[walker].U.at(step).Norm() > MYEPSILON)
     1371                *out << "\t" << scientific << setprecision(6) << Trajectories[walker].U.at(step).x[0] << "\t" << Trajectories[walker].U.at(step).x[1] << "\t" << Trajectories[walker].U.at(step).x[2] << "\t";
     1372              if (Trajectories[walker].F.at(step).Norm() > MYEPSILON)
     1373                *out << "\t" << scientific << setprecision(6) << Trajectories[walker].F.at(step).x[0] << "\t" << Trajectories[walker].F.at(step).x[1] << "\t" << Trajectories[walker].F.at(step).x[2] << "\t";
     1374              *out << " # Number in molecule " << walker->nr << endl;
     1375            }
    13171376          }
    13181377        }
Note: See TracChangeset for help on using the changeset viewer.