Ignore:
Timestamp:
Jul 23, 2009, 1:45:24 PM (15 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:
51c910
Parents:
ce5ac3 (diff), 437922 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Frederik Heber <heber@…> (07/23/09 12:34:47)
git-committer:
Frederik Heber <heber@…> (07/23/09 13:45:24)
Message:

Merge branch 'MultipleMolecules'

Conflicts:

molecuilder/src/analyzer.cpp
molecuilder/src/atom.cpp
molecuilder/src/boundary.cpp
molecuilder/src/boundary.hpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/datacreator.hpp
molecuilder/src/helpers.cpp
molecuilder/src/joiner.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/molecules.cpp
molecuilder/src/molecules.hpp
molecuilder/src/parser.cpp
molecuilder/src/parser.hpp
molecuilder/src/vector.cpp
molecuilder/src/verbose.cpp

merges:

compilation fixes:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/datacreator.cpp

    rce5ac3 rd067d45  
    11/** \file datacreator.cpp
    22 *
    3  * Declarations of assisting functions in creating data and plot files. 
    4  *   
     3 * Declarations of assisting functions in creating data and plot files.
     4 *
    55 */
    66
     
    2727  }
    2828  return true;
    29 }; 
     29};
    3030
    3131/** Opens a file for appending with \a *filename in \a *dir.
     
    4545  }
    4646  return true;
    47 }; 
     47};
    4848
    4949/** Plots an energy vs. order.
     
    5454 * \return true if file was written successfully
    5555 */
    56 bool CreateDataEnergyOrder(class EnergyMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum) 
    57 {
    58   stringstream filename;
    59   ofstream output;
    60 
    61   filename << prefix << ".dat";
    62   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     56bool CreateDataEnergyOrder(class EnergyMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum)
     57{
     58  stringstream filename;
     59  ofstream output;
     60
     61  filename << prefix << ".dat";
     62  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    6363  cout << msg << endl;
    6464  output << "# " << msg << ", created on " << datum;
     
    8787 * \return true if file was written successfully
    8888 */
    89 bool CreateDataDeltaEnergyOrder(class EnergyMatrix &Energy, class EnergyMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum) 
    90 {
    91   stringstream filename;
    92   ofstream output;
    93 
    94   filename << prefix << ".dat";
    95   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     89bool CreateDataDeltaEnergyOrder(class EnergyMatrix &Energy, class EnergyMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum)
     90{
     91  stringstream filename;
     92  ofstream output;
     93
     94  filename << prefix << ".dat";
     95  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    9696  cout << msg << endl;
    9797  output << "# " << msg << ", created on " << datum;
     
    130130
    131131  filename << prefix << ".dat";
    132   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     132  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    133133  cout << msg << endl;
    134134  output << "# " << msg << ", created on " << datum;
     
    162162
    163163  filename << prefix << ".dat";
    164   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     164  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    165165  cout << msg << endl;
    166166  output << "# " << msg << ", created on " << datum;
     
    188188 * \return true if file was written successfully
    189189 */
    190 bool CreateDataDeltaForcesOrderPerAtom(class ForceMatrix &Force, class ForceMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum) 
     190bool CreateDataDeltaForcesOrderPerAtom(class ForceMatrix &Force, class ForceMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum)
    191191{
    192192  stringstream filename;
     
    195195
    196196  filename << prefix << ".dat";
    197   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     197  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    198198  cout << msg << endl;
    199199  output << "# " << msg << ", created on " << datum;
     
    205205    // errors per atom
    206206    output << endl << "#Order\t" << BondOrder+1 << endl;
    207     for(int j=0;j<Fragments.RowCounter[ Fragments.MatrixCounter ];j++) { 
     207    for(int j=0;j<Fragments.RowCounter[ Fragments.MatrixCounter ];j++) {
    208208      output << Fragments.Indices[Fragments.MatrixCounter][j] << "\t";
    209209      for (int l=0;l<Fragments.ColumnCounter[ Fragments.MatrixCounter ];l++) {
     
    213213            norm += Force.Matrix[Force.MatrixCounter][ j ][l+m]*Force.Matrix[Force.MatrixCounter][ j ][l+m];
    214214          norm = sqrt(norm);
    215         }                                                                                                           
     215        }                                                                                                   
    216216//        if (norm < MYEPSILON)
    217217          output << scientific << Fragments.Matrix[Fragments.MatrixCounter][ j ][l] << "\t";
     
    235235 * \return true if file was written successfully
    236236 */
    237 bool CreateDataForcesOrderPerAtom(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum) 
    238 {
    239   stringstream filename;
    240   ofstream output;
    241 
    242   filename << prefix << ".dat";
    243   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     237bool CreateDataForcesOrderPerAtom(class ForceMatrix &Fragments, class KeySetsContainer &KeySet, char *dir, char *prefix, char *msg, char *datum)
     238{
     239  stringstream filename;
     240  ofstream output;
     241
     242  filename << prefix << ".dat";
     243  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    244244  cout << msg << endl;
    245245  output << "# " << msg << ", created on " << datum;
     
    250250    // errors per atom
    251251    output << endl << "#Order\t" << BondOrder+1 << endl;
    252     for(int j=0;j<Fragments.RowCounter[ Fragments.MatrixCounter ];j++) { 
     252    for(int j=0;j<Fragments.RowCounter[ Fragments.MatrixCounter ];j++) {
    253253      output << Fragments.Indices[Fragments.MatrixCounter][j] << "\t";
    254254      for (int l=0;l<Fragments.ColumnCounter[ Fragments.MatrixCounter ];l++)
     
    390390
    391391  filename << prefix << ".dat";
    392   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     392  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    393393  cout << msg << endl;
    394394  output << "# " << msg << ", created on " << datum << endl;
     
    411411 * \param &KeySet KeySetsContainer with associations of each fragment to a bond order
    412412 * \param BondOrder current bond order
    413  */ 
     413 */
    414414void CreateMaxFragmentOrder(class MatrixContainer &Fragments, class KeySetsContainer &KeySet, int BondOrder)
    415415{
     
    420420          Fragments.Matrix[ Fragments.MatrixCounter ][j][k] = Fragments.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
    421421      }
    422     }     
     422    }
    423423  }
    424424};
     
    428428 * \param &KeySet KeySetsContainer with associations of each fragment to a bond order
    429429 * \param BondOrder current bond order
    430  */ 
     430 */
    431431void CreateMinFragmentOrder(class MatrixContainer &Fragments, class KeySetsContainer &KeySet, int BondOrder)
    432432{
     
    443443          Fragments.Matrix[ Fragments.MatrixCounter ][j][k] = Fragments.Matrix[ KeySet.OrderSet[BondOrder][i] ][j][k];
    444444      }
    445     }     
     445    }
    446446  }
    447447};
     
    455455
    456456  filename << prefix << ".dat";
    457   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     457  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    458458  cout << msg << endl;
    459459  output << "# " << msg << ", created on " << datum;
     
    496496    do {
    497497      for (int m=NDIM;m--;) {
    498         stored += Force.Matrix[MatrixNumber][ k ][l+m] 
     498        stored += Force.Matrix[MatrixNumber][ k ][l+m]
    499499              * Force.Matrix[MatrixNumber][ k ][l+m];
    500         Force.Matrix[MatrixNumber][ Force.RowCounter[MatrixNumber] ][l+m]  = Force.Matrix[MatrixNumber][ k ][l+m]; 
     500        Force.Matrix[MatrixNumber][ Force.RowCounter[MatrixNumber] ][l+m]  = Force.Matrix[MatrixNumber][ k ][l+m];
    501501      }
    502502      k++;
     
    505505      double tmp = 0;
    506506      for (int m=NDIM;m--;)
    507         tmp += Force.Matrix[MatrixNumber][ k ][l+m] 
     507        tmp += Force.Matrix[MatrixNumber][ k ][l+m]
    508508              * Force.Matrix[MatrixNumber][ k ][l+m];
    509509      if ((fabs(tmp) > MYEPSILON) && (tmp < stored)) {  // current force is greater than stored
    510510        for (int m=NDIM;m--;)
    511           Force.Matrix[MatrixNumber][ Force.RowCounter[MatrixNumber] ][l+m]  = Force.Matrix[MatrixNumber][ k ][l+m]; 
     511          Force.Matrix[MatrixNumber][ Force.RowCounter[MatrixNumber] ][l+m]  = Force.Matrix[MatrixNumber][ k ][l+m];
    512512        stored = tmp;
    513513      }
     
    531531      double norm = 0.;
    532532      for (int m=NDIM;m--;)
    533         norm += Force.Matrix[MatrixNumber][ k ][l+m] 
     533        norm += Force.Matrix[MatrixNumber][ k ][l+m]
    534534              * Force.Matrix[MatrixNumber][ k ][l+m];
    535535      tmp += sqrt(norm);
     
    553553      double tmp = 0;
    554554      for (int m=NDIM;m--;)
    555         tmp += Force.Matrix[MatrixNumber][ k ][l+m] 
     555        tmp += Force.Matrix[MatrixNumber][ k ][l+m]
    556556              * Force.Matrix[MatrixNumber][ k ][l+m];
    557557      if (tmp > stored) {  // current force is greater than stored
    558558        for (int m=NDIM;m--;)
    559           Force.Matrix[MatrixNumber][ Force.RowCounter[MatrixNumber] ][l+m]  = Force.Matrix[MatrixNumber][ k ][l+m]; 
     559          Force.Matrix[MatrixNumber][ Force.RowCounter[MatrixNumber] ][l+m]  = Force.Matrix[MatrixNumber][ k ][l+m];
    560560        stored = tmp;
    561561      }
     
    592592 * \param *key position of key
    593593 * \param *logscale axis for logscale
    594  * \param *extraline extra set lines if desired 
     594 * \param *extraline extra set lines if desired
    595595 * \param mxtics small tics at ...
    596596 * \param xtics large tics at ...
    597  * \param *xlabel label for x axis 
     597 * \param *xlabel label for x axis
    598598 * \param *ylabel label for y axis
    599  */ 
     599 */
    600600void CreatePlotHeader(ofstream &output, const char *prefix, const int keycolumns, const char *key, const char *logscale, const char *extraline, const int mxtics, const int xtics, const char *xlabel, const char *ylabel)
    601601{
     
    626626 * \param mxtics small tics at ...
    627627 * \param xtics large tics at ...
    628  * \param xlabel label for x axis 
     628 * \param xlabel label for x axis
    629629 * \param xlabel label for x axis
    630630 * \param *xrange xrange
     
    634634 * \param (*CreatePlotLines) function reference that writes a single plot line
    635635 * \return true if file was written successfully
    636  */   
     636 */
    637637bool CreatePlotOrder(class MatrixContainer &Matrix, const class KeySetsContainer &KeySet, const char *dir, const char *prefix, const int keycolumns, const char *key, const char *logscale, const char *extraline, const int mxtics, const int xtics, const char *xlabel, const char *ylabel, const char *xrange, const char *yrange, const char *xargument, const char *uses, void (*CreatePlotLines)(ofstream &, class MatrixContainer &, const char *, const char *, const char *))
    638638{
     
    641641
    642642  filename << prefix << ".pyx";
    643   if (!OpenOutputFile(output, dir, filename.str().c_str())) return false; 
     643  if (!OpenOutputFile(output, dir, filename.str().c_str())) return false;
    644644  CreatePlotHeader(output, prefix, keycolumns, key, logscale, extraline, mxtics, xtics, xlabel, ylabel);
    645645  output << "plot " << xrange << " " << yrange << " \\" << endl;
    646646  CreatePlotLines(output, Matrix, prefix, xargument, uses);
    647   output.close(); 
     647  output.close();
    648648  return true;
    649649};
Note: See TracChangeset for help on using the changeset viewer.