Changeset 8de375 for src/molecule.cpp


Ignore:
Timestamp:
May 19, 2010, 6:46:52 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, 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:
0fb9f6
Parents:
eff648 (diff), bab12a (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/19/10 18:45:23)
git-committer:
Frederik Heber <heber@…> (05/19/10 18:46:52)
Message:

Merge branch 'StructureRefactoring' into CommandLineActionMapping

Conflicts:

molecuilder/src/atom_particleinfo.cpp
molecuilder/src/builder.cpp

The following conflicts were solved:

  • in atom_particleinfo constructor the bugfix could not be merged automatically
  • in builder.cpp at the end of main() cleanup and memory:getstate() were still present.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.cpp

    reff648 r8de375  
    135135      if (pointer->type->Z != 1)
    136136        NoNonHydrogen++;
    137       if (pointer->Name == NULL) {
    138         Free(&pointer->Name);
    139         pointer->Name = Malloc<char>(6, "molecule::AddAtom: *pointer->Name");
    140         sprintf(pointer->Name, "%2s%02d", pointer->type->symbol, pointer->nr+1);
     137      if(pointer->getName() == "Unknown"){
     138        stringstream sstr;
     139        sstr << pointer->type->symbol << pointer->nr+1;
     140        pointer->setName(sstr.str());
    141141      }
    142142    }
     
    157157  if (pointer != NULL) {
    158158    atom *walker = pointer->clone();
    159     walker->Name = Malloc<char>(strlen(pointer->Name) + 1, "atom::atom: *Name");
    160     strcpy (walker->Name, pointer->Name);
     159    stringstream sstr;
     160    sstr << pointer->getName();
     161    walker->setName(sstr.str());
    161162    walker->nr = last_atom++;  // increase number within molecule
    162163    add(walker, end);
     
    252253  BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
    253254  if (BondRescale == -1) {
    254     DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl);
     255    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
    255256    return false;
    256257    BondRescale = bondlength;
     
    275276      InBondvector *= BondRescale;   // rescale the distance vector to Hydrogen bond length
    276277      FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ...
    277       FirstOtherAtom->x = InBondvector;  // ... and add distance vector to replacement atom
     278      FirstOtherAtom->x += InBondvector;  // ... and add distance vector to replacement atom
    278279      AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
    279280//      Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: ";
     
    295296            SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
    296297          } else {
    297             DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->Name);
     298            DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName());
    298299          }
    299300        }
     
    339340      bondangle = TopOrigin->type->HBondAngle[1];
    340341      if (bondangle == -1) {
    341         DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl);
     342        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
    342343        return false;
    343344        bondangle = 0;
     
    616617    add(Binder, last);
    617618  } else {
    618     DoeLog(1) && (eLog()<< Verbose(1) << "Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl);
     619    DoeLog(1) && (eLog()<< Verbose(1) << "Could not add bond between " << atom1->getName() << " and " << atom2->getName() << " as one or both are not present in the molecule." << endl);
    619620  }
    620621  return Binder;
     
    695696    AtomCount--;
    696697  } else
    697     DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
     698    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->getName() << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
    698699  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    699700    ElementCount--;
     
    713714    ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element
    714715  else
    715     DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
     716    DoeLog(1) && (eLog()<< Verbose(1) << "Atom " << pointer->getName() << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl);
    716717  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    717718    ElementCount--;
     
    915916        if (Walker->type->Z != 1) // count non-hydrogen atoms whilst at it
    916917          NoNonHydrogen++;
    917         Free(&Walker->Name);
    918         Walker->Name = Malloc<char>(6, "molecule::CountAtoms: *walker->Name");
    919         sprintf(Walker->Name, "%2s%02d", Walker->type->symbol, Walker->nr+1);
    920         DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker->Name << "." << endl);
     918        stringstream sstr;
     919        sstr << Walker->type->symbol << Walker->nr+1;
     920        Walker->setName(sstr.str());
     921        DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker->getName() << "." << endl);
    921922        i++;
    922923      }
Note: See TracChangeset for help on using the changeset viewer.