Closed InfluenceFunctional closed 1 year ago
Minimal example
` #build one molecule in each space group and confirm molecules are not warped collater = Collater(None, None) mol_batch = collater([testcrystals[0] for in range(230)]) mol_batch.sg_ind = torch.arange(1, 231) for i in range(230): mol_batch.symmetry_operators[i] = supercell_builder.sym_ops[i + 1] mol_batch.mult[i] = len(mol_batch.symmetry_operators[i])
all_params = torch.ones((230, 12), dtype=torch.float32, device=supercell_builder.device) / 2
all_params[:, 3:6] = torch.pi / 2 # valid in most SGs
all_params[:, 0:3] *= 20
symmetries_dict = init_sym_info()
final_samples = clean_cell_params(all_params, mol_batch.sg_ind, modeller.lattice_means, modeller.lattice_stds,
symmetries_dict, supercell_builder.asym_unit_dict,
rescale_asymmetric_unit=False, destandardize=False, mode='hard')
all_sg_supercells, _ = supercell_builder.build_supercells(
molecule_data=mol_batch,
cell_parameters=final_samples,
align_to_standardized_orientation=False,
graph_convolution_cutoff=6,
supercell_size=1,
pare_to_convolution_cluster=True)
dmaxes = torch.zeros(230)
for ind in tqdm(range(all_sg_supercells.num_graphs)):
dists = get_intra_mol_dists(all_sg_supercells, ind) # assumes molecules are indexed sequentially in blocks
dmat = torch.zeros((len(dists), len(dists)))
for i in range(len(dists)):
for j in range(len(dists)):
if j > i:
dmat[i, j] = torch.abs(torch.mean(dists[i] - dists[j]))
dmaxes[ind] = dmat.amax()
assert dmaxes.amax() < 1e-3
`
Fixed - had 3/2pi instead of 2/3 pi for gamma in hex groups
Space groups 143-194 https://en.wikipedia.org/wiki/List_of_space_groups
Badly warp the molecules when building unit cells, oddly by a constant maximum factor of 0.26, and an average of 0.045 angstroms.