Ignore:
Timestamp:
Sep 11, 2008, 1:28:25 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
9070650
Parents:
909610
git-author:
Frederik Heber <heber@…> (09/09/08 15:29:58)
git-committer:
Frederik Heber <heber@…> (09/11/08 13:28:25)
Message:

Implemented molecule::LinearInterpolationBetweenConfiguration().

command line option "-L" with start and end step performs a linear interpolation between two atomic configurations. So far the mapping from initial atom labels to final labels is not yet finished, it is injective, but not yet minimal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/moleculelist.cpp

    r909610 r63b5c31  
    378378 * \param *configuration standard configuration to attach atoms in fragment molecule to.
    379379 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
     380 * \param DoPeriodic true - call ScanForPeriodicCorrection, false - don't
     381 * \param DoCentering true - call molecule::CenterEdge(), false - don't
    380382 * \return true - success (each file was written), false - something went wrong.
    381383 */
    382 bool MoleculeListClass::OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex)
     384bool MoleculeListClass::OutputConfigForListOfFragments(ofstream *out, const char *fragmentprefix, config *configuration, int *SortIndex, bool DoPeriodic, bool DoCentering)
    383385{
    384386  ofstream outputFragment;
     
    404406
    405407    // correct periodic
    406     ListOfMolecules[i]->ScanForPeriodicCorrection(out);
     408    if (DoPeriodic)
     409      ListOfMolecules[i]->ScanForPeriodicCorrection(out);
    407410
    408411    // output xyz file
    409412    FragmentNumber = FixedDigitNumber(NumberOfMolecules, FragmentCounter++);
    410     sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     413    sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, fragmentprefix, FragmentNumber);
    411414    outputFragment.open(FragmentName, ios::out);
    412     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as XYZ ...";
     415    *out << Verbose(2) << "Saving " << fragmentprefix << " No. " << FragmentNumber << "/" << FragmentCounter-1 << " as XYZ ...";
    413416    if ((intermediateResult = ListOfMolecules[i]->OutputXYZ(&outputFragment)))
    414417      *out << " done." << endl;
     
    429432   
    430433    // center on edge
    431     ListOfMolecules[i]->CenterEdge(out, &BoxDimension);
    432     ListOfMolecules[i]->SetBoxDimension(&BoxDimension);  // update Box of atoms by boundary
    433     int j = -1;
    434     for (int k=0;k<NDIM;k++) {
    435       j += k+1;
    436       BoxDimension.x[k] = 2.5* (configuration->GetIsAngstroem() ? 1. : 1./AtomicLengthToAngstroem);
    437       ListOfMolecules[i]->cell_size[j] += BoxDimension.x[k]*2.;
    438     }
    439     ListOfMolecules[i]->Translate(&BoxDimension);
     434    if (DoCentering) {
     435      ListOfMolecules[i]->CenterEdge(out, &BoxDimension);
     436      ListOfMolecules[i]->SetBoxDimension(&BoxDimension);  // update Box of atoms by boundary
     437      int j = -1;
     438      for (int k=0;k<NDIM;k++) {
     439        j += k+1;
     440        BoxDimension.x[k] = 2.5* (configuration->GetIsAngstroem() ? 1. : 1./AtomicLengthToAngstroem);
     441        ListOfMolecules[i]->cell_size[j] += BoxDimension.x[k]*2.;
     442      }
     443      ListOfMolecules[i]->Translate(&BoxDimension);
     444    }
    440445
    441446    // also calculate necessary orbitals
     
    445450    // change path in config
    446451    //strcpy(PathBackup, configuration->configpath);
    447     sprintf(FragmentName, "%s/%s%s/", PathBackup, FRAGMENTPREFIX, FragmentNumber);
     452    sprintf(FragmentName, "%s/%s%s/", PathBackup, fragmentprefix, FragmentNumber);
    448453    configuration->SetDefaultPath(FragmentName);
    449454   
    450455    // and save as config
    451     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     456    sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, fragmentprefix, FragmentNumber);
    452457    outputFragment.open(FragmentName, ios::out);
    453     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as config ...";
     458    *out << Verbose(2) << "Saving " << fragmentprefix << " No. " << FragmentNumber << "/" << FragmentCounter-1 << " as config ...";
    454459    if ((intermediateResult = configuration->Save(&outputFragment, ListOfMolecules[i]->elemente, ListOfMolecules[i])))
    455460      *out << " done." << endl;
     
    465470
    466471    // and save as mpqc input file
    467     sprintf(FragmentName, "%s/%s%s.in", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     472    sprintf(FragmentName, "%s/%s%s.in", configuration->configpath, fragmentprefix, FragmentNumber);
    468473    outputFragment.open(FragmentName, ios::out);
    469     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as mpqc input ...";
     474    *out << Verbose(2) << "Saving " << fragmentprefix << " No. " << FragmentNumber << "/" << FragmentCounter-1 << " as mpqc input ...";
    470475    if ((intermediateResult = configuration->SaveMPQC(&outputFragment, ListOfMolecules[i])))
    471476      *out << " done." << endl;
Note: See TracChangeset for help on using the changeset viewer.