Changeset 1801 for branches/blt4/gui
- Timestamp:
- Jul 12, 2010, 8:03:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/analyzer.tcl
r1795 r1801 1205 1205 1206 1206 # ---------------------------------------------------------------------- 1207 # USAGE: _ trajtosequence <xmlobj> ?<path>?1208 # 1209 1210 1207 # USAGE: _pdbToSequence <xmlobj> ?<path>? 1208 # 1209 # If the molecule element is a trajectory, delete the original 1210 # and create a sequence of individual molecules. 1211 1211 # Used internally to detect any molecule output elements that contain 1212 1212 # trajectory data. Trajectories will be converted into sequences of … … 1221 1221 $xmlobj remove $child 1222 1222 1223 set seqPath $path.sequence($id) 1224 $xmlobj put ${seqPath}.about.label $seqLabel 1225 $xmlobj put ${seqPath}.about.description $descr 1226 $xmlobj put ${seqPath}.index.label "Frame" 1223 set sequence $path.sequence($id) 1224 $xmlobj put ${sequence}.about.label $seqLabel 1225 $xmlobj put ${sequence}.about.description $descr 1226 $xmlobj put ${sequence}.index.label "Frame" 1227 1228 set frameNum 0 1229 set numLines [llength $data] 1230 for { set i 0 } { $i < $numLines } { incr i } { 1231 set line [lindex $data $i] 1232 set line [string trim $line] 1233 set contents {} 1234 if { [string match "MODEL*" $line] } { 1235 # Save the contents until we get an ENDMDL record. 1236 for {} { $i < $numLines } { incr i } { 1237 set line [lindex $data $i] 1238 set line [string trim $line] 1239 if { $line == "" } { 1240 continue; # Skip blank lines. 1241 } 1242 if { [string match "ENDMDL*" $line] } { 1243 break; 1244 } 1245 append contents $line\n 1246 } 1247 set frame ${sequence}.element($frameNum) 1248 $xmlobj put ${frame}.index $frameNum 1249 1250 set molecule ${frame}.structure.components.molecule 1251 $xmlobj put ${molecule}.pdb $contents 1252 $xmlobj put ${molecule}.formula $formula 1253 incr frameNum 1254 } 1255 } 1256 } 1257 1258 itcl::body Rappture::Analyzer::_lammpsToSequence {xmlobj path id child data} { 1259 1260 set seqLabel [$xmlobj get ${child}.about.label] 1261 set descr [$xmlobj get ${child}.about.description] 1262 set typemap [$xmlobj get ${child}.components.molecule.lammpstypemap] 1263 $xmlobj remove $child 1264 1265 set sequence ${path}.sequence($id) 1266 $xmlobj put ${sequence}.about.label $seqLabel 1267 $xmlobj put ${sequence}.about.description $descr 1268 $xmlobj put ${sequence}.index.label "Frame" 1227 1269 1228 1270 set frameNum 0 … … 1234 1276 continue; # Skip blank lines 1235 1277 } 1236 if { [string match "MODEL*" $line] } {1237 if { $inModel && $frameContents != "" } {1238 # Dump the current contents into the last model1239 1240 set framePath ${seqPath}.element($frameNum)1241 $xmlobj put ${framePath}.index $frameNum1242 1243 set molPath ${framePath}.structure.components.molecule1244 $xmlobj put ${molPath}.pdb $frameContents1245 $xmlobj put ${molPath}.formula $formula1246 1247 incr frameNum1248 set frameContents ""1249 }1250 set inModel 11251 } elseif {[string match "ATOM*" $line] } {1252 if { !$inModel } {1253 puts stderr "found \"$line\" without previous MODEL line"1254 set inModel 11255 }1256 append frameContents $line\n1257 }1258 }1259 if { $frameContents != "" } {1260 # Dump the current contents into the last model1261 1262 set framePath ${seqPath}.element($frameNum)1263 $xmlobj put ${framePath}.index $frameNum1264 1265 set molPath ${framePath}.structure.components.molecule1266 $xmlobj put ${molPath}.pdb $frameContents1267 $xmlobj put ${molPath}.formula $formula1268 }1269 }1270 1271 itcl::body Rappture::Analyzer::_lammpsToSequence {xmlobj path id child data} {1272 1273 set seqLabel [$xmlobj get ${child}.about.label]1274 set descr [$xmlobj get ${child}.about.description]1275 set typemap [$xmlobj get ${child}.components.molecule.lammpstypemap]1276 $xmlobj remove $child1277 1278 set seqPath ${path}.sequence($id)1279 $xmlobj put ${seqPath}.about.label $seqLabel1280 $xmlobj put ${seqPath}.about.description $descr1281 $xmlobj put ${seqPath}.index.label "Frame"1282 1283 set frameNum 01284 set frameContents ""1285 set inModel 01286 foreach line $data {1287 set line [string trim $line]1288 if { $line == "" } {1289 continue; # Skip blank lines1290 }1291 1278 if {[regexp {^[\t ]*ITEM:[ \t]+ATOMS} $line] } { 1292 1279 if { $inModel && $frameContents != "" } { 1293 set frame Path ${seqPath}.element($frameNum)1294 $xmlobj put ${frame Path}.index $frameNum1280 set frame ${sequence}.element($frameNum) 1281 $xmlobj put ${frame}.index $frameNum 1295 1282 1296 set mol Path ${framePath}.structure.components.molecule1297 $xmlobj put ${mol Path}.lammps $frameContents1298 $xmlobj put ${mol Path}.lammpstypemap $typemap1283 set molecule ${frame}.structure.components.molecule 1284 $xmlobj put ${molecule}.lammps $frameContents 1285 $xmlobj put ${molecule}.lammpstypemap $typemap 1299 1286 1300 1287 incr frameNum … … 1311 1298 } 1312 1299 if { $frameContents != "" } { 1313 set frame Path ${seqPath}.element($frameNum)1314 $xmlobj put ${frame Path}.index $frameNum1300 set frame ${sequence}.element($frameNum) 1301 $xmlobj put ${frame}.index $frameNum 1315 1302 1316 set mol Path ${framePath}.structure.components.molecule1317 $xmlobj put ${mol Path}.lammps $frameContents1318 $xmlobj put ${mol Path}.lammpstypemap $typemap1303 set molecule ${frame}.structure.components.molecule 1304 $xmlobj put ${molecule}.lammps $frameContents 1305 $xmlobj put ${molecule}.lammpstypemap $typemap 1319 1306 } 1320 1307 }
Note: See TracChangeset
for help on using the changeset viewer.