Пример #1
0
	def allocate_drude_space( s, structure_groups, wrapbox_groups ): 
		s.drude_space_list = []
		for i, structure_list in enumerate( structure_groups ):
			c1 = wrapbox_groups[i][2]
			c2 = s.center_pt
			d1 = wrapbox_groups[i][3]
			d2 = s.length
			if is_overlap_3d( c1, c2, d1, d2 ) and structure_list[0].matter_type == 'drude':
				wb_pt1 = list( wrapbox_groups[i][0] )
				wb_pt2 = list( wrapbox_groups[i][1] )
				for i in xrange(3):
					if wb_pt1[i] < s.wrapbox_pt1[i]: wb_pt1[i] = s.wrapbox_pt1[i] 
					if wb_pt2[i] > s.wrapbox_pt2[i]: wb_pt2[i] = s.wrapbox_pt2[i] 
				local_wb_pt1 = []
				local_wb_pt2 = []
				for i in xrange(3):
					local_wb_pt1.append( wb_pt1[i] )
					local_wb_pt2.append( wb_pt2[i] )
				local_wb_pt1[0] -= s.wrapbox_pt1[0]
				local_wb_pt2[0] -= s.wrapbox_pt1[0]

				i1, j1, k1 = sc.int32( sc.array(local_wb_pt1,'f')/s.dx + 1e-5 ) + 1
				i2, j2, k2 = sc.int32( sc.array(local_wb_pt2,'f')/s.dx + 1e-5 ) + 1

				Nx = i2 - i1
				Ny = j2 - j1
				Nz = k2 - k1
				s.drude_space_list.append( DrudeAde( s, Nx, Ny, Nz, i1, j1, k1 ) )
				s.drude_space_list[-1].allocate()
				s.drude_space_list[-1].set_coeff( wb_pt1, wb_pt2, structure_list )
Пример #2
0
    def allocate_drude_space(s, structure_groups, wrapbox_groups):
        s.drude_space_list = []
        for i, structure_list in enumerate(structure_groups):
            c1 = wrapbox_groups[i][2]
            c2 = s.center_pt
            d1 = wrapbox_groups[i][3]
            d2 = s.length
            if is_overlap_3d(c1, c2, d1, d2) and structure_list[0].matter_type == "drude":
                wb_pt1 = list(wrapbox_groups[i][0])
                wb_pt2 = list(wrapbox_groups[i][1])
                for i in xrange(3):
                    if wb_pt1[i] < s.wrapbox_pt1[i]:
                        wb_pt1[i] = s.wrapbox_pt1[i]
                    if wb_pt2[i] > s.wrapbox_pt2[i]:
                        wb_pt2[i] = s.wrapbox_pt2[i]
                local_wb_pt1 = []
                local_wb_pt2 = []
                for i in xrange(3):
                    local_wb_pt1.append(wb_pt1[i])
                    local_wb_pt2.append(wb_pt2[i])
                local_wb_pt1[0] -= s.wrapbox_pt1[0]
                local_wb_pt2[0] -= s.wrapbox_pt1[0]

                i1, j1, k1 = sc.int32(sc.array(local_wb_pt1, "f") / s.dx + 1e-5) + 1
                i2, j2, k2 = sc.int32(sc.array(local_wb_pt2, "f") / s.dx + 1e-5) + 1

                Nx = i2 - i1
                Ny = j2 - j1
                Nz = k2 - k1
                s.drude_space_list.append(DrudeAde(s, Nx, Ny, Nz, i1, j1, k1))
                s.drude_space_list[-1].allocate()
                s.drude_space_list[-1].set_coeff(wb_pt1, wb_pt2, structure_list)
Пример #3
0
    def set_coeff(s, structure_groups=[], wrapbox_groups=[]):
        s.epr_x = sc.ones(s.shape, "f")
        s.epr_y = sc.ones(s.shape, "f")
        s.epr_z = sc.ones(s.shape, "f")

        for i, structure_list in enumerate(structure_groups):
            c1 = wrapbox_groups[i][2]
            c2 = s.center_pt
            d1 = wrapbox_groups[i][3]
            d2 = s.length
            if is_overlap_3d(c1, c2, d1, d2):
                wb_pt1 = list(wrapbox_groups[i][0])
                wb_pt2 = list(wrapbox_groups[i][1])
                for i in xrange(3):
                    if wb_pt1[i] < s.wrapbox_pt1[i]:
                        wb_pt1[i] = s.wrapbox_pt1[i]
                    if wb_pt2[i] > s.wrapbox_pt2[i]:
                        wb_pt2[i] = s.wrapbox_pt2[i]
                wb_pt1[0] -= s.wrapbox_pt1[0]
                wb_pt2[0] -= s.wrapbox_pt1[0]

                i1, j1, k1 = sc.int32(sc.array(wb_pt1, "f") / s.dx) + 1
                i2, j2, k2 = sc.int32(sc.array(wb_pt2, "f") / s.dx) + 1
                for st in structure_list:
                    for i in xrange(i1, i2 + 1):
                        for j in xrange(j1, j2 + 1):
                            for k in xrange(k1, k2 + 1):
                                pt_real_x = (s.wrapbox_pt1[0] + (i - 1) * s.dx, (j - 0.5) * s.dx, (k - 0.5) * s.dx)
                                pt_real_y = (s.wrapbox_pt1[0] + (i - 0.5) * s.dx, (j - 1) * s.dx, (k - 0.5) * s.dx)
                                pt_real_z = (s.wrapbox_pt1[0] + (i - 0.5) * s.dx, (j - 0.5) * s.dx, (k - 1) * s.dx)
                                if st.is_in(pt_real_x):
                                    s.epr_x[i, j, k] = st.matter_parameter[0]
                                if st.is_in(pt_real_y):
                                    s.epr_y[i, j, k] = st.matter_parameter[0]
                                if st.is_in(pt_real_z):
                                    s.epr_z[i, j, k] = st.matter_parameter[0]

        s.CEx[1:, 1:-1, 1:-1] = 0.5 / s.epr_x[1:, 1:-1, 1:-1]
        s.CEy[1:-1, 1:, 1:-1] = 0.5 / s.epr_y[1:-1, 1:, 1:-1]
        s.CEz[1:-1, 1:-1, 1:] = 0.5 / s.epr_z[1:-1, 1:-1, 1:]

        del s.epr_x, s.epr_y, s.epr_z
Пример #4
0
	def set_coeff( s, structure_groups=[], wrapbox_groups=[] ):
		s.epr_x = sc.ones( s.shape, 'f' )
		s.epr_y = sc.ones( s.shape, 'f' )
		s.epr_z = sc.ones( s.shape, 'f' )

		for i, structure_list in enumerate( structure_groups ):
			c1 = wrapbox_groups[i][2]
			c2 = s.center_pt
			d1 = wrapbox_groups[i][3]
			d2 = s.length
			if is_overlap_3d( c1, c2, d1, d2 ):
				wb_pt1 = list( wrapbox_groups[i][0] )
				wb_pt2 = list( wrapbox_groups[i][1] )
				for i in xrange(3):
					if wb_pt1[i] < s.wrapbox_pt1[i]: wb_pt1[i] = s.wrapbox_pt1[i] 
					if wb_pt2[i] > s.wrapbox_pt2[i]: wb_pt2[i] = s.wrapbox_pt2[i] 
				wb_pt1[0] -= s.wrapbox_pt1[0]
				wb_pt2[0] -= s.wrapbox_pt1[0]

				i1, j1, k1 = sc.int32( sc.array(wb_pt1,'f')/s.dx ) + 1
				i2, j2, k2 = sc.int32( sc.array(wb_pt2,'f')/s.dx ) + 1
				for st in structure_list:
					for i in xrange( i1, i2+1 ):
						for j in xrange( j1, j2+1 ):
							for k in xrange( k1, k2+1 ):
								pt_real_x = ( s.wrapbox_pt1[0] + (i-1)*s.dx, (j-0.5)*s.dx, (k-0.5)*s.dx )
								pt_real_y = ( s.wrapbox_pt1[0] + (i-0.5)*s.dx, (j-1)*s.dx, (k-0.5)*s.dx )
								pt_real_z = ( s.wrapbox_pt1[0] + (i-0.5)*s.dx, (j-0.5)*s.dx, (k-1)*s.dx )
								if st.is_in( pt_real_x ): s.epr_x[i,j,k] = st.matter_parameter[0]
								if st.is_in( pt_real_y ): s.epr_y[i,j,k] = st.matter_parameter[0]
								if st.is_in( pt_real_z ): s.epr_z[i,j,k] = st.matter_parameter[0]

		s.CEx[1:,1:-1,1:-1] = 0.5/s.epr_x[1:,1:-1,1:-1]
		s.CEy[1:-1,1:,1:-1] = 0.5/s.epr_y[1:-1,1:,1:-1]
		s.CEz[1:-1,1:-1,1:] = 0.5/s.epr_z[1:-1,1:-1,1:]

		del s.epr_x, s.epr_y, s.epr_z
Пример #5
0
	def set_coeff( s, structure_groups, wrapbox_groups ):
		s.epr_x = sc.ones( s.shape, 'f' )
		s.epr_y = sc.ones( s.shape, 'f' )
		s.epr_z = sc.ones( s.shape, 'f' )
		s.pfreq_x = sc.zeros( s.shape, 'f' )
		s.pfreq_y = sc.zeros( s.shape, 'f' )
		s.pfreq_z = sc.zeros( s.shape, 'f' )
		s.gamma_x = sc.zeros( s.shape, 'f' )
		s.gamma_y = sc.zeros( s.shape, 'f' )
		s.gamma_z = sc.zeros( s.shape, 'f' )

		for i, structure_list in enumerate( structure_groups ):
			c1 = wrapbox_groups[i][2]
			c2 = s.center_pt
			d1 = wrapbox_groups[i][3]
			d2 = s.length
			if is_overlap_3d( c1, c2, d1, d2 ):
				wb_pt1 = list( wrapbox_groups[i][0] )
				wb_pt2 = list( wrapbox_groups[i][1] )
				for i in xrange(3):
					if wb_pt1[i] < s.wrapbox_pt1[i]: wb_pt1[i] = s.wrapbox_pt1[i] 
					if wb_pt2[i] > s.wrapbox_pt2[i]: wb_pt2[i] = s.wrapbox_pt2[i] 
				wb_pt1[0] -= s.wrapbox_pt1[0]
				wb_pt2[0] -= s.wrapbox_pt1[0]

				i1, j1, k1 = sc.int32( sc.array(wb_pt1,'f')/s.dx ) + 1
				i2, j2, k2 = sc.int32( sc.array(wb_pt2,'f')/s.dx ) + 1
				for st in structure_list:
					for i in xrange( i1, i2+1 ):
						for j in xrange( j1, j2+1 ):
							for k in xrange( k1, k2+1 ):
								pt_real_x = ( s.wrapbox_pt1[0] + (i-1)*s.dx, (j-0.5)*s.dx, (k-0.5)*s.dx )
								pt_real_y = ( s.wrapbox_pt1[0] + (i-0.5)*s.dx, (j-1)*s.dx, (k-0.5)*s.dx )
								pt_real_z = ( s.wrapbox_pt1[0] + (i-0.5)*s.dx, (j-0.5)*s.dx, (k-1)*s.dx )
								if st.is_in( pt_real_x ): 
									s.epr_x[i,j,k] = st.matter_parameter[0]
									s.pfreq_x[i,j,k] = st.matter_parameter[1]
									s.gamma_x[i,j,k] = st.matter_parameter[2]
								if st.is_in( pt_real_y ):
									s.epr_y[i,j,k] = st.matter_parameter[0]
									s.pfreq_y[i,j,k] = st.matter_parameter[1]
									s.gamma_y[i,j,k] = st.matter_parameter[2]
								if st.is_in( pt_real_z ):
									s.epr_z[i,j,k] = st.matter_parameter[0]
									s.pfreq_z[i,j,k] = st.matter_parameter[1]
									s.gamma_z[i,j,k] = st.matter_parameter[2]

		s.CEx[1:,1:-1,1:-1] = 0.5/s.epr_x[1:,1:-1,1:-1]
		s.CEy[1:-1,1:,1:-1] = 0.5/s.epr_y[1:-1,1:,1:-1]
		s.CEz[1:-1,1:-1,1:] = 0.5/s.epr_z[1:-1,1:-1,1:]

		tmp = sc.zeros( s.shape, 'f' )

		tmp[:,:,:] = (2+s.gamma_x[:,:,:]*s.dt)
		s.CJAx[:,:,:] = (2-s.gamma_x[:,:,:]*s.dt)/tmp[:,:,:]
		s.CJBx[:,:,:] = 4*(s.dt*s.pfreq_x[:,:,:])**2/tmp[:,:,:]

		tmp[:,:,:] = (2+s.gamma_y[:,:,:]*s.dt)
		s.CJAy[:,:,:] = (2-s.gamma_y[:,:,:]*s.dt)/tmp[:,:,:]
		s.CJBy[:,:,:] = 4*(s.dt*s.pfreq_y[:,:,:])**2/tmp[:,:,:]

		tmp[:,:,:] = (2+s.gamma_z[:,:,:]*s.dt)
		s.CJAz[:,:,:] = (2-s.gamma_z[:,:,:]*s.dt)/tmp[:,:,:]
		s.CJBz[:,:,:] = 4*(s.dt*s.pfreq_z[:,:,:])**2/tmp[:,:,:]
		
		del s.epr_x, s.epr_y, s.epr_z
		del tmp
		del s.pfreq_x, s.pfreq_y, s.pfreq_z
		del s.gamma_x, s.gamma_y, s.gamma_z