def run_transformation(structure, params):
    """
    This method performs a transformation on the currently selected structure in avogadro, using
    any passed dialog parameters as needed.

    returns a tuple of (status, results) where status = 0 for success, 64 for failure, and the
    results equal a dictionary of the terms to be returned across stdout.
    """

    fg = FullereneGenerator(N=params['N'])

    structure["atoms"]["elements"]["number"] =  [ a.Z for a in fg.atoms ]
    structure["atoms"]["coords"]["3d"] = [ c for a in fg.atoms for c in (a.x, a.y, a.z) ]
    atoms = [ (a.x, a.y, a.z, a.Z) for a in fg.atoms ]

    # put together result information
    # note that you can return a message for display, if there was a result to report or an error.
    results = {
        'message_type': None,
        'message': None,
        'cjson': structure,
    }

    status = 0 # success!
    # status = 64 # fail :(

    return (status, results)
 def test2(self):
     C70 = FullereneGenerator(N=70)
     C70.save()
     self.tmpdata.append(C70.fname)
     C70.save(structure_format='data')
     self.tmpdata.append(C70.fname)
Beispiel #3
0
 def test2(self):
     C70 = FullereneGenerator(N=70)
     C70.save()
     self.tmpdata.append(C70.fname)
     C70.save(structure_format='data')
     self.tmpdata.append(C70.fname)
 def test1(self):
     buckyball = FullereneGenerator()
     buckyball.save(fname='buckyball.xyz')
     self.tmpdata.append(buckyball.fname)
     buckyball.save(fname='buckyball.data')
     self.tmpdata.append(buckyball.fname)
Beispiel #5
0
 def test1(self):
     buckyball = FullereneGenerator()
     buckyball.save(fname='buckyball.xyz')
     self.tmpdata.append(buckyball.fname)
     buckyball.save(fname='buckyball.data')
     self.tmpdata.append(buckyball.fname)