예제 #1
0
    (opts, args) = parser.parse_args()
    if len(args) < 6:
        print usage
        exit(-1)

    # input cube files
    Mx_cube_file = args[0]
    My_cube_file = args[1]
    Mz_cube_file = args[2]
    # output cube files
    Ax_cube_file = args[3]
    Ay_cube_file = args[4]
    Az_cube_file = args[5]


    # load cube files with magnetic dipole density
    print "load magnetic dipole density from cube files..."
    atomlist, origin, axes, Mx = Cube.readCube(Mx_cube_file)
    atomlist, origin, axes, My = Cube.readCube(My_cube_file)
    atomlist, origin, axes, Mz = Cube.readCube(Mz_cube_file)
    print "compute vector potential..."
    Ax,Ay,Az = vector_potential_Poisson(atomlist, origin, axes, Mx, My, Mz,
                                        poisson_solver=opts.solver,
                                        conv_eps=opts.conv_eps, maxiter=opts.maxiter)
    # save vector potential
    Cube.writeCube(Ax_cube_file, atomlist, origin, axes, Ax)
    Cube.writeCube(Ay_cube_file, atomlist, origin, axes, Ay)
    Cube.writeCube(Az_cube_file, atomlist, origin, axes, Az)
    print "x-,y- and z-components of vector potential saved to '%s', '%s' and '%s'" % (Ax_cube_file, Ay_cube_file, Az_cube_file)

예제 #2
0
        dest="nuclear_potential",
        type=int,
        help=
        "Should the nuclear potential be added to the electrostatic potential (0: no, 1: yes) [default: %default]",
        default=1)

    (opts, args) = parser.parse_args()
    if len(args) < 2:
        print usage
        exit(-1)

    rho_cube_file = args[0]
    pot_cube_file = args[1]

    # load cube file with electronic density
    print "load density from cube file..."
    atomlist, origin, axes, rho = Cube.readCube(rho_cube_file)
    print "compute electrostatic potential..."
    pot = electrostatic_potential_Poisson(
        atomlist,
        origin,
        axes,
        rho,
        poisson_solver=opts.solver,
        conv_eps=opts.conv_eps,
        maxiter=opts.maxiter,
        nuclear_potential=opts.nuclear_potential)
    # save potential
    Cube.writeCube(pot_cube_file, atomlist, origin, axes, pot)
    print "electrostatic potential saved to '%s'" % pot_cube_file