Changeset b38b64 for src/joiner.cpp


Ignore:
Timestamp:
Jul 23, 2009, 9:14:18 AM (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, Candidate_v1.7.0, 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:
631dcb
Parents:
b77416 (diff), 72744a (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.
Message:

Merge branch 'HessianMatrix'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/joiner.cpp

    rb77416 rb38b64  
    1919  periodentafel *periode = NULL; // and a period table of all elements
    2020  EnergyMatrix Energy;
     21  EnergyMatrix EnergyFragments;
     22 
    2123  EnergyMatrix Hcorrection;
     24  EnergyMatrix HcorrectionFragments;
     25 
    2226  ForceMatrix Force;
    23   EnergyMatrix EnergyFragments;
    24   EnergyMatrix HcorrectionFragments;
    2527  ForceMatrix ForceFragments;
     28
     29  HessianMatrix Hessian;
     30  HessianMatrix HessianFragments;
     31 
    2632  ForceMatrix Shielding;
    2733  ForceMatrix ShieldingPAS;
     
    3541  stringstream prefix;
    3642  char *dir = NULL;
    37   bool Hcorrected = true;
     43  bool NoHCorrection = false;
     44  bool NoHessian = false;
    3845
    3946  cout << "Joiner" << endl;
     
    6572  // ------------- Parse through all Fragment subdirs --------
    6673  if (!Energy.ParseFragmentMatrix(argv[1], dir, EnergySuffix, 0,0)) return 1;
    67   Hcorrected = Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX, 0,0);
     74  if (!Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX, 0,0)) {
     75    NoHCorrection = true;
     76    cout << "No HCorrection matrices found, skipping these." << endl;
     77  }
    6878  if (!Force.ParseFragmentMatrix(argv[1], dir, ForcesSuffix, 0,0)) return 1;
     79  if (!Hessian.ParseFragmentMatrix(argv[1], dir, HessianSuffix, 0,0)) {
     80    NoHessian = true;
     81    cout << "No hessian matrices found, skipping these." << endl;
     82  }
    6983  if (periode != NULL) { // also look for PAS values
    7084    if (!Shielding.ParseFragmentMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1;
     
    7589
    7690  // ---------- Parse the TE Factors into an array -----------------
    77   if (!Energy.ParseIndices()) return 1;
    78   if (Hcorrected) Hcorrection.ParseIndices();
     91  if (!Energy.InitialiseIndices()) return 1;
     92  if (!NoHCorrection)
     93    Hcorrection.InitialiseIndices();
    7994 
    8095  // ---------- Parse the Force indices into an array ---------------
    8196  if (!Force.ParseIndices(argv[1])) return 1;
     97
     98  // ---------- Parse the Hessian (=force) indices into an array ---------------
     99  if (!NoHessian)
     100    if (!Hessian.InitialiseIndices((class MatrixContainer *)&Force)) return 1;
    82101
    83102  // ---------- Parse the shielding indices into an array ---------------
     
    94113
    95114  if (!EnergyFragments.AllocateMatrix(Energy.Header, Energy.MatrixCounter, Energy.RowCounter, Energy.ColumnCounter)) return 1;
    96   if (Hcorrected)  HcorrectionFragments.AllocateMatrix(Hcorrection.Header, Hcorrection.MatrixCounter, Hcorrection.RowCounter, Hcorrection.ColumnCounter);
     115  if (!NoHCorrection) 
     116    HcorrectionFragments.AllocateMatrix(Hcorrection.Header, Hcorrection.MatrixCounter, Hcorrection.RowCounter, Hcorrection.ColumnCounter);
    97117  if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return 1;
     118  if (!NoHessian)
     119    if (!HessianFragments.AllocateMatrix(Hessian.Header, Hessian.MatrixCounter, Hessian.RowCounter, Hessian.ColumnCounter)) return 1;
    98120  if (periode != NULL) { // also look for PAS values
    99121    if (!ShieldingFragments.AllocateMatrix(Shielding.Header, Shielding.MatrixCounter, Shielding.RowCounter, Shielding.ColumnCounter)) return 1;
     
    106128  if(!Energy.SetLastMatrix(0., 0)) return 1;
    107129  if(!Force.SetLastMatrix(0., 2)) return 1;
     130  if (!NoHessian)
     131    if (!Hessian.SetLastMatrix(0., 0)) return 1;
    108132  if (periode != NULL) { // also look for PAS values
    109133    if(!Shielding.SetLastMatrix(0., 2)) return 1;
     
    120144    cout << "Summing energy of order " << BondOrder+1 << " ..." << endl;
    121145    if (!EnergyFragments.SumSubManyBodyTerms(Energy, KeySet, BondOrder)) return 1;
    122     if (Hcorrected) {
     146    if (!NoHCorrection) {
    123147      HcorrectionFragments.SumSubManyBodyTerms(Hcorrection, KeySet, BondOrder);
    124148      if (!Energy.SumSubEnergy(EnergyFragments, &HcorrectionFragments, KeySet, BondOrder, 1.)) return 1;
    125       if (Hcorrected) Hcorrection.SumSubEnergy(HcorrectionFragments, NULL, KeySet, BondOrder, 1.);
     149      Hcorrection.SumSubEnergy(HcorrectionFragments, NULL, KeySet, BondOrder, 1.);
    126150    } else
    127151      if (!Energy.SumSubEnergy(EnergyFragments, NULL, KeySet, BondOrder, 1.)) return 1;
     
    130154    if (!ForceFragments.SumSubManyBodyTerms(Force, KeySet, BondOrder)) return 1;
    131155    if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder, 1.)) return 1;
     156    // --------- sum up Hessian --------------------
     157    if (!NoHessian) {
     158      cout << "Summing Hessian of order " << BondOrder+1 << " ..." << endl;
     159      if (!HessianFragments.SumSubManyBodyTerms(Hessian, KeySet, BondOrder)) return 1;
     160      if (!Hessian.SumSubHessians(HessianFragments, KeySet, BondOrder, 1.)) return 1;
     161    }
    132162    if (periode != NULL) { // also look for PAS values
    133163      cout << "Summing shieldings and susceptibilities of order " << BondOrder+1 << " ..." << endl;
     
    150180    // forces
    151181    if (!Force.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ForcesSuffix)) return 1;
     182    // hessian
     183    if (!NoHessian)
     184      if (!Hessian.WriteLastMatrix(argv[1], (prefix.str()).c_str(), HessianSuffix)) return 1;
    152185    // shieldings
    153186    if (periode != NULL) { // also look for PAS values
     
    162195  prefix << dir << EnergyFragmentSuffix;
    163196  if (!EnergyFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    164   if (Hcorrected) {
     197  if (!NoHCorrection) {
    165198    prefix.str(" ");
    166199    prefix << dir << HcorrectionFragmentSuffix;
     
    171204  if (!ForceFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    172205  if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], FRAGMENTPREFIX ENERGYPERFRAGMENT, "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1;
     206  if (!NoHessian) {
     207    prefix.str(" ");
     208    prefix << dir << HessianFragmentSuffix;
     209    if (!HessianFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
     210  }
    173211  if (periode != NULL) { // also look for PAS values
    174212    prefix.str(" ");
     
    188226  // write last matrices as fragments into central dir (not subdir as above), for analyzer to know index bounds
    189227  if (!Energy.WriteLastMatrix(argv[1], dir, EnergyFragmentSuffix)) return 1;
    190   if (Hcorrected) Hcorrection.WriteLastMatrix(argv[1], dir, HcorrectionFragmentSuffix);
     228  if (!NoHCorrection) Hcorrection.WriteLastMatrix(argv[1], dir, HcorrectionFragmentSuffix);
    191229  if (!Force.WriteLastMatrix(argv[1], dir, ForceFragmentSuffix)) return 1;
     230  if (!NoHessian)
     231    if (!Hessian.WriteLastMatrix(argv[1], dir, HessianFragmentSuffix)) return 1;
    192232  if (periode != NULL) { // also look for PAS values
    193233    if (!Shielding.WriteLastMatrix(argv[1], dir, ShieldingFragmentSuffix)) return 1;
Note: See TracChangeset for help on using the changeset viewer.