Ignore:
File:
1 edited

Legend:

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

    r83f176 r6e5084  
    1 /*
    2  * Project: MoleCuilder
    3  * Description: creates and alters molecular systems
    4  * Copyright (C)  2010 University of Bonn. All rights reserved.
    5  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
    6  */
    7 
    81/*
    92 * PrincipalAxisSystemAction.cpp
     
    125 *      Author: heber
    136 */
    14 
    15 // include config.h
    16 #ifdef HAVE_CONFIG_H
    17 #include <config.h>
    18 #endif
    197
    208#include "Helpers/MemDebug.hpp"
     
    7462    // sum up inertia tensor
    7563    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    76       Vector x = (*iter)->getPosition();
     64      Vector x = (*iter)->x;
    7765      x -= *CenterOfGravity;
    78       const double mass = (*iter)->getType()->getMass();
    79       InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
    80       InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
    81       InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
    82       InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
    83       InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
    84       InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
    85       InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
    86       InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
    87       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]);
    8875    }
    8976    // print InertiaTensor for debugging
Note: See TracChangeset for help on using the changeset viewer.