Skip to content
Snippets Groups Projects
Commit f6aa7ec4 authored by marco's avatar marco
Browse files

unit test (and fix) for loading pdb files with only 66 columns

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2100 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 1551af84
Branches
Tags
No related merge requests found
...@@ -382,11 +382,19 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, ...@@ -382,11 +382,19 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num,
if(is_pqr_) { if(is_pqr_) {
occ=std::make_pair(true, 1.0); occ=std::make_pair(true, 1.0);
temp=std::make_pair(true, 0.0); temp=std::make_pair(true, 0.0);
charge=line.substr(54,6).ltrim().to_float(); if (line.length()>=60) {
radius=line.substr(60, 6).ltrim().to_float(); charge=line.substr(54,6).ltrim().to_float();
}
if (line.length()>=66) {
radius=line.substr(60, 6).ltrim().to_float();
}
} else { } else {
occ=line.substr(54,6).ltrim().to_float(); if (line.length()>=60) {
temp=line.substr(60, 6).ltrim().to_float(); occ=line.substr(54,6).ltrim().to_float();
}
if (line.length()>=66) {
temp=line.substr(60, 6).ltrim().to_float();
}
} }
LOGN_TRACE( "line: [" << line << "]" ); LOGN_TRACE( "line: [" << line << "]" );
String s_ele; String s_ele;
......
...@@ -171,4 +171,12 @@ BOOST_AUTO_TEST_CASE(anisou_record) ...@@ -171,4 +171,12 @@ BOOST_AUTO_TEST_CASE(anisou_record)
} }
BOOST_AUTO_TEST_CASE(only_66_cols)
{
String fname("testfiles/pdb/short.pdb");
PDBReader reader(fname);
mol::EntityHandle ent=mol::CreateEntity();
reader.Import(ent);
}
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
ATOM 1 N SER 1 -35.012 -34.611 -8.045 1.0 0.0
ATOM 2 H1 SER 1 -34.315 -35.342 -8.037 1.0 0.0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment