Skip to content

Commit

Permalink
read_pdb_from_stream: Allow wider MODEL field
Browse files Browse the repository at this point in the history
Increases the maximum model sequence number to 99999999
(almost 100 million).

The format of a MODEL record in a PDB file is specified as the string
"MODEL ", some spaces and a 4-digit serial number. Due to the field
width of four, the highest model number can only be 9999.

However, this causes issues for some generated PDB files, such as converted MD
trajetories with more than 9999 frames.

This change "extends" the PDB format specificuation and uses the available
space currently occupied by spaces.
  • Loading branch information
akors committed Nov 22, 2024
1 parent 063651c commit fbf79de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ Structure read_pdb_from_stream(LineReaderBase&& line_reader, const std::string&
} else if (is_record_type4(line, "MODEL")) {
if (model && chain)
wrong("MODEL without ENDMDL?");
int num = read_int(line+10, 4);
int num = read_int(line+6, 8);
model = &st.find_or_add_model(num);
if (!model->chains.empty())
wrong("duplicate MODEL number: " + std::to_string(num));
Expand Down

0 comments on commit fbf79de

Please sign in to comment.