Index: tests/GuiChecks/Potential/FitPartialCharges/testsuite-potential-fit-partial-charges.at
===================================================================
--- tests/GuiChecks/Potential/FitPartialCharges/testsuite-potential-fit-partial-charges.at	(revision af340c21b5447cefb53f0abf8de5efbe586d4b7b)
+++ tests/GuiChecks/Potential/FitPartialCharges/testsuite-potential-fit-partial-charges.at	(revision d50b9151219b75020931486afa73b2b92312849b)
@@ -18,20 +18,41 @@
 ### fit partial particle charges
 
-# the potential has been generated by:
-# ./molecuilder -i pre/water.pdb --center-in-box "8,0,8,0,0,8" --select-all-atoms --fragment-molecule BondFragment --distance 2 --order 1 --fragment-automation --server-address 127.0.0.1 --server-port 1026 --DoLongrange 1 --grid 4 --DoPrintDebug 1 --DoValenceOnly 0 --analyse-fragment-results --store-grids 1 --save-homologies homology_grid_4_full.dat
+AT_SETUP([Potential - Fit partial charges - atomfragment check])
+AT_KEYWORDS([potential parse-homologies fit-partial-charges save-particle-parameters])
+AT_SKIP_IF([../../molecuilder --help fit-partial-charges; if test $? -eq 5; then /bin/true; else /bin/false; fi])
+
+input=water.pdb
+homologyfile=homology_grid.dat
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/pre/$input $input], 0)
+AT_CHECK([chmod u+w $input], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/pre/$homologyfile $homologyfile], 0)
+AT_CHECK([chmod u+w $homologyfile], 0, [ignore], [ignore])
+# fails because atomFragments has not been parsed
+AT_CHECK([../../molecuilder --dry-run -l $input --select-all-atoms --parse-homologies $homologyfile --fit-partial-charges --radius 1.5 --save-particle-parameters water.particles --no-dry-run --store-session session-potential-fit-partial-charges.py --session-type python], 0, [stdout], [ignore])
+AT_CHECK([grep -v "Command.*DryRun" session-potential-fit-partial-charges.py >session-potential-fit-partial-charges_new.py], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilderguitest session-potential-fit-partial-charges_new.py], 5, [stdout], [ignore])
+
+AT_CLEANUP
 
 AT_SETUP([Potential - Fit partial charges to water])
-AT_KEYWORDS([potential parse-homologies fit-partial-charges])
+AT_KEYWORDS([potential parse-homologies fit-partial-charges save-particle-parameters])
 AT_SKIP_IF([../../molecuilder --help fit-partial-charges; if test $? -eq 5; then /bin/true; else /bin/false; fi])
 
 # homology file created with water.pdb and as follows:
-# molecuilder -i water.pdb --select-all-atoms --fragment-molecule --distance 2 --order 1 --fragment-automation --server-address 127.0.0.1 --server-port 1026 --DoLongrange 1 --grid 5 --store-grids 1 --analyse-fragment-results --save-homologies homology_grid.dat
-file=homology_grid.dat
-AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/pre/$file $file], 0)
-AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
-AT_CHECK([../../molecuilder --dry-run --parse-homologies $file --fit-partial-charges --fragment-charges 8 1 1 --radius 1.5 --no-dry-run --store-session session-potential-fit-partial-charges.py --session-type python], 0, [stdout], [ignore])
+# molecuilder -i water.pdb --select-all-atoms --fragment-molecule --distance 2 --order 1 --fragment-automation --server-address 127.0.0.1 --server-port 1026 --DoLongrange 1 --grid 5 --store-grids 1 --analyse-fragment-results --save-homologies homology_grid.dat --save-atom-fragments atomfragments.dat
+input=water.pdb
+homologyfile=homology_grid.dat
+atomfragmentsfile=atomfragments.dat
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/pre/$input $input], 0)
+AT_CHECK([chmod u+w $input], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/pre/$homologyfile $homologyfile], 0)
+AT_CHECK([chmod u+w $homologyfile], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/pre/$atomfragmentsfile $atomfragmentsfile], 0)
+AT_CHECK([chmod u+w $atomfragmentsfile], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder --dry-run -l $input --select-all-atoms --parse-homologies $homologyfile --parse-atom-fragments $atomfragmentsfile --fit-partial-charges --radius 1.5 --save-particle-parameters water.particles --no-dry-run --store-session session-potential-fit-partial-charges.py --session-type python], 0, [stdout], [ignore])
 AT_CHECK([grep -v "Command.*DryRun" session-potential-fit-partial-charges.py >session-potential-fit-partial-charges_new.py], 0, [ignore], [ignore])
 AT_CHECK([../../molecuilderguitest session-potential-fit-partial-charges_new.py], 0, [stdout], [ignore])
 # check that L_2 error is below 1e-6
+AT_CHECK([diff water.particles ${abs_top_srcdir}/tests/regression/Potential/FitPartialCharges/post/water.particles], 0)
 
 AT_CLEANUP
