Example #1
0
    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 = tune_geometry(graph, graph.molecule).coordinates
        org_coords = graph.molecule.coordinates

        coords_to_zeobuilder(org_coords, opt_coords, graph.molecule.atoms, parent)
Example #2
0
 def test_example_periodic(self):
     mol = Molecule.from_file("input/caplayer.cml")
     unit_cell = UnitCell(
         numpy.array([
             [14.218,  7.109,  0.0],
             [ 0.0  , 12.313,  0.0],
             [ 0.0  ,  0.0  , 10.0],
         ])*angstrom,
         numpy.array([True, True, False]),
     )
     dm = mol.distance_matrix
     dm = dm + dm.max()*numpy.identity(len(dm))
     mol = tune_geometry(mol.graph, mol, unit_cell)
     mol.write_to_file("output/caplayer.xyz")
Example #3
0
 def test_tune_geometry(self):
     for input_mol in self.iter_molecules(allow_multi=False):
         output_mol = tune_geometry(input_mol.graph, input_mol)
         output_mol.title = input_mol.title
         output_mol.write_to_file("output/tune_%s.xyz" % input_mol.title)