Changeset eeec8f for src/datacreator.cpp


Ignore:
Timestamp:
Oct 19, 2008, 1:57:23 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:
84fc91
Parents:
f731ae
Message:

HessianMatrix implemented fully, but not yet working, probably due to wrong matrix generation in script file (convertHessian.py)

HessianMatrix::IsSymmetric was though to be needed, but is NOT. As we regard full matrices, we don't need to add onto mirrored indices as well
Joiner and Analyzer have seen some small changes and bugfixes: NoHessian was not also always looked at when needed and so on

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/datacreator.cpp

    rf731ae reeec8f  
    6363  cout << msg << endl;
    6464  output << "# " << msg << ", created on " << datum;
    65   output << "#Order\tFrag.No.\t" << Fragments.Header << endl;
     65  output << "#Order\tFrag.No.\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
    6666  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
    6767    for(int i=KeySet.FragmentsPerOrder[BondOrder];i--;) {
     
    9696  cout << msg << endl;
    9797  output << "# " << msg << ", created on " << datum;
    98   output << "#Order\tFrag.No.\t" << Fragments.Header << endl;
     98  output << "#Order\tFrag.No.\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
    9999  Fragments.SetLastMatrix(Energy.Matrix[Energy.MatrixCounter],0);
    100100  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     
    133133  cout << msg << endl;
    134134  output << "# " << msg << ", created on " << datum;
    135   output << "# Order\tFrag.No.\t" << Fragments.Header << endl;
     135  output << "# Order\tFrag.No.\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
    136136  Fragments.SetLastMatrix(0.,0);
    137137  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     
    165165  cout << msg << endl;
    166166  output << "# " << msg << ", created on " << datum;
    167   output << "# Order\tFrag.No.\t" << Fragments.Header << endl;
     167  output << "# Order\tFrag.No.\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
    168168  Fragments.SetLastMatrix(Force.Matrix[Force.MatrixCounter],0);
    169169  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     
    198198  cout << msg << endl;
    199199  output << "# " << msg << ", created on " << datum;
    200   output << "# AtomNo\t" << Fragments.Header << endl;
     200  output << "# AtomNo\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
    201201  Fragments.SetLastMatrix(Force.Matrix[Force.MatrixCounter], 0);
    202202  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     
    244244  cout << msg << endl;
    245245  output << "# " << msg << ", created on " << datum;
    246   output << "# AtomNo\t" << Fragments.Header << endl;
     246  output << "# AtomNo\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
    247247  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
    248248    //cout << "Current order is " << BondOrder << "." << endl;
     
    262262};
    263263
     264
     265/** Plot hessian error vs. vs atom vs. order.
     266 * \param &Hessian HessianMatrix containing reference values (in MatrixCounter matrix)
     267 * \param &Fragments HessianMatrix class containing matrix values
     268 * \param KeySet KeySetContainer class holding bond KeySetContainer::Order
     269 * \param *prefix prefix in filename (without ending)
     270 * \param *msg message to be place in first line as a comment
     271 * \param *datum current date and time
     272 * \return true if file was written successfully
     273 */
     274bool CreateDataDeltaHessianOrderPerAtom(class HessianMatrix &Hessian, class HessianMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum)
     275{
     276  stringstream filename;
     277  ofstream output;
     278  double norm = 0.;
     279
     280  filename << prefix << ".dat";
     281  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
     282  cout << msg << endl;
     283  output << "# " << msg << ", created on " << datum;
     284  output << "# AtomNo\t" << Fragments.Header[Fragments.MatrixCounter] << endl;
     285  Fragments.SetLastMatrix(Hessian.Matrix[Hessian.MatrixCounter], 0);
     286  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     287    //cout << "Current order is " << BondOrder << "." << endl;
     288    Fragments.SumSubHessians(Fragments, KeySet, BondOrder, -1.);
     289    // errors per atom
     290    output << endl << "#Order\t" << BondOrder+1 << endl;
     291    for(int j=0;j<Fragments.RowCounter[ Fragments.MatrixCounter ];j++) {
     292      output << Fragments.Indices[Fragments.MatrixCounter][j] << "\t";
     293      for (int l=0;l<Fragments.ColumnCounter[ Fragments.MatrixCounter ];l++) {
     294        output << scientific << Fragments.Matrix[Fragments.MatrixCounter][ j ][l] << "\t";
     295      }
     296      output << endl;
     297    }
     298    output << endl;
     299  }
     300  output.close();
     301  return true;
     302};
     303
     304/** Plot hessian error vs. vs atom vs. order.
     305 * \param &Fragments HessianMatrix class containing matrix values
     306 * \param KeySet KeySetContainer class holding bond KeySetContainer::Order
     307 * \param *prefix prefix in filename (without ending)
     308 * \param *msg message to be place in first line as a comment
     309 * \param *datum current date and time
     310 * \return true if file was written successfully
     311 */
     312bool CreateDataHessianOrderPerAtom(class HessianMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum)
     313{
     314  stringstream filename;
     315  ofstream output;
     316
     317  filename << prefix << ".dat";
     318  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
     319  cout << msg << endl;
     320  output << "# " << msg << ", created on " << datum;
     321  output << "# AtomNo\t" << Fragments.Header[ Fragments.MatrixCounter ] << endl;
     322  Fragments.SetLastMatrix(0., 0);
     323  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     324    //cout << "Current order is " << BondOrder << "." << endl;
     325    Fragments.SumSubHessians(Fragments, KeySet, BondOrder, 1.);
     326    // errors per atom
     327    output << endl << "#Order\t" << BondOrder+1 << endl;
     328    for(int j=0;j<Fragments.RowCounter[ Fragments.MatrixCounter ];j++) {
     329      output << Fragments.Indices[Fragments.MatrixCounter][j] << "\t";
     330      for (int l=0;l<Fragments.ColumnCounter[ Fragments.MatrixCounter ];l++)
     331        output << scientific << Fragments.Matrix[Fragments.MatrixCounter][ j ][l] << "\t";
     332      output << endl;
     333    }
     334    output << endl;
     335  }
     336  output.close();
     337  return true;
     338};
     339
    264340/** Plot matrix vs. fragment.
    265341 */
     
    273349  cout << msg << endl;
    274350  output << "# " << msg << ", created on " << datum << endl;
    275   output << "#Order\tFrag.No.\t" << Fragment.Header << endl;
     351  output << "#Order\tFrag.No.\t" << Fragment.Header[ Fragment.MatrixCounter ] << endl;
    276352  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
    277353    for(int i=0;i<KeySet.FragmentsPerOrder[BondOrder];i++) {
     
    338414  cout << msg << endl;
    339415  output << "# " << msg << ", created on " << datum;
    340   output << "#Order\tFrag.No.\t" << Fragment.Header << endl;
     416  output << "#Order\tFrag.No.\t" << Fragment.Header[ Fragment.MatrixCounter ] << endl;
    341417  // max
    342418  for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) {
     
    538614void AbsEnergyPlotLine(ofstream &output, class MatrixContainer &Energy, const char *prefix, const char *xargument, const char *uses)
    539615{
    540   stringstream line(Energy.Header);
     616  stringstream line(Energy.Header[ Energy.MatrixCounter ]);
    541617  string token;
    542618
     
    562638void EnergyPlotLine(ofstream &output, class MatrixContainer &Energy, const char *prefix, const char *xargument, const char *uses)
    563639{
    564   stringstream line(Energy.Header);
     640  stringstream line(Energy.Header[Energy.MatrixCounter]);
    565641  string token;
    566642
     
    586662void ForceMagnitudePlotLine(ofstream &output, class MatrixContainer &Force, const char *prefix, const char *xargument, const char *uses)
    587663{
    588   stringstream line(Force.Header);
     664  stringstream line(Force.Header[Force.MatrixCounter]);
    589665  string token;
    590666
     
    617693void AbsFirstForceValuePlotLine(ofstream &output, class MatrixContainer &Force, const char *prefix, const char *xargument, const char *uses)
    618694{
    619   stringstream line(Force.Header);
     695  stringstream line(Force.Header[Force.MatrixCounter]);
    620696  string token;
    621697
     
    648724void BoxesForcePlotLine(ofstream &output, class MatrixContainer &Force, const char *prefix, const char *xargument, const char *uses)
    649725{
    650   stringstream line(Force.Header);
     726  stringstream line(Force.Header[Force.MatrixCounter]);
    651727  char *fillcolor[5] = {"black", "red", "blue", "green", "cyan"};
    652728  string token;
     
    680756void BoxesFirstForceValuePlotLine(ofstream &output, class MatrixContainer &Force, const char *prefix, const char *xargument, const char *uses)
    681757{
    682   stringstream line(Force.Header);
     758  stringstream line(Force.Header[Force.MatrixCounter]);
    683759  char *fillcolor[5] = {"black", "red", "blue", "green", "cyan"};
    684760  string token;
Note: See TracChangeset for help on using the changeset viewer.