@@ -1127,8 +1127,14 @@ def _check_restart(self):
11271127 _logger .error (msg )
11281128 raise ValueError (msg )
11291129 else :
1130+ if self ._config .gcmc :
1131+ num_gcmc_waters = self ._config .gcmc_num_waters
1132+ else :
1133+ num_gcmc_waters = 0
11301134 # Check the system is the same as the reference system.
1131- are_same , reason = self ._systems_are_same (self ._system , system )
1135+ are_same , reason = self ._systems_are_same (
1136+ self ._system , system , num_gcmc_waters = num_gcmc_waters
1137+ )
11321138 if not are_same :
11331139 raise ValueError (
11341140 f"Checkpoint file does not match system for the following reason: { reason } ."
@@ -1313,7 +1319,7 @@ def get_last_config(output_directory):
13131319 self ._compare_configs (self ._last_config , config )
13141320
13151321 @staticmethod
1316- def _systems_are_same (system0 , system1 ):
1322+ def _systems_are_same (system0 , system1 , num_gcmc_waters = 0 ):
13171323 """
13181324 Check for equivalence between a pair of sire systems.
13191325
@@ -1326,6 +1332,9 @@ def _systems_are_same(system0, system1):
13261332 system1: sire.system.System
13271333 The second system to be compared.
13281334
1335+ num_gcmc_waters: int
1336+ The number of GCMC ghost waters to ignore in the comparison.
1337+
13291338 Returns
13301339 -------
13311340
@@ -1337,18 +1346,25 @@ def _systems_are_same(system0, system1):
13371346 if not isinstance (system1 , _System ):
13381347 raise TypeError ("'system1' must be of type 'sire.system.System'" )
13391348
1349+ try :
1350+ num_point = system0 ["water" ].molecules ()[0 ].num_atoms ()
1351+ except :
1352+ num_point = 0
1353+
13401354 # Check for matching number of molecules.
1341- if not len (system0 .molecules ()) == len (system1 .molecules ()):
1355+ if not len (system0 .molecules ()) == len (system1 .molecules ()) - num_gcmc_waters :
13421356 reason = "number of molecules do not match"
13431357 return False , reason
13441358
13451359 # Check for matching number of residues.
1346- if not len (system0 .residues ()) == len (system1 .residues ()):
1360+ if not len (system0 .residues ()) == len (system1 .residues ()) - num_gcmc_waters :
13471361 reason = "number of residues do not match"
13481362 return False , reason
13491363
13501364 # Check for matching number of atoms.
1351- if not len (system0 .atoms ()) == len (system1 .atoms ()):
1365+ if not len (system0 .atoms ()) == len (system1 .atoms ()) - (
1366+ num_gcmc_waters * num_point
1367+ ):
13521368 reason = "number of atoms do not match"
13531369 return False , reason
13541370
0 commit comments