Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    rbf3817 r6e5084  
    55 *      Author: heber
    66 */
    7 
    8 // include config.h
    9 #ifdef HAVE_CONFIG_H
    10 #include <config.h>
    11 #endif
    127
    138#include "Helpers/MemDebug.hpp"
     
    6762    // sum up inertia tensor
    6863    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    69       Vector x = (*iter)->getPosition();
     64      Vector x = (*iter)->x;
    7065      x -= *CenterOfGravity;
    71       const double mass = (*iter)->getType()->mass;
    72       InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
    73       InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
    74       InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
    75       InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
    76       InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
    77       InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
    78       InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
    79       InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
    80       InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
     66      InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
     67      InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
     68      InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
     69      InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
     70      InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
     71      InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
     72      InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
     73      InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
     74      InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
    8175    }
    8276    // print InertiaTensor for debugging
Note: See TracChangeset for help on using the changeset viewer.