Skip to content
Snippets Groups Projects
Commit e939008d authored by Marco Biasini's avatar Marco Biasini
Browse files

also read element column in charmm pdb import mode

parent 27553450
No related branches found
No related tags found
No related merge requests found
...@@ -456,26 +456,24 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, ...@@ -456,26 +456,24 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num,
} }
LOG_TRACE( "line: [" << line << "]" ); LOG_TRACE( "line: [" << line << "]" );
String s_ele; String s_ele;
if (!(PDB::Flags() & PDB::CHARMM_FORMAT)) { // determine element from element column (77-78, right justified) if
// determine element from element column (77-78, right justified) if // present otherwise set to empty String. It is up to the builder to
// present otherwise set to empty String. It is up to the builder to // determine the correct element in that case.
// determine the correct element in that case. if (line.length()>=78) { // element column present
if (line.length()>=78) { // element column present if(line[76]==' ' && line[77]==' ') { // both characters are empty
if(line[76]==' ' && line[77]==' ') { // both characters are empty s_ele="";
s_ele=""; } else if(line[76]!=' ' || line[77]!=' ') { // at least one character not
} else if(line[76]!=' ' || line[77]!=' ') { // at least one character not // empty
// empty if(line[76]==' ' && line[77]!=' ') { // single character element,
if(line[76]==' ' && line[77]!=' ') { // single character element, // right justified
// right justified s_ele=line.substr(77,1).str();
s_ele=line.substr(77,1).str(); } else if(line[76]!=' ' && line[77]==' ') {// single character element,
} else if(line[76]!=' ' && line[77]==' ') {// single character element, // left justified
// left justified s_ele=line.substr(76,1).str();
s_ele=line.substr(76,1).str(); } else { // Real character element
} else { // Real character element s_ele=line.substr(76,2).str();
s_ele=line.substr(76,2).str();
}
} }
} }
} }
String aname(atom_name.str()); String aname(atom_name.str());
// some postprocessing // some postprocessing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment