示例#1
0
    def __init__(self, atoms, scale=1.0, **parameters):
        for k, v in self.default_settings.items():
            setattr(self, k, parameters.pop(k, v))
        PlottingVariables.__init__(self, atoms, scale=scale, **parameters)
        constr = atoms.constraints
        self.constrainatoms = []
        for c in constr:
            if isinstance(c, FixAtoms):
                for n, i in enumerate(c.index):
                    self.constrainatoms += [i]

        self.material_styles_dict = {
            'simple':
            'finish {phong 0.7}',
            'pale':
            'finish {ambient 0.5 diffuse 0.85 roughness 0.001 specular 0.200 }',
            'intermediate':
            'finish {ambient 0.3 diffuse 0.6 specular 0.1 roughness 0.04}',
            'vmd':
            'finish {ambient 0.0 diffuse 0.65 phong 0.1 phong_size 40.0 specular 0.5 }',
            'jmol':
            'finish {ambient 0.2 diffuse 0.6 specular 1 roughness 0.001 metallic}',
            'ase2':
            'finish {ambient 0.05 brilliance 3 diffuse 0.6 metallic specular 0.7 roughness 0.04 reflection 0.15}',
            'ase3':
            'finish {ambient 0.15 brilliance 2 diffuse 0.6 metallic specular 1.0 roughness 0.001 reflection 0.0}',
            'glass':
            'finish {ambient 0.05 diffuse 0.3 specular 1.0 roughness 0.001}',
            'glass2':
            'finish {ambient 0.01 diffuse 0.3 specular 1.0 reflection 0.25 roughness 0.001}'
        }
示例#2
0
文件: pov.py 项目: arosen93/rASE
def write_pov(filename,
              atoms,
              generic_projection_settings=None,
              povray_settings=None,
              isosurface_data=None):

    if generic_projection_settings is None:
        generic_projection_settings = {}

    if povray_settings is None:
        povray_settings = {}

    pvars = PlottingVariables(atoms, scale=1.0, **generic_projection_settings)
    pov_obj = POVRAY.from_PlottingVariables(pvars, **povray_settings)

    if isinstance(isosurface_data, Mapping):
        pov_obj.isosurfaces = [
            POVRAYIsosurface.from_POVRAY(pov_obj, **isosurface_data)
        ]
    elif isinstance(isosurface_data, Sequence):
        pov_obj.isosurfaces = [
            POVRAYIsosurface.from_POVRAY(pov_obj, **isodata)
            for isodata in isosurface_data
        ]

    return pov_obj.write(filename)
示例#3
0
def write_pov(filename,
              atoms,
              *,
              povray_settings=None,
              isosurface_data=None,
              **generic_projection_settings):

    for name in ['run_povray', 'povray_path', 'stderr', 'extras']:
        pop_deprecated(generic_projection_settings, name)

    if povray_settings is None:
        povray_settings = {}

    pvars = PlottingVariables(atoms, scale=1.0, **generic_projection_settings)
    pov_obj = POVRAY.from_PlottingVariables(pvars, **povray_settings)

    if isinstance(isosurface_data, Mapping):
        pov_obj.isosurfaces = [
            POVRAYIsosurface.from_POVRAY(pov_obj, **isosurface_data)
        ]
    elif isinstance(isosurface_data, Sequence):
        pov_obj.isosurfaces = [
            POVRAYIsosurface.from_POVRAY(pov_obj, **isodata)
            for isodata in isosurface_data
        ]

    return pov_obj.write(filename)
示例#4
0
    def __init__(self,
                 atoms,
                 ax,
                 rotation='',
                 radii=None,
                 colors=None,
                 scale=1,
                 offset=(0, 0),
                 **parameters):
        PlottingVariables.__init__(self,
                                   atoms,
                                   rotation=rotation,
                                   radii=radii,
                                   colors=colors,
                                   scale=scale,
                                   extra_offset=offset,
                                   **parameters)

        self.ax = ax
        self.figure = ax.figure
        self.ax.set_aspect('equal')
示例#5
0
    def __init__(self,
                 atoms,
                 rotation='',
                 radii=None,
                 bbox=None,
                 colors=None,
                 scale=20,
                 maxwidth=500,
                 **kwargs):
        """Encapsulated PostScript writer.

        show_unit_cell: int
            0: Don't show unit cell (default).  1: Show unit cell.
            2: Show unit cell and make sure all of it is visible.
        """
        PlottingVariables.__init__(self,
                                   atoms,
                                   rotation=rotation,
                                   radii=radii,
                                   bbox=bbox,
                                   colors=colors,
                                   scale=scale,
                                   maxwidth=maxwidth,
                                   **kwargs)
示例#6
0
def write_pov(filename,
              atoms,
              generic_projection_settings={},
              povray_settings={},
              isosurface_data=None):

    if isinstance(atoms, list):
        assert len(atoms) == 1
        atoms = atoms[0]

    pvars = PlottingVariables(atoms, scale=1.0, **generic_projection_settings)
    pov_obj = POVRAY.from_PlottingVariables(pvars, **povray_settings)

    if type(isosurface_data) is dict:
        pov_obj.isosurfaces = [
            POVRAYIsosurface.from_POVRAY(pov_obj, **isosurface_data)
        ]
    elif type(isosurface_data) is list:
        pov_obj.isosurfaces = [
            POVRAYIsosurface.from_POVRAY(pov_obj, **isodata)
            for isodata in isosurface_data
        ]

    return pov_obj.write(filename)
示例#7
0
文件: pov.py 项目: arosen93/rASE
 def from_atoms(cls, atoms, **kwargs):
     return cls.from_plotting_variables(PlottingVariables(atoms, scale=1.0),
                                        **kwargs)