Changeset b8463f


Ignore:
Timestamp:
Feb 8, 2015, 11:23:22 AM (10 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:
5dcb3c
Parents:
2e7afe
git-author:
Frederik Heber <heber@…> (02/08/15 11:19:55)
git-committer:
Frederik Heber <heber@…> (02/08/15 11:23:22)
Message:

FIX: RotateAroundSelf converted rotation angle to rad in params.

  • this caused wrong angles written in StoreSession (in radian and not in degree as expected). This fixes ticket #251.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    r2e7afe rb8463f  
    6262  }
    6363
     64  // check whether Axis is valid
     65  if (params.Axis.get().IsZero()) {
     66    STATUS("Rotation Axis must not be zero.");
     67    return Action::failure;
     68  }
     69
     70  // convert from degrees to radian
     71  const double angle_radian = params.angle.get() * M_PI/180.;
     72
    6473  // go through all selected molecules
    6574  BOOST_FOREACH(molecule *mol, selectedMolecules) {
    66     // check whether Axis is valid
    67     if (params.Axis.get().IsZero()) {
    68       STATUS("Rotation Axis must not be zero.");
    69       return Action::failure;
    70     }
    71 
    72     // convert from degrees to radian
    73     params.angle.set(params.angle.get() * M_PI/180.);
    74 
    7575    // Creation Line that is the rotation axis
    7676    const Vector CenterOfGravity = mol->DetermineCenterOfGravity();
    77     LOG(0,  "Center of gravity is " << CenterOfGravity << ".");
     77    LOG(3, "DEBUG: Center of gravity is " << CenterOfGravity << ".");
    7878    Line RotationAxis(CenterOfGravity, params.Axis.get());
    79     LOG(0, "Rotate " << mol->getName() << " around self by " << params.angle.get() << " radian around axis " << RotationAxis << ".");
     79    LOG(2, "DEBUG: Rotate " << mol->getName() << " around self by " << angle_radian << " radian around axis " << RotationAxis << ".");
    8080
    8181    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    82       (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), params.angle.get()));
     82      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), angle_radian));
    8383    }
    84     LOG(0, "done.");
     84    LOG(2, "DEBUG: Rotatating of " << mol->getName() << " done.");
    8585  }
    8686
     
    9191  MoleculeRotateAroundSelfByAngleState *state = assert_cast<MoleculeRotateAroundSelfByAngleState*>(_state.get());
    9292
     93  // convert from degrees to radian
     94  const double angle_radian = -state->params.angle.get() * M_PI/180.;
     95
    9396  BOOST_FOREACH(molecule *mol, state->selectedMolecules) {
    9497    const Vector CenterOfGravity = mol->DetermineCenterOfGravity();
    9598    LOG(0,  "Center of gravity is " <<CenterOfGravity << ".");
    9699    Line RotationAxis(CenterOfGravity, state->params.Axis.get());
    97     LOG(0, "Rotate " << mol->getName() << " around self by " << -state->params.angle.get() << " radian around axis " << RotationAxis << ".");
     100    LOG(0, "Rotate " << mol->getName() << " around self by " << angle_radian << " radian around axis " << RotationAxis << ".");
    98101
    99     for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    100       (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->params.angle.get()));
    101     }
     102    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter)
     103      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), angle_radian));
    102104  }
    103105
     
    108110  MoleculeRotateAroundSelfByAngleState *state = assert_cast<MoleculeRotateAroundSelfByAngleState*>(_state.get());
    109111
     112  // convert from degrees to radian
     113  const double angle_radian = state->params.angle.get() * M_PI/180.;
     114
    110115  BOOST_FOREACH(molecule *mol, state->selectedMolecules) {
    111116    const Vector CenterOfGravity = mol->DetermineCenterOfGravity();
    112117    LOG(0,  "Center of gravity is " << CenterOfGravity << ".");
    113118    Line RotationAxis(CenterOfGravity, state->params.Axis.get());
    114     LOG(0, "Rotate " << mol->getName() << " around self by " << state->params.angle.get() << " radian around axis " << RotationAxis << ".");
     119    LOG(0, "Rotate " << mol->getName() << " around self by " << angle_radian << " radian around axis " << RotationAxis << ".");
    115120
    116     for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    117       (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->params.angle.get()));
    118     }
     121    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter)
     122      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), angle_radian));
    119123  }
    120124
Note: See TracChangeset for help on using the changeset viewer.