Changeset 5e0d1f for src/config.cpp


Ignore:
Timestamp:
Aug 6, 2008, 12:00:18 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, Candidate_v1.7.0, Candidate_v1.7.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/config.cpp

    re9b8bb r5e0d1f  
    461461  int Z, No[MAX_ELEMENTS];
    462462  int verbose = 0;
     463  int MinSteps = -1;
    463464 
    464465  /* Namen einlesen */
     
    652653        while (ParseForParameter(verbose,file, keyword, 0, 1, 1, double_type, &neues->x.x[0], repetition, (repetition == 1) ? critical : optional) &&
    653654          ParseForParameter(verbose,file, keyword, 0, 2, 1, double_type, &neues->x.x[1], repetition, (repetition == 1) ? critical : optional) &&
    654           ParseForParameter(verbose,file, keyword, 0, 3, 1, double_type, &neues->x.x[2], repetition, (repetition == 1) ? critical : optional))
     655          ParseForParameter(verbose,file, keyword, 0, 3, 1, double_type, &neues->x.x[2], repetition, (repetition == 1) ? critical : optional)) {
     656          // check size of vectors
     657          if (mol->Trajectories[neues].R.size() <= (unsigned int)(repetition-1)) {
     658            cout << "Increasing size for trajectory array of " << keyword << " to " << (repetition+10) << "." << endl;
     659            mol->Trajectories[neues].R.resize(repetition+10);
     660            mol->Trajectories[neues].U.resize(repetition+10);
     661            mol->Trajectories[neues].F.resize(repetition+10);
     662          }
     663           
     664          // put into trajectories list
     665          for (int d=0;d<NDIM;d++)
     666            mol->Trajectories[neues].R.at(repetition-1).x[d] = neues->x.x[d];
     667         
     668          // parse velocities if present
     669          if(!ParseForParameter(verbose,file, keyword, 0, 5, 1, double_type, &neues->v.x[0], repetition,optional))
     670            neues->v.x[0] = 0.;
     671          if(!ParseForParameter(verbose,file, keyword, 0, 6, 1, double_type, &neues->v.x[1], repetition,optional))
     672            neues->v.x[1] = 0.;
     673          if(!ParseForParameter(verbose,file, keyword, 0, 7, 1, double_type, &neues->v.x[2], repetition,optional))
     674            neues->v.x[2] = 0.;
     675          for (int d=0;d<NDIM;d++)
     676            mol->Trajectories[neues].U[repetition-1].x[d] = neues->v.x[d];
     677         
     678          // parse forces if present
     679          if(!ParseForParameter(verbose,file, keyword, 0, 8, 1, double_type, &neues->v.x[0], repetition,optional))
     680            neues->v.x[0] = 0.;
     681          if(!ParseForParameter(verbose,file, keyword, 0, 9, 1, double_type, &neues->v.x[1], repetition,optional))
     682            neues->v.x[1] = 0.;
     683          if(!ParseForParameter(verbose,file, keyword, 0, 10, 1, double_type, &neues->v.x[2], repetition,optional))
     684            neues->v.x[2] = 0.;
     685          for (int d=0;d<NDIM;d++)
     686            mol->Trajectories[neues].F[repetition-1].x[d] = neues->v.x[d];
     687         
     688          cout << "Parsed position of step " << (repetition-1) << " ";
     689          for (int d=0;d<NDIM;d++)
     690            cout << mol->Trajectories[neues].R.at(repetition-1).x[d] << "  ";          // next step
     691          cout << endl;
     692         
    655693          repetition++;
     694        }
    656695        repetition--;
    657         //cout << "Found " << repetition << " times of the keyword " << keyword << "." << endl;
     696        cout << "Found " << repetition << " times of the keyword " << keyword << "." << endl;
    658697      }
     698      if ((repetition < MinSteps) || (MinSteps == -1))
     699        MinSteps = repetition;
    659700      ParseForParameter(verbose,file, keyword, 0, 1, 1, double_type, &neues->x.x[0], repetition,critical);
    660701      ParseForParameter(verbose,file, keyword, 0, 2, 1, double_type, &neues->x.x[1], repetition,critical);
     
    667708      if(!ParseForParameter(verbose,file, keyword, (int)FastParsing, 7, 1, double_type, &neues->v.x[2], repetition,optional))
    668709        neues->v.x[2] = 0.;
     710      // here we don't care if forces are present (last in trajectories is always equal to current position)
    669711      neues->type = elementhash[i]; // find element type
    670712      mol->AddAtom(neues);
    671713    }
    672714  }
     715  mol->MDSteps = MinSteps;    // set equal to smallest number of parsed steps
    673716  file->close();
    674717  delete(file);
     
    9721015    *output << endl;
    9731016    result = result && mol->Checkout(output);
    974     result = result && mol->Output(output);
     1017    result = result && mol->OutputTrajectories(output);
    9751018    return result;
    9761019  } else
Note: See TracChangeset for help on using the changeset viewer.