Exemplo n.º 1
0
 def notestDetermineWavefunctionRange(self):
     density_file = join(test_folder, 'Rho.grid.nc')
     rho, r, dh_cell = readNCDensity(density_file)
     rho = rho.sum(axis=0)
     r = determineWaveFunctionRange(
             rho=rho,
             r=r,
             density_range=(-3.5, -2.5),
             point_density=6,
             )
     X, Y, Z = r
     self.assertArraysEqual((X.min(), X.max()), (-3.8654757894093597, 3.8654757894093597), 5)
     self.assertArraysEqual((Y.min(), Y.max()), (-1.86849, 1.86849), 5)
     self.assertArraysEqual((Z.min(), Z.max()), (1.40626, 4.92191), 5)
Exemplo n.º 2
0
def prepareDenchar(label='./siesta', density_range=(-3.5, -2.5)):
    folder = os.path.dirname(label)
    nc_filename = join(folder, 'Rho.grid.nc')
    rho, r, dh_cell = readNCDensity(nc_filename)
    rho = rho.sum(axis=0)
    X, Y, Z = determineWaveFunctionRange(
            rho=rho,
            r=r,
            point_density=5,
            density_range=density_range,
            )
    span = np.array([
         [X.min(), X.max()],
         [Y.min(), Y.max()],
         [Z.min(), Z.max()],
        ])
    d_input = makeDencharInput(
            span=span,
            shape=X.shape,
            main_file='siesta.fdf',
            plot_wavefunctions=False,
            plot_charge=True,
            )
    with open('denchar_charge.fdf', 'w') as f:
         f.write(d_input)
    d_input = makeDencharInput(
            span=span,
            shape=X.shape,
            main_file='siesta.fdf',
            plot_wavefunctions=True,
            plot_charge=False,
            )
    with open('denchar_wf.fdf', 'w') as f:
         f.write(d_input)

    cmd = 'denchar < denchar_charge.fdf &> TMP.out'
    p = subprocess.Popen(cmd, shell=True)
    p.wait()