Hi David, there is a constraints object that tells you which elements of the metrical matrix can be varied:
from cctbx.sgtbx import space_group_info sg = space_group_info('P4').group() c = sg.adp_constraints() c.independent_indices (1, 2)
This means elements 1 and 2 of the metrical matrix are independent and can be varied. So you could randomly vary those elements of the metrical matrix. Say here we pick (25,100). Then to convert those back to a unit cell:
from cctbx.uctbx import unit_cell uc = unit_cell(metrical_matrix=c.all_params(independent_params=(25,100))) print(uc) (5, 5, 10, 90, 90, 90)
This code is part of symmetrize_reduce_enlarge in
./rstbx/symmetry/constraints/parameter_reduction.py
I would presume this works for any space group. Is this along the lines
you were looking for?
-Aaron
On Fri, Sep 15, 2023 at 11:59 AM David Waterman
Hi folks,
I'm testing some code changes and would like to iterate over every space group and for each generate a random unit cell compatible with the Bravais symmetry. I've got the iteration sorted with space_group_symbol_iterator, but I'm not sure how best to generate some compatible unit cell from the space_group object. Is this something I could do easily with cctbx?
Cheers, -- David _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb