@@ -293,24 +293,24 @@ def test_observed_structure_extraction_uses_one_connected_component():
293293 encoding = "utf-8" ,
294294 )
295295
296- def _restart_block (mol_id : int , partners : list [int ], coord ) -> list [str ]:
296+ def _restart_block (mol_id : int , iface_count : int , partners : list [int ], coord ) -> list [str ]:
297297 bound_iface_line = " " .join ([str (len (partners ))] + [str (i ) for i in range (len (partners ))])
298298 return [
299299 f"{ mol_id } 0 0 0 0" ,
300300 "1.0 0 0 0 0 0" ,
301301 f"{ coord [0 ]} { coord [1 ]} { coord [2 ]} " ,
302- "4 0 1 2 3" ,
302+ " " . join ([ str ( iface_count )] + [ str ( i ) for i in range ( iface_count )]) ,
303303 bound_iface_line ,
304304 " " .join ([str (len (partners ))] + [str (pid ) for pid in partners ]),
305- "4" ,
306- "0 0 0 0 \0 0" ,
307- "0.0 0.0 0.0" ,
308- "1 1 0 0 \0 0" ,
309- "0.0 0.0 0.0" ,
310- "2 2 0 0 \0 0" ,
311- "0.0 0.0 0.0" ,
312- "3 3 0 0 \0 0" ,
313- "0.0 0.0 0.0" ,
305+ str ( iface_count ) ,
306+ * [
307+ token
308+ for iface_idx in range ( iface_count )
309+ for token in (
310+ f" { iface_idx } { iface_idx } 0 0 \0 0" ,
311+ "0.0 0.0 0.0" ,
312+ )
313+ ] ,
314314 "0" ,
315315 "0" ,
316316 "0" ,
@@ -320,15 +320,19 @@ def _restart_block(mol_id: int, partners: list[int], coord) -> list[str]:
320320 ]
321321
322322 restart_lines = [
323+ "#MolTemplates" ,
324+ "0 A 4" ,
325+ "1 H 3" ,
326+ "2 L 2" ,
323327 "#All Molecules and coordinates" ,
324328 "6 6" ,
325329 ]
326- restart_lines .extend (_restart_block (0 , [1 , 2 ], (0.0 , 0.0 , 0.0 )))
327- restart_lines .extend (_restart_block (1 , [0 , 2 ], (1.0 , 0.0 , 0.0 )))
328- restart_lines .extend (_restart_block (2 , [0 , 1 ], (0.0 , 1.0 , 0.0 )))
329- restart_lines .extend (_restart_block (3 , [4 , 5 ], (10.0 , 10.0 , 0.0 )))
330- restart_lines .extend (_restart_block (4 , [3 , 5 ], (10.0 , 0.0 , 0.0 )))
331- restart_lines .extend (_restart_block (5 , [3 , 4 ], (10.0 , 11.0 , 0.0 )))
330+ restart_lines .extend (_restart_block (0 , 4 , [1 , 2 ], (0.0 , 0.0 , 0.0 )))
331+ restart_lines .extend (_restart_block (1 , 3 , [0 , 2 ], (1.0 , 0.0 , 0.0 )))
332+ restart_lines .extend (_restart_block (2 , 2 , [0 , 1 ], (0.0 , 1.0 , 0.0 )))
333+ restart_lines .extend (_restart_block (3 , 4 , [4 , 5 ], (10.0 , 10.0 , 0.0 )))
334+ restart_lines .extend (_restart_block (4 , 3 , [3 , 5 ], (10.0 , 0.0 , 0.0 )))
335+ restart_lines .extend (_restart_block (5 , 2 , [3 , 4 ], (10.0 , 11.0 , 0.0 )))
332336 restart_path .write_text ("\n " .join (restart_lines ), encoding = "utf-8" )
333337
334338 observed = _extract_observed_com_coordinates (
@@ -385,24 +389,24 @@ def test_restart_snapshot_search_falls_back_to_restart_directory():
385389 encoding = "utf-8" ,
386390 )
387391
388- def _restart_block (mol_id : int , partners : list [int ], coord ) -> list [str ]:
392+ def _restart_block (mol_id : int , iface_count : int , partners : list [int ], coord ) -> list [str ]:
389393 bound_iface_line = " " .join ([str (len (partners ))] + [str (i ) for i in range (len (partners ))])
390394 return [
391395 f"{ mol_id } 0 0 0 0" ,
392396 "1.0 0 0 0 0 0" ,
393397 f"{ coord [0 ]} { coord [1 ]} { coord [2 ]} " ,
394- "4 0 1 2 3" ,
398+ " " . join ([ str ( iface_count )] + [ str ( i ) for i in range ( iface_count )]) ,
395399 bound_iface_line ,
396400 " " .join ([str (len (partners ))] + [str (pid ) for pid in partners ]),
397- "4" ,
398- "0 0 0 0 \0 0" ,
399- "0.0 0.0 0.0" ,
400- "1 1 0 0 \0 0" ,
401- "0.0 0.0 0.0" ,
402- "2 2 0 0 \0 0" ,
403- "0.0 0.0 0.0" ,
404- "3 3 0 0 \0 0" ,
405- "0.0 0.0 0.0" ,
401+ str ( iface_count ) ,
402+ * [
403+ token
404+ for iface_idx in range ( iface_count )
405+ for token in (
406+ f" { iface_idx } { iface_idx } 0 0 \0 0" ,
407+ "0.0 0.0 0.0" ,
408+ )
409+ ] ,
406410 "0" ,
407411 "0" ,
408412 "0" ,
@@ -412,21 +416,29 @@ def _restart_block(mol_id: int, partners: list[int], coord) -> list[str]:
412416 ]
413417
414418 primary_lines = [
419+ "#MolTemplates" ,
420+ "0 A 4" ,
421+ "1 H 3" ,
422+ "2 L 2" ,
415423 "#All Molecules and coordinates" ,
416424 "3 3" ,
417425 ]
418- primary_lines .extend (_restart_block (0 , [], (10.0 , 0.0 , 0.0 )))
419- primary_lines .extend (_restart_block (1 , [], (20.0 , 0.0 , 0.0 )))
420- primary_lines .extend (_restart_block (2 , [], (30.0 , 0.0 , 0.0 )))
426+ primary_lines .extend (_restart_block (0 , 4 , [], (10.0 , 0.0 , 0.0 )))
427+ primary_lines .extend (_restart_block (1 , 3 , [], (20.0 , 0.0 , 0.0 )))
428+ primary_lines .extend (_restart_block (2 , 2 , [], (30.0 , 0.0 , 0.0 )))
421429 primary_restart_path .write_text ("\n " .join (primary_lines ), encoding = "utf-8" )
422430
423431 older_lines = [
432+ "#MolTemplates" ,
433+ "0 A 4" ,
434+ "1 H 3" ,
435+ "2 L 2" ,
424436 "#All Molecules and coordinates" ,
425437 "3 3" ,
426438 ]
427- older_lines .extend (_restart_block (0 , [1 , 2 ], (0.0 , 0.0 , 0.0 )))
428- older_lines .extend (_restart_block (1 , [0 , 2 ], (1.0 , 0.0 , 0.0 )))
429- older_lines .extend (_restart_block (2 , [0 , 1 ], (0.0 , 1.0 , 0.0 )))
439+ older_lines .extend (_restart_block (0 , 4 , [1 , 2 ], (0.0 , 0.0 , 0.0 )))
440+ older_lines .extend (_restart_block (1 , 3 , [0 , 2 ], (1.0 , 0.0 , 0.0 )))
441+ older_lines .extend (_restart_block (2 , 2 , [0 , 1 ], (0.0 , 1.0 , 0.0 )))
430442 older_restart_path .write_text ("\n " .join (older_lines ), encoding = "utf-8" )
431443
432444 observed , used_restart = _find_observed_com_coordinates_in_restart_snapshots (
0 commit comments