def do(self): # Get the molecular graph of the molecule in the selection parent = context.application.cache.node graph = create_molecular_graph([parent], parent) if graph.molecule.size == 0: raise UserError("Could not get molecular graph.", "Make sure that the selected frame contains a molecule.") # Guessed and original geometry opt_coords = guess_geometry(graph).coordinates org_coords = graph.molecule.coordinates coords_to_zeobuilder(org_coords, opt_coords, graph.molecule.atoms, parent)
def do(self): # Get the molecular graph of the molecule in the selection parent = context.application.cache.node graph = create_molecular_graph([parent], parent) if graph.molecule.size == 0: raise UserError("Could not get molecular graph.", "Make sure that the selected frame contains a molecule.") # Guessed and original geometry unitcell = context.application.model.universe.cell unitcell_reciproke = context.application.model.universe.cell_reciproke unitcell_active = context.application.model.universe.cell_active # not entirely sure where to set this in zeobuilder opt_coords = guess_geometry(graph, unitcell_active, unitcell, unitcell_reciproke).coordinates org_coords = graph.molecule.coordinates coords_to_zeobuilder(org_coords, opt_coords, graph.molecule.atoms, parent, graph)
def test_guess_geometry(self): for input_mol in self.iter_molecules(allow_multi=False): output_mol = guess_geometry(input_mol.graph) output_mol.title = input_mol.title output_mol.write_to_file("output/guess_%s.xyz" % input_mol.title)