From: James Kress (jimkress_58_at_kressworks.org)
Date: Sat Apr 02 2016 - 22:14:08 CDT

John, thanks for the response.

I'm trying to cobble together a workflow that allows the generation of
photorealistic 3D PDFs of DNA and other biomolecules from VMD.
Unfortunately, STL from VMD doesn't seem to support color and VRML doesn't
translate well. Another issue is the translation of whatever output I
generate from VMD into U3D (which is one of the file format for 3D PDFs) or
the apparently nonexistent PRC file format (which is the other file format
for 3D PDFs). I cannot find a good translator that yields a U3D file that
faithfully represents what is displayed in VMD in terms of photorealism (or
anything close to it). AutoCAD files would be a good alternative, but I can
find no way from VMD to and of the various AutoCAD file formats.

I know it can be done since there is at least one commercial product that
will take an OBJ file and do a decent job in creating a 3D PDF
(PDF3DReportGen). However, I just cannot replicate the quality of their
results.

Jim

James Kress Ph.D., President
The KressWorksR Foundation
An IRS Approved 501 (c)(3) Charitable, Nonprofit Organization
"ENGINEERING THE CURE" C
(248) 605-8770

Learn More and Donate At:
Website: http://www.kressworks.org
Facebook: https://www.facebook.com/KressWorks.Foundation/
Twitter: @KressWorksFnd

Confidentiality Notice | This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
or proprietary information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
immediately contact the sender by reply e-mail and destroy all copies of the
original message.

-----Original Message-----
From: John Stone [mailto:johns_at_ks.uiuc.edu]
Sent: Saturday, April 02, 2016 10:21 PM
To: James Kress <jimkress_58_at_kressworks.org>
Cc: vmd-l_at_ks.uiuc.edu
Subject: Re: vmd-l: Rendering high quality obj, x3d and other files for use
in other 3D representation systems

Hi,
  At present, there are no special flags that have any specific effect on
the export of VMD molecular scenes to the various scene file formats, and
that's why you didn't find anything in the User's Guide.

Essentially VMD attempts to provide as close to WYSIWYG output as possible,
within the limits of what each of the file formats is capable of supporting.
You haven't said much about what you're trying to accomplish by exporting
the scenes in one of the formats you listed, so it's hard to give specific
guidance. In general, the resolution parameters for the graphical
representations will have the greatest impact on the geometry that you get
in scene file formats like OBJ or STL that only support triangle meshes.
VMD will use actual spheres and cylinders when exporting to file formats
such as like X3D or VRML which support such primitives. What do you plan to
do with the exported scene files after export?

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Sat, Apr 02, 2016 at 05:09:00PM -0400, James Kress wrote:
> I have read the "VMD Images and Movies Tutorial" but it gives no
> information on what parameters can be specified in the File Render
> Controls for obj, x3d, stl, VRML 2.0 and other files for use in other
3D
> representation systems.\001 It also does not provide, nor does the VMD
> documentation, the default settings used to create these other 3D file
> representations.
>
>
>
> Where can I get this information and how do I modify the renderer
command
> to provide higher resolution, higher-antialiasing, and better materials
> and material properties for these output formats?
>
>
>
> Thanks.
>
>
>
> Jim Kress
>
>
>
> James Kress Ph.D., President
>
> The KressWorks(R) Foundation
>
> An IRS Approved 501 (c)(3) Charitable, Nonprofit Organization
>
> "Engineering The Cure" (c)
>
> (248) 605-8770
>
>
>
> Learn More and Donate At:
>
> Website: [1]http://www.kressworks.org
>
> Facebook: [2]https://www.facebook.com/KressWorks.Foundation/
>
> Twitter: @KressWorksFnd
>
>
>
> Confidentiality Notice | This e-mail message, including any
attachments,
> is for the sole use of the intended recipient(s) and may contain
> confidential or proprietary information. Any unauthorized review, use,
> disclosure or distribution is prohibited. If you are not the intended
> recipient, immediately contact the sender by reply e-mail and destroy
all
> copies of the original message.
>
>
>
> From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On
Behalf
> Of MannyEful E
> Sent: Saturday, April 02, 2016 1:28 PM
> To: John Stone <johns_at_ks.uiuc.edu>; MannyEful E <mannyeful_at_gmail.com>;
> vmd-l_at_ks.uiuc.edu
> Subject: Re: vmd-l: Residence Time Script (v2.)
>
>
>
> Thank you John and Norman!
>
>
>
> On Thu, Mar 31, 2016 at 4:38 PM, John Stone <[3]johns_at_ks.uiuc.edu>
wrote:
>
> Don't use the variable name "list" because "list" is a Tcl command.
> You could rename that to "lst" or something more indicative of what
> it actually contains and the problem might go away.
> In general you should avoid using Tcl command names as variables, as
> they can cause confusing syntax errors and the like.
> That seems to be a likely source of your problem.
>
> Cheers,
> John
>
> On Thu, Mar 31, 2016 at 01:51:48AM +0100, MannyEful E wrote:
> > Hello Everyone,A
> > I have seen a few requests for the average residence time of
water
> > molecules around the protein and am currently working on such a
> script. I
> > get a few errors which I believe are the result of the incorrect
> syntax.
> > Could someone please point me in the right direction?
> > The script is attached below and the two lines responsible for
the
> errors
> > are highlighted with arrows. (<-----------)
> > The error message:
> > A invalid character "." in expression "...st +])/[llength
$list]."A
> > In sum, the script does the following:
> > 1. For each water molecules it counts the number of separate
> occasions
> > that it approaches the polymer, including the times that it
leaves
> but
> > returns (A).A
> > 2. It also records how long they stay (B).
> > 3. An array of A/B is produced (C).
> > 4. Finally, the average and stdev of C is obtained and printed.
A
> (The
> > errors crop up here when I try to output my results in double
> precision,
> > whilst using a proc function.)
> > #################### A The Residence Script: A A
> #####################
> > puts "Bash usage: vmd -dispdev text -gro file.gro -xtc file.xtc
-e
> > residence_times_v2.tcl"
> > puts "Next, type: residence nth unit pol"
> > puts "e.g.: residence 1st 500 pvc "
> >
#################################################################
> > # process used to calculate the average of values in an array
> > proc lavg list {
> > expr {double([join $list +])/[llength $list].}
> > }
> > A
> > A # process used to calculate the stdev of values in an array
> > proc stddev list {
> > A set m [lavg $list]
> > A expr {sqrt([mean2 $list]-$m*$m)}
> > A }
> > A
> >
#################################################################
> > A
> > #proc residence {nth pol unit} {
> > # Variables for Atomselection
> > set nth 1st; # which repeat is it
> > set unit 5; # how many units is the polymer
> > set pol pva; # what is the polymer name
> > set min1 0.0; A A # lower limit for the hydration shell1 in
> angstroms
> > set max1 10.5;A # higher limit of the hydration shell1 in
> angstroms
> > set fp1 [open "residence_times_tracker.xvg" w]; # tracks the
> calculation
> > outputs
> > set fp2 [open "residence_times_output.xvg" w]; # tracks the
output
> > section
> > set atom_ref ${pol}${unit};A # VMD residue name of the
reference
> atom
> > set sel [atomselect top all];A # select all the atomsA
> > set all [$sel num];A # count the number of atoms
> > set fn [molinfo top get numframes]; # count the number of frames
> > set stepsize 40.00;
> >
#################################################################
> > # set all the histograms to zero
> > for {set i 0} {$i < $all} {incr i} {
> > set hist1($i) 0; A # counter: If it is within region
> > set hist2($i) 0;A A # note: If it left
> > set hist3($i) 0; A # counter: Sum of those that leftA
> > set hist4($i) 0; # counter
> > }
> >
#################################################################
> > # loop through all the frames
> > for {set i 0} {$i < $fn} {incr i} {
> > # do the following for all the frames except the last one
> > if {$i < [expr $fn - 1]} {
> > # go to the next frame
> > animate goto $i;
> > # outputs frame we are on
> > puts $fp1 "Frame $i of $fn: [expr {double(($i *
$stepsize)/1000)}]
> ns ";A
> > # make selections in frame and in next frame
> > set sel1 [atomselect top "(name OW and same resid as (resname
SOL
> and
> > (within $max1 of resname $atom_ref))) and not (name OW and same
> resid as
> > (resname SOL and (within $min1 of resname $atom_ref)))" frame
$i];A
> > set sel2 [atomselect top "(name OW and same resid as (resname
SOL
> and
> > (within $max1 of resname $atom_ref))) and not (name OW and same
> resid as
> > (resname SOL and (within $min1 of resname $atom_ref)))" frame
[expr
> $i +
> > 1]];A
> > A A A $sel1 update; # updates dynamic water selection1 for
this
> frame
> > A A A $sel2 update; # updates dynamic water selection2 for
this
> frame
> > puts $fp1 "Both selections made";
> > # creates a list of atoms indices from the next frame
> > set list2 [$sel2 get index];
> > puts $fp1 "List of future atom indices made: \n $list2";
> > # for every water oxygen atom that is near the polymer
> > # get the atoms index
> > foreach present [$sel1 get index] {
> > puts $fp1 "ID: $present";
> > # check: Is it near the polymer (Always true in this loop)
> > incr hist1([expr $present - 1]);A # add 1 if present near the
> area of
> > interest
> > puts $fp1 "HIST1: $hist1([expr $present - 1])";
> > # check: Is it coming back?
> > if { $hist2([expr $present - 1]) == 1 } A {
> > incr hist3([expr $present - 1]);A # add 1 if previous hist2
was 1
> > because it left and came back.A
> > puts $fp1 "HIST3: $hist3([expr $present - 1])";
> > }A
> > # check: Will it leave?
> > # compare the atom indices to the list of selection2
> > # and if it is present, it will return a value greater than 1
> > # so add one to our approaches counter
> > # if it has left it returns a -1
> > if { [lsearch -exact $list2 $present] >= 0} {
> > set hist2([expr $present - 1]) 1;
> > incr hist4([expr $present - 1]);
> > puts $fp1 "It will stay in the next frame";A
> > } else {
> > set hist2([expr $present - 1]) 0;
> > puts $fp1 "It will leave in the next frame";
> > }
> > }
> > } else {
> > # go to the next frame
> > animate goto $i;
> > # outputs frame we are on
> > puts $fp1 "Frame $i of $fn: [expr {double(($i *
$stepsize)/1000)}]
> ns ";A
> > # make selections in frame and in next frame
> > set sel1 [atomselect top "(name OW and same resid as (resname
SOL
> and
> > (within $max1 of resname $atom_ref))) and not (name OW and same
> resid as
> > (resname SOL and (within $min1 of resname $atom_ref)))" frame
$i];A
> > foreach present [$sel1 get index] {
> > puts $fp1 "ID: $present";
> > #Any present? Always in this loop
> > incr hist1([expr $present - 1]); # add 1 because it is present
> near area
> > of interest
> > # check: Is it coming back?
> > if { $hist2([expr $present - 1]) == 1 } A {
> > incr hist3([expr $present - 1]);A # add 1 if previous hist2
was 1
> > because it left and came back.A
> > puts $fp1 "HIST3: $hist3([expr $present - 1])";
> > }A
> > # in order to account for those occasions where the water
molecule
> > remained at the last frame
> > # artificially set all atoms present in the area of interest to
> leave in
> > the last frameA
> > set hist2([expr $present - 1]) 1;
> > incr hist4([expr $present - 1]);
> > puts $fp1 "It will stay in the next frame";A
> > }
> > }
> > $sel1 delete; array unset sel1; # unset the selection1A
> > $sel2 delete; array unset sel2; # unset the selection2A
> > }
> >
#################################################################
> > # set new constants to zero
> > set hist_final {};A
> > set counter 0;
> > set comebacks 0;
> > # loop through all atoms (non-oxygens as well)
> > for {set i 0} {$i < [llength $hist1([expr $all - 1])]} {incr i}
{
> > puts $fp2 "Atom ${i} : [lindex $hist1([expr $all - 1]) $i]";
> > # find the atoms that have residence times (ie if the hist1
counter
> is
> > greater than zero, a residence time is available)A
> > if {[lindex $hist1([expr $all - 1]) $i] > 0} {
> > # count the number of atoms with residences recorded
> > incr $counter;
> > puts $fp2 "Number of atoms with residences: $counter Counter";
> > # calculate the individual residence times for each oxygen atom
> that was
> > near the molecule
> > puts $fp2 " [lindex $hist1([expr $all - 1]) $i] / [lindex
> $hist4([expr
> > $all - 1]) $i] = [expr [lindex $hist1([expr $all - 1]) $i] /
> [lindex
> > $hist4([expr $all - 1]) $i]]";
> > # populate the array hist_final
> > lappend hist_final [expr {double([lindex $hist1([expr $all - 1])
> $i]) /
> > double([lindex $hist4([expr $all - 1]) $i])}];
> > # identify how many times the water molecules returned after
> leaving
> > set comebacks [expr $comebacks + [lindex $hist3([expr $all - 1])
> $i]];
> > } else {
> > puts $fp2 "No residence times to record ${i} - number [lindex
> $hist1([expr
> > $all - 1]) ${i}]";
> > }
> > }
> > puts $fp2 "$counter : Number of oxygen atoms with residences
within
> $max1
> > of the polymer over $fn frames";
> > puts $fp2 "$comebacks : Number of times any of the $counter
water
> > molecules";
> > puts $fp2 "[expr {[lavg (double($hist_final))] * $stepsize}] ps
:
> Average
> > residence time "; A <--------------
> > puts $fp2 "[expr {[stddev (double($hist_final))] * $stepsize}]
ps :
> Stdev
> > "; A <-----------
> > close $fp1;
> > close $fp2;
> >
#################################################################
> > # unset all the selections for faster execution
> > array unset nth;
> > array unset unit;
> > array unset pol;
> > array unset min1;A
> > array unset max1;A
> > array unset fp1;
> > array unset fp2;
> > array unset atom_ref;A
> > array unset fn;A
> > array unset stepsize;
> > $sel delete; array unset sel;
> > array unset list2;A
> > array unset present;
> > for {set i 0} {$i < $all} {incr i} {
> > array unset hist1($i); A
> > array unset hist2($i);A A
> > array unset hist3($i); A A
> > array unset hist4($i);
> > }
> > array unset all;A
> > array unset hist_final;A
>
> > array unset counter;
> > array unset comebacks;
> >
#################################################################
> > #}
> > END
>
> --
> NIH Center for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> [4]http://www.ks.uiuc.edu/~johns/ Phone: [5]217-244-3349
> [6]http://www.ks.uiuc.edu/Research/vmd/
>
>
>
> References
>
> Visible links
> 1. http://www.kressworks.org/
> 2. https://www.facebook.com/KressWorks.Foundation/
> 3. mailto:johns_at_ks.uiuc.edu
> 4. http://www.ks.uiuc.edu/~johns/
> 5. tel:217-244-3349
> 6. http://www.ks.uiuc.edu/Research/vmd/

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/