@@ -1338,7 +1338,7 @@ def order_fragments_by_constraints(fragments: List[List[int]],
13381338 Entries are atom index lists of all atoms in a fragment, each list represents a different fragment.
13391339 constraints_dict (dict, optional):
13401340 A dictionary of atom constraints. The function will try to find an atom order in which all constrained atoms
1341- are after the atoms they are constraint to.
1341+ are after the atoms they are constrained to.
13421342
13431343 Returns:
13441344 List[List[int]]: The ordered fragments list.
@@ -1378,7 +1378,7 @@ def get_atom_order(xyz: Optional[Dict[str, tuple]] = None,
13781378 Entries are atom index lists of all atoms in a fragment, each list represents a different fragment.
13791379 constraints_dict (dict, optional):
13801380 A dictionary of atom constraints. The function will try to find an atom order in which all constrained atoms
1381- are after the atoms they are constraint to.
1381+ are after the atoms they are constrained to.
13821382
13831383 Returns:
13841384 List[int]: The atom order, 0-indexed.
@@ -2356,3 +2356,30 @@ def check_ordered_zmats(zmat_1: dict,
23562356 bool: Whether the ZMats are ordered.
23572357 """
23582358 return zmat_1 ['symbols' ] == zmat_2 ['symbols' ] and zmat_1 ['vars' ].keys () == zmat_2 ['vars' ].keys ()
2359+
2360+
2361+ def update_zmat_by_xyz (zmat : dict ,
2362+ xyz : Dict [str , tuple ],
2363+ ) -> dict :
2364+ """
2365+ Update a zmat vars by xyz.
2366+
2367+ Args:
2368+ zmat (dict): The zmat to update.
2369+ xyz (dict): The xyz to update the zmat with.
2370+
2371+ Returns:
2372+ dict: The updated zmat.
2373+ """
2374+ zmat = {'symbols' : zmat ['symbols' ],
2375+ 'coords' : zmat ['coords' ],
2376+ 'vars' : zmat ['vars' ],
2377+ 'map' : zmat ['map' ],
2378+ }
2379+ new_vars = dict ()
2380+ for key , val in zmat ['vars' ].items ():
2381+ indices = get_atom_indices_from_zmat_parameter (key )[0 ]
2382+ indices = [zmat ['map' ][index ] for index in indices ]
2383+ new_vars [key ] = calculate_param (coords = xyz , atoms = indices )
2384+ zmat ['vars' ] = new_vars
2385+ return zmat
0 commit comments