Index: /trunk/packages/vizservers/vtkvis/Molecule.cpp
===================================================================
--- /trunk/packages/vizservers/vtkvis/Molecule.cpp	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/Molecule.cpp	(revision 3693)
@@ -242,10 +242,12 @@
 
             // Atoms
-            vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New();
-            sphereSource->SetRadius(1.0);
-            sphereSource->SetThetaResolution(14);
-            sphereSource->SetPhiResolution(14);
-
-            _atomMapper->SetSourceConnection(sphereSource->GetOutputPort());
+            if (_sphereSource == NULL) {
+                _sphereSource = vtkSmartPointer<vtkSphereSource>::New();
+                _sphereSource->SetRadius(1.0);
+                _sphereSource->SetThetaResolution(14);
+                _sphereSource->SetPhiResolution(14);
+            }
+
+            _atomMapper->SetSourceConnection(_sphereSource->GetOutputPort());
 #ifdef USE_VTK6
             _atomMapper->SetInputData(pd);
@@ -662,4 +664,45 @@
 }
 
+void Molecule::setAtomQuality(double quality)
+{
+    if (_sphereSource == NULL)
+        return;
+
+    if (quality > 10.0)
+        quality = 10.0;
+
+    int thetaRes = (int)(quality * 14.0);
+    int phiRes = (int)(quality * 14.0);
+    if (thetaRes < 4) thetaRes = 4;
+    if (phiRes < 3) phiRes = 3;
+
+    _sphereSource->SetThetaResolution(thetaRes);
+    _sphereSource->SetPhiResolution(phiRes);
+
+    if (_atomMapper != NULL) {
+        _atomMapper->Modified();
+        _atomMapper->Update();
+    }
+}
+
+void Molecule::setBondQuality(double quality)
+{
+    if (_cylinderSource == NULL)
+        return;
+
+    if (quality > 10.0)
+        quality = 10.0;
+
+    int res = (int)(quality * 12.0);
+    if (res < 3) res = 3;
+
+    _cylinderSource->SetResolution(res);
+
+    if (_bondMapper != NULL) {
+        _bondMapper->Modified();
+        _bondMapper->Update();
+    }
+}
+
 void Molecule::setBondStyle(BondStyle style)
 {
Index: /trunk/packages/vizservers/vtkvis/Molecule.h
===================================================================
--- /trunk/packages/vizservers/vtkvis/Molecule.h	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/Molecule.h	(revision 3693)
@@ -17,4 +17,5 @@
 #include <vtkGlyph3DMapper.h>
 #include <vtkTransformPolyDataFilter.h>
+#include <vtkSphereSource.h>
 #include <vtkCylinderSource.h>
 #include <vtkLineSource.h>
@@ -128,4 +129,8 @@
     void setBondColorMode(BondColorMode mode);
 
+    void setAtomQuality(double quality);
+
+    void setBondQuality(double quality);
+
     static ColorMap *createElementColorMap();
 
@@ -157,4 +162,5 @@
     vtkSmartPointer<vtkActor> _bondProp;
     vtkSmartPointer<vtkActor2D> _labelProp;
+    vtkSmartPointer<vtkSphereSource> _sphereSource;
     vtkSmartPointer<vtkPolyData> _bondPD;
     vtkSmartPointer<vtkCylinderSource> _cylinderSource;
Index: /trunk/packages/vizservers/vtkvis/Renderer.h
===================================================================
--- /trunk/packages/vizservers/vtkvis/Renderer.h	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/Renderer.h	(revision 3693)
@@ -742,4 +742,8 @@
     // Molecules
 
+    void setMoleculeAtomQuality(const DataSetId& id, double quality);
+
+    void setMoleculeBondQuality(const DataSetId& id, double quality);
+
     void setMoleculeAtomRadiusScale(const DataSetId& id, double scale);
 
Index: /trunk/packages/vizservers/vtkvis/RendererCmd.cpp
===================================================================
--- /trunk/packages/vizservers/vtkvis/RendererCmd.cpp	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/RendererCmd.cpp	(revision 3693)
@@ -7332,4 +7332,21 @@
 
 static int
+MoleculeAtomQualityOp(ClientData clientData, Tcl_Interp *interp, int objc, 
+                      Tcl_Obj *const *objv)
+{
+    double quality;
+    if (Tcl_GetDoubleFromObj(interp, objv[2], &quality) != TCL_OK) {
+        return TCL_ERROR;
+    }
+    if (objc == 4) {
+        const char *name = Tcl_GetString(objv[3]);
+        g_renderer->setMoleculeAtomQuality(name, quality);
+    } else {
+        g_renderer->setMoleculeAtomQuality("all", quality);
+    }
+    return TCL_OK;
+}
+
+static int
 MoleculeAtomScaleFactorOp(ClientData clientData, Tcl_Interp *interp, int objc, 
                           Tcl_Obj *const *objv)
@@ -7415,4 +7432,21 @@
     } else {
         g_renderer->setMoleculeBondColor("all", color);
+    }
+    return TCL_OK;
+}
+
+static int
+MoleculeBondQualityOp(ClientData clientData, Tcl_Interp *interp, int objc, 
+                      Tcl_Obj *const *objv)
+{
+    double quality;
+    if (Tcl_GetDoubleFromObj(interp, objv[2], &quality) != TCL_OK) {
+        return TCL_ERROR;
+    }
+    if (objc == 4) {
+        const char *name = Tcl_GetString(objv[3]);
+        g_renderer->setMoleculeBondQuality(name, quality);
+    } else {
+        g_renderer->setMoleculeBondQuality("all", quality);
     }
     return TCL_OK;
@@ -7747,4 +7781,5 @@
 static Rappture::CmdSpec moleculeOps[] = {
     {"add",          2, MoleculeAddOp, 2, 3, "?dataSetName?"},
+    {"aquality",     2, MoleculeAtomQualityOp, 3, 4, "value ?dataSetName?"},
     {"ascale",       2, MoleculeAtomScaleFactorOp, 3, 4, "value ?dataSetName?"},
     {"atoms",        2, MoleculeAtomVisibilityOp, 3, 4, "bool ?dataSetName?"},
@@ -7752,4 +7787,5 @@
     {"bcolor",       3, MoleculeBondColorOp, 5, 6, "r g b ?dataSetName?"},
     {"bonds",        2, MoleculeBondVisibilityOp, 3, 4, "bool ?dataSetName?"},
+    {"bquality",     2, MoleculeBondQualityOp, 3, 4, "value ?dataSetName?"},
     {"bscale",       3, MoleculeBondScaleFactorOp, 3, 4, "value ?dataSetName?"},
     {"bstyle",       3, MoleculeBondStyleOp, 3, 4, "value ?dataSetName?"},
Index: /trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp
===================================================================
--- /trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp	(revision 3693)
@@ -2269,4 +2269,66 @@
 
 /**
+ * \brief Set atom sphere resolution
+ */
+void Renderer::setMoleculeAtomQuality(const DataSetId& id, double quality)
+{
+    MoleculeHashmap::iterator itr;
+
+    bool doAll = false;
+
+    if (id.compare("all") == 0) {
+        itr = _molecules.begin();
+        if (itr == _molecules.end())
+            return;
+        doAll = true;
+    } else {
+        itr = _molecules.find(id);
+    }
+    if (itr == _molecules.end()) {
+        ERROR("Molecule not found: %s", id.c_str());
+        return;
+    }
+
+    do {
+        itr->second->setAtomQuality(quality);
+    } while (doAll && ++itr != _molecules.end());
+
+    sceneBoundsChanged();
+    _needsRedraw = true;
+}
+
+
+/**
+ * \brief Set bond cylinder resolution
+ */
+void Renderer::setMoleculeBondQuality(const DataSetId& id, double quality)
+{
+    MoleculeHashmap::iterator itr;
+
+    bool doAll = false;
+
+    if (id.compare("all") == 0) {
+        itr = _molecules.begin();
+        if (itr == _molecules.end())
+            return;
+        doAll = true;
+    } else {
+        itr = _molecules.find(id);
+    }
+    if (itr == _molecules.end()) {
+        ERROR("Molecule not found: %s", id.c_str());
+        return;
+    }
+
+    do {
+        itr->second->setBondQuality(quality);
+    } while (doAll && ++itr != _molecules.end());
+
+    sceneBoundsChanged();
+    _needsRedraw = true;
+}
+
+
+/**
  * \brief Set radius scale factor for atoms
  */
@@ -3020,4 +3082,5 @@
  * \param[in] data Bytes of VTK DataSet file
  * \param[in] nbytes Length of data array
+ * \param[in] maxPoints Maximum number of points to be used as seeds
  *
  * \return boolean indicating success or failure
Index: /trunk/packages/vizservers/vtkvis/Streamlines.cpp
===================================================================
--- /trunk/packages/vizservers/vtkvis/Streamlines.cpp	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/Streamlines.cpp	(revision 3693)
@@ -706,4 +706,5 @@
  *
  * \param[in] seed vtkDataSet with points to use as seeds
+ * \param[in] maxPoints Maximum number of points to be used as seeds
  */
 void Streamlines::setSeedToMeshPoints(vtkDataSet *seed, int maxPoints)
Index: /trunk/packages/vizservers/vtkvis/protocol.txt
===================================================================
--- /trunk/packages/vizservers/vtkvis/protocol.txt	(revision 3692)
+++ /trunk/packages/vizservers/vtkvis/protocol.txt	(revision 3693)
@@ -591,8 +591,10 @@
 
 molecule add <?datasetName?>
+molecule aquality <val> <?datasetName?>
+         Set atom sphere resolution quality val=[0,10], 1 is default
+molecule ascale <val> <?datasetName?>
+         Set atom scale factor
 molecule atoms <bool> <?datasetName?>
          Toggle rendering of atoms
-molecule ascale <val> <?datasetName?>
-         Set atom scale factor
 molecule bcmode <by_elements|constant> <?datasetName?>
          Set bond color mode
@@ -601,4 +603,6 @@
 molecule bonds <bool> <?datasetName?>
          Toggle rendering of bonds
+molecule bquality <val> <?datasetName?>
+         Set bond cylinder resolution quality val=[0,10], 1 is default
 molecule bscale <val> <?datasetName?>
          Set bond scale factor
