Changes in / [8d6d31:1bab08]


Ignore:
Files:
1 added
18 deleted
7 edited

Legend:

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

    r8d6d31 r1bab08  
    5252{}
    5353
    54 void MoleculeRotateAroundOriginByAngle(const Vector &Axis, double angle) {
     54void MoleculeRotateAroundOriginByAngle(double angle) {
    5555  ValueStorage::getInstance().setCurrentValue(MoleculeRotateAroundOriginByAngleAction::NAME, angle);
    56   ValueStorage::getInstance().setCurrentValue("position", Axis);
    5756  ActionRegistry::getInstance().getActionByName(MoleculeRotateAroundOriginByAngleAction::NAME)->call(Action::NonInteractive);
    5857};
     
    8382  alpha *= M_PI/180.;
    8483
    85   // Creation Line that is the rotation axis
    86   Line RotationAxis(Vector(0.,0.,0.), Axis);
    87 
    8884  DoLog(0) && (Log() << Verbose(0) << "Rotate around origin by " << alpha << " radian, axis from origin to " << Axis << "." << endl);
    8985  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
    9086    mol = iter->second;
    9187
     88    // Creation Line that is the rotation axis
     89    Line RotationAxis(Vector(0.,0.,0.), Axis);
     90
    9291    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    9392      *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
    9493    }
     94    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    9595  }
    96   DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    9796  return Action::state_ptr(new MoleculeRotateAroundOriginByAngleState(World::getInstance().getSelectedMolecules(), Axis, alpha));
    9897}
  • src/Actions/MoleculeAction/RotateAroundOriginByAngleAction.hpp

    r8d6d31 r1bab08  
    1717
    1818class MoleculeRotateAroundOriginByAngleAction : public Action {
    19   friend void MoleculeRotateAroundOriginByAngle(const Vector &Axis, double angle);
     19  friend void MoleculeRotateAroundOriginByAngle(double angle);
    2020
    2121public:
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    r8d6d31 r1bab08  
    3434class MoleculeRotateAroundSelfByAngleState : public ActionState {
    3535public:
    36     MoleculeRotateAroundSelfByAngleState(molecule * const _mol, const Vector &_Axis, const double _alpha) :
     36    MoleculeRotateAroundSelfByAngleState(molecule * const _mol, const double _alpha) :
    3737      mol(_mol),
    38       Axis(_Axis),
    3938      alpha(_alpha)
    4039    {}
    4140    molecule* const mol;
    42     Vector Axis;
    4341    double alpha;
    4442};
     
    5351{}
    5452
    55 void MoleculeRotateAroundSelfByAngle(const Vector &Axis, const double angle) {
     53void MoleculeRotateAroundSelfByAngle(double angle) {
    5654  ValueStorage::getInstance().setCurrentValue(MoleculeRotateAroundSelfByAngleAction::NAME, angle);
    57   ValueStorage::getInstance().setCurrentValue("position", Axis);
    5855  ActionRegistry::getInstance().getActionByName(MoleculeRotateAroundSelfByAngleAction::NAME)->call(Action::NonInteractive);
    5956};
     
    6360
    6461  dialog->queryDouble(NAME, MapOfActions::getInstance().getDescription(NAME));
    65   dialog->queryVector("position", false, MapOfActions::getInstance().getDescription(NAME));
    6662
    6763  return dialog;
     
    7167  molecule *mol = NULL;
    7268  double alpha = 0.;
    73   Vector Axis;
    7469
    75   // obtain angle and axis around which rotate
     70  // obtain angle around which rotate
    7671  ValueStorage::getInstance().queryCurrentValue(NAME, alpha);
    77   ValueStorage::getInstance().queryCurrentValue("position", Axis);
    7872
    7973  // check whether a single atom and molecule is selected
    80   if (World::getInstance().getSelectedMolecules().size() != 1)
    81     return Action::failure;
    82   mol = World::getInstance().beginMoleculeSelection()->second;
    83 
    84   // check whether Axis is valid
    85   if (Axis.IsZero())
     74  if ((World::getInstance().getSelectedAtoms().size() != 1) || (World::getInstance().getSelectedMolecules().size() != 1))
    8675    return Action::failure;
    8776
    88   // convert from degrees to radian
    89   alpha *= M_PI/180.;
     77  DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << alpha << "." << endl);
     78  mol = World::getInstance().beginMoleculeSelection()->second;
    9079
    9180  // Creation Line that is the rotation axis
    9281  Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
    93   Line RotationAxis(*CenterOfGravity, Axis);
     82  Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x);
    9483  delete(CenterOfGravity);
    95   DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << alpha << " along " << RotationAxis << "." << endl);
    9684
    9785  for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     
    10088  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    10189
    102   return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, Axis, alpha));
     90  return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, alpha));
    10391}
    10492
     
    10795
    10896  Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity();
    109   Line RotationAxis(*CenterOfGravity, state->Axis);
     97  Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x);
    11098  delete(CenterOfGravity);
    11199
     
    121109
    122110  Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity();
    123   Line RotationAxis(*CenterOfGravity, state->Axis);
     111  Line RotationAxis(*CenterOfGravity, (World::getInstance().beginAtomSelection()->second)->x);
    124112  delete(CenterOfGravity);
    125113
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp

    r8d6d31 r1bab08  
    1717
    1818class MoleculeRotateAroundSelfByAngleAction : public Action {
    19   friend void MoleculeRotateAroundSelfByAngle(const Vector &Axis, const double angle);
     19  friend void MoleculeRotateAroundSelfByAngle(double angle);
    2020
    2121public:
  • src/LinearAlgebra/Line.cpp

    r8d6d31 r1bab08  
    241241  return Line(x1,x1-x2);
    242242}
    243 
    244 ostream& operator<<(ostream& ost, const Line& m)
    245 {
    246   const Vector origin = m.getOrigin();
    247   const Vector direction = m.getDirection();
    248   ost << "(";
    249   for (int i=0;i<NDIM;i++) {
    250     ost << origin[i];
    251     if (i != 2)
    252       ost << ",";
    253   }
    254   ost << ") -> (";
    255   for (int i=0;i<NDIM;i++) {
    256     ost << direction[i];
    257     if (i != 2)
    258       ost << ",";
    259   }
    260   ost << ")";
    261   return ost;
    262 };
    263 
  • src/LinearAlgebra/Line.hpp

    r8d6d31 r1bab08  
    1111#include "LinearAlgebra/Space.hpp"
    1212
    13 #include <iosfwd>
    1413#include <memory>
    1514#include <vector>
     
    4645};
    4746
    48 std::ostream & operator << (std::ostream& ost, const Line &m);
    49 
    5047/**
    5148 * Named constructor to make a line through two points
  • tests/regression/testsuite-molecules.at

    r8d6d31 r1bab08  
    6161
    6262# 8. Rotate to PAS
    63 AT_SETUP([Molecules - Rotate to PAS])
     63AT_SETUP([Molecules - BROKEN: Rotate to PAS])
    6464AT_KEYWORDS([Molecules])
    65 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test-*.xyz .], 0)
    66 AT_CHECK([../../molecuilder -i test-rotated-z90.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    67 AT_CHECK([file="test-rotated-z90.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    68 AT_CHECK([../../molecuilder -i test-rotated-z180.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    69 AT_CHECK([file="test-rotated-z180.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    70 AT_CHECK([../../molecuilder -i test-rotated-z360.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    71 AT_CHECK([file="test-rotated-z360.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    72 AT_CHECK([../../molecuilder -i test-rotated-xYz20.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    73 AT_CHECK([file="test-rotated-xYz20.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     65AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test.* .], 0)
     66AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
     67#AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    7468AT_CLEANUP
    7569
    76 # 9. Rotate around origin
    77 AT_SETUP([Molecules - Rotate around origin])
    78 AT_KEYWORDS([Molecules])
    79 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    80 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 90. --position "0,0,1"], 0, [stdout], [stderr])
    81 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
    82 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    83 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 180. --position "0,0,1"], 0, [stdout], [stderr])
    84 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
    85 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    86 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 360. --position "0,0,1"], 0, [stdout], [stderr])
    87 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
    88 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz], 0, [ignore], [ignore])
    89 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    90 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-origin 20. --position "1,2,1"], 0, [stdout], [stderr])
    91 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
    92 AT_CLEANUP
    93 
    94 # 9. Rotate around self
    95 AT_SETUP([Molecules - Rotate around self])
    96 AT_KEYWORDS([Molecules])
    97 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    98 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 90. --position "0,0,1"], 0, [stdout], [stderr])
    99 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
    100 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    101 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 180. --position "0,0,1"], 0, [stdout], [stderr])
    102 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
    103 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    104 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 360. --position "0,0,1"], 0, [stdout], [stderr])
    105 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
    106 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz], 0, [ignore], [ignore])
    107 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    108 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 20. --position "1,2,1"], 0, [stdout], [stderr])
    109 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
    110 AT_CLEANUP
    111 
Note: See TracChangeset for help on using the changeset viewer.