source: src/Parser/PdbParser.cpp@ 687ef1

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 687ef1 was 45b45d, checked in by Frederik Heber <heber@…>, 9 years ago

FIX: PdbParser would calculate trajectors over all atoms, not just given set.

  • this is only to determine maximum number of trajectory steps but nonetheless unnecessary.
  • Property mode set to 100644
File size: 34.4 KB
RevLine 
[3ae731]1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
[0aa122]4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
[5aaa43]5 * Copyright (C) 2013 Frederik Heber. All rights reserved.
[94d5ac6]6 *
7 *
8 * This file is part of MoleCuilder.
9 *
10 * MoleCuilder is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * MoleCuilder is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
[3ae731]22 */
23
24/*
25 * PdbParser.cpp
26 *
27 * Created on: Aug 17, 2010
28 * Author: heber
29 */
30
31// include config.h
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35
[ad011c]36#include "CodePatterns/MemDebug.hpp"
[3ae731]37
[ad011c]38#include "CodePatterns/Assert.hpp"
39#include "CodePatterns/Log.hpp"
40#include "CodePatterns/toString.hpp"
41#include "CodePatterns/Verbose.hpp"
[42127c]42
[6f0841]43#include "Atom/atom.hpp"
[129204]44#include "Bond/bond.hpp"
[42127c]45#include "Descriptors/AtomIdDescriptor.hpp"
[3bdb6d]46#include "Element/element.hpp"
47#include "Element/periodentafel.hpp"
[42127c]48#include "molecule.hpp"
49#include "MoleculeListClass.hpp"
[4fbca9c]50#include "Parser/PdbParser.hpp"
[073a9e4]51#include "World.hpp"
52#include "WorldTime.hpp"
[bb6193]53
[105b72]54#include <algorithm>
55#include <cmath>
[3ae731]56#include <map>
57#include <vector>
58
[bb6193]59#include <iostream>
60#include <iomanip>
[3ae731]61
62using namespace std;
63
[765f16]64// declare specialized static variables
65const std::string FormatParserTrait<pdb>::name = "pdb";
66const std::string FormatParserTrait<pdb>::suffix = "pdb";
67const ParserTypes FormatParserTrait<pdb>::type = pdb;
68
[3ae731]69/**
70 * Constructor.
71 */
[765f16]72FormatParser< pdb >::FormatParser() :
73 FormatParser_common(NULL)
74{
[4fbca9c]75 knownTokens["ATOM"] = PdbKey::Atom;
[16462f]76 knownTokens["HETATM"] = PdbKey::Atom;
[4fbca9c]77 knownTokens["TER"] = PdbKey::Filler;
[9dba5f]78 knownTokens["END"] = PdbKey::EndOfTimestep;
[4fbca9c]79 knownTokens["CONECT"] = PdbKey::Connect;
80 knownTokens["REMARK"] = PdbKey::Remark;
[9dba5f]81 knownTokens[""] = PdbKey::EndOfTimestep;
[16462f]82
83 // argh, why can't just PdbKey::X+(size_t)i
84 PositionEnumMap[0] = PdbKey::X;
85 PositionEnumMap[1] = PdbKey::Y;
86 PositionEnumMap[2] = PdbKey::Z;
[3ae731]87}
88
89/**
90 * Destructor.
91 */
[765f16]92FormatParser< pdb >::~FormatParser()
93{
[873037]94 PdbAtomInfoContainer::clearknownDataKeys();
[3ae731]95 additionalAtomData.clear();
[4fbca9c]96}
97
98
99/** Parses the initial word of the given \a line and returns the token type.
100 *
101 * @param line line to scan
102 * @return token type
103 */
[955b91]104enum PdbKey::KnownTokens FormatParser< pdb >::getToken(std::string &line)
[4fbca9c]105{
106 // look for first space
[3dfd9c]107 std::string token = line.substr(0,6);
108 const size_t space_location = token.find(' ');
109 const size_t tab_location = token.find('\t');
[4fbca9c]110 size_t location = space_location < tab_location ? space_location : tab_location;
111 if (location != string::npos) {
[47d041]112 //LOG(1, "Found space at position " << space_location);
[3dfd9c]113 token = token.substr(0,space_location);
[4fbca9c]114 }
115
[47d041]116 //LOG(1, "Token is " << token);
[4fbca9c]117 if (knownTokens.count(token) == 0)
118 return PdbKey::NoToken;
119 else
120 return knownTokens[token];
121
122 return PdbKey::NoToken;
[3ae731]123}
124
125/**
[4fbca9c]126 * Loads atoms from a PDB-formatted file.
[3ae731]127 *
[4fbca9c]128 * \param PDB file
[3ae731]129 */
[765f16]130void FormatParser< pdb >::load(istream* file) {
[4fbca9c]131 string line;
132 size_t linecount = 0;
133 enum PdbKey::KnownTokens token;
134
[c0e28c]135 // reset id maps for this file (to correctly parse CONECT entries)
136 resetIdAssociations();
[16462f]137
[9dba5f]138 bool NotEndOfFile = true;
[4fbca9c]139 molecule *newmol = World::getInstance().createMolecule();
140 newmol->ActiveFlag = true;
[b0a2e3]141 unsigned int step = 0;
[4fbca9c]142 // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
143 World::getInstance().getMolecules()->insert(newmol);
144 while (NotEndOfFile) {
[9dba5f]145 bool NotEndOfTimestep = true;
[b0a2e3]146 while (NotEndOfTimestep && NotEndOfFile) {
[9dba5f]147 std::getline(*file, line, '\n');
[b0a2e3]148 if (!line.empty()) {
149 // extract first token
150 token = getToken(line);
151 switch (token) {
152 case PdbKey::Atom:
153 LOG(3,"INFO: Parsing ATOM entry for time step " << step << ".");
154 readAtomDataLine(step, line, newmol);
155 break;
156 case PdbKey::Remark:
157 LOG(3,"INFO: Parsing REM entry for time step " << step << ".");
158 break;
159 case PdbKey::Connect:
160 LOG(3,"INFO: Parsing CONECT entry for time step " << step << ".");
161 readNeighbors(step, line);
162 break;
163 case PdbKey::Filler:
164 LOG(3,"INFO: Stumbled upon Filler entry for time step " << step << ".");
165 break;
166 case PdbKey::EndOfTimestep:
[44f53e]167 LOG(1,"INFO: Parsing END entry or empty line for time step " << step << ".");
[b0a2e3]168 NotEndOfTimestep = false;
169 break;
170 default:
171 // TODO: put a throw here
[47d041]172 ELOG(2, "Unknown token: '" << line << "' for time step " << step << ".");
[765f16]173 //ASSERT(0, "FormatParser< pdb >::load() - Unknown token in line "+toString(linecount)+": "+line+".");
[b0a2e3]174 break;
175 }
[9dba5f]176 }
177 NotEndOfFile = NotEndOfFile && (file->good());
178 linecount++;
[4fbca9c]179 }
[b0a2e3]180 ++step;
181 }
[3dfd9c]182 LOG(4, "INFO: Listing all newly parsed atoms.");
183 BOOST_FOREACH(atom *_atom, *newmol)
[48801a]184 LOG(4, "INFO: Atom " << _atom->getName() << " " << *dynamic_cast<AtomInfo *>(_atom) << ".");
[4afa46]185
186 // refresh atom::nr and atom::name
187 newmol->getAtomCount();
[3ae731]188}
189
190/**
[73916f]191 * Saves the \a atoms into as a PDB file.
[3ae731]192 *
193 * \param file where to save the state
[73916f]194 * \param atoms atoms to store
[3ae731]195 */
[fac58f]196void FormatParser< pdb >::save(
197 ostream* file,
198 const std::vector<const atom *> &AtomList)
[73916f]199{
[830b3e]200 LOG(2, "DEBUG: Saving changes to pdb.");
[9dba5f]201
202 // check for maximum number of time steps
203 size_t max_timesteps = 0;
[45b45d]204 for (vector<const atom *>::const_iterator atomIt = AtomList.begin();
205 atomIt != AtomList.end(); atomIt++) {
206 const atom * _atom = *atomIt;
207 LOG(4, "INFO: Atom " << _atom->getName() << " "
208 << *dynamic_cast<const AtomInfo *>(_atom) << ".");
[9dba5f]209 if (_atom->getTrajectorySize() > max_timesteps)
210 max_timesteps = _atom->getTrajectorySize();
[bb6193]211 }
[9dba5f]212 LOG(2,"INFO: Found a maximum of " << max_timesteps << " time steps to store.");
[3ae731]213
[9dba5f]214 // re-distribute serials
[c0e28c]215 resetIdAssociations();
[9dba5f]216 // (new atoms might have been added)
217 int AtomNo = 1; // serial number starts at 1 in pdb
[45b45d]218 for (vector<const atom *>::const_iterator atomIt = AtomList.begin();
219 atomIt != AtomList.end(); atomIt++) {
[9dba5f]220 PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt);
[c0e28c]221 associateLocaltoGlobalId(AtomNo, (*atomIt)->getId());
[9dba5f]222 atomInfo.set(PdbKey::serial, toString(AtomNo));
[c0e28c]223 ++AtomNo;
[9dba5f]224 }
225
[5c5472]226 // store all time steps (always do first step)
227 for (size_t step = 0; (step == 0) || (step < max_timesteps); ++step) {
[9dba5f]228 {
229 // add initial remark
230 *file << "REMARK created by molecuilder on ";
231 time_t now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time'
232 // ctime ends in \n\0, we have to cut away the newline
233 std::string time(ctime(&now));
234 size_t pos = time.find('\n');
235 if (pos != 0)
236 *file << time.substr(0,pos);
237 else
238 *file << time;
239 *file << ", time step " << step;
240 *file << endl;
[16462f]241 }
[9dba5f]242
243 {
244 std::map<size_t,size_t> MolIdMap;
245 size_t MolNo = 1; // residue number starts at 1 in pdb
[45b45d]246 for (vector<const atom *>::const_iterator atomIt = AtomList.begin();
247 atomIt != AtomList.end(); atomIt++) {
[9dba5f]248 const molecule *mol = (*atomIt)->getMolecule();
249 if ((mol != NULL) && (MolIdMap.find(mol->getId()) == MolIdMap.end())) {
250 MolIdMap[mol->getId()] = MolNo++;
251 }
[bb6193]252 }
[9dba5f]253 const size_t MaxMol = MolNo;
254
255 // have a count per element and per molecule (0 is for all homeless atoms)
256 std::vector<int> **elementNo = new std::vector<int>*[MaxMol];
257 for (size_t i = 0; i < MaxMol; ++i)
258 elementNo[i] = new std::vector<int>(MAX_ELEMENTS,1);
259 char name[MAXSTRINGSIZE];
260 std::string ResidueName;
261
262 // write ATOMs
[45b45d]263 for (vector<const atom *>::const_iterator atomIt = AtomList.begin();
264 atomIt != AtomList.end(); atomIt++) {
[9dba5f]265 PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt);
266 // gather info about residue
267 const molecule *mol = (*atomIt)->getMolecule();
268 if (mol == NULL) {
269 MolNo = 0;
270 atomInfo.set(PdbKey::resSeq, "0");
271 } else {
272 ASSERT(MolIdMap.find(mol->getId()) != MolIdMap.end(),
[765f16]273 "FormatParser< pdb >::save() - Mol id "+toString(mol->getId())+" not present despite we set it?!");
[9dba5f]274 MolNo = MolIdMap[mol->getId()];
275 atomInfo.set(PdbKey::resSeq, toString(MolIdMap[mol->getId()]));
276 if (atomInfo.get<std::string>(PdbKey::resName) == "-")
277 atomInfo.set(PdbKey::resName, mol->getName().substr(0,3));
278 }
279 // get info about atom
280 const size_t Z = (*atomIt)->getType()->getAtomicNumber();
281 if (atomInfo.get<std::string>(PdbKey::name) == "-") { // if no name set, give it a new name
282 sprintf(name, "%2s%02d",(*atomIt)->getType()->getSymbol().c_str(), (*elementNo[MolNo])[Z]);
283 (*elementNo[MolNo])[Z] = ((*elementNo[MolNo])[Z]+1) % 100; // confine to two digits
284 atomInfo.set(PdbKey::name, name);
285 }
286 // set position
287 for (size_t i=0; i<NDIM;++i) {
288 stringstream position;
[105b72]289 position << setprecision(7) << (*atomIt)->getPositionAtStep(step).at(i);
[9dba5f]290 atomInfo.set(PositionEnumMap[i], position.str());
291 }
292 // change element and charge if changed
[8990879]293 if (atomInfo.get<std::string>(PdbKey::element) != (*atomIt)->getType()->getSymbol()) {
294 std::string symbol = (*atomIt)->getType()->getSymbol();
295 if ((symbol[1] >= 'a') && (symbol[1] <= 'z'))
296 symbol[1] = (symbol[1] - 'a') + 'A';
297 atomInfo.set(PdbKey::element, symbol);
298 }
[9dba5f]299
300 // finally save the line
301 saveLine(file, atomInfo);
[16462f]302 }
[9dba5f]303 for (size_t i = 0; i < MaxMol; ++i)
304 delete elementNo[i];
[3d70e3]305 delete[] elementNo;
[3ae731]306
[9dba5f]307 // write CONECTs
[45b45d]308 for (vector<const atom *>::const_iterator atomIt = AtomList.begin();
309 atomIt != AtomList.end(); atomIt++) {
[9dba5f]310 writeNeighbors(file, 4, *atomIt);
311 }
[bb6193]312 }
[9dba5f]313 // END
314 *file << "END" << endl;
[3ae731]315 }
316
317}
318
[6bc86c]319/** Add default info, when new atom is added to World.
320 *
321 * @param id of atom
322 */
[765f16]323void FormatParser< pdb >::AtomInserted(atomId_t id)
[6bc86c]324{
[765f16]325 //LOG(3, "FormatParser< pdb >::AtomInserted() - notified of atom " << id << "'s insertion.");
[6bc86c]326 ASSERT(!isPresentadditionalAtomData(id),
[765f16]327 "FormatParser< pdb >::AtomInserted() - additionalAtomData already present for newly added atom "
[6bc86c]328 +toString(id)+".");
329 // don't insert here as this is our check whether we are in the first time step
330 //additionalAtomData.insert( std::make_pair(id, defaultAdditionalData) );
331}
332
333/** Remove additional AtomData info, when atom has been removed from World.
334 *
335 * @param id of atom
336 */
[765f16]337void FormatParser< pdb >::AtomRemoved(atomId_t id)
[6bc86c]338{
[765f16]339 //LOG(3, "FormatParser< pdb >::AtomRemoved() - notified of atom " << id << "'s removal.");
[8bf9c6]340 std::map<const atomId_t, PdbAtomInfoContainer>::iterator iter = additionalAtomData.find(id);
[6bc86c]341 // as we do not insert AtomData on AtomInserted, we cannot be assured of its presence
342// ASSERT(iter != additionalAtomData.end(),
[765f16]343// "FormatParser< pdb >::AtomRemoved() - additionalAtomData is not present for atom "
[6bc86c]344// +toString(id)+" to remove.");
345 if (iter != additionalAtomData.end()) {
346 additionalAtomData.erase(iter);
347 }
348}
349
350
[9dba5f]351/** Checks whether there is an entry for the given atom's \a _id.
352 *
353 * @param _id atom's id we wish to check on
354 * @return true - entry present, false - only for atom's father or no entry
355 */
[8bf9c6]356bool FormatParser< pdb >::isPresentadditionalAtomData(const atomId_t _id) const
[9dba5f]357{
[8bf9c6]358 std::map<const atomId_t, PdbAtomInfoContainer>::const_iterator iter = additionalAtomData.find(_id);
359 return (iter != additionalAtomData.end());
[9dba5f]360}
361
362
[93fd43e]363/** Either returns reference to present entry or creates new with default values.
364 *
365 * @param _atom atom whose entry we desire
366 * @return
367 */
[fac58f]368PdbAtomInfoContainer& FormatParser< pdb >::getadditionalAtomData(const atom * const _atom)
[93fd43e]369{
370 if (additionalAtomData.find(_atom->getId()) != additionalAtomData.end()) {
[910a5d]371 } else if (additionalAtomData.find(_atom->getFather()->getId()) != additionalAtomData.end()) {
[93fd43e]372 // use info from direct father
[910a5d]373 additionalAtomData[_atom->getId()] = additionalAtomData[_atom->getFather()->getId()];
[93fd43e]374 } else if (additionalAtomData.find(_atom->GetTrueFather()->getId()) != additionalAtomData.end()) {
375 // use info from topmost father
376 additionalAtomData[_atom->getId()] = additionalAtomData[_atom->GetTrueFather()->getId()];
377 } else {
378 // create new entry use default values if nothing else is known
379 additionalAtomData[_atom->getId()] = defaultAdditionalData;
380 }
381 return additionalAtomData[_atom->getId()];
382}
383
[105b72]384/** Tiny helper function to print a float with a most 8 digits.
385 *
386 * A few examples best give the picture:
387 * 1234.678
388 * 1.234
389 * 0.001
390 * 0.100
391 * 1234567.
392 * 123456.7
393 * -1234.56
394 *
395 * \param value
396 * \return string representation
397 */
398const std::string FormatParser< pdb >::printCoordinate(
399 const double value)
400{
401 size_t meaningful_bits=7; // one for decimal dot
402 if (value < 0) //one for the minus sign
403 --meaningful_bits;
404 // count digits before dot (without minus and round towards zero!)
[4e65af]405 int full = floor(fabs(value));
[105b72]406 size_t bits_before_dot = 1;
407 {
408 int tmp = full;
409 for (;bits_before_dot < meaningful_bits;++bits_before_dot) {
410 // even if value is 0...somethingish, we still must start at one digit
411 tmp = tmp/10;
412 if (tmp == 0)
413 break;
414 }
415 }
416 // this fixes bits available after dot
417 const size_t bits_after_dot = std::min((int)meaningful_bits - (int)bits_before_dot, 3);
418 stringstream position;
419 if (bits_after_dot > 0) {
420 if (value < 0)
421 position << "-";
[4e65af]422 // truncate 999.9 to 999 and not to 1000! (hence, extra check!)
423 int remainder = round((abs(value)-full)*pow(10,bits_after_dot));
424 if (remainder >= pow(10,bits_after_dot)) {
425 remainder = 0;
426 ++full;
427 }
[105b72]428 position << full << "." << setfill('0') << setw(bits_after_dot) << remainder;
429 if (bits_after_dot == 2)
430 ELOG(2, "PdbParser is writing coordinates with just a two decimal places.");
431 if (bits_after_dot == 1)
432 ELOG(1, "PdbParser is writing coordinates with just a single decimal places.");
433 } else {
434 ELOG(0, "PdbParser is writing coordinates without any decimal places.");
435 position << full << ".";
436 }
437 return position.str();
438}
439
[3ae731]440/**
[4fbca9c]441 * Writes one line of PDB-formatted data to the provided stream.
[3ae731]442 *
443 * \param stream where to write the line to
[bb6193]444 * \param *currentAtom the atom of which information should be written
445 * \param AtomNo serial number of atom
[16462f]446 * \param *name name of atom, i.e. H01
447 * \param ResidueName Name of molecule
[bb6193]448 * \param ResidueNo number of residue
[3ae731]449 */
[765f16]450void FormatParser< pdb >::saveLine(
[16462f]451 ostream* file,
452 const PdbAtomInfoContainer &atomInfo)
453{
454 *file << setfill(' ') << left << setw(6)
455 << atomInfo.get<std::string>(PdbKey::token);
456 *file << setfill(' ') << right << setw(5)
[1f5e97]457 << (atomInfo.get<int>(PdbKey::serial) % 100000); /* atom serial number */
[16462f]458 *file << " "; /* char 12 is empty */
459 *file << setfill(' ') << left << setw(4)
460 << atomInfo.get<std::string>(PdbKey::name); /* atom name */
461 *file << setfill(' ') << left << setw(1)
462 << atomInfo.get<std::string>(PdbKey::altLoc); /* alternate location/conformation */
463 *file << setfill(' ') << left << setw(3)
464 << atomInfo.get<std::string>(PdbKey::resName); /* residue name */
465 *file << " "; /* char 21 is empty */
466 *file << setfill(' ') << left << setw(1)
467 << atomInfo.get<std::string>(PdbKey::chainID); /* chain identifier */
468 *file << setfill(' ') << left << setw(4)
[1f5e97]469 << (atomInfo.get<int>(PdbKey::resSeq) % 10000); /* residue sequence number */
[16462f]470 *file << setfill(' ') << left << setw(1)
471 << atomInfo.get<std::string>(PdbKey::iCode); /* iCode */
472 *file << " "; /* char 28-30 are empty */
473 // have the following operate on stringstreams such that format specifiers
474 // only act on these
475 for (size_t i=0;i<NDIM;++i) {
[105b72]476 *file << setfill(' ') << right << setw(8)
477 << printCoordinate(atomInfo.get<double>(PositionEnumMap[i]));
[16462f]478 }
479 {
480 stringstream occupancy;
481 occupancy << fixed << setprecision(2) << showpoint
482 << atomInfo.get<double>(PdbKey::occupancy); /* occupancy */
483 *file << setfill(' ') << right << setw(6) << occupancy.str();
[3ae731]484 }
[16462f]485 {
486 stringstream tempFactor;
487 tempFactor << fixed << setprecision(2) << showpoint
488 << atomInfo.get<double>(PdbKey::tempFactor); /* temperature factor */
489 *file << setfill(' ') << right << setw(6) << tempFactor.str();
490 }
491 *file << " "; /* char 68-76 are empty */
492 *file << setfill(' ') << right << setw(2) << atomInfo.get<std::string>(PdbKey::element); /* element */
493 *file << setfill(' ') << right << setw(2) << atomInfo.get<int>(PdbKey::charge); /* charge */
[3ae731]494
495 *file << endl;
496}
497
498/**
499 * Writes the neighbor information of one atom to the provided stream.
500 *
[9d83b6]501 * Note that ListOfBonds of WorldTime::CurrentTime is used.
502 *
[473237]503 * Also, we fill up the CONECT line to extend over 80 chars.
504 *
[bb6193]505 * \param *file where to write neighbor information to
506 * \param MaxnumberOfNeighbors of neighbors
507 * \param *currentAtom to the atom of which to take the neighbor information
[3ae731]508 */
[fac58f]509void FormatParser< pdb >::writeNeighbors(
510 ostream* file,
511 int MaxnumberOfNeighbors,
512 const atom * const currentAtom) {
[4c1230]513 int MaxNo = MaxnumberOfNeighbors;
[473237]514 int charsleft = 80;
[9d83b6]515 const BondList & ListOfBonds = currentAtom->getListOfBonds();
516 if (!ListOfBonds.empty()) {
517 for(BondList::const_iterator currentBond = ListOfBonds.begin(); currentBond != ListOfBonds.end(); ++currentBond) {
[4c1230]518 if (MaxNo >= MaxnumberOfNeighbors) {
519 *file << "CONECT";
[c0e28c]520 *file << setw(5) << getLocalId(currentAtom->getId());
[473237]521 charsleft = 80-6-5;
[4c1230]522 MaxNo = 0;
[bb6193]523 }
[c0e28c]524 *file << setw(5) << getLocalId((*currentBond)->GetOtherAtom(currentAtom)->getId());
[473237]525 charsleft -= 5;
[bb6193]526 MaxNo++;
[473237]527 if (MaxNo == MaxnumberOfNeighbors) {
528 for (;charsleft > 0; charsleft--)
529 *file << ' ';
[4c1230]530 *file << "\n";
[473237]531 }
[3ae731]532 }
[473237]533 if (MaxNo != MaxnumberOfNeighbors) {
534 for (;charsleft > 0; charsleft--)
535 *file << ' ';
[4c1230]536 *file << "\n";
[473237]537 }
[3ae731]538 }
539}
540
[9dba5f]541/** Either returns present atom with given id or a newly created one.
542 *
543 * @param id_string
544 * @return
545 */
[c0e28c]546atom* FormatParser< pdb >::getAtomToParse(std::string id_string)
[9dba5f]547{
548 // get the local ID
549 ConvertTo<int> toInt;
[c0e28c]550 const unsigned int AtomID_local = toInt(id_string);
551 LOG(4, "INFO: Local id is "+toString(AtomID_local)+".");
[9dba5f]552 // get the atomic ID if present
553 atom* newAtom = NULL;
[c0e28c]554 if (getGlobalId(AtomID_local) != -1) {
555 const unsigned int AtomID_global = getGlobalId(AtomID_local);
556 LOG(4, "INFO: Global id present as " << AtomID_global << ".");
[9dba5f]557 // check if atom exists
[c0e28c]558 newAtom = World::getInstance().getAtom(AtomById(AtomID_global));
[9dba5f]559 LOG(5, "INFO: Listing all present atoms with id.");
[a58c16]560 BOOST_FOREACH(const atom *_atom, const_cast<const World &>(World::getInstance()).getAllAtoms())
[9dba5f]561 LOG(5, "INFO: " << *_atom << " with id " << _atom->getId());
562 }
563 // if not exists, create
564 if (newAtom == NULL) {
565 newAtom = World::getInstance().createAtom();
[8bf9c6]566 //const unsigned int AtomID_global = newAtom->getId();
[9dba5f]567 LOG(4, "INFO: No association to global id present, creating atom.");
568 } else {
569 LOG(4, "INFO: Existing atom found: " << *newAtom << ".");
570 }
571 return newAtom;
572}
573
[5fa2ba]574/** read a line starting with key ATOM.
575 *
576 * We check for line's length and parse only up to this value.
577 *
578 * @param atomInfo container to put information in
579 * @param line line containing key ATOM
580 */
[765f16]581void FormatParser< pdb >::readPdbAtomInfoContainer(PdbAtomInfoContainer &atomInfo, std::string &line) const
[9dba5f]582{
[5fa2ba]583 const size_t length = line.length();
584 if (length < 80)
[765f16]585 ELOG(2, "FormatParser< pdb >::readPdbAtomInfoContainer() - pdb is mal-formed, containing less than 80 chars!");
[5fa2ba]586 if (length >= 6) {
587 LOG(4,"INFO: Parsing token from "+line.substr(0,6)+".");
588 atomInfo.set(PdbKey::token, line.substr(0,6));
589 }
590 if (length >= 11) {
591 LOG(4,"INFO: Parsing serial from "+line.substr(6,5)+".");
592 atomInfo.set(PdbKey::serial, line.substr(6,5));
593 ASSERT(atomInfo.get<int>(PdbKey::serial) != 0,
[765f16]594 "FormatParser< pdb >::readPdbAtomInfoContainer() - serial 0 is invalid (filler id for conect entries).");
[5fa2ba]595 }
596
597 if (length >= 16) {
598 LOG(4,"INFO: Parsing name from "+line.substr(12,4)+".");
599 atomInfo.set(PdbKey::name, line.substr(12,4));
600 }
601 if (length >= 17) {
602 LOG(4,"INFO: Parsing altLoc from "+line.substr(16,1)+".");
603 atomInfo.set(PdbKey::altLoc, line.substr(16,1));
604 }
605 if (length >= 20) {
606 LOG(4,"INFO: Parsing resName from "+line.substr(17,3)+".");
607 atomInfo.set(PdbKey::resName, line.substr(17,3));
608 }
609 if (length >= 22) {
610 LOG(4,"INFO: Parsing chainID from "+line.substr(21,1)+".");
611 atomInfo.set(PdbKey::chainID, line.substr(21,1));
612 }
613 if (length >= 26) {
614 LOG(4,"INFO: Parsing resSeq from "+line.substr(22,4)+".");
615 atomInfo.set(PdbKey::resSeq, line.substr(22,4));
616 }
617 if (length >= 27) {
618 LOG(4,"INFO: Parsing iCode from "+line.substr(26,1)+".");
619 atomInfo.set(PdbKey::iCode, line.substr(26,1));
620 }
621
622 if (length >= 60) {
623 LOG(4,"INFO: Parsing occupancy from "+line.substr(54,6)+".");
624 atomInfo.set(PdbKey::occupancy, line.substr(54,6));
625 }
626 if (length >= 66) {
627 LOG(4,"INFO: Parsing tempFactor from "+line.substr(60,6)+".");
628 atomInfo.set(PdbKey::tempFactor, line.substr(60,6));
629 }
630 if (length >= 80) {
631 LOG(4,"INFO: Parsing charge from "+line.substr(78,2)+".");
632 atomInfo.set(PdbKey::charge, line.substr(78,2));
633 }
634 if (length >= 78) {
635 LOG(4,"INFO: Parsing element from "+line.substr(76,2)+".");
636 atomInfo.set(PdbKey::element, line.substr(76,2));
637 } else {
638 LOG(4,"INFO: Trying to parse alternative element from name "+line.substr(12,4)+".");
639 atomInfo.set(PdbKey::element, line.substr(12,4));
640 }
[9dba5f]641}
642
[4fbca9c]643/** Parse an ATOM line from a PDB file.
644 *
645 * Reads one data line of a pdstatus file and interprets it according to the
646 * specifications of the PDB 3.2 format: http://www.wwpdb.org/docs.html
647 *
648 * A new atom is created and filled with available information, non-
649 * standard information is placed in additionalAtomData at the atom's id.
[3ae731]650 *
[b0a2e3]651 * \param _step time step to use
[3ae731]652 * \param line to parse as an atom
[4fbca9c]653 * \param newmol molecule to add parsed atoms to
[3ae731]654 */
[765f16]655void FormatParser< pdb >::readAtomDataLine(const unsigned int _step, std::string &line, molecule *newmol = NULL) {
[4fbca9c]656 vector<string>::iterator it;
[9dba5f]657
658 atom* newAtom = getAtomToParse(line.substr(6,5));
659 LOG(3,"INFO: Parsing END entry or empty line.");
660 bool FirstTimestep = isPresentadditionalAtomData(newAtom->getId()) ? false : true;
[b0a2e3]661 ASSERT((FirstTimestep && (_step == 0)) || (!FirstTimestep && (_step !=0)),
[765f16]662 "FormatParser< pdb >::readAtomDataLine() - additionalAtomData present though atom is newly parsed.");
[9dba5f]663 if (FirstTimestep) {
[c0e28c]664 LOG(3,"INFO: Parsing new atom "+toString(*newAtom)+" "+toString(newAtom->getId())+".");
[9dba5f]665 } else {
666 LOG(3,"INFO: Parsing present atom "+toString(*newAtom)+".");
667 }
[93fd43e]668 PdbAtomInfoContainer &atomInfo = getadditionalAtomData(newAtom);
[9dba5f]669 LOG(4,"INFO: Information in container is "+toString(atomInfo)+".");
670
[4fbca9c]671 string word;
672 ConvertTo<size_t> toSize_t;
673
674 // check whether serial exists, if so, assign next available
675
[47d041]676// LOG(2, "Split line:"
[4fbca9c]677// << line.substr(6,5) << "|"
678// << line.substr(12,4) << "|"
679// << line.substr(16,1) << "|"
680// << line.substr(17,3) << "|"
681// << line.substr(21,1) << "|"
682// << line.substr(22,4) << "|"
683// << line.substr(26,1) << "|"
684// << line.substr(30,8) << "|"
685// << line.substr(38,8) << "|"
686// << line.substr(46,8) << "|"
687// << line.substr(54,6) << "|"
688// << line.substr(60,6) << "|"
689// << line.substr(76,2) << "|"
[47d041]690// << line.substr(78,2));
[4fbca9c]691
[9dba5f]692 if (FirstTimestep) {
693 // first time step
694 // then fill info container
695 readPdbAtomInfoContainer(atomInfo, line);
[c0e28c]696 // associate local with global id
697 associateLocaltoGlobalId(toSize_t(atomInfo.get<std::string>(PdbKey::serial)), newAtom->getId());
[9dba5f]698 // set position
699 Vector tempVector;
700 LOG(4,"INFO: Parsing position from ("
701 +line.substr(30,8)+","
702 +line.substr(38,8)+","
703 +line.substr(46,8)+").");
704 PdbAtomInfoContainer::ScanKey(tempVector[0], line.substr(30,8));
705 PdbAtomInfoContainer::ScanKey(tempVector[1], line.substr(38,8));
706 PdbAtomInfoContainer::ScanKey(tempVector[2], line.substr(46,8));
707 newAtom->setPosition(tempVector);
708 // set element
[8990879]709 std::string value = atomInfo.get<std::string>(PdbKey::element);
710 // make second character lower case if not
711 if ((value[1] >= 'A') && (value[1] <= 'Z'))
712 value[1] = (value[1] - 'A') + 'a';
[9dba5f]713 const element *elem = World::getInstance().getPeriode()
[8990879]714 ->FindElement(value);
[9dba5f]715 ASSERT(elem != NULL,
[765f16]716 "FormatParser< pdb >::readAtomDataLine() - element "+atomInfo.get<std::string>(PdbKey::element)+" is unknown!");
[9dba5f]717 newAtom->setType(elem);
718
719 if (newmol != NULL)
720 newmol->AddAtom(newAtom);
721 } else {
722 // not first time step
723 // then parse into different container
724 PdbAtomInfoContainer consistencyInfo;
725 readPdbAtomInfoContainer(consistencyInfo, line);
726 // then check additional info for consistency
727 ASSERT(atomInfo.get<std::string>(PdbKey::token) == consistencyInfo.get<std::string>(PdbKey::token),
[765f16]728 "FormatParser< pdb >::readAtomDataLine() - difference in token on multiple time step for atom with id "
[9dba5f]729 +atomInfo.get<std::string>(PdbKey::serial)+"!");
730 ASSERT(atomInfo.get<std::string>(PdbKey::name) == consistencyInfo.get<std::string>(PdbKey::name),
[765f16]731 "FormatParser< pdb >::readAtomDataLine() - difference in name on multiple time step for atom with id "
[9dba5f]732 +atomInfo.get<std::string>(PdbKey::serial)+":"
733 +atomInfo.get<std::string>(PdbKey::name)+"!="
734 +consistencyInfo.get<std::string>(PdbKey::name)+".");
735 ASSERT(atomInfo.get<std::string>(PdbKey::altLoc) == consistencyInfo.get<std::string>(PdbKey::altLoc),
[765f16]736 "FormatParser< pdb >::readAtomDataLine() - difference in altLoc on multiple time step for atom with id "
[9dba5f]737 +atomInfo.get<std::string>(PdbKey::serial)+"!");
738 ASSERT(atomInfo.get<std::string>(PdbKey::resName) == consistencyInfo.get<std::string>(PdbKey::resName),
[765f16]739 "FormatParser< pdb >::readAtomDataLine() - difference in resName on multiple time step for atom with id "
[9dba5f]740 +atomInfo.get<std::string>(PdbKey::serial)+"!");
741 ASSERT(atomInfo.get<std::string>(PdbKey::chainID) == consistencyInfo.get<std::string>(PdbKey::chainID),
[765f16]742 "FormatParser< pdb >::readAtomDataLine() - difference in chainID on multiple time step for atom with id "
[9dba5f]743 +atomInfo.get<std::string>(PdbKey::serial)+"!");
744 ASSERT(atomInfo.get<std::string>(PdbKey::resSeq) == consistencyInfo.get<std::string>(PdbKey::resSeq),
[765f16]745 "FormatParser< pdb >::readAtomDataLine() - difference in resSeq on multiple time step for atom with id "
[9dba5f]746 +atomInfo.get<std::string>(PdbKey::serial)+"!");
747 ASSERT(atomInfo.get<std::string>(PdbKey::iCode) == consistencyInfo.get<std::string>(PdbKey::iCode),
[765f16]748 "FormatParser< pdb >::readAtomDataLine() - difference in iCode on multiple time step for atom with id "
[9dba5f]749 +atomInfo.get<std::string>(PdbKey::serial)+"!");
750 ASSERT(atomInfo.get<std::string>(PdbKey::occupancy) == consistencyInfo.get<std::string>(PdbKey::occupancy),
[765f16]751 "FormatParser< pdb >::readAtomDataLine() - difference in occupancy on multiple time step for atom with id "
[9dba5f]752 +atomInfo.get<std::string>(PdbKey::serial)+"!");
753 ASSERT(atomInfo.get<std::string>(PdbKey::tempFactor) == consistencyInfo.get<std::string>(PdbKey::tempFactor),
[765f16]754 "FormatParser< pdb >::readAtomDataLine() - difference in tempFactor on multiple time step for atom with id "
[9dba5f]755 +atomInfo.get<std::string>(PdbKey::serial)+"!");
756 ASSERT(atomInfo.get<std::string>(PdbKey::charge) == consistencyInfo.get<std::string>(PdbKey::charge),
[765f16]757 "FormatParser< pdb >::readAtomDataLine() - difference in charge on multiple time step for atom with id "
[9dba5f]758 +atomInfo.get<std::string>(PdbKey::serial)+"!");
759 ASSERT(atomInfo.get<std::string>(PdbKey::element) == consistencyInfo.get<std::string>(PdbKey::element),
[765f16]760 "FormatParser< pdb >::readAtomDataLine() - difference in element on multiple time step for atom with id "
[9dba5f]761 +atomInfo.get<std::string>(PdbKey::serial)+"!");
762 // and parse in trajectory
763 Vector tempVector;
764 LOG(4,"INFO: Parsing trajectory position from ("
765 +line.substr(30,8)+","
766 +line.substr(38,8)+","
767 +line.substr(46,8)+").");
768 PdbAtomInfoContainer::ScanKey(tempVector[0], line.substr(30,8));
769 PdbAtomInfoContainer::ScanKey(tempVector[1], line.substr(38,8));
770 PdbAtomInfoContainer::ScanKey(tempVector[2], line.substr(46,8));
[b0a2e3]771 LOG(4,"INFO: Adding trajectory point to time step "+toString(_step)+".");
[9dba5f]772 // and set position at new time step
[b0a2e3]773 newAtom->setPositionAtStep(_step, tempVector);
[9dba5f]774 }
775
[4fbca9c]776
777// printAtomInfo(newAtom);
[3ae731]778}
779
[4fbca9c]780/** Prints all PDB-specific information known about an atom.
[3ae731]781 *
782 */
[765f16]783void FormatParser< pdb >::printAtomInfo(const atom * const newAtom) const
[4fbca9c]784{
785 const PdbAtomInfoContainer &atomInfo = additionalAtomData.at(newAtom->getId()); // operator[] const does not exist
786
[47d041]787 LOG(1, "We know about atom " << newAtom->getId() << ":");
788 LOG(1, "\ttoken is " << atomInfo.get<std::string>(PdbKey::token));
789 LOG(1, "\tserial is " << atomInfo.get<int>(PdbKey::serial));
790 LOG(1, "\tname is " << atomInfo.get<std::string>(PdbKey::name));
791 LOG(1, "\taltLoc is " << atomInfo.get<std::string>(PdbKey::altLoc));
792 LOG(1, "\tresName is " << atomInfo.get<std::string>(PdbKey::resName));
793 LOG(1, "\tchainID is " << atomInfo.get<std::string>(PdbKey::chainID));
794 LOG(1, "\tresSeq is " << atomInfo.get<int>(PdbKey::resSeq));
795 LOG(1, "\tiCode is " << atomInfo.get<std::string>(PdbKey::iCode));
796 LOG(1, "\tX is " << atomInfo.get<double>(PdbKey::X));
797 LOG(1, "\tY is " << atomInfo.get<double>(PdbKey::Y));
798 LOG(1, "\tZ is " << atomInfo.get<double>(PdbKey::Z));
799 LOG(1, "\toccupancy is " << atomInfo.get<double>(PdbKey::occupancy));
800 LOG(1, "\ttempFactor is " << atomInfo.get<double>(PdbKey::tempFactor));
801 LOG(1, "\telement is '" << *(newAtom->getType()) << "'");
802 LOG(1, "\tcharge is " << atomInfo.get<int>(PdbKey::charge));
[3ae731]803}
804
805/**
[4fbca9c]806 * Reads neighbor information for one atom from the input.
807 *
[b0a2e3]808 * \param _step time step to use
[4fbca9c]809 * \param line to parse as an atom
[3ae731]810 */
[765f16]811void FormatParser< pdb >::readNeighbors(const unsigned int _step, std::string &line)
[4fbca9c]812{
813 const size_t length = line.length();
814 std::list<size_t> ListOfNeighbors;
815 ConvertTo<size_t> toSize_t;
816
817 // obtain neighbours
818 // show split line for debugging
819 string output;
820 ASSERT(length >=16,
[765f16]821 "FormatParser< pdb >::readNeighbors() - CONECT entry has not enough entries: "+line+"!");
822// output = "Split line:|";
823// output += line.substr(6,5) + "|";
[4fbca9c]824 const size_t id = toSize_t(line.substr(6,5));
825 for (size_t index = 11; index <= 26; index+=5) {
826 if (index+5 <= length) {
[473237]827 output += line.substr(index,5) + "|";
828 // search for digits
829 int otherid = -1;
830 PdbAtomInfoContainer::ScanKey(otherid, line.substr(index,5));
[5fa2ba]831 if (otherid > 0)
832 ListOfNeighbors.push_back(otherid);
833 else
[44f53e]834 ELOG(3, "FormatParser< pdb >::readNeighbors() - discarding CONECT entry with id 0.");
[4fbca9c]835 } else {
836 break;
837 }
838 }
[473237]839 LOG(4, output);
[4fbca9c]840
841 // add neighbours
[f01769]842 atom * const _atom = World::getInstance().getAtom(AtomById(getGlobalId(id)));
[473237]843 LOG(2, "STATUS: Atom " << _atom->getId() << " gets " << ListOfNeighbors.size() << " more neighbours.");
[4fbca9c]844 for (std::list<size_t>::const_iterator iter = ListOfNeighbors.begin();
845 iter != ListOfNeighbors.end();
846 ++iter) {
[c0e28c]847 atom * const _Otheratom = World::getInstance().getAtom(AtomById(getGlobalId(*iter)));
[473237]848 LOG(3, "INFO: Adding Bond (" << *_atom << "," << *_Otheratom << ")");
[b0a2e3]849 _atom->addBond(_step, _Otheratom);
[4fbca9c]850 }
[3ae731]851}
852
[765f16]853bool FormatParser< pdb >::operator==(const FormatParser< pdb >& b) const
[4fbca9c]854{
855 bool status = true;
[a58c16]856 World::ConstAtomComposite atoms = const_cast<const World &>(World::getInstance()).
857 getAllAtoms();
858 for (World::ConstAtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
[4fbca9c]859 if ((additionalAtomData.find((*iter)->getId()) != additionalAtomData.end())
860 && (b.additionalAtomData.find((*iter)->getId()) != b.additionalAtomData.end())) {
861 const PdbAtomInfoContainer &atomInfo = additionalAtomData.at((*iter)->getId());
862 const PdbAtomInfoContainer &OtheratomInfo = b.additionalAtomData.at((*iter)->getId());
863
[16462f]864 status = status && (atomInfo.get<std::string>(PdbKey::serial) == OtheratomInfo.get<std::string>(PdbKey::serial));
[47d041]865 if (!status) ELOG(1, "Mismatch in serials!");
[16462f]866 status = status && (atomInfo.get<std::string>(PdbKey::name) == OtheratomInfo.get<std::string>(PdbKey::name));
[47d041]867 if (!status) ELOG(1, "Mismatch in names!");
[16462f]868 status = status && (atomInfo.get<std::string>(PdbKey::altLoc) == OtheratomInfo.get<std::string>(PdbKey::altLoc));
[47d041]869 if (!status) ELOG(1, "Mismatch in altLocs!");
[16462f]870 status = status && (atomInfo.get<std::string>(PdbKey::resName) == OtheratomInfo.get<std::string>(PdbKey::resName));
[47d041]871 if (!status) ELOG(1, "Mismatch in resNames!");
[16462f]872 status = status && (atomInfo.get<std::string>(PdbKey::chainID) == OtheratomInfo.get<std::string>(PdbKey::chainID));
[47d041]873 if (!status) ELOG(1, "Mismatch in chainIDs!");
[16462f]874 status = status && (atomInfo.get<std::string>(PdbKey::resSeq) == OtheratomInfo.get<std::string>(PdbKey::resSeq));
[47d041]875 if (!status) ELOG(1, "Mismatch in resSeqs!");
[16462f]876 status = status && (atomInfo.get<std::string>(PdbKey::iCode) == OtheratomInfo.get<std::string>(PdbKey::iCode));
[47d041]877 if (!status) ELOG(1, "Mismatch in iCodes!");
[16462f]878 status = status && (atomInfo.get<std::string>(PdbKey::occupancy) == OtheratomInfo.get<std::string>(PdbKey::occupancy));
[47d041]879 if (!status) ELOG(1, "Mismatch in occupancies!");
[16462f]880 status = status && (atomInfo.get<std::string>(PdbKey::tempFactor) == OtheratomInfo.get<std::string>(PdbKey::tempFactor));
[47d041]881 if (!status) ELOG(1, "Mismatch in tempFactors!");
[16462f]882 status = status && (atomInfo.get<std::string>(PdbKey::charge) == OtheratomInfo.get<std::string>(PdbKey::charge));
[47d041]883 if (!status) ELOG(1, "Mismatch in charges!");
[4fbca9c]884 }
[3ae731]885 }
886
[4fbca9c]887 return status;
[3ae731]888}
889
Note: See TracBrowser for help on using the repository browser.