diff --git a/src/reference/MultiDomainRMSD.cpp b/src/reference/MultiDomainRMSD.cpp
index b3961a61c24af8c3efece49c29c329850ee666fd..1c35290c6a0f877e4e91af2a1b86957d5a1db9c2 100644
--- a/src/reference/MultiDomainRMSD.cpp
+++ b/src/reference/MultiDomainRMSD.cpp
@@ -35,10 +35,6 @@ MultiDomainRMSD::MultiDomainRMSD( const ReferenceConfigurationOptions& ro ):
 {
 }
 
-MultiDomainRMSD::~MultiDomainRMSD() {
-  for(unsigned i=0; i<domains.size(); ++i) delete domains[i];
-}
-
 void MultiDomainRMSD::read( const PDB& pdb ) {
   unsigned nblocks =  pdb.getNumberOfAtomBlocks();
   if( nblocks<2 ) error("multidomain RMSD only has one block of atoms");
@@ -60,7 +56,7 @@ void MultiDomainRMSD::read( const PDB& pdb ) {
       parse("UPPER_CUTOFF"+num,upper,true);
       nopbc=false; parseFlag("NOPBC"+num,nopbc);
     }
-    domains.push_back( metricRegister().create<SingleDomainRMSD>( ftype ) );
+    domains.emplace_back( metricRegister().create<SingleDomainRMSD>( ftype ) );
     positions.resize( blocks[i] - blocks[i-1] );
     align.resize( blocks[i] - blocks[i-1] );
     displace.resize( blocks[i] - blocks[i-1] );
diff --git a/src/reference/MultiDomainRMSD.h b/src/reference/MultiDomainRMSD.h
index 5207da6085a36b70e020ef84cb3bf4e875c02560..66b2f9cfb0db978b1d6a191d81bb422f8154ddcf 100644
--- a/src/reference/MultiDomainRMSD.h
+++ b/src/reference/MultiDomainRMSD.h
@@ -37,10 +37,9 @@ private:
 /// Blocks containing start and end points for all the domains
   std::vector<unsigned> blocks;
 /// Each of the domains we are calculating the distance from
-  std::vector<SingleDomainRMSD*> domains;
+  std::vector<std::unique_ptr<SingleDomainRMSD>> domains;
 public:
   explicit MultiDomainRMSD( const ReferenceConfigurationOptions& ro );
-  ~MultiDomainRMSD();
 /// Read in the input from a pdb
   void read( const PDB& );
 /// Set the input from an analysis object (don't know how this will work yet so currently just a plumed_error)