Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/joiner.cpp

    • Property mode changed from 100644 to 100755
    rf98e5a r97c751  
    1919  periodentafel *periode = NULL; // and a period table of all elements
    2020  EnergyMatrix Energy;
     21  EnergyMatrix Hcorrection;
     22  ForceMatrix Force;
    2123  EnergyMatrix EnergyFragments;
    22  
    23   EnergyMatrix Hcorrection;
    2424  EnergyMatrix HcorrectionFragments;
    25  
    26   ForceMatrix Force;
    2725  ForceMatrix ForceFragments;
    28 
    29   HessianMatrix Hessian;
    30   HessianMatrix HessianFragments;
    31  
    3226  ForceMatrix Shielding;
    3327  ForceMatrix ShieldingPAS;
    3428  ForceMatrix ShieldingFragments;
    3529  ForceMatrix ShieldingPASFragments;
     30  EnergyMatrix Chi;
     31  EnergyMatrix ChiPAS;
     32  EnergyMatrix ChiFragments;
     33  EnergyMatrix ChiPASFragments;
    3634  KeySetsContainer KeySet; 
    3735  stringstream prefix;
    3836  char *dir = NULL;
    39   bool NoHCorrection = false;
    40   bool NoHessian = false;
     37  bool Hcorrected = true;
    4138
    4239  cout << "Joiner" << endl;
     
    6865  // ------------- Parse through all Fragment subdirs --------
    6966  if (!Energy.ParseFragmentMatrix(argv[1], dir, EnergySuffix, 0,0)) return 1;
    70   if (!Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX, 0,0)) {
    71     NoHCorrection = true;
    72     cout << "No HCorrection matrices found, skipping these." << endl;
    73   }
     67  Hcorrected = Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX, 0,0);
    7468  if (!Force.ParseFragmentMatrix(argv[1], dir, ForcesSuffix, 0,0)) return 1;
    75   if (!Hessian.ParseFragmentMatrix(argv[1], dir, HessianSuffix, 0,0)) {
    76     NoHessian = true;
    77     cout << "No hessian matrices found, skipping these." << endl;
    78   }
    7969  if (periode != NULL) { // also look for PAS values
    8070    if (!Shielding.ParseFragmentMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1;
    8171    if (!ShieldingPAS.ParseFragmentMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1;
     72    if (!Chi.ParseFragmentMatrix(argv[1], dir, ChiSuffix, 1, 0)) return 1;
     73    if (!ChiPAS.ParseFragmentMatrix(argv[1], dir, ChiPASSuffix, 1, 0)) return 1;
    8274  }
    8375
    8476  // ---------- Parse the TE Factors into an array -----------------
    85   if (!Energy.InitialiseIndices()) return 1;
    86   if (!NoHCorrection)
    87     Hcorrection.InitialiseIndices();
     77  if (!Energy.ParseIndices()) return 1;
     78  if (Hcorrected) Hcorrection.ParseIndices();
    8879 
    8980  // ---------- Parse the Force indices into an array ---------------
    9081  if (!Force.ParseIndices(argv[1])) return 1;
    9182
    92   // ---------- Parse the Hessian (=force) indices into an array ---------------
    93   if (!NoHessian)
    94     if (!Hessian.InitialiseIndices((class MatrixContainer *)&Force)) return 1;
    95 
    9683  // ---------- Parse the shielding indices into an array ---------------
    9784  if (periode != NULL) { // also look for PAS values
    9885    if(!Shielding.ParseIndices(argv[1])) return 1;
    9986    if(!ShieldingPAS.ParseIndices(argv[1])) return 1;
     87    if(!Chi.ParseIndices()) return 1;
     88    if(!ChiPAS.ParseIndices()) return 1;
    10089  }
    10190
    10291  // ---------- Parse the KeySets into an array ---------------
    10392  if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1;
    104 
    10593  if (!KeySet.ParseManyBodyTerms()) return 1;
     94
    10695  if (!EnergyFragments.AllocateMatrix(Energy.Header, Energy.MatrixCounter, Energy.RowCounter, Energy.ColumnCounter)) return 1;
    107   if (!NoHCorrection) 
    108     HcorrectionFragments.AllocateMatrix(Hcorrection.Header, Hcorrection.MatrixCounter, Hcorrection.RowCounter, Hcorrection.ColumnCounter);
     96  if (Hcorrected)  HcorrectionFragments.AllocateMatrix(Hcorrection.Header, Hcorrection.MatrixCounter, Hcorrection.RowCounter, Hcorrection.ColumnCounter);
    10997  if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return 1;
    110   if (!NoHessian)
    111     if (!HessianFragments.AllocateMatrix(Hessian.Header, Hessian.MatrixCounter, Hessian.RowCounter, Hessian.ColumnCounter)) return 1;
    11298  if (periode != NULL) { // also look for PAS values
    11399    if (!ShieldingFragments.AllocateMatrix(Shielding.Header, Shielding.MatrixCounter, Shielding.RowCounter, Shielding.ColumnCounter)) return 1;
    114100    if (!ShieldingPASFragments.AllocateMatrix(ShieldingPAS.Header, ShieldingPAS.MatrixCounter, ShieldingPAS.RowCounter, ShieldingPAS.ColumnCounter)) return 1;
     101    if (!ChiFragments.AllocateMatrix(Chi.Header, Chi.MatrixCounter, Chi.RowCounter, Chi.ColumnCounter)) return 1;
     102    if (!ChiPASFragments.AllocateMatrix(ChiPAS.Header, ChiPAS.MatrixCounter, ChiPAS.RowCounter, ChiPAS.ColumnCounter)) return 1;
    115103  }
    116104 
     
    118106  if(!Energy.SetLastMatrix(0., 0)) return 1;
    119107  if(!Force.SetLastMatrix(0., 2)) return 1;
    120   if (!NoHessian)
    121     if (!Hessian.SetLastMatrix(0., 0)) return 1;
    122108  if (periode != NULL) { // also look for PAS values
    123109    if(!Shielding.SetLastMatrix(0., 2)) return 1;
    124110    if(!ShieldingPAS.SetLastMatrix(0., 2)) return 1;
     111    if(!Chi.SetLastMatrix(0., 2)) return 1;
     112    if(!ChiPAS.SetLastMatrix(0., 2)) return 1;
    125113  }
    126114
     
    132120    cout << "Summing energy of order " << BondOrder+1 << " ..." << endl;
    133121    if (!EnergyFragments.SumSubManyBodyTerms(Energy, KeySet, BondOrder)) return 1;
    134     if (!NoHCorrection) {
     122    if (Hcorrected) {
    135123      HcorrectionFragments.SumSubManyBodyTerms(Hcorrection, KeySet, BondOrder);
    136124      if (!Energy.SumSubEnergy(EnergyFragments, &HcorrectionFragments, KeySet, BondOrder, 1.)) return 1;
    137       Hcorrection.SumSubEnergy(HcorrectionFragments, NULL, KeySet, BondOrder, 1.);
     125      if (Hcorrected) Hcorrection.SumSubEnergy(HcorrectionFragments, NULL, KeySet, BondOrder, 1.);
    138126    } else
    139127      if (!Energy.SumSubEnergy(EnergyFragments, NULL, KeySet, BondOrder, 1.)) return 1;
     
    142130    if (!ForceFragments.SumSubManyBodyTerms(Force, KeySet, BondOrder)) return 1;
    143131    if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder, 1.)) return 1;
    144     // --------- sum up Hessian --------------------
    145     if (!NoHessian) {
    146       cout << "Summing Hessian of order " << BondOrder+1 << " ..." << endl;
    147       if (!HessianFragments.SumSubManyBodyTerms(Hessian, KeySet, BondOrder)) return 1;
    148       if (!Hessian.SumSubHessians(HessianFragments, KeySet, BondOrder, 1.)) return 1;
    149     }
    150132    if (periode != NULL) { // also look for PAS values
    151       cout << "Summing shieldings of order " << BondOrder+1 << " ..." << endl;
     133      cout << "Summing shieldings and susceptibilities of order " << BondOrder+1 << " ..." << endl;
    152134      if (!ShieldingFragments.SumSubManyBodyTerms(Shielding, KeySet, BondOrder)) return 1;
    153135      if (!Shielding.SumSubForces(ShieldingFragments, KeySet, BondOrder, 1.)) return 1;
    154136      if (!ShieldingPASFragments.SumSubManyBodyTerms(ShieldingPAS, KeySet, BondOrder)) return 1;
    155137      if (!ShieldingPAS.SumSubForces(ShieldingPASFragments, KeySet, BondOrder, 1.)) return 1;
     138      if (!ChiFragments.SumSubManyBodyTerms(Chi, KeySet, BondOrder)) return 1;
     139      if (!Chi.SumSubEnergy(ChiFragments, NULL, KeySet, BondOrder, 1.)) return 1;
     140      if (!ChiPASFragments.SumSubManyBodyTerms(ChiPAS, KeySet, BondOrder)) return 1;
     141      if (!ChiPAS.SumSubEnergy(ChiPASFragments, NULL,KeySet, BondOrder, 1.)) return 1;
    156142    }
    157143
     
    164150    // forces
    165151    if (!Force.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ForcesSuffix)) return 1;
    166     // hessian
    167     if (!NoHessian)
    168       if (!Hessian.WriteLastMatrix(argv[1], (prefix.str()).c_str(), HessianSuffix)) return 1;
    169152    // shieldings
    170153    if (periode != NULL) { // also look for PAS values
    171154      if (!Shielding.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ShieldingSuffix)) return 1;
    172155      if (!ShieldingPAS.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ShieldingPASSuffix)) return 1;
     156      if (!Chi.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ChiSuffix)) return 1;
     157      if (!ChiPAS.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ChiPASSuffix)) return 1;
    173158    }
    174159  }
     
    177162  prefix << dir << EnergyFragmentSuffix;
    178163  if (!EnergyFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    179   if (!NoHCorrection) {
     164  if (Hcorrected) {
    180165    prefix.str(" ");
    181166    prefix << dir << HcorrectionFragmentSuffix;
     
    186171  if (!ForceFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    187172  if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], FRAGMENTPREFIX ENERGYPERFRAGMENT, "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1;
    188   if (!NoHessian) {
    189     prefix.str(" ");
    190     prefix << dir << HessianFragmentSuffix;
    191     if (!HessianFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    192   }
    193173  if (periode != NULL) { // also look for PAS values
    194174    prefix.str(" ");
     
    198178    prefix << dir << ShieldingPASFragmentSuffix;
    199179    if (!ShieldingPASFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
     180    prefix.str(" ");
     181    prefix << dir << ChiFragmentSuffix;
     182    if (!ChiFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
     183    prefix.str(" ");
     184    prefix << dir << ChiPASFragmentSuffix;
     185    if (!ChiPASFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
    200186  }
    201187
    202188  // write last matrices as fragments into central dir (not subdir as above), for analyzer to know index bounds
    203189  if (!Energy.WriteLastMatrix(argv[1], dir, EnergyFragmentSuffix)) return 1;
    204   if (!NoHCorrection) Hcorrection.WriteLastMatrix(argv[1], dir, HcorrectionFragmentSuffix);
     190  if (Hcorrected) Hcorrection.WriteLastMatrix(argv[1], dir, HcorrectionFragmentSuffix);
    205191  if (!Force.WriteLastMatrix(argv[1], dir, ForceFragmentSuffix)) return 1;
    206   if (!NoHessian)
    207     if (!Hessian.WriteLastMatrix(argv[1], dir, HessianFragmentSuffix)) return 1;
    208192  if (periode != NULL) { // also look for PAS values
    209193    if (!Shielding.WriteLastMatrix(argv[1], dir, ShieldingFragmentSuffix)) return 1;
    210194    if (!ShieldingPAS.WriteLastMatrix(argv[1], dir, ShieldingPASFragmentSuffix)) return 1;
     195    if (!Chi.WriteLastMatrix(argv[1], dir, ChiFragmentSuffix)) return 1;
     196    if (!ChiPAS.WriteLastMatrix(argv[1], dir, ChiPASFragmentSuffix)) return 1;
    211197  }
    212198
Note: See TracChangeset for help on using the changeset viewer.