source: utils/developer/tcl/surfacing.tcl@ 321470

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 321470 was 0773bd, checked in by Frederik Heber <heber@…>, 12 years ago

Added Tcl scripts used for visualizing faulty rolling spheres or the whole surface.

  • in CandidateForTesselation an error message makes explicit reference to animate_sphere, hence we should place it with molecuilder to eas debugging.
  • show_surface can be used to visualize the written TecPlot style .dat file containing the triangle information of the tesselated surface.
  • surfacing produces an animation (i.e. a number of frames) showing the sequence of found triangles and the rolling sphere which can be used to easily produce movies of the on-going tesselation.
  • Property mode set to 100644
File size: 2.4 KB
Line 
1#!/usr/bin/tclsh
2#
3# This scripts parsed a tecplot style file of triangles and produces one
4# frame for each found triangle to be used in animation of the tesselation
5# including the rolling sphere via VMD's graphics interface.
6#
7# Use as follows:
8# surfacing <filename> # to start
9# surfacing_off # to end
10
11# fname is the filename of the tecplot .dat file
12proc surfacing { fname } {
13 global nodes
14 global Triangles
15 global tcount
16 # open file
17 set file [open $fname r]
18 gets $file title
19 gets $file variables
20 gets $file zone
21 # parse nodes
22 set ncount 1
23 gets $file line
24 while { $line != {} } {
25 set nodes($ncount) $line
26 incr ncount
27 gets $file line
28 }
29 set ncount [ expr $ncount -1 ]
30 puts "There are $ncount nodes."
31 # there's a blank line in between
32 # parse triangles
33 set tcount 0
34 gets $file line
35 while { $line != {} } {
36 set Triangles($tcount) [ split $line " "]
37 incr tcount
38 gets $file line
39 }
40 puts "There are $tcount triangles."
41
42
43 # avoid some 'animate dup' bug
44 set molid [molinfo top]
45 if {$tcount < 2} {
46 error "tcount should be greater than 2."
47 }
48 # make tcount-1 copies of current frame
49 for {set i 0} {$i <$tcount} {incr i} {
50 animate dup frame 0 $molid
51 }
52 animate goto 0
53
54 global vmd_frame
55 trace variable vmd_frame([molinfo top]) w update_current_surface
56 display update
57 return
58}
59
60proc update_current_surface {name index op} {
61 draw delete all
62 global nodes
63 global Triangles
64 set count 0
65 set frame [molinfo $index get frame]
66 while { [expr $count+1] < $frame } {
67 draw color red
68 draw material Transparent
69 set first [ lrange $nodes([ lindex $Triangles($count) 0 ]) 0 2 ]
70 set second [ lrange $nodes([ lindex $Triangles($count) 1 ]) 0 2 ]
71 set third [ lrange $nodes([ lindex $Triangles($count) 2 ]) 0 2 ]
72 draw triangle $first $second $third
73 incr count
74 }
75 if { [expr $count+1] <= $frame } {
76 draw color green
77 draw material Opaque
78 puts "Last triangle is [lindex $Triangles($count) 0] [lindex $Triangles($count) 1] [lindex $Triangles($count) 2]"
79 set first [ lrange $nodes([ lindex $Triangles($count) 0 ]) 0 2 ]
80 set second [ lrange $nodes([ lindex $Triangles($count) 1 ]) 0 2 ]
81 set third [ lrange $nodes([ lindex $Triangles($count) 2 ]) 0 2 ]
82 draw triangle $first $second $third
83 }
84 #enumerate_atoms 0
85
86 return
87}
88
89proc surfacing_off {} {
90 global vmd_frame
91 global tcount
92 trace vdelete vmd_frame([molinfo top]) w update_current_surface
93 draw delete all
94 animate delete beg 1 end $tcount skip 0 [molinfo top]
95 return
96}
97
Note: See TracBrowser for help on using the repository browser.