Skip to content

Commit

Permalink
Merge pull request espressomd#146 from Marcello-Sega/master
Browse files Browse the repository at this point in the history
fixes VMD crash with long lines in vtf files
  • Loading branch information
Olaf Lenz committed Apr 29, 2014
2 parents 7725435 + b458fc8 commit 5a3eb5c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scripts/vtf.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,20 @@ proc writevsf { file args } {
lappend aids "$from:$to"
}
unset from

puts $file "atom [join $aids ,] $desc"
# let's group atom ranges, so that there are no more than 8 per line
# This fixes a problem with the vmd plugin, and makes the vtf more
# readable anyway.
set start 0
set maxlen 8
set ll [llength [lrange $aids $start end ]]
while { $ll >= $maxlen } {
puts $file "atom [join [lrange $aids $start [expr $start + $maxlen -1]] ,] $desc"
incr start $maxlen
set ll [llength [lrange $aids $start end ]]
}
if { $start < [llength $aids ] } {
puts $file "atom [join [lrange $aids $start end] ,] $desc"
}
}

# Print bond data
Expand Down

0 comments on commit 5a3eb5c

Please sign in to comment.