def runAlign():
	# -----------------------------------------------------------------------------
	### set files
	#maindir = '/ami/data16/appion/09mar04b/models/emanmodel28'
	default_settings.set('limit_voxel_count', False)
	maindir = '/home/vossman/Documents/papers/initmodel/initmodels-figure'
	map1_path = os.path.join(maindir, 'reconemdb.mrc')

	map1 = open_volume_file(map1_path)[0]
	map1.set_parameters(surface_levels = [1.0])
	mrcfiles = glob.glob(os.path.join(maindir, '*.mrc'))
	aligndir = os.path.join(maindir, 'align/')
	if not os.path.isdir(aligndir):
		os.mkdir(aligndir)
	N = len(mrcfiles)
	random.shuffle(mrcfiles)
	for i,mrcfile in enumerate(mrcfiles):
		if os.path.basename(mrcfile)[:5] == "align":
			continue
		new_path = os.path.join(aligndir, 'align'+os.path.basename(mrcfile))
		if os.path.isfile(new_path):
			print "----------", os.path.basename(mrcfile)
			continue
		print ("\n==============================\n", 
			os.path.basename(mrcfile), 
			"\n==============================\n")
		map2 = open_volume_file(mrcfile)[0]
		map2.set_parameters(surface_levels = [1.0])
		new_path = os.path.join(aligndir, 'align'+os.path.basename(mrcfile))
		fit_map_in_map(map1, map2, map1_threshold=1.0)
		runCommand('vop #1 resample onGrid #0 modelId %d'%(i+N))
		runCommand('volume #%d save %s'%(i+N, new_path))
		map2.close()
		runCommand('close #1')
		runCommand('close #%d'%(i+N))
    def openVolumeData(self):
        """
		open MRC file
		set step size to 1, set contour, show surface
		create self.voldata
		"""
        self.writeMessageToLog("Opening volume type: %s file: %s" %
                               (self.fileformat, self.tmpfilepath))
        default_settings.set('limit_voxel_count', self.voxellimit)
        default_settings.set('surface_smoothing', True)
        default_settings.set('smoothing_iterations', 10)
        self.voldata = open_volume_file(self.tmpfilepath, self.fileformat)[0]
        #self.writeMessageToLog(str(dir(self.voldata)))
        self.voldata.set_parameters(
            show_outline_box=False,
            surface_smoothing=True,
            two_sided_lighting=False,
        )
        if self.contour is not None:
            self.voldata.set_parameters(surface_levels=[self.contour])
        self.voldata.show('surface')
        self.surfaces = openModels.list(modelTypes=[SurfaceModel])
        self.setZoom()

        ### This does not work on CentOS and Chimera v1.2509, but does with Chimera v1.4
        result = re.search("([0-9]\.[0-9]*)", chimera.version.release)
        if not result or not result.groups():
            self.writeMessageToLog(
                "Failed to get numeric version of Chimera: %s" %
                (chimera.version.release))
            sys.exit(1)
        version = float(result.groups()[0])
        self.writeMessageToLog("Chimera numeric version: %lf" % (version))
        if version > 1.3:
            ### draw scale bar if version greater than 1.3
            self.drawScaleBar()
        else:
            self.writeMessageToLog("Skipping scale bar")
        def openVolumeData(self):
                """
                open MRC file
                set step size to 1, set contour, show surface
                create self.voldata
                """
                self.writeMessageToLog("Opening volume type: %s file: %s"%(self.fileformat, self.tmpfilepath))
                default_settings.set('limit_voxel_count', self.voxellimit)
                default_settings.set('surface_smoothing', True)
                default_settings.set('smoothing_iterations', 10)
                self.voldata = open_volume_file(self.tmpfilepath, self.fileformat)[0]
                #self.writeMessageToLog(str(dir(self.voldata)))
                self.voldata.set_parameters(
                        show_outline_box=False,
                        surface_smoothing=True,
                        two_sided_lighting=False,
                )
                if self.contour is not None:
                        self.voldata.set_parameters(surface_levels = [self.contour])
                self.voldata.show('surface')
                self.surfaces = openModels.list(modelTypes=[SurfaceModel])
                self.setZoom()

                ### This does not work on CentOS and Chimera v1.2509, but does with Chimera v1.4
                result = re.search("([0-9]\.[0-9]*)", chimera.version.release)
                if not result or not result.groups():
                        self.writeMessageToLog("Failed to get numeric version of Chimera: %s"
                                %(chimera.version.release))
                        sys.exit(1)
                version = float(result.groups()[0])
                self.writeMessageToLog("Chimera numeric version: %lf"%(version))
                if version > 1.3:
                        ### draw scale bar if version greater than 1.3
                        self.drawScaleBar()
                else:
                        self.writeMessageToLog("Skipping scale bar")