source: src/Parser/XmlParser.hpp@ b3b31e

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 b3b31e was 856d05, checked in by Frederik Heber <heber@…>, 12 years ago

MEMFIX: Added WorldTime and ObserverLog ::purgeInstance() calls.

  • added several memory fixes:
  • added ObserverLog include to GLMoleculeObject_bond, _molecule, and GLWorldView.
  • TESTFIX: due to changes with new JobMarket, we need to give jobids in regression test mpqc-jobs.
  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * XmlParser.hpp
3 *
4 * Created on: Mar 23, 2012
5 * Author: heber
6 */
7
8#ifndef XMLPARSER_HPP_
9#define XMLPARSER_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <map>
17#include <string>
18
19#include "FormatParser.hpp"
20#include "FormatParserTrait.hpp"
21#include "FormatParserInterface.hpp"
22#include "FormatParser_common.hpp"
23#include "ParserTypes.hpp"
24
25#include "LinearAlgebra/RealSpaceMatrix.hpp"
26#include "LinearAlgebra/Vector.hpp"
27
28// declaration of specialized FormatParserTrait
29template<>
30struct FormatParserTrait<xml>
31{
32 //!> Name of the parser
33 static const std::string name;
34 //!> suffix of the files the parser understands to read and write
35 static const std::string suffix;
36 //!> ParserTypes enumeration for the parser
37 static const enum ParserTypes type;
38};
39
40class ParserXmlUnitTest;
41
42/**
43 * Parser for XYZ files.
44 */
45template <>
46class FormatParser< xml > : virtual public FormatParserInterface, public FormatParser_common
47{
48 //!> grant unit test access to private parts
49 friend class ParserXmlUnitTest;
50 //!> grant mem debugger access
51 friend void AddStaticEntitiestoIgnoreList();
52public:
53 FormatParser();
54 virtual ~FormatParser();
55 void load(std::istream* file);
56 void save(std::ostream* file, const std::vector<atom *> &atoms);
57
58protected:
59 void AtomInserted(atomId_t);
60 void AtomRemoved(atomId_t);
61
62private:
63 //!> structure that contains all information from the xml file
64 struct scafacos {
65 std::string name;
66 std::string description;
67 std::string reference_method;
68 double error_potential;
69 double error_field;
70 struct configuration {
71 Vector offset;
72 RealSpaceMatrix box;
73 bool periodicity[NDIM];
74 std::string epsilon;
75
76 struct particle {
77 Vector position;
78 double q;
79 double potential;
80 Vector field;
81
82 bool operator==(const particle &p) const;
83 bool operator!=(const particle &p) const {
84 return !((*this) == p);
85 }
86 };
87 std::vector<struct particle> p;
88
89 bool operator==(const configuration &c) const;
90 bool operator!=(const configuration &c) const {
91 return !((*this) == c);
92 }
93 } config;
94
95 bool operator==(const scafacos &s) const;
96 bool operator!=(const scafacos &s) const {
97 return !((*this) == s);
98 }
99 } data;
100
101 //!> additional parser-specific information for an atom.
102 struct additionalAtomInfo {
103 /** Default constructor for additionalAtomInfo.
104 *
105 * Sets all parser-specific values to zero.
106 */
107 additionalAtomInfo() :
108 charge(0.),
109 potential(0),
110 field(zeroVec)
111 {}
112
113 /** Default constructor for additionalAtomInfo.
114 *
115 */
116 additionalAtomInfo(double _charge, double _potential, const Vector& _field) :
117 charge(_charge),
118 potential(_potential),
119 field(_field)
120 {}
121
122 //!> charge of the atom
123 double charge;
124 //!> potential at position of atom
125 double potential;
126 //!> field at position of atom
127 Vector field;
128 };
129
130 //!> typedef for map to associate additional parser-specific information to each atom.
131 typedef std::map< atomId_t, additionalAtomInfo> AtomInfoMap_t;
132
133 //!> map to associate additional parser-specific information to each atom.
134 AtomInfoMap_t additionalAtomData;
135
136 //!> static instance with default additional atom information
137 static additionalAtomInfo defaultAtomInfo;
138
139 /** Getter for additionalAtomInfo.
140 *
141 * @param _atom constant ref to atom
142 * @return constant reference to additional atom info container,
143 * otherwise to default atom info
144 */
145 const additionalAtomInfo& getAtomData(const atom &_atom) const;
146};
147
148
149#endif /* XMLPARSER_HPP_ */
Note: See TracBrowser for help on using the repository browser.