Changeset deac6c for src/molecules.cpp


Ignore:
Timestamp:
Sep 6, 2008, 4:21:31 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, 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:
bd3e55
Parents:
a6b7fb
Message:

BUGFIX: molecule::...Scale(),Translate(),Mirror() and Align() did only change vectors of atom struct, not in the Trajectories structure. RemoveAtom did not remove trajectories entry

This is fixed.
Also, fixed that RemoveAtom() did not remove the entry in Trajectories structure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecules.cpp

    ra6b7fb rdeac6c  
    644644  if (!status)
    645645    *out << "WARNING: molecule is bigger than defined box!" << endl;
    646   else {  // else center in box
    647     ptr = start;
    648     while (ptr->next != end) {
    649       ptr = ptr->next;
    650       for (int i=NDIM;i--;)
    651         ptr->x.x[i] += -(max->x[i] + min->x[i])/2. + BoxLengths->x[i]/2.; // first term centers molecule at (0,0,0), second shifts to center of new box
    652     }
     646  else {  // else center in box
     647    max->AddVector(min);
     648    max->Scale(-1.);
     649    max->AddVector(BoxLengths);
     650    max->Scale(0.5);
     651    Translate(max);
    653652  }
    654653
     
    687686//    min->Output(out);
    688687//    *out << endl;
    689    
    690     for (int i=NDIM;i--;) {
    691       min->x[i] *= -1.;
    692       max->x[i] += min->x[i];
    693     }
     688    min->Scale(-1.);
     689    max->AddVector(min);
    694690    Translate(min);
    695691  }
     
    772768    a->Scale(-1./Num); // divide through total mass (and sign for direction)
    773769  }
    774   *out << Verbose(1) << "Resulting center of gravity: ";
    775   a->Output(out);
    776   *out << endl;
     770//  *out << Verbose(1) << "Resulting center of gravity: ";
     771//  a->Output(out);
     772//  *out << endl;
    777773  return a;
    778774};
     
    802798  while (ptr->next != end) {
    803799    ptr = ptr->next;
     800    for (int j=0;j<MDSteps;j++)
     801      Trajectories[ptr].R.at(j).Scale(factor);
    804802    ptr->x.Scale(factor);
    805803  }     
     
    815813  while (ptr->next != end) {
    816814    ptr = ptr->next;
     815    for (int j=0;j<MDSteps;j++)
     816      Trajectories[ptr].R.at(j).Translate(trans);
    817817    ptr->x.Translate(trans);
    818818  }     
     
    828828  while (ptr->next != end) {
    829829    ptr = ptr->next;
     830    for (int j=0;j<MDSteps;j++)
     831      Trajectories[ptr].R.at(j).Mirror(n);
    830832    ptr->x.Mirror(n);
    831833  }     
     
    961963          while (ptr->next != end) {
    962964            ptr = ptr->next;
     965            for (int j=0;j<MDSteps;j++)
     966              Trajectories[ptr].R.at(j).MatrixMultiplication(evec->data);
    963967            ptr->x.MatrixMultiplication(evec->data);
    964968          }
     
    11421146    ptr->x.x[0] =  cos(alpha) * tmp + sin(alpha) * ptr->x.x[2];
    11431147    ptr->x.x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x.x[2];
     1148    for (int j=0;j<MDSteps;j++) {
     1149      tmp = Trajectories[ptr].R.at(j).x[0];
     1150      Trajectories[ptr].R.at(j).x[0] =  cos(alpha) * tmp + sin(alpha) * Trajectories[ptr].R.at(j).x[2];
     1151      Trajectories[ptr].R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * Trajectories[ptr].R.at(j).x[2];
     1152    }
    11441153  }     
    11451154  // rotate n vector
     
    11601169    ptr->x.x[1] =  cos(alpha) * tmp + sin(alpha) * ptr->x.x[2];
    11611170    ptr->x.x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x.x[2];
     1171    for (int j=0;j<MDSteps;j++) {
     1172      tmp = Trajectories[ptr].R.at(j).x[1];
     1173      Trajectories[ptr].R.at(j).x[1] =  cos(alpha) * tmp + sin(alpha) * Trajectories[ptr].R.at(j).x[2];
     1174      Trajectories[ptr].R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * Trajectories[ptr].R.at(j).x[2];
     1175    }
    11621176  }     
    11631177  // rotate n vector (for consistency check)
     
    11841198  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    11851199    ElementCount--;
     1200  Trajectories.erase(pointer);
    11861201  return remove(pointer, start, end);
    11871202};
Note: See TracChangeset for help on using the changeset viewer.