Ignore:
Timestamp:
Jun 23, 2010, 3:52:50 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:
d0fbec
Parents:
dc0d21
git-author:
Frederik Heber <heber@…> (06/23/10 15:20:35)
git-committer:
Frederik Heber <heber@…> (06/23/10 15:52:50)
Message:

BIG CHANGE: config::load and config::save in ParseCommandLineOptions() and main() replaced with FormatParser replacements.

Fragmentation:

  • FIX: MoleculeFillWithMoleculeAction: filler atoms have to be removed before the system can be stored to file.
  • FIX: PcpParser::load() - has to put the molecule also into World's MoleculeListClass (otherwise the name cannot be set right after loading)
  • new Libparser.a
  • all sources from PARSER subdir are compiled into libparser such that only ParserUnitTest is recompiled.

Testfixes:

  • testsuite-fragmentation - changes to due to different -f calling syntax.
  • most of the xyz files had to be replaced due to a single whitespace at the end of each entry: Domain/6, Simple_configuration/2, Simple_configuration/3, Simple_configuration/4, Simple_configuration/5, Simple_configuration/8
  • in many cases were the number orbitals (and thus MaxMinStopStep) wrong: Filling/1, Simple_configuration/4, Simple_configuration/5

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    rdc0d21 r35b698  
    380380 * bonded to the same atom, then we add for this pair a correction term constructed from a Morse
    381381 * potential function fit to QM calculations with respecting to the interatomic hydrogen distance.
    382  * \param *out output stream for debugging
    383  * \param *path path to file
    384  */
    385 bool MoleculeListClass::AddHydrogenCorrection(char *path)
     382 * \param &path path to file
     383 */
     384bool MoleculeListClass::AddHydrogenCorrection(std::string &path)
    386385{
    387386  bond *Binder = NULL;
     
    401400  // 0a. find dimension of matrices with constants
    402401  line = path;
    403   line.append("/");
    404   line += FRAGMENTPREFIX;
    405402  line += "1";
    406403  line += FITCONSTANTSUFFIX;
    407404  input.open(line.c_str());
    408   if (input == NULL) {
     405  if (input.fail()) {
    409406    DoLog(1) && (Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
    410407    return false;
     
    570567
    571568/** Store force indices, i.e. the connection between the nuclear index in the total molecule config and the respective atom in fragment config.
    572  * \param *out output stream for debugging
    573  * \param *path path to file
     569 * \param &path path to file
    574570 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
    575571 * \return true - file written successfully, false - writing failed
    576572 */
    577 bool MoleculeListClass::StoreForcesFile(char *path,
    578     int *SortIndex)
     573bool MoleculeListClass::StoreForcesFile(std::string &path, int *SortIndex)
    579574{
    580575  bool status = true;
    581   ofstream ForcesFile;
    582   stringstream line;
     576  string filename(path);
     577  filename += FORCESFILE;
     578  ofstream ForcesFile(filename.c_str());
    583579  periodentafel *periode=World::getInstance().getPeriode();
    584580
    585581  // open file for the force factors
    586582  DoLog(1) && (Log() << Verbose(1) << "Saving  force factors ... ");
    587   line << path << "/" << FRAGMENTPREFIX << FORCESFILE;
    588   ForcesFile.open(line.str().c_str(), ios::out);
    589   if (ForcesFile != NULL) {
     583  if (!ForcesFile.fail()) {
    590584    //Log() << Verbose(1) << "Final AtomicForcesList: ";
    591585    //output << prefix << "Forces" << endl;
     
    612606  } else {
    613607    status = false;
    614     DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
     608    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << filename << "." << endl);
    615609  }
    616610  ForcesFile.close();
     
    621615/** Writes a config file for each molecule in the given \a **FragmentList.
    622616 * \param *out output stream for debugging
    623  * \param *configuration standard configuration to attach atoms in fragment molecule to.
     617 * \param &prefix path and prefix to the fragment config files
    624618 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
    625619 * \return true - success (each file was written), false - something went wrong.
    626620 */
    627 bool MoleculeListClass::OutputConfigForListOfFragments(config *configuration, int *SortIndex)
     621bool MoleculeListClass::OutputConfigForListOfFragments(std::string &prefix, int *SortIndex)
    628622{
    629623  ofstream outputFragment;
    630   char FragmentName[MAXSTRINGSIZE];
     624  std::string FragmentName;
    631625  char PathBackup[MAXSTRINGSIZE];
    632626  bool result = true;
     
    646640  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    647641    // save default path as it is changed for each fragment
    648     path = configuration->GetDefaultPath();
     642    path = World::getInstance().getConfig()->GetDefaultPath();
    649643    if (path != NULL)
    650644      strcpy(PathBackup, path);
     
    659653    // output xyz file
    660654    FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), FragmentCounter++);
    661     sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    662     outputFragment.open(FragmentName, ios::out);
     655    FragmentName = prefix + FragmentNumber + ".conf.xyz";
     656    outputFragment.open(FragmentName.c_str(), ios::out);
    663657    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...");
    664658    if ((intermediateResult = (*ListRunner)->OutputXYZ(&outputFragment)))
     
    683677    for (int k = 0; k < NDIM; k++) {
    684678      j += k + 1;
    685       BoxDimension[k] = 2.5 * (configuration->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
     679      BoxDimension[k] = 2.5 * (World::getInstance().getConfig()->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
    686680      cell_size[j] = BoxDimension[k] * 2.;
    687681    }
     
    690684    // also calculate necessary orbitals
    691685    (*ListRunner)->CountElements(); // this is a bugfix, atoms should shoulds actually be added correctly to this fragment
    692     (*ListRunner)->CalculateOrbitals(*configuration);
     686    //(*ListRunner)->CalculateOrbitals(*World::getInstance().getConfig);
    693687
    694688    // change path in config
    695     //strcpy(PathBackup, configuration->configpath);
    696     sprintf(FragmentName, "%s/%s%s/", PathBackup, FRAGMENTPREFIX, FragmentNumber);
    697     configuration->SetDefaultPath(FragmentName);
     689    FragmentName = PathBackup;
     690    FragmentName += "/";
     691    FragmentName += FRAGMENTPREFIX;
     692    FragmentName += FragmentNumber;
     693    FragmentName += "/";
     694    World::getInstance().getConfig()->SetDefaultPath(FragmentName.c_str());
    698695
    699696    // and save as config
    700     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     697    FragmentName = prefix + FragmentNumber + ".conf";
    701698    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...");
    702     if ((intermediateResult = configuration->Save(FragmentName, (*ListRunner)->elemente, (*ListRunner))))
     699    if ((intermediateResult = World::getInstance().getConfig()->Save(FragmentName.c_str(), (*ListRunner)->elemente, (*ListRunner))))
    703700      DoLog(0) && (Log() << Verbose(0) << " done." << endl);
    704701    else
     
    707704
    708705    // restore old config
    709     configuration->SetDefaultPath(PathBackup);
     706    World::getInstance().getConfig()->SetDefaultPath(PathBackup);
    710707
    711708    // and save as mpqc input file
    712     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     709    FragmentName = prefix + FragmentNumber + ".conf";
    713710    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...");
    714     if ((intermediateResult = configuration->SaveMPQC(FragmentName, (*ListRunner))))
     711    if ((intermediateResult = World::getInstance().getConfig()->SaveMPQC(FragmentName.c_str(), (*ListRunner))))
    715712      DoLog(2) && (Log() << Verbose(2) << " done." << endl);
    716713    else
     
    768765
    769766  // 1. dissect the molecule into connected subgraphs
    770   if (!configuration->BG->ConstructBondGraph(mol)) {
    771     World::getInstance().destroyMolecule(mol);
    772     DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     767  if (configuration->BG != NULL) {
     768    if (!configuration->BG->ConstructBondGraph(mol)) {
     769      World::getInstance().destroyMolecule(mol);
     770      DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     771      return;
     772    }
     773  } else {
     774    DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
    773775    return;
    774776  }
Note: See TracChangeset for help on using the changeset viewer.