Ignore:
Timestamp:
Jul 31, 2010, 3:23:10 PM (15 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:
8f4df1
Parents:
5fbaeb
Message:

Member variable Vector and element of class atom are now private.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_geometry.cpp

    r5fbaeb rd74077  
    4545
    4646  // go through all atoms
    47   ActOnAllVectors( &Vector::SubtractVector, *Center);
    48   ActOnAllVectors( &Vector::SubtractVector, *CenterBox);
    4947  BOOST_FOREACH(atom* iter, atoms){
    50     *iter->node = domain.WrapPeriodically(*iter->node);
     48    *iter -= *Center;
     49    *iter -= *CenterBox;
     50    iter->setPosition(domain.WrapPeriodically(iter->getPosition()));
    5151  }
    5252
     
    6767  // go through all atoms
    6868  BOOST_FOREACH(atom* iter, atoms){
    69     *iter->node = domain.WrapPeriodically(*iter->node);
     69    iter->setPosition(domain.WrapPeriodically(iter->getPosition()));
    7070  }
    7171
     
    8585  if (iter != end()) { //list not empty?
    8686    for (int i=NDIM;i--;) {
    87       max->at(i) = (*iter)->x[i];
    88       min->at(i) = (*iter)->x[i];
     87      max->at(i) = (*iter)->at(i);
     88      min->at(i) = (*iter)->at(i);
    8989    }
    9090    for (; iter != end(); ++iter) {// continue with second if present
    9191      //(*iter)->Output(1,1,out);
    9292      for (int i=NDIM;i--;) {
    93         max->at(i) = (max->at(i) < (*iter)->x[i]) ? (*iter)->x[i] : max->at(i);
    94         min->at(i) = (min->at(i) > (*iter)->x[i]) ? (*iter)->x[i] : min->at(i);
     93        max->at(i) = (max->at(i) < (*iter)->at(i)) ? (*iter)->at(i) : max->at(i);
     94        min->at(i) = (min->at(i) > (*iter)->at(i)) ? (*iter)->at(i) : min->at(i);
    9595      }
    9696    }
     
    123123    for (; iter != end(); ++iter) {  // continue with second if present
    124124      Num++;
    125       Center += (*iter)->x;
     125      Center += (*iter)->getPosition();
    126126    }
    127127    Center.Scale(-1./(double)Num); // divide through total number (and sign for direction)
     
    145145    for (; iter != end(); ++iter) {  // continue with second if present
    146146      Num++;
    147       (*a) += (*iter)->x;
     147      (*a) += (*iter)->getPosition();
    148148    }
    149149    a->Scale(1./(double)Num); // divide through total mass (and sign for direction)
     
    178178  if (iter != end()) {   //list not empty?
    179179    for (; iter != end(); ++iter) {  // continue with second if present
    180       Num += (*iter)->type->mass;
    181       tmp = (*iter)->type->mass * (*iter)->x;
     180      Num += (*iter)->getType()->mass;
     181      tmp = (*iter)->getType()->mass * (*iter)->getPosition();
    182182      (*a) += tmp;
    183183    }
     
    223223    for (int j=0;j<MDSteps;j++)
    224224      (*iter)->Trajectory.R.at(j).ScaleAll(*factor);
    225     (*iter)->x.ScaleAll(*factor);
     225    (*iter)->ScaleAll(*factor);
    226226  }
    227227};
     
    235235    for (int j=0;j<MDSteps;j++)
    236236      (*iter)->Trajectory.R.at(j) += (*trans);
    237     (*iter)->x += (*trans);
     237    *(*iter) += (*trans);
    238238  }
    239239};
     
    248248
    249249  // go through all atoms
    250   ActOnAllVectors( &Vector::AddVector, *trans);
    251250  BOOST_FOREACH(atom* iter, atoms){
    252     *iter->node = domain.WrapPeriodically(*iter->node);
     251    *iter += *trans;
     252    iter->setPosition(domain.WrapPeriodically(iter->getPosition()));
    253253  }
    254254
     
    264264  Plane p(*n,0);
    265265  BOOST_FOREACH(atom* iter, atoms ){
    266     (*iter->node) = p.mirrorVector(*iter->node);
     266    iter->setPosition(p.mirrorVector(iter->getPosition()));
    267267  }
    268268};
     
    284284    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    285285#ifdef ADDHYDROGEN
    286       if ((*iter)->type->Z != 1) {
     286      if ((*iter)->getType()->Z != 1) {
    287287#endif
    288         Testvector = inversematrix * (*iter)->x;
     288        Testvector = inversematrix * (*iter)->getPosition();
    289289        Translationvector.Zero();
    290290        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    291291         if ((*iter)->nr < (*Runner)->GetOtherAtom((*iter))->nr) // otherwise we shift one to, the other fro and gain nothing
    292292            for (int j=0;j<NDIM;j++) {
    293               tmp = (*iter)->x[j] - (*Runner)->GetOtherAtom(*iter)->x[j];
     293              tmp = (*iter)->at(j) - (*Runner)->GetOtherAtom(*iter)->at(j);
    294294              if ((fabs(tmp)) > BondDistance) {
    295295                flag = false;
     
    309309        // now also change all hydrogens
    310310        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    311           if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
    312             Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->x;
     311          if ((*Runner)->GetOtherAtom((*iter))->getType()->Z == 1) {
     312            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
    313313            Testvector += Translationvector;
    314314            Testvector *= matrix;
     
    343343  // sum up inertia tensor
    344344  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    345     Vector x = (*iter)->x;
     345    Vector x = (*iter)->getPosition();
    346346    //x.SubtractVector(CenterOfGravity);
    347     InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    348     InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
    349     InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
    350     InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
    351     InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    352     InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
    353     InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
    354     InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
    355     InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     347    InertiaTensor[0] += (*iter)->getType()->mass*(x[1]*x[1] + x[2]*x[2]);
     348    InertiaTensor[1] += (*iter)->getType()->mass*(-x[0]*x[1]);
     349    InertiaTensor[2] += (*iter)->getType()->mass*(-x[0]*x[2]);
     350    InertiaTensor[3] += (*iter)->getType()->mass*(-x[1]*x[0]);
     351    InertiaTensor[4] += (*iter)->getType()->mass*(x[0]*x[0] + x[2]*x[2]);
     352    InertiaTensor[5] += (*iter)->getType()->mass*(-x[1]*x[2]);
     353    InertiaTensor[6] += (*iter)->getType()->mass*(-x[2]*x[0]);
     354    InertiaTensor[7] += (*iter)->getType()->mass*(-x[2]*x[1]);
     355    InertiaTensor[8] += (*iter)->getType()->mass*(x[0]*x[0] + x[1]*x[1]);
    356356  }
    357357  // print InertiaTensor for debugging
     
    383383    // the eigenvectors specify the transformation matrix
    384384    Matrix M = Matrix(evec->data);
     385    Vector tempVector;
    385386    BOOST_FOREACH(atom* iter, atoms){
    386       (*iter->node) *= M;
     387      tempVector = iter->getPosition();
     388      tempVector *= M;
     389      iter->setPosition(tempVector);
    387390    }
    388391    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     
    395398    // sum up inertia tensor
    396399    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    397       Vector x = (*iter)->x;
    398       InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    399       InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
    400       InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
    401       InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
    402       InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    403       InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
    404       InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
    405       InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
    406       InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     400      Vector x = (*iter)->getPosition();
     401      InertiaTensor[0] += (*iter)->getType()->mass*(x[1]*x[1] + x[2]*x[2]);
     402      InertiaTensor[1] += (*iter)->getType()->mass*(-x[0]*x[1]);
     403      InertiaTensor[2] += (*iter)->getType()->mass*(-x[0]*x[2]);
     404      InertiaTensor[3] += (*iter)->getType()->mass*(-x[1]*x[0]);
     405      InertiaTensor[4] += (*iter)->getType()->mass*(x[0]*x[0] + x[2]*x[2]);
     406      InertiaTensor[5] += (*iter)->getType()->mass*(-x[1]*x[2]);
     407      InertiaTensor[6] += (*iter)->getType()->mass*(-x[2]*x[0]);
     408      InertiaTensor[7] += (*iter)->getType()->mass*(-x[2]*x[1]);
     409      InertiaTensor[8] += (*iter)->getType()->mass*(x[0]*x[0] + x[1]*x[1]);
    407410    }
    408411    // print InertiaTensor for debugging
     
    439442  DoLog(1) && (Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ");
    440443  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    441     tmp = (*iter)->x[0];
    442     (*iter)->x[0] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
    443     (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     444    tmp = (*iter)->at(0);
     445    (*iter)->set(0,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     446    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
    444447    for (int j=0;j<MDSteps;j++) {
    445448      tmp = (*iter)->Trajectory.R.at(j)[0];
     
    458461  DoLog(1) && (Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ");
    459462  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    460     tmp = (*iter)->x[1];
    461     (*iter)->x[1] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
    462     (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     463    tmp = (*iter)->at(1);
     464    (*iter)->set(1,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     465    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
    463466    for (int j=0;j<MDSteps;j++) {
    464467      tmp = (*iter)->Trajectory.R.at(j)[1];
     
    498501  // go through all atoms
    499502  for (molecule::const_iterator iter = par->mol->begin(); iter != par->mol->end(); ++iter) {
    500     if ((*iter)->type == ((struct lsq_params *)params)->type) { // for specific type
    501       c = (*iter)->x - a;
     503    if ((*iter)->getType() == ((struct lsq_params *)params)->type) { // for specific type
     504      c = (*iter)->getPosition() - a;
    502505      t = c.ScalarProduct(b);           // get direction parameter
    503506      d = t*b;       // and create vector
Note: See TracChangeset for help on using the changeset viewer.