Changeset 6b8b57 for src


Ignore:
Timestamp:
Aug 29, 2008, 10:12:00 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, 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:
c1fc22
Parents:
ab3a0e
Message:

new function SaveMPQC(), bugfixes in ParseForParameter()

ParseForParameter(): first while loop tested dummy[0] although it might occur that dummy = NULL, this is now checked beforehand. On stepping through the values in the keyword line, the end marker (dummy) was shifted to the start of the next value, hence included the tabs. This lead to strings being stored with tabs at the end and on consecutive loading&storing in an MD run to an accumulation of tabs till MD step 152, where the config file could not be parsed anymore due to the size of the string value. This is fixed (the shifthing further is removed, as unnecessary).
SaveMPQC(): molecuilder now stores input files for MPQC directly, i.e. they don't have to be converted from the ESPACK format externally. This saves a lot of time during BOSSANOVA MD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    rab3a0e r6b8b57  
    652652    atom *neues = NULL;
    653653    while (status) {
     654      cout << "Currently parsing MD step " << repetition << "." << endl;
    654655      for (int i=0; i < config::MaxTypes; i++) {
    655656        sprintf(name,"Ion_Type%i",i+1);
     
    10601061};
    10611062
     1063/** Stores all elements in a MPQC input file.
     1064 * Note that this format cannot be parsed again.
     1065 * \param output open output *file stream to write to
     1066 * \param *mol pointer to molecule containing all atoms of the molecule
     1067 */
     1068bool config::SaveMPQC(ofstream *output, molecule *mol) const
     1069{
     1070  int ElementNo;
     1071  int AtomNo;
     1072  atom *Walker = NULL;
     1073  element *runner;
     1074  Vector center;
     1075
     1076  *output << "% Created by MoleCuilder" << endl;
     1077  *output << "mpqc: (" << endl;
     1078  *output << "\tsavestate = no" << endl;
     1079  *output << "\tdo_gradient = yes" << endl;
     1080  *output << "\tmole<CLHF>: (" << endl;
     1081  *output << "\t\tmolecule<Molecule>: (" << endl;
     1082  *output << "\t\t\tunit = " << (IsAngstroem ? "angstrom" : "bohr" ) << endl;
     1083  *output << "\t\t\t{ atoms geometry } = {" << endl;
     1084  mol->DetermineCenter(center);
     1085  // output of atoms
     1086  ElementNo = 0;
     1087  runner = mol->elemente->start;
     1088  while (runner->next != mol->elemente->end) { // go through every element
     1089    runner = runner->next;
     1090    if (mol->ElementsInMolecule[runner->Z]) { // if this element got atoms
     1091      ElementNo++;
     1092      AtomNo = 0;
     1093      Walker = mol->start;
     1094      while (Walker->next != mol->end) { // go through every atom of this element
     1095        Walker = Walker->next;
     1096        if (Walker->type == runner) { // if this atom fits to element
     1097          AtomNo++;
     1098          *output << "\t\t\t\t" << Walker->type->symbol << " [ " << Walker->x.x[0]-center.x[0] << "\t" << Walker->x.x[1]-center.x[1] << "\t" << Walker->x.x[2]-center.x[2] << " ]" << endl;
     1099        }
     1100      }
     1101    }
     1102  }
     1103  *output << "\t\t\t}" << endl;
     1104  *output << "\t\t)" << endl;
     1105  *output << "\t\tbasis<GaussianBasisSet>: (" << endl;
     1106  *output << "\t\t\tname = \"STO-3G\"" << endl;
     1107  *output << "\t\t\tmolecule = $:mpqc:mole:molecule" << endl;
     1108  *output << "\t\t)" << endl;
     1109  *output << "\t)" << endl;
     1110  *output << ")" << endl;
     1111  return true;
     1112};
     1113
    10621114/** Reads parameter from a parsed file.
    10631115 * The file is either parsed for a certain keyword or if null is given for
     
    11031155          Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
    11041156          //Error(InitReading, name);
    1105           fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     1157          //fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
    11061158          exit(255);
    11071159        } else {
     
    11141166      }
    11151167      line++;
    1116     } while (((dummy1[0] == '#') || (dummy1[0] == '\n')) && dummy != NULL); // skip commentary and empty lines
     1168    } while (dummy != NULL && dummy1 != NULL && ((dummy1[0] == '#') || (dummy1[0] == '\0'))); // skip commentary and empty lines
    11171169   
    11181170    // C++ getline removes newline at end, thus re-add
     
    11221174      dummy1[i+1] = '\0';
    11231175    }
    1124     //fprintf(stderr,"line ends at %i, newline at %i\n", strlen(dummy1), strchr(dummy1,'\n')-free_dummy);
     1176    //fprintf(stderr,"line %i ends at %i, newline at %i\n", line, strlen(dummy1), strchr(dummy1,'\n')-free_dummy);
     1177
    11251178    if (dummy1 == NULL) {
    11261179      if (verbose) fprintf(stderr,"Error reading line %i\n",line);
    11271180    } else {
    1128       //fprintf(stderr,"Reading next line %i: %s\n", line, dummy1);
     1181      //fprintf(stderr,"Now parsing the line %i: %s\n", line, dummy1);
    11291182    }
    11301183    // Seek for possible end of keyword on line if given ...
     
    12041257              if (dummy == NULL)
    12051258                dummy = strchr(dummy1, ' ');  // if not found seek for space
    1206               while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary
    1207                 dummy++;
    1208 /*              while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary
    1209                 dummy++;*/
    12101259              if (dummy == NULL) { // if still zero returned ...
    12111260                dummy = strchr(dummy1, '\n');  // ... at line end then
Note: See TracChangeset for help on using the changeset viewer.