diff --git a/src/colvar/PathMSDBase.cpp b/src/colvar/PathMSDBase.cpp
index bc56ee1a03e7336ec3c4de275e66dc62e8229b73..6a7c6edfd3ac26ac1bb8c1826ed24e8ca9938598 100644
--- a/src/colvar/PathMSDBase.cpp
+++ b/src/colvar/PathMSDBase.cpp
@@ -66,10 +66,9 @@ nframes(0)
          RMSD mymsd; 
          do_read=mypdb.readFromFilepointer(fp,plumed.getAtoms().usingNaturalUnits(),0.1/atoms.getUnits().getLength());
          if(do_read){
-            unsigned nat=0;
             nframes++;
             if(mypdb.getAtomNumbers().size()==0) error("number of atoms in a frame should be more than zero");
-            if(nat==0) nat=mypdb.getAtomNumbers().size();
+            unsigned nat=mypdb.getAtomNumbers().size();
             if(nat!=mypdb.getAtomNumbers().size()) error("frames should have the same number of atoms");
             if(aaa.empty()) aaa=mypdb.getAtomNumbers();
             if(aaa!=mypdb.getAtomNumbers()) error("frames should contain same atoms in same order");
diff --git a/src/crystallization/OrientationSphere.cpp b/src/crystallization/OrientationSphere.cpp
index a5229d6a6381b91d12cacc7a6a0c4b70c6686892..393463214bd5bb5a18b895aa55ba00c9cdf3b697 100644
--- a/src/crystallization/OrientationSphere.cpp
+++ b/src/crystallization/OrientationSphere.cpp
@@ -67,7 +67,7 @@ MultiColvarFunction(ao)
 }
 
 double OrientationSphere::compute( const unsigned& tindex, multicolvar::AtomValuePack& myatoms ) const {
-   double d2, sw, value=0, denom=0, dot, f_dot, dot_df, dfunc; Vector ddistance;
+   double d2, sw, value=0, denom=0, dfunc; Vector ddistance;
    unsigned ncomponents=getBaseMultiColvar(0)->getNumberOfQuantities();
    std::vector<double> catom_orient( ncomponents ), this_orient( ncomponents );
    std::vector<double> this_der( ncomponents ), catom_der( ncomponents );