Ignore:
Timestamp:
Aug 28, 2010, 3:21:11 AM (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, Candidate_v1.7.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:
a6e6b5, f8982c
Parents:
2ad482 (diff), fd4905 (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.
git-author:
Frederik Heber <heber@…> (08/28/10 03:17:48)
git-committer:
Frederik Heber <heber@…> (08/28/10 03:21:11)
Message:

Merge branch 'StructureRefactoring' into Shapes

Conflicts:

src/Box.cpp
src/Box.hpp
src/Descriptors/AtomShapeDescriptor.cpp
src/Descriptors/AtomShapeDescriptor.hpp
src/Descriptors/AtomShapeDescriptor_impl.hpp
src/LinearAlgebra/Line.cpp
src/LinearAlgebra/Line.hpp
src/LinearAlgebra/Matrix.cpp
src/LinearAlgebra/Matrix.hpp
src/Makefile.am
src/Shapes/BaseShapes.cpp
src/Shapes/BaseShapes_impl.hpp
src/Shapes/Shape.cpp
src/Shapes/Shape.hpp
src/Shapes/ShapeOps_impl.hpp
src/Shapes/Shape_impl.hpp
src/unittests/ShapeUnittest.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TremoloParser.cpp

    r2ad482 r6c438f  
     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
    18/*
    29 * TremoloParser.cpp
     
    613 */
    714
     15// include config.h
     16#ifdef HAVE_CONFIG_H
     17#include <config.h>
     18#endif
     19
    820#include "Helpers/MemDebug.hpp"
    921
    1022#include "Helpers/Assert.hpp"
     23#include "Helpers/Log.hpp"
     24#include "Helpers/Verbose.hpp"
    1125#include "TremoloParser.hpp"
    1226#include "World.hpp"
    1327#include "atom.hpp"
     28#include "bond.hpp"
    1429#include "element.hpp"
    15 #include "bond.hpp"
     30#include "molecule.hpp"
    1631#include "periodentafel.hpp"
    1732#include "Descriptors/AtomIdDescriptor.hpp"
     
    1934#include <vector>
    2035
     36#include <iostream>
     37#include <iomanip>
    2138
    2239using namespace std;
    23 using namespace boost;
    2440
    2541/**
     
    7591
    7692  usedFields.clear();
     93  molecule *newmol = World::getInstance().createMolecule();
    7794  while (file->good()) {
    7895    std::getline(*file, line, '\n');
     
    84101    }
    85102    if (line.length() > 0 && line.at(0) != '#') {
    86       readAtomDataLine(line);
     103      readAtomDataLine(line, newmol);
    87104    }
    88105  }
     
    99116 */
    100117void TremoloParser::save(ostream* file) {
     118  DoLog(0) && (Log() << Verbose(0) << "Saving changes to tremolo." << std::endl);
     119
    101120  vector<atom*>::iterator atomIt;
    102121  vector<string>::iterator it;
     
    140159      case TremoloKey::x :
    141160        // for the moment, assume there are always three dimensions
    142         *file << currentAtom->x[0] << "\t";
    143         *file << currentAtom->x[1] << "\t";
    144         *file << currentAtom->x[2] << "\t";
     161        *file << currentAtom->at(0) << "\t";
     162        *file << currentAtom->at(1) << "\t";
     163        *file << currentAtom->at(2) << "\t";
    145164        break;
    146165      case TremoloKey::u :
    147166        // for the moment, assume there are always three dimensions
    148         *file << currentAtom->v[0] << "\t";
    149         *file << currentAtom->v[1] << "\t";
    150         *file << currentAtom->v[2] << "\t";
     167        *file << currentAtom->AtomicVelocity[0] << "\t";
     168        *file << currentAtom->AtomicVelocity[1] << "\t";
     169        *file << currentAtom->AtomicVelocity[2] << "\t";
    151170        break;
    152171      case TremoloKey::Type :
     
    154173        break;
    155174      case TremoloKey::Id :
    156         *file << currentAtom->getId() << "\t";
     175        *file << currentAtom->getId()+1 << "\t";
    157176        break;
    158177      case TremoloKey::neighbors :
    159178        writeNeighbors(file, atoi(it->substr(it->find("=") + 1, 1).c_str()), currentAtom);
    160179        break;
     180      case TremoloKey::resSeq :
     181        if (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()) {
     182          *file << additionalAtomData[currentAtom->getId()].get(currentField);
     183        } else if (currentAtom->getMolecule() != NULL) {
     184          *file << setw(4) << currentAtom->getMolecule()->getId()+1;
     185        } else {
     186          *file << defaultAdditionalData.get(currentField);
     187        }
     188        *file << "\t";
     189      break;
    161190      default :
    162         *file << (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()
    163           ? additionalAtomData[currentAtom->getId()].get(currentField)
    164           : defaultAdditionalData.get(currentField));
     191        if (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()) {
     192          *file << additionalAtomData[currentAtom->getId()].get(currentField);
     193        } else if (additionalAtomData.find(currentAtom->GetTrueFather()->getId()) != additionalAtomData.end()) {
     194          *file << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField);
     195        } else {
     196          *file << defaultAdditionalData.get(currentField);
     197        }
    165198        *file << "\t";
    166199        break;
     
    182215  for (int i = 0; i < numberOfNeighbors; i++) {
    183216    *file << (currentBond != currentAtom->ListOfBonds.end()
    184         ? (*currentBond)->GetOtherAtom(currentAtom)->getId() : 0) << "\t";
     217        ? (*currentBond)->GetOtherAtom(currentAtom)->getId()+1 : 0) << "\t";
     218    if (currentBond != currentAtom->ListOfBonds.end())
     219      currentBond++;
    185220  }
    186221}
     
    214249 *
    215250 * \param line to parse as an atom
    216  */
    217 void TremoloParser::readAtomDataLine(string line) {
     251 * \param *newmol molecule to add atom to
     252 */
     253void TremoloParser::readAtomDataLine(string line, molecule *newmol = NULL) {
    218254  vector<string>::iterator it;
    219255  stringstream lineStream;
     
    225261  string word;
    226262  int oldId;
     263  double tmp;
    227264
    228265  lineStream << line;
     
    232269      case TremoloKey::x :
    233270        // for the moment, assume there are always three dimensions
    234         lineStream >> newAtom->x[0];
    235         lineStream >> newAtom->x[1];
    236         lineStream >> newAtom->x[2];
     271        for (int i=0;i<NDIM;i++) {
     272          lineStream >> tmp;
     273          newAtom->set(i, tmp);
     274        }
    237275        break;
    238276      case TremoloKey::u :
    239277        // for the moment, assume there are always three dimensions
    240         lineStream >> newAtom->v[0];
    241         lineStream >> newAtom->v[1];
    242         lineStream >> newAtom->v[2];
     278        lineStream >> newAtom->AtomicVelocity[0];
     279        lineStream >> newAtom->AtomicVelocity[1];
     280        lineStream >> newAtom->AtomicVelocity[2];
    243281        break;
    244282      case TremoloKey::Type :
     
    262300    }
    263301  }
     302  if (newmol != NULL)
     303    newmol->AddAtom(newAtom);
    264304}
    265305
     
    385425
    386426
    387 TremoloAtomInfoContainer::TremoloAtomInfoContainer() {
    388   F = "0";
    389   stress = "0";
    390   imprData = "-";
    391   GroupMeasureTypeNo = "0";
    392   extType = "-";
    393   name = "-";
    394   resName = "-";
    395   chainID = "0";
    396   resSeq = "0";
    397   occupancy = "0";
    398   tempFactor = "0";
    399   segID = "0";
    400   Charge = "0";
    401   charge = "0";
    402   GrpTypeNo = "0";
    403   torsion = "-";
    404   neighbors = vector<int>(0, 5);
    405 }
     427TremoloAtomInfoContainer::TremoloAtomInfoContainer() :
     428  F("0"),
     429  stress("0"),
     430  imprData("-"),
     431  GroupMeasureTypeNo("0"),
     432  extType("-"),
     433  name("-"),
     434  resName("-"),
     435  chainID("0"),
     436  resSeq("0"),
     437  occupancy("0"),
     438  tempFactor("0"),
     439  segID("0"),
     440  Charge("0"),
     441  charge("0"),
     442  GrpTypeNo("0"),
     443  torsion("-"),
     444  neighbors(vector<int>(0, 5))
     445{}
    406446
    407447void TremoloAtomInfoContainer::set(TremoloKey::atomDataKey key, string value) {
Note: See TracChangeset for help on using the changeset viewer.