|
4 | 4 | # Usage (after installing): |
5 | 5 | # package require cv_dashboard |
6 | 6 | # cv_dashboard |
| 7 | +# or select the Extensions/Analysis menu item |
7 | 8 |
|
8 | 9 | # Design principles: |
9 | 10 | # - take advantage of colvars/VMD binding for maximum user interaction |
10 | 11 | # - hide the colvars config text from user, instead expose colvar, names and values |
11 | 12 | # - do not try to parse the colvars config (let the Colvars Module do it) |
12 | 13 | # to avoid coming up with an incompatible parser |
13 | 14 |
|
14 | | -# This plugin only acts on the "top" molecule |
15 | | -# which is most consistent for trajectory animation (determined by the frame number of mol) |
| 15 | +# Source file layout: |
| 16 | +# - this file contains utility functions and data structure, without GUI |
| 17 | +# - other files contain GUI elements |
16 | 18 |
|
17 | 19 | # TODO Multiplot: |
18 | 20 | # - properly calculate position of cursor in plot when not all the plot is visible (resized window) |
@@ -954,7 +956,8 @@ Read the standard output (terminal) for details." |
954 | 956 | } |
955 | 957 |
|
956 | 958 |
|
957 | | -# Create a scripted colvar that returns values from a precomputed trajectory |
| 959 | +# Create a scripted colvar that returns values from a precomputed trajectory |
| 960 | +# (internal utility function for load_cv_traj, hence not in the main namespace) |
958 | 961 |
|
959 | 962 | proc create_traj_colvar { molid cv } { |
960 | 963 |
|
@@ -1010,3 +1013,20 @@ proc create_traj_colvar { molid cv } { |
1010 | 1013 | " |
1011 | 1014 | cv config $configString |
1012 | 1015 | } |
| 1016 | + |
| 1017 | +# Save trajectory of currently defined colvars to a file in the colvars.traj format |
| 1018 | + |
| 1019 | +proc ::cv_dashboard::save_traj_file { fileName } { |
| 1020 | + |
| 1021 | + puts "Writing colvars trajectory to file $fileName" |
| 1022 | + set o [open $fileName w] |
| 1023 | + puts -nonewline $o [cv printframelabels] |
| 1024 | + |
| 1025 | + set nf [molinfo top get numframes] |
| 1026 | + for {set f 0} {$f< $nf} {incr f} { |
| 1027 | + cv frame $f |
| 1028 | + cv update |
| 1029 | + puts -nonewline $o [cv printframe] |
| 1030 | + } |
| 1031 | + close $o |
| 1032 | +} |
0 commit comments