Changeset 1024cb for src/config.cpp


Ignore:
Timestamp:
May 31, 2010, 5:32:27 PM (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:
e08c46
Parents:
42af9e (diff), a7b761b (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.
git-author:
Frederik Heber <heber@…> (05/31/10 17:29:30)
git-committer:
Frederik Heber <heber@…> (05/31/10 17:32:27)
Message:

Merge commit 'jupiter/MoleculeStartEndSwitch' into CommandLineActionMapping

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/unittests/AnalysisCorrelationToPointUnitTest.cpp
molecuilder/src/unittests/listofbondsunittest.cpp

Integration of MoleculeStartEndSwitch had the following consequences:

  • no more AtomCount -> getAtomCount()
  • no more start/end -> begin(), end() and iterator
  • no more decent ordering in atomic ids (hence, Simple_configuration/8 and Domain/5, Domain/6 now check by comparing sorted xyz, not confs)

There is still a huge problem with bonds. One test runs into an endless loop.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    r42af9e r1024cb  
    15481548  int AtomNo = -1;
    15491549  int MolNo = 0;
    1550   atom *Walker = NULL;
    15511550  FILE *f = NULL;
    15521551
     
    15611560  fprintf(f, "# Created by MoleCuilder\n");
    15621561
    1563   for (MoleculeList::const_iterator Runner = MolList->ListOfMolecules.begin(); Runner != MolList->ListOfMolecules.end(); Runner++) {
    1564     Walker = (*Runner)->start;
     1562  for (MoleculeList::const_iterator MolRunner = MolList->ListOfMolecules.begin(); MolRunner != MolList->ListOfMolecules.end(); MolRunner++) {
    15651563    int *elementNo = new int[MAX_ELEMENTS];
    15661564    for (int i=0;i<MAX_ELEMENTS;i++)
    15671565      elementNo[i] = 0;
    15681566    AtomNo = 0;
    1569     while (Walker->next != (*Runner)->end) {
    1570       Walker = Walker->next;
    1571       sprintf(name, "%2s%2d",Walker->type->symbol, elementNo[Walker->type->Z]);
    1572       elementNo[Walker->type->Z] = (elementNo[Walker->type->Z]+1) % 100;   // confine to two digits
     1567    for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
     1568      sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
     1569      elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
    15731570      fprintf(f,
    15741571             "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
    1575              Walker->nr,                /* atom serial number */
     1572             (*iter)->nr,                /* atom serial number */
    15761573             name,         /* atom name */
    1577              (*Runner)->name,      /* residue name */
     1574             (*MolRunner)->name,      /* residue name */
    15781575             'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    15791576             MolNo,         /* residue sequence number */
    1580              Walker->node->at(0),                 /* position X in Angstroem */
    1581              Walker->node->at(1),                 /* position Y in Angstroem */
    1582              Walker->node->at(2),                 /* position Z in Angstroem */
    1583              (double)Walker->type->Valence,         /* occupancy */
    1584              (double)Walker->type->NoValenceOrbitals,          /* temperature factor */
     1577             (*iter)->node->at(0),                 /* position X in Angstroem */
     1578             (*iter)->node->at(1),                 /* position Y in Angstroem */
     1579             (*iter)->node->at(2),                 /* position Z in Angstroem */
     1580             (double)(*iter)->type->Valence,         /* occupancy */
     1581             (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
    15851582             "0",            /* segment identifier */
    1586              Walker->type->symbol,    /* element symbol */
     1583             (*iter)->type->symbol,    /* element symbol */
    15871584             "0");           /* charge */
    15881585      AtomNo++;
     
    16041601{
    16051602  int AtomNo = -1;
    1606   atom *Walker = NULL;
    16071603  FILE *f = NULL;
    16081604
     
    16211617  fprintf(f, "# Created by MoleCuilder\n");
    16221618
    1623   Walker = mol->start;
    16241619  AtomNo = 0;
    1625   while (Walker->next != mol->end) {
    1626     Walker = Walker->next;
    1627     sprintf(name, "%2s%2d",Walker->type->symbol, elementNo[Walker->type->Z]);
    1628     elementNo[Walker->type->Z] = (elementNo[Walker->type->Z]+1) % 100;   // confine to two digits
     1620  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     1621    sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
     1622    elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
    16291623    fprintf(f,
    16301624           "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
    1631            Walker->nr,                /* atom serial number */
     1625           (*iter)->nr,                /* atom serial number */
    16321626           name,         /* atom name */
    16331627           mol->name,      /* residue name */
    16341628           'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    16351629           0,         /* residue sequence number */
    1636            Walker->node->at(0),                 /* position X in Angstroem */
    1637            Walker->node->at(1),                 /* position Y in Angstroem */
    1638            Walker->node->at(2),                 /* position Z in Angstroem */
    1639            (double)Walker->type->Valence,         /* occupancy */
    1640            (double)Walker->type->NoValenceOrbitals,          /* temperature factor */
     1630           (*iter)->node->at(0),                 /* position X in Angstroem */
     1631           (*iter)->node->at(1),                 /* position Y in Angstroem */
     1632           (*iter)->node->at(2),                 /* position Z in Angstroem */
     1633           (double)(*iter)->type->Valence,         /* occupancy */
     1634           (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
    16411635           "0",            /* segment identifier */
    1642            Walker->type->symbol,    /* element symbol */
     1636           (*iter)->type->symbol,    /* element symbol */
    16431637           "0");           /* charge */
    16441638    AtomNo++;
     
    16581652bool config::SaveTREMOLO(const char * const filename, const molecule * const mol) const
    16591653{
    1660   atom *Walker = NULL;
    16611654  ofstream *output = NULL;
    16621655  stringstream * const fname = new stringstream;
     
    16711664
    16721665  // scan maximum number of neighbours
    1673   Walker = mol->start;
    16741666  int MaxNeighbours = 0;
    1675   while (Walker->next != mol->end) {
    1676     Walker = Walker->next;
    1677     const int count = Walker->ListOfBonds.size();
     1667  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     1668    const int count = (*iter)->ListOfBonds.size();
    16781669    if (MaxNeighbours < count)
    16791670      MaxNeighbours = count;
    16801671  }
    1681   *output << "# ATOMDATA Id name resName resSeq x=3 charge type neighbors=" << MaxNeighbours << endl;
    1682 
    1683   Walker = mol->start;
    1684   while (Walker->next != mol->end) {
    1685     Walker = Walker->next;
    1686     *output << Walker->nr << "\t";
    1687     *output << Walker->getName() << "\t";
     1672  *output << "# ATOMDATA Id name resName resSeq x=3 Charge type neighbors=" << MaxNeighbours << endl;
     1673
     1674  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     1675    *output << (*iter)->nr << "\t";
     1676    *output << (*iter)->getName() << "\t";
    16881677    *output << mol->name << "\t";
    16891678    *output << 0 << "\t";
    1690     *output << Walker->node->at(0) << "\t" << Walker->node->at(1) << "\t" << Walker->node->at(2) << "\t";
    1691     *output << static_cast<double>(Walker->type->Valence) << "\t";
    1692     *output << Walker->type->symbol << "\t";
    1693     for (BondList::iterator runner = Walker->ListOfBonds.begin(); runner != Walker->ListOfBonds.end(); runner++)
    1694       *output << (*runner)->GetOtherAtom(Walker)->nr << "\t";
    1695     for(int i=Walker->ListOfBonds.size(); i < MaxNeighbours; i++)
     1679    *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
     1680    *output << static_cast<double>((*iter)->type->Valence) << "\t";
     1681    *output << (*iter)->type->symbol << "\t";
     1682    for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
     1683      *output << (*runner)->GetOtherAtom(*iter)->nr << "\t";
     1684    for(int i=(*iter)->ListOfBonds.size(); i < MaxNeighbours; i++)
    16961685      *output << "-\t";
    16971686    *output << endl;
     
    17141703{
    17151704  Info FunctionInfo(__func__);
    1716   atom *Walker = NULL;
    17171705  ofstream *output = NULL;
    17181706  stringstream * const fname = new stringstream;
     
    17291717  int MaxNeighbours = 0;
    17301718  for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) {
    1731     Walker = (*MolWalker)->start;
    1732     while (Walker->next != (*MolWalker)->end) {
    1733       Walker = Walker->next;
    1734       const int count = Walker->ListOfBonds.size();
     1719    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     1720      const int count = (*iter)->ListOfBonds.size();
    17351721      if (MaxNeighbours < count)
    17361722        MaxNeighbours = count;
    17371723    }
    17381724  }
    1739   *output << "# ATOMDATA Id name resName resSeq x=3 charge type neighbors=" << MaxNeighbours << endl;
     1725  *output << "# ATOMDATA Id name resName resSeq x=3 Charge type neighbors=" << MaxNeighbours << endl;
    17401726
    17411727  // create global to local id map
     
    17451731    int AtomNo = 1;
    17461732    for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) {
    1747       atom *Walker = (*MolWalker)->start;
    1748       while (Walker->next != (*MolWalker)->end) {
    1749         Walker = Walker->next;
    1750         LocalNotoGlobalNoMap.insert( pair<int,int>(Walker->getId(), AtomNo++) );
     1733      for(molecule::iterator AtomRunner = (*MolWalker)->begin(); AtomRunner != (*MolWalker)->end(); ++AtomRunner) {
     1734        LocalNotoGlobalNoMap.insert( pair<int,int>((*AtomRunner)->getId(), AtomNo++) );
    17511735      }
    17521736      MolCounter++;
     
    17601744    int AtomNo = 0;
    17611745    for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) {
    1762       Walker = (*MolWalker)->start;
    1763       while (Walker->next != (*MolWalker)->end) {
    1764         Walker = Walker->next;
    1765         *output << LocalNotoGlobalNoMap[ Walker->getId() ] << "\t";
    1766         *output << Walker->getName() << "\t";
     1746      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     1747        *output << LocalNotoGlobalNoMap[ (*iter)->getId() ] << "\t";
     1748        *output << (*iter)->getName() << "\t";
    17671749        *output << (*MolWalker)->name << "\t";
    17681750        *output << MolCounter+1 << "\t";
    1769         *output << Walker->node->at(0) << "\t" << Walker->node->at(1) << "\t" << Walker->node->at(2) << "\t";
    1770         *output << (double)Walker->type->Valence << "\t";
    1771         *output << Walker->type->symbol << "\t";
    1772         for (BondList::iterator runner = Walker->ListOfBonds.begin(); runner != Walker->ListOfBonds.end(); runner++)
    1773           *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom(Walker)->getId() ] << "\t";
    1774         for(int i=Walker->ListOfBonds.size(); i < MaxNeighbours; i++)
     1751        *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
     1752        *output << (double)(*iter)->type->Valence << "\t";
     1753        *output << (*iter)->type->symbol << "\t";
     1754        for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
     1755          *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t";
     1756        for(int i=(*iter)->ListOfBonds.size(); i < MaxNeighbours; i++)
    17751757          *output << "-\t";
    17761758        *output << endl;
     
    18131795  if (output == NULL)
    18141796    strcpy(filename,"main_pcp_linux");
    1815   Log() << Verbose(0) << "Saving as pdb input ";
     1797  Log() << Verbose(0) << "Saving as pdb input ... " << endl;
    18161798  if (SavePDB(filename, molecules))
    1817     Log() << Verbose(0) << "done." << endl;
     1799    Log() << Verbose(0) << "\t... done." << endl;
    18181800  else
    1819     Log() << Verbose(0) << "failed." << endl;
     1801    Log() << Verbose(0) << "\t... failed." << endl;
    18201802
    18211803  // then save as tremolo data file
     
    18241806  if (output == NULL)
    18251807    strcpy(filename,"main_pcp_linux");
    1826   Log() << Verbose(0) << "Saving as tremolo data input ";
     1808  Log() << Verbose(0) << "Saving as tremolo data input ... " << endl;
    18271809  if (SaveTREMOLO(filename, molecules))
    1828     Log() << Verbose(0) << "done." << endl;
     1810    Log() << Verbose(0) << "\t... done." << endl;
    18291811  else
    1830     Log() << Verbose(0) << "failed." << endl;
     1812    Log() << Verbose(0) << "\t... failed." << endl;
    18311813
    18321814  // translate each to its center and merge all molecules in MoleculeListClass into this molecule
     
    18641846  output.close();
    18651847  output.clear();
    1866   Log() << Verbose(0) << "Saving of config file ";
     1848  Log() << Verbose(0) << "Saving of config file ... " << endl;
    18671849  if (Save(filename, periode, mol))
    1868     Log() << Verbose(0) << "successful." << endl;
     1850    Log() << Verbose(0) << "\t... successful." << endl;
    18691851  else
    1870     Log() << Verbose(0) << "failed." << endl;
     1852    Log() << Verbose(0) << "\t... failed." << endl;
    18711853
    18721854  // and save to xyz file
     
    18811863    output.open(filename, ios::trunc);
    18821864  }
    1883   Log() << Verbose(0) << "Saving of XYZ file ";
     1865  Log() << Verbose(0) << "Saving of XYZ file ... " << endl;
    18841866  if (mol->MDSteps <= 1) {
    18851867    if (mol->OutputXYZ(&output))
    1886       Log() << Verbose(0) << "successful." << endl;
     1868      Log() << Verbose(0) << "\t... successful." << endl;
    18871869    else
    1888       Log() << Verbose(0) << "failed." << endl;
     1870      Log() << Verbose(0) << "\t... failed." << endl;
    18891871  } else {
    18901872    if (mol->OutputTrajectoriesXYZ(&output))
    1891       Log() << Verbose(0) << "successful." << endl;
     1873      Log() << Verbose(0) << "\t... successful." << endl;
    18921874    else
    1893       Log() << Verbose(0) << "failed." << endl;
     1875      Log() << Verbose(0) << "\t... failed." << endl;
    18941876  }
    18951877  output.close();
     
    19011883  if (output == NULL)
    19021884    strcpy(filename,"main_pcp_linux");
    1903   Log() << Verbose(0) << "Saving as mpqc input ";
     1885  Log() << Verbose(0) << "Saving as mpqc input .. " << endl;
    19041886  if (SaveMPQC(filename, mol))
    1905     Log() << Verbose(0) << "done." << endl;
     1887    Log() << Verbose(0) << "\t... done." << endl;
    19061888  else
    1907     Log() << Verbose(0) << "failed." << endl;
     1889    Log() << Verbose(0) << "\t... failed." << endl;
    19081890
    19091891  if (!strcmp(configpath, GetDefaultPath())) {
Note: See TracChangeset for help on using the changeset viewer.