https://chat.openai.com/share/b0a3ca0b-01ab-4469-a965-b54b4a3fed3d
which essentially tells me to look at the source code
Computational Crystallography Toolbox / Code / [r25775] /trunk/cctbx/development/random_structure.py (sourceforge.net)
go to line 344, it uses space_group_info.any_compatible_unit_cell(volume=1000)
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.pyI 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 <dgwaterman@gmail.com> wrote: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
cctbxbb@phenix-online.org
http://phenix-online.org/mailman/listinfo/cctbxbb
cctbxbb mailing list
cctbxbb@phenix-online.org
http://phenix-online.org/mailman/listinfo/cctbxbb