Changeset 9df680 for src


Ignore:
Timestamp:
Feb 3, 2011, 9:51:18 AM (14 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:
ea430a
Parents:
d6f886
git-author:
Frederik Heber <heber@…> (01/15/11 15:04:18)
git-committer:
Frederik Heber <heber@…> (02/03/11 09:51:18)
Message:

FIX: FillVoidWithMolecule() now centers filler molecule at its center of gravity.

  • this is the only sensible option if we later rotate the molecule.
  • atom::clone() reduced a lot, as copy constructors contains it all.
  • FillVoidWithMolecule() - filler is now selected to reside entirely within the domain. Otherwise, we seg'fault on save on exit, as one of the father atoms for all copied atoms is missing and hence, we cannot look at its additional...Data for various parsers.
  • new function molecule::removeAtomsInMolecule() which destroys all the molecule's atoms.

TESTFIXES:

  • Filling/3: filled water box has changed due to different center of water molecules.
Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/atom.cpp

    rd6f886 r9df680  
    4949    ParticleInfo(pointer),
    5050    father(pointer),
    51     sort(&nr)
     51    sort(&nr),
     52    mol(0)
    5253{
    5354  setType(pointer->getType());  // copy element of atom
     
    5556  AtomicVelocity = pointer->AtomicVelocity; // copy velocity
    5657  FixedIon = pointer->FixedIon;
    57   mol = 0;
    5858};
    5959
    6060atom *atom::clone(){
    6161  atom *res = new atom(this);
    62   res->father = this;
    63   res->sort = &res->nr;
    64   res->setType(getType());
    65   res->setPosition(this->getPosition());
    66   res->AtomicVelocity = this->AtomicVelocity;
    67   res->FixedIon = FixedIon;
    68   res->mol = 0;
    6962  World::getInstance().registerAtom(res);
    7063  return res;
  • src/boundary.cpp

    rd6f886 r9df680  
    852852        if (DoRandomRotation)
    853853          for (int i=0;i<NDIM;i++)
    854             phi[i] = rand()/(RAND_MAX/(2.*M_PI));
     854            phi[i] = (rand()/RAND_MAX)*(2.*M_PI);
    855855
    856856        for(molecule::const_iterator iter = filler->begin(); iter !=filler->end();++iter){
     
    961961 * @param Filling molecule whose atoms to check, removed if eventually left
    962962 *        empty.
    963  */
    964 void RemoveAtomsOutsideDomain(molecule *&Filling)
    965 {
     963 * @return true - atoms had to be removed, false - no atoms have been removed
     964 */
     965bool RemoveAtomsOutsideDomain(molecule *&Filling)
     966{
     967  bool status = false;
    966968  Box &Domain = World::getInstance().getDomain();
    967969  // check if all is still inside domain
     
    969971    // check whether each atom is inside box
    970972    if (!Domain.isInside((*miter)->getPosition())) {
     973      status = true;
    971974      atom *Walker = *miter;
    972975      ++miter;
     
    980983    World::getInstance().destroyMolecule(Filling);
    981984  }
     985  return status;
    982986}
    983987
     
    10691073    }
    10701074
    1071   // Center filler at origin
    1072   filler->CenterEdge(&Inserter);
     1075  // Center filler at its center of gravity
     1076  Vector *gravity = filler->DetermineCenterOfGravity();
     1077  filler->CenterAtVector(gravity);
     1078  delete gravity;
    10731079  //const int FillerCount = filler->getAtomCount();
    10741080  DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);
     
    11241130          DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is void point." << endl);
    11251131          // fill!
    1126           if (firstInsertion) { // use filler as first molecule
     1132          Filling = filler->CopyMolecule();
     1133          RandomizeMoleculePositions(Filling, RandomAtomDisplacement, Rotations);
     1134          // translation
     1135          Filling->Translate(&Inserter);
     1136          // remove out-of-bounds atoms
     1137          const bool status = RemoveAtomsOutsideDomain(Filling);
     1138          if ((firstInsertion) && (!status)) { // no atom has been removed
     1139            // remove copied atoms and molecule again
     1140            Filling->removeAtomsinMolecule();
     1141            World::getInstance().destroyMolecule(Filling);
     1142            // and mark is final filler position
    11271143            Filling = filler;
    11281144            firstInsertion = false;
    11291145            firstInserter = Inserter;
    1130           } else { // copy from filler molecule
    1131             Filling = filler->CopyMolecule();
    1132             RandomizeMoleculePositions(Filling, RandomAtomDisplacement, Rotations);
    1133             // translation
    1134             Filling->Translate(&Inserter);
    1135             // remove out-of-bounds atoms
    1136             RemoveAtomsOutsideDomain(Filling);
     1146          } else {
    11371147            // TODO: Remove when World has no MoleculeListClass anymore
    11381148            MolList->insert(Filling);
    11391149          }
    11401150        } else {
    1141           DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance." << endl);
     1151         DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance." << endl);
    11421152          continue;
    11431153        }
  • src/molecule.cpp

    rd6f886 r9df680  
    678678
    679679
     680/** Destroys all atoms inside this molecule.
     681 */
     682void molecule::removeAtomsinMolecule()
     683{
     684  // remove each atom from world
     685  for(molecule::const_iterator AtomRunner = begin(); !empty(); AtomRunner = begin())
     686    World::getInstance().destroyAtom(*AtomRunner);
     687};
     688
     689
    680690/**
    681691 * Copies all atoms of a molecule which are within the defined parallelepiped.
  • src/molecule.hpp

    rd6f886 r9df680  
    171171  bool UnlinkAtom(atom *pointer);
    172172  bool CleanupMolecule();
     173  void removeAtomsinMolecule();
    173174
    174175  /// Add/remove atoms to/from molecule.
Note: See TracChangeset for help on using the changeset viewer.