source: src/Parser/PdbAtomInfoContainer.cpp@ 16462f

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 16462f was 16462f, checked in by Frederik Heber <heber@…>, 14 years ago

PdbParser is now complete with respect to additionalAtomData.

  • serial, name, resName, resSeq, element, and charge are updated if changed, otherwise we use values from PdbAtomInfoContainer.
  • PdbParser::saveLine() completely uses information from PdbAtomInfoContainer.

Testchanges:

  • Simple_configuration/2/post/test.pdb updated as we are now closer to real PDB format also concerning alignment and the resName changed again.
  • Property mode set to 100644
File size: 3.9 KB
Line 
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
8/*
9 * PdbAtomInfoContainer.cpp
10 *
11 * Created on: Dec 4, 2010
12 * Author: heber
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "Helpers/MemDebug.hpp"
21
22//#include "Helpers/Assert.hpp"
23//#include "Helpers/Log.hpp"
24#include "Helpers/toString.hpp"
25//#include "Helpers/Verbose.hpp"
26#include "LinearAlgebra/Vector.hpp"
27#include "PdbAtomInfoContainer.hpp"
28
29
30PdbAtomInfoContainer::PdbAtomInfoContainer() :
31 token("ATOM"),
32 serial(0),
33 name("-"),
34 altLoc('0'),
35 resName("-"),
36 chainID('0'),
37 resSeq(0),
38 iCode(' '),
39 occupancy(0.),
40 tempFactor(0.),
41 element(""),
42 charge(0)
43{}
44
45PdbAtomInfoContainer::~PdbAtomInfoContainer()
46{}
47
48void PdbAtomInfoContainer::set(const PdbKey::PdbDataKey key, std::string value)
49{
50 switch (key) {
51 case PdbKey::token :
52 ScanKey(token, value);
53 break;
54 case PdbKey::serial :
55 ScanKey(serial, value);
56 break;
57 case PdbKey::name :
58 ScanKey(name, value);
59 break;
60 case PdbKey::altLoc :
61 ScanKey(altLoc, value);
62 break;
63 case PdbKey::resName :
64 ScanKey(resName, value);
65 break;
66 case PdbKey::chainID :
67 ScanKey(chainID, value);
68 break;
69 case PdbKey::resSeq :
70 ScanKey(resSeq, value);
71 break;
72 case PdbKey::iCode :
73 ScanKey(iCode, value);
74 break;
75 case PdbKey::X :
76 ScanKey(XYZ[0], value);
77 break;
78 case PdbKey::Y :
79 ScanKey(XYZ[1], value);
80 break;
81 case PdbKey::Z :
82 ScanKey(XYZ[2], value);
83 break;
84 case PdbKey::occupancy :
85 ScanKey(occupancy, value);
86 break;
87 case PdbKey::tempFactor :
88 ScanKey(tempFactor, value);
89 break;
90 case PdbKey::element :
91 ScanKey(element, value);
92 break;
93 case PdbKey::charge :
94 ScanKey(charge, value);
95 break;
96 default :
97 std::cout << "Unknown key: " << key << ", value: " << value << std::endl;
98 break;
99 }
100}
101
102template <>
103std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const
104{
105 switch (key) {
106 case PdbKey::token :
107 return toString(token);
108 case PdbKey::serial :
109 return toString(serial);
110 case PdbKey::name :
111 return toString(name);
112 case PdbKey::altLoc :
113 return toString(altLoc);
114 case PdbKey::resName :
115 return toString(resName);
116 case PdbKey::chainID :
117 return toString(chainID);
118 case PdbKey::resSeq :
119 return toString(resSeq);
120 case PdbKey::iCode :
121 return toString(iCode);
122 case PdbKey::X :
123 return toString(XYZ[0]);
124 case PdbKey::Y :
125 return toString(XYZ[1]);
126 case PdbKey::Z :
127 return toString(XYZ[2]);
128 case PdbKey::occupancy :
129 return toString(occupancy);
130 case PdbKey::tempFactor :
131 return toString(tempFactor);
132 case PdbKey::element :
133 return toString(element);
134 case PdbKey::charge :
135 return toString(charge);
136 default :
137 std::cout << "Unknown key: " << key << std::endl;
138 return "";
139 }
140}
141
142template <>
143int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const
144{
145 switch (key) {
146 case PdbKey::serial :
147 return serial;
148 case PdbKey::resSeq :
149 return resSeq;
150 case PdbKey::charge :
151 return charge;
152 default :
153 std::cout << "Unknown key or not presentable as int: " << key << std::endl;
154 return 0;
155 }
156}
157
158template <>
159double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const
160{
161 switch (key) {
162 case PdbKey::X :
163 return XYZ[0];
164 case PdbKey::Y :
165 return XYZ[1];
166 case PdbKey::Z :
167 return XYZ[2];
168 case PdbKey::occupancy :
169 return occupancy;
170 case PdbKey::tempFactor :
171 return tempFactor;
172 default :
173 std::cout << "Unknown key or not presentable as double: " << key << std::endl;
174 return 0.;
175 }
176}
Note: See TracBrowser for help on using the repository browser.