source: src/Parser/PdbAtomInfoContainer.hpp@ a2c4f3

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 a2c4f3 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: 1.9 KB
Line 
1/*
2 * PdbAtomInfoContainer.hpp
3 *
4 * Created on: Dec 4, 2010
5 * Author: heber
6 */
7
8#ifndef PDBATOMINFOCONTAINER_HPP_
9#define PDBATOMINFOCONTAINER_HPP_
10
11#include "PdbKey.hpp"
12
13class Vector;
14
15#include <string>
16#include <typeinfo>
17
18/**
19 * Holds tremolo-specific information which is not store in the atom class.
20 */
21class PdbAtomInfoContainer {
22public:
23 PdbAtomInfoContainer();
24 ~PdbAtomInfoContainer();
25
26 // getter and setter
27 template <class T> T get(const PdbKey::PdbDataKey key) const {
28 switch (key) {
29 default :
30 std::cout << "Unknown key or not representable as " << typeid(T).name() << ": " << key << std::endl;
31 break;
32 }
33 return (T)NULL;
34 }
35 void set(const PdbKey::PdbDataKey key, std::string value);
36
37 /** Scans a value from a short string and checks whether its empty.
38 *
39 * @param value value to set
40 * @param _piece short string
41 */
42 template <class T> static void ScanKey(T& value, std::string _piece)
43 {
44 ConvertTo<T> toValue;
45 // scan all empty chars ' ' and skip
46 std::string::iterator iter = _piece.begin();
47 for (;iter != _piece.end();++iter)
48 if ((*iter != ' ') && (*iter != '\t'))
49 break;
50 // only set if there is something contained in the string
51 if (iter != _piece.end()) {
52 _piece.erase(_piece.begin(), iter);
53 value = toValue(_piece);
54 }
55 }
56
57private:
58 std::string token;
59 int serial;
60 std::string name;
61 char altLoc;
62 std::string resName;
63 char chainID;
64 int resSeq;
65 char iCode;
66 Vector XYZ;
67 float occupancy;
68 float tempFactor;
69 std::string element;
70 int charge;
71};
72
73template <>
74std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const;
75template <>
76int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const;
77template <>
78double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const;
79
80#endif /* PDBATOMINFOCONTAINER_HPP_ */
Note: See TracBrowser for help on using the repository browser.