Commit 4f82acd1 authored by Luka Vretenar's avatar Luka Vretenar Committed by Vedran Miletić

Replaced all usage of <strstream> with <sstream>

parent 5c18669c
......@@ -59,9 +59,7 @@ public:
result = r;
evaluated = true;
constant = true;
ostrstream nm;
nm << r << ends;
name = nm.str();
name = std::to_string(r);
}
void ResetConstant() {
evaluated = false;
......
......@@ -18,16 +18,16 @@
#include <iostream>
// For g++ 3.4.3 (libstdc++)
#include <strstream>
#include <sstream>
using std::cerr;
using std::cout;
using std::endl;
using std::ends;
using std::ios_base;
using std::istream;
using std::istrstream;
using std::istringstream;
using std::ostream;
using std::ostrstream;
using std::ostringstream;
#ifndef _RBTTYPES_H_
#include "RbtTypes.h"
......
......@@ -65,9 +65,7 @@ public:
if (it != vm.end())
vm[key]->SetValue(val);
else {
ostrstream s;
s << val << ends;
vm[key] = new RbtVble(s.str(), val);
vm[key] = new RbtVble(std::to_string(val), val);
}
}
void Assign(RbtString s, RbtReturnType val) {
......
......@@ -134,9 +134,7 @@ public:
if (m_sl.empty())
return c;
else {
/// istrstream istr(m_sl.front().c_str());
istringstream istr(m_sl.front().c_str());
istr >> c;
istringstream(m_sl.front()) >> c;
return c;
}
}
......
......@@ -17,7 +17,6 @@
#include "RbtGPTypes.h"
#include "RbtTypes.h"
#include <strstream>
class RbtVble {
public:
......@@ -43,9 +42,7 @@ public:
void SetValue(RbtReturnType val) {
value = val;
if (name == "") {
ostrstream s;
s << value << ends;
name = s.str();
name = std::to_string(value);
}
}
RbtReturnType GetValue() const { return value; }
......
......@@ -21,7 +21,7 @@
#include "RbtRand.h"
#include "RbtTokenIter.h"
#include <fstream>
#include <strstream>
#include <sstream>
RbtString RbtGPFFCHK1::_CT("RbtGPFFCHK1");
......
......@@ -15,7 +15,7 @@
#include "RbtGPGenome.h"
#include "RbtGPParser.h"
#include <fstream>
#include <strstream>
#include <sstream>
RbtString RbtGPFFCrossDock::_CT("RbtGPFFCrossDock");
......
......@@ -15,7 +15,7 @@
#include "RbtGPGenome.h"
#include "RbtGPParser.h"
#include <fstream>
#include <strstream>
#include <sstream>
RbtString RbtGPFFGold::_CT("RbtGPFFGold");
......
......@@ -22,7 +22,7 @@
#include "RbtTokenIter.h"
#include <cassert>
#include <fstream>
#include <strstream>
#include <sstream>
RbtString RbtGPFFHSP90::_CT("RbtGPFFHSP90");
int nInversions(RbtInt idx, RbtReturnTypeArray &list);
......
......@@ -21,7 +21,7 @@
#include "RbtTokenIter.h"
#include <cassert>
#include <fstream>
#include <strstream>
#include <sstream>
RbtString RbtGPFFSpike::_CT("RbtGPFFSpike");
void RbtGPFFSpike::ReadTables(istream &in, RbtReturnTypeArray &it,
......
......@@ -15,7 +15,7 @@
#include "RbtGPGenome.h"
#include "RbtGPParser.h"
#include <fstream>
#include <strstream>
#include <sstream>
RbtString RbtGPFitnessFunction::_CT("RbtGPFitnessFunction");
......
......@@ -14,7 +14,7 @@
#include "RbtDebug.h"
#include "RbtGPParser.h"
#include <fstream>
#include <strstream>
#include <sstream>
using std::ifstream;
using std::ios_base;
......@@ -56,7 +56,7 @@ RbtGPGenome::RbtGPGenome(istream &in) : m_rand(Rbt::GetRbtRand()) {
}
RbtGPGenome::RbtGPGenome(RbtString str) : m_rand(Rbt::GetRbtRand()) {
istrstream ist(str.c_str());
istringstream ist(str);
// Get structure
ist >> npi >> nfi >> nsfi >> no >> nf >> nr >> nc >> l;
nn = nr * nc; // number of nodes
......
......@@ -14,8 +14,8 @@
#include "RbtCell.h"
#include "RbtCommand.h"
#include <fstream>
#include <strstream>
using std::ostrstream;
#include <sstream>
using std::ostringstream;
RbtString RbtGPParser::_CT("RbtGPParser");
RbtInt RbtCommand::ntabs = 0;
......@@ -101,15 +101,15 @@ RbtString RbtGPParser::PrintEval(RbtGPChromosomePtr chrom, RbtInt n,
RbtBool numbers, RbtBool ins) {
if (!(chrom->Cells(n)->Named())) {
RbtString o(PrintParse1Output(chrom, n, numbers, ins));
ostrstream nm;
ostringstream nm;
if (numbers) {
nm << "(";
nm << n << " ";
nm << o << ") " << ends;
nm << o << ") ";
} else
nm << o << ends;
nm << o;
chrom->Cells(n)->SetName(nm.str());
return (nm.str());
return nm.str();
} else
return chrom->Cells(n)->GetName();
}
......
......@@ -14,8 +14,8 @@
#include "../inc/RbtGPPopulation.h"
#include "../inc/RbtParser.h"
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <strstream>
void main(int argc, char *argv[]) {
/*cout << "Genome file: \n";
RbtString gfile;
......
......@@ -261,10 +261,9 @@ int main(int argc, char *argv[]) {
if (bDump) {
RbtCavityList cavList = spDockSite->GetCavityList();
for (RbtInt i = 0; i < cavList.size(); i++) {
ostrstream filename;
filename << wsName << "_cav" << i + 1 << ".grd" << ends;
ostringstream filename;
filename << wsName << "_cav" << i + 1 << ".grd";
ofstream dumpFile(filename.str());
delete filename.str();
if (dumpFile) {
cavList[i]->GetGrid()->PrintInsightGrid(dumpFile);
dumpFile.close();
......
......@@ -237,7 +237,7 @@ int main(int argc, char *argv[]) {
// BGD 26 Feb 2003 - Create filters to simulate old rbdock
// behaviour
ostrstream strFilter;
ostringstream strFilter;
if (!bFilter) {
if (bTarget) // -t<TS>
{
......@@ -518,12 +518,11 @@ int main(int argc, char *argv[]) {
// Catching errors with this specific run
try {
if (bOutput) {
ostrstream histr;
ostringstream histr;
histr << strRunName << "_" << strMolName << nRec << "_his_"
<< iRun << ".sd" << ends;
<< iRun << ".sd";
RbtMolecularFileSinkPtr spHistoryFileSink(
new RbtMdlFileSink(histr.str(), spLigand));
delete histr.str();
spWS->SetHistorySink(spHistoryFileSink);
}
spWS->Run(); // Dock!
......
......@@ -14,7 +14,7 @@
// corresponding tethered atoms in the sd files
#include <iomanip>
#include <strstream>
#include <sstream>
#include "RbtBiMolWorkSpace.h"
#include "RbtMdlFileSink.h"
......@@ -25,7 +25,7 @@
const RbtString EXEVERSION =
" ($Id: //depot/dev/client3/rdock/2013.1/src/exe/rbtether.cxx#5 $)";
void print_atoms(RbtAtomList &atoms, ostrstream &ost);
void print_atoms(RbtAtomList &atoms, ostringstream &ost);
/////////////////////////////////////////////////////////////////////
// MAIN PROGRAM STARTS HERE
/////////////////////////////////////////////////////////////////////
......@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) {
// for each ligand
if (bOutput) {
// writing down the reference sd file for the query
ostrstream ost;
ostringstream ost;
print_atoms(tetheredAtomList, ost);
RbtVariant vTetherAtoms(ost.str());
RbtMolecularFileSinkPtr spRefMdlFileSink(
......@@ -254,7 +254,7 @@ int main(int argc, char *argv[]) {
Rbt::TranslateAtom(refAxes.com));
///////////////////////////////////
ostrstream ost;
ostringstream ost;
print_atoms(*alli, ost);
RbtVariant vTetherAtoms(ost.str());
// DM 18 May 1999 - store run info in model data
......@@ -283,7 +283,7 @@ int main(int argc, char *argv[]) {
return 0;
}
void print_atoms(RbtAtomList &atoms, ostrstream &ost) {
void print_atoms(RbtAtomList &atoms, ostringstream &ost) {
ost.clear();
for (RbtInt iter = 0; iter < atoms.size(); iter++) {
ost << atoms[iter]->GetAtomId();
......@@ -295,5 +295,4 @@ void print_atoms(RbtAtomList &atoms, ostrstream &ost) {
else
ost << ",";
}
ost << ends;
}
......@@ -47,7 +47,7 @@ void RbtAnnotation::SetScore(RbtDouble s) { m_score = s; }
// Full string required for SD file is:
// strName + "," + Render();
RbtString RbtAnnotation::Render() const {
ostrstream ostr;
ostringstream ostr;
// Check if either atom is a pseudoatom
// If so, arbitrarily write the first non-bridgehead atom ID
const RbtPseudoAtom *pseudo1 = dynamic_cast<const RbtPseudoAtom *>(m_pAtom1);
......@@ -76,9 +76,8 @@ RbtString RbtAnnotation::Render() const {
}
ostr.setf(ios_base::fixed, ios_base::floatfield);
ostr.precision(2);
ostr << m_dist << "," << m_score << ends;
ostr << m_dist << "," << m_score;
RbtString retVal(ostr.str());
delete ostr.str();
return retVal;
}
......
......@@ -350,11 +350,10 @@ RbtString Rbt::ConvertFormalChargeToString(RbtInt nCharge) {
return "--";
default:
// For higher charges, return as +3,-3 etc
ostrstream ostr;
ostringstream ostr;
ostr.setf(ios_base::showpos);
ostr << nCharge << ends;
ostr << nCharge;
RbtString strCharge(ostr.str());
delete ostr.str();
return strCharge;
}
}
......
......@@ -61,7 +61,7 @@ void RbtCharmmTypesFileSource::Parse() throw(RbtError) {
// We have a match so read in the line and store in the types list
CharmmType chrmType;
RbtString strDummy;
istrstream istr((*fileIter).c_str());
istringstream istr(*fileIter);
istr >> strDummy >> chrmType.nAtomType >> chrmType.strAtomType >>
chrmType.mass >> chrmType.element;
// >> strDummy
......
......@@ -71,10 +71,9 @@ void RbtCrdFileSink::Render() throw(RbtError) {
AddLine("*");
// 2. Write number of atoms
ostrstream ostr;
ostr << setw(5) << spModel->GetNumAtoms() << ends;
ostringstream ostr;
ostr << setw(5) << spModel->GetNumAtoms();
AddLine(ostr.str());
delete ostr.str(); // DM 24 Mar 1999 - fix memory leak
// Remember the line number containing the number of atoms
// as we'll need to update the total num atoms after each Render when we
// are in multiconf mode m_numAtomsLineRec = titleList.size()+1;
......@@ -105,7 +104,7 @@ void RbtCrdFileSink::Render() throw(RbtError) {
}
// Render the atom to a string stream
ostrstream ostr;
ostringstream ostr;
ostr.precision(5);
ostr.setf(ios_base::fixed, ios_base::floatfield);
ostr.setf(ios_base::right, ios_base::adjustfield);
......@@ -141,18 +140,16 @@ void RbtCrdFileSink::Render() throw(RbtError) {
<< spAtom->GetSubunitId()
.c_str(); // This subunit ID is unique in the segment
ostr.setf(ios_base::right, ios_base::adjustfield);
ostr << setw(10) << 0.0 << ends;
ostr << setw(10) << 0.0;
AddLine(ostr.str());
delete ostr.str(); // DM 24 Mar 1999 - fix memory leak
}
// In multiconf mode, we need to update the total number of atoms in the
// cache then write the file without clearing the cache
if (GetMultiConf()) {
ostrstream ostr;
ostr << setw(5) << m_nAtomId << ends;
ostringstream ostr;
ostr << setw(5) << m_nAtomId;
ReplaceLine(ostr.str(), m_numAtomsLineRec);
delete ostr.str(); // DM 24 Mar 1999 - fix memory leak
Write(false);
} else
Write(); // Commit the cache to the file
......
......@@ -60,7 +60,7 @@ void RbtCrdFileSource::Parse() throw(RbtError) {
// 3a. Read number of atoms
RbtInt nAtomRec;
fileIter++;
istrstream((*fileIter).c_str()) >> nAtomRec;
istringstream(*fileIter) >> nAtomRec;
// 3b ...and store them
fileIter++;
......@@ -78,9 +78,9 @@ void RbtCrdFileSource::Parse() throw(RbtError) {
// NOTE: we do not read the weighting array value at present
while ((m_atomList.size() < nAtomRec) && (fileIter != fileEnd)) {
istrstream((*fileIter++).c_str()) >> nAtomId >> nSubunitId >>
strSubunitName >> strAtomName >> coord.x >> coord.y >> coord.z >>
strSegmentName >> strSubunitId;
istringstream(*fileIter++) >> nAtomId >> nSubunitId >> strSubunitName >>
strAtomName >> coord.x >> coord.y >> coord.z >> strSegmentName >>
strSubunitId;
// Construct a new atom (constructor only accepts the 2D params)
RbtAtomPtr spAtom(new RbtAtom(
......
......@@ -40,7 +40,7 @@ RbtFilter::RbtFilter(RbtString strfilter, RbtBool filter)
// RbtString filterfilen = GetParameter("_FILTER_FILE");
SmartPtr<istream> filterfile;
if (filter) // filterfilen is the filter
filterfile = new istrstream(strfilter.c_str());
filterfile = new istringstream(strfilter);
else // assume the strfilter is the name of the file
// where the filter is
filterfile = new ifstream(strfilter.c_str(), ios_base::in);
......@@ -52,7 +52,7 @@ RbtFilter::RbtFilter(RbtString strfilter, RbtBool filter)
cout << "\n------------- Terminate filter " << i << "------------" << endl;
RbtString s;
getline(*filterfile, s, ',');
SmartPtr<istream> istrp(new istrstream(s.c_str()));
SmartPtr<istream> istrp(new istringstream(s));
RbtTokenIterPtr ti(new RbtStringTokenIter(istrp, contextp));
RbtFilterExpressionPtr filter = p.Parse(ti, contextp);
PrettyPrintVisitor visitor1(contextp);
......@@ -64,7 +64,7 @@ RbtFilter::RbtFilter(RbtString strfilter, RbtBool filter)
cout << "\n------------- Write filter -----------------" << endl;
RbtString s;
getline(*filterfile, s, ',');
SmartPtr<istream> istrp(new istrstream(s.c_str()));
SmartPtr<istream> istrp(new istringstream(s));
RbtTokenIterPtr ti(new RbtStringTokenIter(istrp, contextp));
RbtFilterExpressionPtr filter = p.Parse(ti, contextp);
PrettyPrintVisitor visitor1(contextp);
......
......@@ -72,14 +72,13 @@ void RbtMdlFileSink::Render() throw(RbtError) {
Rbt::GetBuild());
// Write number of atoms and bonds
ostrstream ostr;
ostringstream ostr;
ostr << setw(3) << modelAtomList.size() + solventAtomList.size() << setw(3)
<< modelBondList.size() + solventBondList.size() << setw(3) << 0
<< setw(3) << 0 << setw(3) << 0 << setw(3) << 0 << setw(3) << 0
<< setw(3) << 0 << setw(3) << 0 << setw(3) << 0 << setw(3) << 999
<< " V2000" << ends;
<< " V2000";
AddLine(ostr.str());
delete ostr.str();
// DM 19 June 2006 - clear the map of logical atom IDs each time
// we render a model
......@@ -124,7 +123,7 @@ void RbtMdlFileSink::RenderAtomList(const RbtAtomList &atomList) {
RbtInt nFormalCharge = spAtom->GetFormalCharge();
if (nFormalCharge != 0)
nFormalCharge = 4 - nFormalCharge;
ostrstream ostr;
ostringstream ostr;
ostr.precision(4);
ostr.setf(ios_base::fixed, ios_base::floatfield);
ostr.setf(ios_base::right, ios_base::adjustfield);
......@@ -138,11 +137,10 @@ void RbtMdlFileSink::RenderAtomList(const RbtAtomList &atomList) {
<< setw(3) << 0 // atom stereo parity
<< setw(3) << 0 // hydrogen count+1 (query CTABs only)
<< setw(3) << 0 // stereo care box (query CTABs only)
<< setw(3) << 0 // valence (0 = no marking)
<< ends; // Mass diff, formal charge, stereo parity, num hydrogens,
// center
<< setw(3) << 0; // valence (0 = no marking)
// Mass diff, formal charge, stereo parity, num hydrogens,
// center
AddLine(ostr.str());
delete ostr.str();
}
}
......@@ -162,14 +160,13 @@ void RbtMdlFileSink::RenderBondList(const RbtBondList &bondList) {
// << spBond->GetAtom2Ptr()->GetFullAtomName()
// << "; file ID1=" << id1
// << "; file ID2=" << id2 << endl;
ostrstream ostr;
ostringstream ostr;
ostr.setf(ios_base::right, ios_base::adjustfield);
ostr << setw(3) << id1 << setw(3) << id2 << setw(3)
<< spBond->GetFormalBondOrder() << setw(3) << 0 << setw(3) << 0
<< setw(3) << 0 << ends; // Atom1, Atom2, bond order, stereo
// designator, unused, topology code
<< setw(3) << 0; // Atom1, Atom2, bond order, stereo
// designator, unused, topology code
AddLine(ostr.str());
delete ostr.str();
} else {
// Should never happen. Probably best to throw an error at this point.
throw RbtBadArgument(_WHERE_,
......
......@@ -78,7 +78,7 @@ void RbtMdlFileSource::Parse() throw(RbtError) {
// to insert a space between the two fields (or use sscanf)
if ((*fileIter).size() > 3)
(*fileIter).insert(3, " ");
istrstream istr((*fileIter++).c_str());
istringstream istr(*fileIter++);
istr >> nAtomRec >> nBondRec;
#ifdef _DEBUG
// cout << nAtomRec << " atoms, " << nBondRec << " bonds" << endl;
......@@ -101,12 +101,8 @@ void RbtMdlFileSource::Parse() throw(RbtError) {
RbtString strSubunitId("1"); // constant
RbtString strSubunitName("MOL"); // constant
// DM 24 Mar 1999 - allocate a C-string for streaming the atom name into
RbtInt lenAtomName(10);
char *szAtomName(new char[lenAtomName + 1]);
while ((m_atomList.size() < nAtomRec) && (fileIter != fileEnd)) {
istrstream istr((*fileIter++).c_str());
istringstream istr(*fileIter++);
istr >> coord.x >> coord.y >> coord.z >> strElementName >> nMassDiff >>
nFormalCharge;
......@@ -122,9 +118,9 @@ void RbtMdlFileSource::Parse() throw(RbtError) {
// Compose the atom name from element+atomID (i.e. C1, N2, C3 etc)
nAtomId++;
ostrstream ostr(szAtomName, lenAtomName);
ostr << strElementName << nAtomId << ends;
RbtString strAtomName(szAtomName);
ostringstream ostr;
ostr << strElementName << nAtomId;
RbtString strAtomName(ostr.str());
// Construct a new atom (constructor only accepts the 2D params)
RbtAtomPtr spAtom(
......@@ -146,8 +142,6 @@ void RbtMdlFileSource::Parse() throw(RbtError) {
m_segmentMap[strSegmentName]++; // increment atom count in segment map
}
delete[] szAtomName; // Tidy up the C-string
// 3b ..and check we read them all before reaching the end of the file
if (m_atomList.size() != nAtomRec)
throw RbtFileParseError(_WHERE_,
......@@ -169,7 +163,7 @@ void RbtMdlFileSource::Parse() throw(RbtError) {
// sscanf)
if ((*fileIter).size() > 3)
(*fileIter).insert(3, " ");
istrstream istr((*fileIter++).c_str());
istringstream istr(*fileIter++);
istr >> idxAtom1 >> idxAtom2 >> nBondOrder;
if ((idxAtom1 > nAtomRec) ||
(idxAtom2 > nAtomRec)) { // Check for indices in range
......@@ -817,10 +811,9 @@ void RbtMdlFileSource::AddHydrogen(RbtAtomPtr spAtom) throw(RbtError) {
// Construct the new hydrogen atom (constructor only accepts the 2D params)
RbtInt nAtomId = m_atomList.size() + 1;
ostrstream ostr;
ostr << "H" << nAtomId << ends;
ostringstream ostr;
ostr << "H" << nAtomId;
RbtString strAtomName(ostr.str());
delete ostr.str();
RbtAtomPtr spHAtom(new RbtAtom(nAtomId,
1, // nAtomicNo,
strAtomName,
......@@ -1066,10 +1059,9 @@ void RbtMdlFileSource::SetupSegmentNames() {
for (nSeg = 1, seed = m_atomList.begin(); seed != m_atomList.end();
nSeg++, seed = Rbt::FindAtom(m_atomList, Rbt::isSegmentName_eq("H"))) {
// New segment name (H1, H2 etc)
ostrstream ostr;
ostr << "H" << nSeg << ends;
ostringstream ostr;
ostr << "H" << nSeg;
RbtString strSegName(ostr.str());
delete ostr.str();
// Temporary atom list containing atoms to be processed
// Note: this is a true list (not a vector) as we will be making numerous
// insertions and deletions
......
......@@ -78,7 +78,7 @@ void RbtNmrRestraintFileSource::Parse() throw(RbtError) {
RbtString strAtomNames1;
RbtString strAtomNames2;
RbtDouble maxDist(0.0);
istrstream istr((*fileIter).c_str());
istringstream istr(*fileIter);
istr >> strAtomNames1 >> strAtomNames2 >> maxDist;
// Check if we read all the fields OK
if (!istr)
......
......@@ -152,10 +152,9 @@ RbtModelPtr RbtPRMFactory::CreateReceptor() throw(RbtError) {
<< endl;
}
for (RbtInt i = 1; i <= n; i++) {
ostrstream ostr;
ostr << _REC_COORD_FILE << "_" << i << ends;
ostringstream ostr;
ostr << _REC_COORD_FILE << "_" << i;
RbtString paramName(ostr.str());
delete ostr.str();
RbtString strCoordFile =
m_pParamSource->GetParameterValueAsString(paramName);
if (m_iTrace > 0) {
......
......@@ -192,7 +192,7 @@ void RbtParameterFileSource::Parse() throw(RbtError) {
else if ((*fileIter).find(strSectionKey) == 0) {
RbtString strSection;
RbtString strDummy;
istrstream istr((*fileIter).c_str());
istringstream istr(*fileIter);
istr >> strDummy >> strSection;
AddSection(strSection);
}
......@@ -208,7 +208,7 @@ void RbtParameterFileSource::Parse() throw(RbtError) {
RbtString strParamName;
// DM 12 May 1999 - read as string then convert to variant
RbtString strParamValue;
istrstream istr((*fileIter).c_str());
istringstream istr(*fileIter);
istr >> strParamName >> strParamValue;
// Prefix the parameter name with the section name and ::
// Hopefully, this will ensure unique parameter names between sections
......
......@@ -205,17 +205,15 @@ void RbtPharmaSF::ScoreMap(RbtStringVariantMap &scoreMap) const {
AddToParentMapEntry(scoreMap, rs);
// Store the mandatory constraint scores
for (RbtInt i = 0; i < m_conScores.size(); i++) {
ostrstream field;
field << name << ".con_" << i + 1 << ends;
ostringstream field;
field << name << ".con_" << i + 1;
scoreMap[field.str()] = m_conScores[i];
delete field.str();
}
// Store the optional constraint scores (unsorted)
for (RbtInt i = 0; i < m_optScores.size(); i++) {
ostrstream field;
field << name << ".opt_" << i + 1 << ends;
ostringstream field;
field << name << ".opt_" << i + 1;
scoreMap[field.str()] = m_optScores[i];
delete field.str();
}
}
}
......@@ -76,7 +76,7 @@ void RbtPsfFileSource::Parse() throw(RbtError) {
// 2a Read number of title lines and check for correct title key...
RbtInt nTitleRec;
fileIter += 2;
istrstream((*fileIter).c_str()) >> nTitleRec >> strKey;
istringstream(*fileIter) >> nTitleRec >> strKey;
if (strKey != strTitleKey)
throw RbtFileParseError(_WHERE_, "Missing " + strTitleKey +
" string in " + GetFileName());
......@@ -97,7 +97,7 @@ void RbtPsfFileSource::Parse() throw(RbtError) {
// 3a. Read number of atoms and check for correct atom key...
RbtInt nAtomRec;
fileIter++;
istrstream((*fileIter).c_str()) >> nAtomRec >> strKey;
istringstream(*fileIter) >> nAtomRec >> strKey;
if (strKey != strAtomKey)
throw RbtFileParseError(_WHERE_, "Missing " + strAtomKey +
" string in " + GetFileName());
......@@ -117,7 +117,7 @@ void RbtPsfFileSource::Parse() throw(RbtError) {
RbtDouble dAtomicMass; // atomic mass from PSF file
while ((m_atomList.size() < nAtomRec) && (fileIter != fileEnd)) {
istrstream istr((*fileIter++).c_str());
istringstream istr(*fileIter++);
istr >> nAtomId >> strSegmentName >> strSubunitId >> strSubunitName >>
strAtomName >> strFFType >> dPartialCharge >> dAtomicMass;
......@@ -162,8 +162,7 @@ void RbtPsfFileSource::Parse() throw(RbtError) {
// 4a. Read number of bonds and check for correct bond key...
RbtInt nBondRec;
fileIter++;
// istrstream((*fileIter).c_str()) >> nBondRec >> strKey;
istrstream((*fileIter).c_str()) >> nBondRec >> strKey;
istringstream(*fileIter) >> nBondRec >> strKey;
// cout << "strKey "<<strKey << " strBondKey " << strBondKey << endl;
// if(strBondKey.compare(strKey,0,6)) {// 6 for "!NBOND" old style API
RbtInt iCmp = strBondKey.compare(0, 5, strKey);
......@@ -181,7 +180,7 @@ void RbtPsfFileSource::Parse() throw(RbtError) {
RbtUInt idxAtom1;
RbtUInt idxAtom2;
while ((m_bondList.size() < nBondRec) && (fileIter != fileEnd)) {
istrstream istr((*fileIter++).c_str());
istringstream istr(*fileIter++);
// Read bonds slightly differently to atoms as we have 4 bonds per line
// Current method assumes atoms are numbered consectively from 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment