Changeset 1830 for trunk/gui/scripts/analyzer.tcl
- Timestamp:
- Jul 17, 2010, 1:54:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r1797 r1830 24 24 option add *Analyzer.simControlActiveBackground #ffffcc widgetDefault 25 25 option add *Analyzer.simControlActiveOutline black widgetDefault 26 option add *Analyzer.notebookpage "about" widgetDefault 26 27 27 28 option add *Analyzer.font \ … … 46 47 itk_option define -simcontrolactivebackground simControlActiveBackground Background "" 47 48 itk_option define -holdwindow holdWindow HoldWindow "" 48 itk_option define -notebookpage notebookPage NotebookPage " about"49 itk_option define -notebookpage notebookPage NotebookPage "" 49 50 50 51 constructor {tool args} { # defined below } … … 505 506 foreach c [$inclobj children output] { 506 507 switch -glob -- $c { 507 # we don't want to include these tags508 # We don't want to include these tags. 508 509 include* - time* - status* - user* { 509 510 continue … … 521 522 lappend _runs $xmlobj 522 523 523 # detect molecule elements that contain trajectory data and convert524 # Detect molecule elements that contain trajectory data and convert 524 525 # to sequences. 525 526 _trajToSequence $xmlobj output 526 527 527 # go through the analysis and find all result sets528 # Go through the analysis and find all result sets. 528 529 set haveresults 0 529 530 foreach item [_reorder [$xmlobj children output]] { … … 1197 1198 1198 1199 # ---------------------------------------------------------------------- 1199 # USAGE: _ trajtosequence <xmlobj> ?<path>?1200 # 1201 1202 1200 # USAGE: _pdbToSequence <xmlobj> ?<path>? 1201 # 1202 # If the molecule element is a trajectory, delete the original 1203 # and create a sequence of individual molecules. 1203 1204 # Used internally to detect any molecule output elements that contain 1204 1205 # trajectory data. Trajectories will be converted into sequences of … … 1213 1214 $xmlobj remove $child 1214 1215 1215 set seq Path$path.sequence($id)1216 $xmlobj put ${seq Path}.about.label $seqLabel1217 $xmlobj put ${seq Path}.about.description $descr1218 $xmlobj put ${seq Path}.index.label "Frame"1216 set sequence $path.sequence($id) 1217 $xmlobj put ${sequence}.about.label $seqLabel 1218 $xmlobj put ${sequence}.about.description $descr 1219 $xmlobj put ${sequence}.index.label "Frame" 1219 1220 1220 1221 set frameNum 0 1221 set frameContents ""1222 set inModel 01223 foreach line $data { 1222 set numLines [llength $data] 1223 for { set i 0 } { $i < $numLines } { incr i } { 1224 set line [lindex $data $i] 1224 1225 set line [string trim $line] 1225 if { $line == "" } { 1226 continue; # Skip blank lines 1226 set contents {} 1227 if { [string match "MODEL*" $line] } { 1228 # Save the contents until we get an ENDMDL record. 1229 for {} { $i < $numLines } { incr i } { 1230 set line [lindex $data $i] 1231 set line [string trim $line] 1232 if { $line == "" } { 1233 continue; # Skip blank lines. 1234 } 1235 if { [string match "ENDMDL*" $line] } { 1236 break; 1237 } 1238 append contents $line\n 1239 } 1240 set frame ${sequence}.element($frameNum) 1241 $xmlobj put ${frame}.index $frameNum 1242 1243 set molecule ${frame}.structure.components.molecule 1244 $xmlobj put ${molecule}.pdb $contents 1245 $xmlobj put ${molecule}.formula $formula 1246 incr frameNum 1227 1247 } 1228 if { [string match "MODEL*" $line] } { 1229 if { $inModel && $frameContents != "" } { 1230 # Dump the current contents into the last model 1231 1232 set framePath ${seqPath}.element($frameNum) 1233 $xmlobj put ${framePath}.index $frameNum 1234 1235 set molPath ${framePath}.structure.components.molecule 1236 $xmlobj put ${molPath}.pdb $frameContents 1237 $xmlobj put ${molPath}.formula $formula 1238 1239 incr frameNum 1240 set frameContents "" 1241 } 1242 set inModel 1 1243 } elseif {[string match "ATOM*" $line] } { 1244 if { !$inModel } { 1245 puts stderr "found \"$line\" without previous MODEL line" 1246 set inModel 1 1247 } 1248 append frameContents $line\n 1249 } 1250 } 1251 if { $frameContents != "" } { 1252 # Dump the current contents into the last model 1253 1254 set framePath ${seqPath}.element($frameNum) 1255 $xmlobj put ${framePath}.index $frameNum 1256 1257 set molPath ${framePath}.structure.components.molecule 1258 $xmlobj put ${molPath}.pdb $frameContents 1259 $xmlobj put ${molPath}.formula $formula 1260 } 1261 } 1262 1248 } 1249 } 1250 1251 # ---------------------------------------------------------------------- 1252 # USAGE: _lammpsToSequence <xmlobj> ?<path>? 1253 # 1254 # If the molecule element is a trajectory, delete the original 1255 # and create a sequence of individual molecules. 1256 # Used internally to detect any molecule output elements that contain 1257 # trajectory data. Trajectories will be converted into sequences of 1258 # individual molecules. All other elements will be unaffected. Scans 1259 # the entire xml tree if a starting path is not specified. 1260 # ---------------------------------------------------------------------- 1263 1261 itcl::body Rappture::Analyzer::_lammpsToSequence {xmlobj path id child data} { 1264 1262 … … 1268 1266 $xmlobj remove $child 1269 1267 1270 set seq Path${path}.sequence($id)1271 $xmlobj put ${seq Path}.about.label $seqLabel1272 $xmlobj put ${seq Path}.about.description $descr1273 $xmlobj put ${seq Path}.index.label "Frame"1268 set sequence ${path}.sequence($id) 1269 $xmlobj put ${sequence}.about.label $seqLabel 1270 $xmlobj put ${sequence}.about.description $descr 1271 $xmlobj put ${sequence}.index.label "Frame" 1274 1272 1275 1273 set frameNum 0 … … 1283 1281 if {[regexp {^[\t ]*ITEM:[ \t]+ATOMS} $line] } { 1284 1282 if { $inModel && $frameContents != "" } { 1285 set frame Path ${seqPath}.element($frameNum)1286 $xmlobj put ${frame Path}.index $frameNum1283 set frame ${sequence}.element($frameNum) 1284 $xmlobj put ${frame}.index $frameNum 1287 1285 1288 set mol Path ${framePath}.structure.components.molecule1289 $xmlobj put ${mol Path}.lammps $frameContents1290 $xmlobj put ${mol Path}.lammpstypemap $typemap1286 set molecule ${frame}.structure.components.molecule 1287 $xmlobj put ${molecule}.lammps $frameContents 1288 $xmlobj put ${molecule}.lammpstypemap $typemap 1291 1289 1292 1290 incr frameNum … … 1303 1301 } 1304 1302 if { $frameContents != "" } { 1305 set frame Path ${seqPath}.element($frameNum)1306 $xmlobj put ${frame Path}.index $frameNum1303 set frame ${sequence}.element($frameNum) 1304 $xmlobj put ${frame}.index $frameNum 1307 1305 1308 set mol Path ${framePath}.structure.components.molecule1309 $xmlobj put ${mol Path}.lammps $frameContents1310 $xmlobj put ${mol Path}.lammpstypemap $typemap1311 } 1312 } 1313 1314 # ---------------------------------------------------------------------- 1315 # USAGE: _traj tosequence <xmlobj> ?<path>?1306 set molecule ${frame}.structure.components.molecule 1307 $xmlobj put ${molecule}.lammps $frameContents 1308 $xmlobj put ${molecule}.lammpstypemap $typemap 1309 } 1310 } 1311 1312 # ---------------------------------------------------------------------- 1313 # USAGE: _trajToSequence <xmlobj> ?<path>? 1316 1314 # 1317 1315 # Check for PDB and LAMMPS trajectories in molecule data and rewrite … … 1333 1331 set current ${path}.${child} 1334 1332 if { [string match "structure*" $child] } { 1333 set isTraj [$xmlobj get ${current}.components.molecule.trajectory] 1334 if { !$isTraj } { 1335 continue; # Not a trajectory. 1336 } 1335 1337 # Look for trajectory if molecule element found. Check both pdb 1336 1338 # data and lammps data. … … 1352 1354 continue 1353 1355 } 1356 if 0 { 1354 1357 # Recurse over all child nodes. 1355 1358 _trajToSequence $xmlobj $current 1359 } 1356 1360 } 1357 1361 }
Note: See TracChangeset
for help on using the changeset viewer.