Index: tests/regression/Fragmentation/FitPotential/pre/improper_homology.dat
===================================================================
--- tests/regression/Fragmentation/FitPotential/pre/improper_homology.dat	(revision ff90e3b5105b9e17f01d56ddedd8e895bf4d529a)
+++ tests/regression/Fragmentation/FitPotential/pre/improper_homology.dat	(revision ff90e3b5105b9e17f01d56ddedd8e895bf4d529a)
@@ -0,0 +1,105 @@
+22 serialization::archive 9 1 0
+0 0 0 21 0 0 0 1 0
+1 0 0 2 0 0 0 1 0
+2 1 1 3
+3 7 3 1 0 0 1 0 0 0 1 0
+4 0 0 1 7 3 0 1 1 0
+5 0 0 4 0 0 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.5210064482571877 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.157944387635766 0
+6 2 0
+7 1 1 3
+8 7 3 1 1 0
+9 1 7 3
+10 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.9934379454019187 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.164081218824769 0
+11 2 0
+12 1 1 3
+13 7 3 1 1 0
+14 1 7 3
+15 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.7099790471150822 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.16047162164682 0
+16 2 0
+17 1 1 3
+18 7 3 1 1 0
+19 1 7 3
+20 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.8044653465440277 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.162173512589902 0
+21 2 0
+22 1 1 3
+23 7 3 1 1 0
+24 1 7 3
+25 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.938300939691381 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.051628364011364 0
+26 2 0
+27 1 1 3
+28 7 3 1 1 0
+29 1 7 3
+30 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.4265201488282422 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.157723505511044 0
+31 2 0
+32 1 1 3
+33 7 3 1 1 0
+34 1 7 3
+35 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 11.032787239120328 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.028836195703825 0
+36 2 0
+37 1 1 3
+38 7 3 1 1 0
+39 1 7 3
+40 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.6154927476861349 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.158935955306269 0
+41 2 0
+42 1 1 3
+43 7 3 1 1 0
+44 1 7 3
+45 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.182410544259813 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.160487750165842 0
+46 2 0
+47 1 1 3
+48 7 3 1 1 0
+49 1 7 3
+50 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.3320338493992967 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.158322368121148 0
+51 2 0
+52 1 1 3
+53 7 3 1 1 0
+54 1 7 3
+55 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.8989516459729732 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.163556092564079 0
+56 2 0
+57 1 1 3
+58 7 3 1 1 0
+59 1 7 3
+60 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 11.127273538549273 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.004935817092139 0
+61 2 0
+62 1 1 3
+63 7 3 1 1 0
+64 1 7 3
+65 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.560355741975597 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.125290745494908 0
+66 2 0
+67 1 1 3
+68 7 3 1 1 0
+69 1 7 3
+70 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.74932834083349 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.092564810822097 0
+71 2 0
+72 1 1 3
+73 7 3 1 1 0
+74 1 7 3
+75 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.654842041404542 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.110087245014626 0
+76 2 0
+77 1 1 3
+78 7 3 1 1 0
+79 1 7 3
+80 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.843814640262435 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.072979011325799 0
+81 2 0
+82 1 1 3
+83 7 3 1 1 0
+84 1 7 3
+85 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.46586944254665 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.137983510144288 0
+86 2 0
+87 1 1 3
+88 7 3 1 1 0
+89 1 7 3
+90 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.371383143117704 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.148059595963296 0
+91 2 0
+92 1 1 3
+93 7 3 1 1 0
+94 1 7 3
+95 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 9.2375475499703512 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.159606831661378 0
+96 2 0
+97 1 1 3
+98 7 3 1 1 0
+99 1 7 3
+100 4 0 3 0 10.986545644179802 12.112387696395468 9.4486299428946161 1 3 0 12.524461345464985 9.4486299428946161 9.4486299428946161 1 3 0 10.986545644179802 10.336555493148195 10.087924244830866 7 3 0 9.4486299428946161 9.4486299428946161 9.4486299428946161 1 -56.163216433825362 0
+101 1 0
+102 7 0 1 0 0
+103 1 0 3 0 10.986545644179802 10.336555493148195 10.276896843688759 7 -53.746780657300775 0
Index: tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at
===================================================================
--- tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at	(revision e2037e5d443e6ac456d3cbf14b2e4127a4bbd7a6)
+++ tests/regression/Fragmentation/FitPotential/testsuite-fragmentation-fit-potential.at	(revision ff90e3b5105b9e17f01d56ddedd8e895bf4d529a)
@@ -63,4 +63,20 @@
 AT_CLEANUP
 
+AT_SETUP([Fragmentation - Fit improper potential to ammonia])
+AT_KEYWORDS([fragmentation parse-homologies fit-potential improper])
+AT_XFAIL_IF([/bin/true])
+AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
+
+file=improper_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 "improper" --potential-charges 1 7 1 1 --fragment-charges 7 1 1 1 --set-threshold 3e-4], 0, [stdout], [ignore])
+# check that L_2 error is below 3e-4
+AT_CHECK([grep "Best parameters with L2 error" stdout | awk '{if ($8 > 3e-4) exit 1}'], 0, [ignore], [ignore])
+# check parameters to printed precision
+AT_CHECK([grep "improper:.*particle_type1=1,.*particle_type2=1,.*particle_type3=7,.*particle_type4=1,.*spring_constant=1.02.*,.*equilibrium_distance=0.85.*;" stdout], 0, [ignore], [ignore])
+
+AT_CLEANUP
+
 AT_SETUP([Fragmentation - Fit LJ potential to argon])
 AT_KEYWORDS([fragmentation parse-homologies fit-potential lennardjones])
