source: src/Parser/TremoloParser.hpp@ 5eebbc

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
Last change on this file since 5eebbc was dc1d9e, checked in by Frederik Heber <heber@…>, 14 years ago

Several bugfixes for TremoloParser.

  • overloaded readAtomDataLine to also accept molecule*.
  • BUGFIX: TremoloParser::writeNeighbors() and TremoloParser::saveLine() write ...->getId()+1.
  • BUGFIX: TremoloParser::writeNeighbors() forgot to increase currentBond iterator.
  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[6bc51d]1/*
2 * TremoloParser.hpp
3 *
4 * Created on: Mar 2, 2010
5 * Author: metzler
6 */
7
8#ifndef TREMOLOPARSER_HPP_
9#define TREMOLOPARSER_HPP_
10
[9131f3]11#include <string>
[a1e929]12#include "Parser/FormatParser.hpp"
[6bc51d]13
[dc1d9e]14class molecule;
15
[b8d4a3]16/**
17 * Known keys for the ATOMDATA line.
18 */
19class TremoloKey {
20public:
21 enum atomDataKey {
22 noKey,
23 x,
24 u,
25 F,
26 stress,
27 Id,
28 neighbors,
29 imprData,
30 GroupMeasureTypeNo,
31 Type,
32 extType,
33 name,
34 resName,
35 chainID,
36 resSeq,
37 occupancy,
38 tempFactor,
39 segID,
40 Charge,
41 charge,
42 GrpTypeNo,
43 torsion
44 };
45};
46
[4415da]47/**
48 * Holds tremolo-specific information which is not store in the atom class.
49 */
50class TremoloAtomInfoContainer {
51public:
52 TremoloAtomInfoContainer();
[b8d4a3]53 void set(TremoloKey::atomDataKey key, std::string value);
54 std::string get(TremoloKey::atomDataKey key);
[4415da]55 std::string F;
56 std::string stress;
57 std::string imprData;
58 std::string GroupMeasureTypeNo;
59 std::string extType;
60 std::string name;
61 std::string resName;
62 std::string chainID;
63 std::string resSeq;
64 std::string occupancy;
65 std::string tempFactor;
66 std::string segID;
67 std::string Charge;
68 std::string charge;
69 std::string GrpTypeNo;
[b8d4a3]70 std::string torsion;
71 std::vector<int> neighbors;
[4415da]72};
73
74/**
75 * Loads a tremolo file into the World and saves the World as a tremolo file.
76 */
[b8d4a3]77class TremoloParser : public FormatParser
[9131f3]78{
[6bc51d]79public:
[9131f3]80 TremoloParser();
81 ~TremoloParser();
82 void load(std::istream* file);
83 void save(std::ostream* file);
[b8d4a3]84 void setFieldsForSave(std::string atomDataLine);
85
[6bc51d]86
87private:
[9131f3]88 void readAtomDataLine(string line);
[dc1d9e]89 void readAtomDataLine(string line, molecule *newmol);
[9131f3]90 void parseAtomDataKeysLine(string line, int offset);
[b8d4a3]91 void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId);
92 void processNeighborInformation();
93 void adaptImprData();
94 void adaptTorsion();
95 std::string adaptIdDependentDataString(std::string data);
96 bool isUsedField(std::string fieldName);
97 void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
98 void saveLine(std::ostream* file, atom* currentAtom);
[9131f3]99
100 /**
101 * Map to associate the known keys with numbers.
102 */
[b8d4a3]103 std::map<std::string, TremoloKey::atomDataKey> knownKeys;
[9131f3]104
105 /**
106 * Fields used in the tremolo file.
107 */
108 std::vector<std::string> usedFields;
109
110 /**
111 * Data which is currently not stored in atoms but was provided by the input
112 * file.
113 */
[b8d4a3]114 std::map<int, TremoloAtomInfoContainer> additionalAtomData;
115
116 /**
117 * Default additional atom data.
118 */
119 TremoloAtomInfoContainer defaultAdditionalData;
120
121 /**
122 * Maps original atom IDs received from the parsed file to atom IDs in the
123 * world.
124 */
125 std::map<int, int> atomIdMap;
[6bc51d]126};
127
128#endif /* TREMOLOPARSER_HPP_ */
Note: See TracBrowser for help on using the repository browser.