Changeset 8f4df1 for src/config.cpp


Ignore:
Timestamp:
Aug 7, 2010, 12:07:04 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, Candidate_v1.7.0, 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:
2d292d
Parents:
8d6d31 (diff), d74077 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'AtomicPositionEncapsulation' into stable

Conflicts:

src/Actions/AtomAction/ChangeElementAction.cpp
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
src/Makefile.am
src/UIElements/TextUI/TextDialog.cpp
src/analysis_correlation.hpp
src/atom.cpp
src/atom_atominfo.hpp
src/bond.cpp
src/boundary.cpp
src/molecule_geometry.cpp
src/tesselation.cpp
src/tesselationhelpers.cpp
src/triangleintersectionlist.cpp
src/unittests/Makefile.am

  • fixed #includes due to moves to Helpers and LinearAlgebra
  • moved VectorInterface.* and vector_ops.* to LinearAlgebra
  • no more direct access of atom::node, remapped to set/getPosition()
  • no more direct access to atom::type, remapped to set/getType() (also in atom due to derivation and atominfo::AtomicElement is private not protected).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    r8d6d31 r8f4df1  
    439439    map<int, atom *> LinearList;
    440440    atom *neues = NULL;
     441    Vector position;
    441442    if (!FastParsing) {
    442443      // parse in trajectories
     
    452453              AtomList[i][j] = neues;
    453454              LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
    454               neues->type = elementhash[i]; // find element type
     455              neues->setType(elementhash[i]); // find element type
    455456            } else
    456457              neues = AtomList[i][j];
    457458            status = (status &&
    458                     ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], 1, (repetition == 0) ? critical : optional) &&
    459                     ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], 1, (repetition == 0) ? critical : optional) &&
    460                     ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], 1, (repetition == 0) ? critical : optional) &&
     459                    ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], 1, (repetition == 0) ? critical : optional) &&
     460                    ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], 1, (repetition == 0) ? critical : optional) &&
     461                    ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], 1, (repetition == 0) ? critical : optional) &&
    461462                    ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, 1, (repetition == 0) ? critical : optional));
    462             if (!status) break;
     463            if (!status)
     464              break;
     465            neues ->setPosition(position);
    463466
    464467            // check size of vectors
     
    472475            // put into trajectories list
    473476            for (int d=0;d<NDIM;d++)
    474               neues->Trajectory.R.at(repetition)[d] = neues->x[d];
     477              neues->Trajectory.R.at(repetition)[d] = neues->at(d);
    475478
    476479            // parse velocities if present
    477             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], 1,optional))
    478               neues->v[0] = 0.;
    479             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], 1,optional))
    480               neues->v[1] = 0.;
    481             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], 1,optional))
    482               neues->v[2] = 0.;
     480            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], 1,optional))
     481              neues->AtomicVelocity[0] = 0.;
     482            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], 1,optional))
     483              neues->AtomicVelocity[1] = 0.;
     484            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], 1,optional))
     485              neues->AtomicVelocity[2] = 0.;
    483486            for (int d=0;d<NDIM;d++)
    484               neues->Trajectory.U.at(repetition)[d] = neues->v[d];
     487              neues->Trajectory.U.at(repetition)[d] = neues->AtomicVelocity[d];
    485488
    486489            // parse forces if present
     
    531534            AtomList[i][j] = neues;
    532535            LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
    533             neues->type = elementhash[i]; // find element type
     536            neues->setType(elementhash[i]); // find element type
    534537          } else
    535538            neues = AtomList[i][j];
    536539          // then parse for each atom the coordinates as often as present
    537           ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], repetition,critical);
    538           ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], repetition,critical);
    539           ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], repetition,critical);
     540          ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], repetition,critical);
     541          ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], repetition,critical);
     542          ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], repetition,critical);
     543          neues->setPosition(position);
    540544          ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, repetition,critical);
    541           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], repetition,optional))
    542             neues->v[0] = 0.;
    543           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], repetition,optional))
    544             neues->v[1] = 0.;
    545           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], repetition,optional))
    546             neues->v[2] = 0.;
     545          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], repetition,optional))
     546            neues->AtomicVelocity[0] = 0.;
     547          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], repetition,optional))
     548            neues->AtomicVelocity[1] = 0.;
     549          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], repetition,optional))
     550            neues->AtomicVelocity[2] = 0.;
    547551          // here we don't care if forces are present (last in trajectories is always equal to current position)
    548           neues->type = elementhash[i]; // find element type
     552          neues->setType(elementhash[i]); // find element type
    549553          mol->AddAtom(neues);
    550554        }
     
    10091013        istringstream input2(zeile);
    10101014        atom *neues = World::getInstance().createAtom();
    1011         input2 >> neues->x[0]; // x
    1012         input2 >> neues->x[1]; // y
    1013         input2 >> neues->x[2]; // z
     1015        double tmp;
     1016        for (int j=0;j<NDIM;j++) {
     1017          input2 >> tmp;
     1018          neues->set(j,tmp);
     1019        }
    10141020        input2 >> l;
    1015         neues->type = elementhash[No]; // find element type
     1021        neues->setType(elementhash[No]); // find element type
    10161022        mol->AddAtom(neues);
    10171023      }
     
    12791285    AtomNo = 0;
    12801286    for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
    1281       sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
    1282       elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     1287      sprintf(name, "%2s%2d",(*iter)->getType()->symbol, elementNo[(*iter)->getType()->Z]);
     1288      elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
    12831289      fprintf(f,
    12841290             "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    12881294             'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    12891295             MolNo,         /* residue sequence number */
    1290              (*iter)->node->at(0),                 /* position X in Angstroem */
    1291              (*iter)->node->at(1),                 /* position Y in Angstroem */
    1292              (*iter)->node->at(2),                 /* position Z in Angstroem */
    1293              (double)(*iter)->type->Valence,         /* occupancy */
    1294              (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
     1296             (*iter)->at(0),                 /* position X in Angstroem */
     1297             (*iter)->at(1),                 /* position Y in Angstroem */
     1298             (*iter)->at(2),                 /* position Z in Angstroem */
     1299             (double)(*iter)->getType()->Valence,         /* occupancy */
     1300             (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
    12951301             "0",            /* segment identifier */
    1296              (*iter)->type->symbol,    /* element symbol */
     1302             (*iter)->getType()->symbol,    /* element symbol */
    12971303             "0");           /* charge */
    12981304      AtomNo++;
     
    13321338  AtomNo = 0;
    13331339  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    1334     sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
    1335     elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     1340    sprintf(name, "%2s%2d",(*iter)->getType()->symbol, elementNo[(*iter)->getType()->Z]);
     1341    elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
    13361342    fprintf(f,
    13371343           "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    13411347           'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    13421348           0,         /* residue sequence number */
    1343            (*iter)->node->at(0),                 /* position X in Angstroem */
    1344            (*iter)->node->at(1),                 /* position Y in Angstroem */
    1345            (*iter)->node->at(2),                 /* position Z in Angstroem */
    1346            (double)(*iter)->type->Valence,         /* occupancy */
    1347            (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
     1349           (*iter)->at(0),                 /* position X in Angstroem */
     1350           (*iter)->at(1),                 /* position Y in Angstroem */
     1351           (*iter)->at(2),                 /* position Z in Angstroem */
     1352           (double)(*iter)->getType()->Valence,         /* occupancy */
     1353           (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
    13481354           "0",            /* segment identifier */
    1349            (*iter)->type->symbol,    /* element symbol */
     1355           (*iter)->getType()->symbol,    /* element symbol */
    13501356           "0");           /* charge */
    13511357    AtomNo++;
     
    13901396    *output << mol->name << "\t";
    13911397    *output << 0 << "\t";
    1392     *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
    1393     *output << static_cast<double>((*iter)->type->Valence) << "\t";
    1394     *output << (*iter)->type->symbol << "\t";
     1398    *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
     1399    *output << static_cast<double>((*iter)->getType()->Valence) << "\t";
     1400    *output << (*iter)->getType()->symbol << "\t";
    13951401    for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
    13961402      *output << (*runner)->GetOtherAtom(*iter)->nr << "\t";
     
    14621468        *output << (*MolWalker)->name << "\t";
    14631469        *output << MolCounter+1 << "\t";
    1464         *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
    1465         *output << (double)(*iter)->type->Valence << "\t";
    1466         *output << (*iter)->type->symbol << "\t";
     1470        *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
     1471        *output << (double)(*iter)->getType()->Valence << "\t";
     1472        *output << (*iter)->getType()->symbol << "\t";
    14671473        for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
    14681474          *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t";
Note: See TracChangeset for help on using the changeset viewer.