Index: tests/regression/Fragmentation/FitPotential/pre/harmonic_homology.dat
===================================================================
--- tests/regression/Fragmentation/FitPotential/pre/harmonic_homology.dat	(revision 6550cffc4643c04ad39b40da4e480915e57ea95b)
+++ tests/regression/Fragmentation/FitPotential/pre/harmonic_homology.dat	(revision 6550cffc4643c04ad39b40da4e480915e57ea95b)
@@ -0,0 +1,57 @@
+22 serialization::archive 9 1 0
+0 0 0 11 0 0 0 1 0
+1 0 0 2 0 0 0 1 0
+2 1 1 2
+3 8 2 1 0 0 1 0 0 0 1 0
+4 0 0 1 8 2 0 1 1 0
+5 0 0 3 0 0 0 3 0 10.873483338283124 9.4486299428946161 10.576796358076235 8 3 0 12.332351801466054 9.4486299428946161 9.4656374767918265 1 3 0 9.4486299428946161 9.4486299428946161 9.4920936406319303 1 -75.984024061625931 0
+6 2 0
+7 1 1 2
+8 8 2 1 1 0
+9 1 8 2
+10 3 0 3 0 22.219398173710978 9.4486299428946161 10.571127180110498 8 3 0 23.663148828985278 9.4486299428946161 9.4713066547575622 1 3 0 20.794544778322472 9.4486299428946161 9.4864244626661947 1 -75.984257977502423 0
+11 2 0
+12 1 1 2
+13 8 2 1 1 0
+14 1 8 2
+15 3 0 3 0 33.535077393321572 9.4486299428946161 10.588134714007706 8 3 0 35.024181472321764 9.4486299428946161 9.4542991208603535 1 3 0 32.110223997933069 9.4486299428946161 9.5034319965634051 1 -75.98301820880279 0
+16 2 0
+17 1 1 2
+18 8 2 1 1 0
+19 1 8 2
+20 3 0 3 0 10.911277858054703 20.786985874368156 10.54845046824755 8 3 0 12.294557281694475 20.786985874368156 9.49398336662051 1 3 0 9.4864244626661947 20.786985874368156 9.4637477508032486 1 -75.983077848501296 0
+21 2 0
+22 1 1 2
+23 8 2 1 1 0
+24 1 8 2
+25 3 0 3 0 22.226957077665297 20.786985874368156 10.56545800214476 8 3 0 23.655589925030963 20.786985874368156 9.4769758327232996 1 3 0 20.802103682276787 20.786985874368156 9.480755284700459 1 -75.984295040494899 0
+26 2 0
+27 1 1 2
+28 8 2 1 1 0
+29 1 8 2
+30 3 0 3 0 33.52751848936726 20.786985874368156 10.593803891973444 8 3 0 35.031740376276083 20.786985874368156 9.4486299428946161 1 3 0 32.10266509397875 20.786985874368156 9.5091011745291425 1 -75.982270494371988 0
+31 2 0
+32 1 1 2
+33 8 2 1 1 0
+34 1 8 2
+35 3 0 3 0 10.903718954100386 32.125341805841693 10.554119646213286 8 3 0 12.30211618564879 32.125341805841693 9.4883141886547744 1 3 0 9.4788655587118793 32.125341805841693 9.4694169287689842 1 -75.983720685710665 0
+36 2 0
+37 1 1 2
+38 8 2 1 1 0
+39 1 8 2
+40 3 0 3 0 22.204280365802347 32.125341805841693 10.582465536041969 8 3 0 23.678266636893909 32.125341805841693 9.4599682988260909 1 3 0 20.779426970413841 32.125341805841693 9.4977628185976677 1 -75.983606637226501 0
+41 2 0
+42 1 1 2
+43 8 2 1 1 0
+44 1 8 2
+45 3 0 3 0 33.603107528910414 32.125341805841693 10.537112112316075 8 3 0 34.956151336732923 32.125341805841693 9.5053217225519848 1 3 0 32.178254133521904 32.125341805841693 9.4524093948717738 1 -75.980994221218239 0
+46 2 0
+47 1 1 2
+48 8 2 1 1 0
+49 1 8 2
+50 3 0 3 0 10.896160050146072 9.4486299428946161 21.898144755652563 8 3 0 12.309675089603106 9.4486299428946161 20.821000942162577 1 3 0 9.4713066547575622 9.4486299428946161 20.813442038208258 1 -75.984121009442191 0
+51 2 0
+52 1 1 2
+53 8 2 1 1 0
+54 1 8 2
+55 3 0 3 0 22.257192693482558 9.4486299428946161 21.881137221755353 8 3 0 23.625354309213701 9.4486299428946161 20.838008476059784 1 3 0 20.832339298094048 9.4486299428946161 20.796434504311051 1 -75.982175185883364 0
Index: tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at
===================================================================
--- tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at	(revision 791a1267512a1feef8dcf3d7a6835d27341ed0ef)
+++ tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at	(revision 6550cffc4643c04ad39b40da4e480915e57ea95b)
@@ -31,4 +31,19 @@
 # check parameters to printed precision
 AT_CHECK([grep "morse:.*particle_type1=8,.*particle_type2=1,.*spring_constant=1.27.*,.*equilibrium_distance=1.78.*,.*dissociation_energy=0.19.*;" stdout], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
+AT_SETUP([Fragmentation - Fit harmonic potential to water])
+AT_KEYWORDS([fragmentation parse-homologies fit-potential harmonic])
+AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
+
+file=harmonic_homology.dat
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Fragmentation/FitPotential/pre/$file $file], 0)
+AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder --parse-homologies $file --fit-potential --potential-type "harmonic_bond" --potential-charges 8 1 --fragment-charges 1 8 1 --set-threshold 1e-6], 0, [stdout], [ignore])
+# check that L_2 error is below 1e-6
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 1e-6) exit 1}'], 0, [ignore], [ignore])
+# check parameters to printed precision
+AT_CHECK([grep "harmonic_bond:.*particle_type1=8,.*particle_type2=1,.*spring_constant=0.29.*,.*equilibrium_distance=1.8.*;" stdout], 0, [ignore], [ignore])
 
 AT_CLEANUP
