text:
! Copyright (c) 2020 Yasunori Futamura All Rights Reserved.

subroutine sgemm_sppart_blas(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: transa, transb
    integer(c_int) :: m, n, k, lda, ldb, ldc
    real(c_float) :: alpha, A(*), B(*), beta, C(*)
    call sgemm(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine
subroutine dgemm_sppart_blas(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: transa, transb
    integer(c_int) :: m, n, k, lda, ldb, ldc
    real(c_double) :: alpha, A(*), B(*), beta, C(*)
    call dgemm(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine
subroutine cgemm_sppart_blas(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: transa, transb
    integer(c_int) :: m, n, k, lda, ldb, ldc
    complex(c_float_complex) :: alpha, A(*), B(*), beta, C(*)
    call cgemm(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine
subroutine zgemm_sppart_blas(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: transa, transb
    integer(c_int) :: m, n, k, lda, ldb, ldc
    complex(c_double_complex) :: alpha, A(*), B(*), beta, C(*)
    call zgemm(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine

subroutine ssymm_sppart_blas(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: side, uplo
    integer(c_int) :: m, n, lda, ldb, ldc
    real(c_float) :: alpha, A(*), B(*), beta, C(*)
    call ssymm(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine
subroutine dsymm_sppart_blas(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: side, uplo
    integer(c_int) :: m, n, lda, ldb, ldc
    real(c_double) :: alpha, A(*), B(*), beta, C(*)
    call dsymm(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine
subroutine chemm_sppart_blas(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: side, uplo
    integer(c_int) :: m, n, lda, ldb, ldc
    complex(c_float_complex) :: alpha, A(*), B(*), beta, C(*)
    call chemm(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine
subroutine zhemm_sppart_blas(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: side, uplo
    integer(c_int) :: m, n, lda, ldb, ldc
    complex(c_double_complex) :: alpha, A(*), B(*), beta, C(*)
    call zhemm(side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc);
end subroutine

subroutine sgetrf_sppart_lapack(m, n, A, lda, ipiv, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, ipiv(*), info
    real(c_float) :: A(*)
    call sgetrf(m, n, A, lda, ipiv, info)
end subroutine
subroutine dgetrf_sppart_lapack(m, n, A, lda, ipiv, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, ipiv(*), info
    real(c_double) :: A(*)
    call dgetrf(m, n, A, lda, ipiv, info)
end subroutine
subroutine cgetrf_sppart_lapack(m, n, A, lda, ipiv, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, ipiv(*), info
    complex(c_float_complex) :: A(*)
    call cgetrf(m, n, A, lda, ipiv, info)
end subroutine
subroutine zgetrf_sppart_lapack(m, n, A, lda, ipiv, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, ipiv(*), info
    complex(c_double_complex) :: A(*)
    call zgetrf(m, n, A, lda, ipiv, info)
end subroutine

subroutine sgetrs_sppart_lapack(trans, n, nrhs, A, lda, ipiv, B, ldb, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: trans
    integer(c_int) :: n, nrhs, lda, ipiv(*), ldb, info
    real(c_float) :: A(*), B(*)
    call sgetrs(trans, n, nrhs, A, lda, ipiv, B, ldb, info)
end subroutine
subroutine dgetrs_sppart_lapack(trans, n, nrhs, A, lda, ipiv, B, ldb, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: trans
    integer(c_int) :: n, nrhs, lda, ipiv(*), ldb, info
    real(c_double) :: A(*), B(*)
    call dgetrs(trans, n, nrhs, A, lda, ipiv, B, ldb, info)
end subroutine
subroutine cgetrs_sppart_lapack(trans, n, nrhs, A, lda, ipiv, B, ldb, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: trans
    integer(c_int) :: n, nrhs, lda, ipiv(*), ldb, info
    complex(c_float_complex) :: A(*), B(*)
    call cgetrs(trans, n, nrhs, A, lda, ipiv, B, ldb, info)
end subroutine
subroutine zgetrs_sppart_lapack(trans, n, nrhs, A, lda, ipiv, B, ldb, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: trans
    integer(c_int) :: n, nrhs, lda, ipiv(*), ldb, info
    complex(c_double_complex) :: A(*), B(*)
    call zgetrs(trans, n, nrhs, A, lda, ipiv, B, ldb, info)
end subroutine

subroutine csytrf_sppart_lapack(uplo, n, A, lda, ipiv, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: uplo
    integer(c_int) :: n, lda, ipiv(*), lwork, info
    complex(c_float_complex) :: A(*), work(*)
    call csytrf(uplo, n, A, lda, ipiv, work, lwork, info)
end subroutine
subroutine zsytrf_sppart_lapack(uplo, n, A, lda, ipiv, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: uplo
    integer(c_int) :: n, lda, ipiv(*), lwork, info
    complex(c_double_complex) :: A(*), work(*)
    call zsytrf(uplo, n, A, lda, ipiv, work, lwork, info)
end subroutine

subroutine csytrs_sppart_lapack(uplo, n, nrhs, A, lda, ipiv, B, ldb, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: uplo
    integer(c_int) :: n, nrhs, lda, ipiv(*), ldb, info
    complex(c_float_complex) :: A(*), B(*)
    call csytrs(uplo, n, nrhs, A, lda, ipiv, B, ldb, info)
end subroutine
subroutine zsytrs_sppart_lapack(uplo, n, nrhs, A, lda, ipiv, B, ldb, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: uplo
    integer(c_int) :: n, nrhs, lda, ipiv(*), ldb, info
    complex(c_double_complex) :: A(*), B(*)
    call zsytrs(uplo, n, nrhs, A, lda, ipiv, B, ldb, info)
end subroutine

subroutine sgesvd_sppart_lapack(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_u, job_v
    integer(c_int) :: m, n, lda, ldb, ldu, ldv, lwork, info
    real(c_float) :: A(*), S(*), U(*), V(*), work(*)
    call sgesvd(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, info)
end subroutine
subroutine dgesvd_sppart_lapack(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_u, job_v
    integer(c_int) :: m, n, lda, ldb, ldu, ldv, lwork, info
    real(c_double) :: A(*), S(*), U(*), V(*), work(*)
    call dgesvd(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, info)
end subroutine
subroutine cgesvd_sppart_lapack(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_u, job_v
    integer(c_int) :: m, n, lda, ldb, ldu, ldv, lwork, info
    complex(c_float_complex) :: A(*), S(*), U(*), V(*), work(*)
    real(c_float) :: rwork(*)
    call cgesvd(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, rwork, info)
end subroutine
subroutine zgesvd_sppart_lapack(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_u, job_v
    integer(c_int) :: m, n, lda, ldb, ldu, ldv, lwork, info
    complex(c_double_complex) :: A(*), S(*), U(*), V(*), work(*)
    real(c_double) :: rwork(*)
    call zgesvd(job_u, job_v, m, n, A, lda, S, U, ldu, V, ldv, work, lwork, rwork, info)
end subroutine

subroutine sgeev_sppart_lapack(job_vl, job_vr, n, A, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldvl, ldvr, lwork, info
    real(c_float) :: A(*), wr(*), wi(*), vl(*), vr(*), work(*)
    call sgeev(job_vl, job_vr, n, A, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info)
end subroutine
subroutine dgeev_sppart_lapack(job_vl, job_vr, n, A, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldvl, ldvr, lwork, info
    real(c_double) :: A(*), wr(*), wi(*), vl(*), vr(*), work(*)
    call dgeev(job_vl, job_vr, n, A, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info)
end subroutine
subroutine cgeev_sppart_lapack(job_vl, job_vr, n, A, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldvl, ldvr, lwork, info
    complex(c_float_complex) :: A(*), w(*), vl(*), vr(*), work(*)
    real(c_float) :: rwork(*)
    call cgeev(job_vl, job_vr, n, A, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
end subroutine
subroutine zgeev_sppart_lapack(job_vl, job_vr, n, A, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldvl, ldvr, lwork, info
    complex(c_double_complex) :: A(*), w(*), vl(*), vr(*), work(*)
    real(c_double) :: rwork(*)
    call zgeev(job_vl, job_vr, n, A, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
end subroutine

subroutine sggev_sppart_lapack(job_vl, job_vr, n, A, lda, B, ldb, &
        alpha_r, alpha_i, beta, vl, ldvl, vr, ldvr, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldb, ldvl, ldvr, lwork, info
    real(c_float) :: A(*), B(*), alpha_r(*), alpha_i(*), beta(*), vl(*), vr(*), work(*)
    call sggev(job_vl, job_vr, n, A, lda, B, ldb, alpha_r, alpha_i, beta, vl, ldvl, vr, ldvr, work, lwork, info)
end subroutine
subroutine dggev_sppart_lapack(job_vl, job_vr, n, A, lda, B, ldb, &
        alpha_r, alpha_i, beta, vl, ldvl, vr, ldvr, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldb, ldvl, ldvr, lwork, info
    real(c_double) :: A(*), B(*), alpha_r(*), alpha_i(*), beta(*), vl(*), vr(*), work(*)
    call dggev(job_vl, job_vr, n, A, lda, B, ldb, alpha_r, alpha_i, beta, vl, ldvl, vr, ldvr, work, lwork, info)
end subroutine
subroutine cggev_sppart_lapack(job_vl, job_vr, n, A, lda, B, ldb, &
        alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldb, ldvl, ldvr, lwork, info
    complex(c_float_complex) :: A(*), B(*), alpha(*), beta(*), vl(*), vr(*), work(*)
    real(c_float) :: rwork(*)
    call cggev(job_vl, job_vr, n, A, lda, B, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
end subroutine
subroutine zggev_sppart_lapack(job_vl, job_vr, n, A, lda, B, ldb, &
        alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: job_vl, job_vr
    integer(c_int) :: n, lda, ldb, ldvl, ldvr, lwork, info
    complex(c_double_complex) :: A(*), B(*), alpha(*), beta(*), vl(*), vr(*), work(*)
    real(c_double) :: rwork(*)
    call zggev(job_vl, job_vr, n, A, lda, B, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
end subroutine

subroutine ssyev_sppart_lapack(jobz, uplo, n, A, lda, w, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: n, lda, lwork, info
    real(c_float) :: A(*), w(*), work(*)
    call ssyev(jobz, uplo, n, A, lda, w, work, lwork, info)
end subroutine
subroutine dsyev_sppart_lapack(jobz, uplo, n, A, lda, w, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: n, lda, lwork, info
    real(c_double) :: A(*), w(*), work(*)
    call dsyev(jobz, uplo, n, A, lda, w, work, lwork, info)
end subroutine
subroutine cheev_sppart_lapack(jobz, uplo, n, A, lda, w, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: n, lda, lwork, info
    complex(c_float_complex) :: A(*), w(*), work(*)
    real(c_float) :: rwork(*)
    call cheev(jobz, uplo, n, A, lda, w, work, lwork, rwork, info)
end subroutine
subroutine zheev_sppart_lapack(jobz, uplo, n, A, lda, w, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: n, lda, lwork, info
    complex(c_double_complex) :: A(*), w(*), work(*)
    real(c_double) :: rwork(*)
    call zheev(jobz, uplo, n, A, lda, w, work, lwork, rwork, info)
end subroutine

subroutine ssygv_sppart_lapack(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: itype, n, lda, ldb, lwork, info
    real(c_float) :: A(*), B(*), w(*), work(*)
    call ssygv(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, info)
end subroutine
subroutine dsygv_sppart_lapack(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: itype, n, lda, ldb, lwork, info
    real(c_double) :: A(*), B(*), w(*), work(*)
    call dsygv(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, info)
end subroutine
subroutine chegv_sppart_lapack(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: itype, n, lda, ldb, lwork, info
    complex(c_double_complex) :: A(*), B(*), w(*), work(*)
    real(c_double) :: rwork(*)
    call chegv(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, rwork, info)
end subroutine
subroutine zhegv_sppart_lapack(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, rwork, info) bind(c)
    use iso_c_binding
    implicit none
    character(c_char) :: jobz, uplo
    integer(c_int) :: itype, n, lda, ldb, lwork, info
    complex(c_double_complex) :: A(*), B(*), w(*), work(*)
    real(c_double) :: rwork(*)
    call zhegv(itype, jobz, uplo, n, A, lda, B, ldb, w, work, lwork, rwork, info)
end subroutine

subroutine sgeqrf_sppart_lapack(m, n, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, lwork, info
    complex(c_float) :: A(*), tau(*), work(*)
    call sgeqrf(m, n, A, lda, tau, work, lwork, info)
end subroutine
subroutine dgeqrf_sppart_lapack(m, n, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, lwork, info
    complex(c_double) :: A(*), tau(*), work(*)
    call dgeqrf(m, n, A, lda, tau, work, lwork, info)
end subroutine
subroutine cgeqrf_sppart_lapack(m, n, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, lwork, info
    complex(c_float_complex) :: A(*), tau(*), work(*)
    call cgeqrf(m, n, A, lda, tau, work, lwork, info)
end subroutine
subroutine zgeqrf_sppart_lapack(m, n, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, lda, lwork, info
    complex(c_double_complex) :: A(*), tau(*), work(*)
    call zgeqrf(m, n, A, lda, tau, work, lwork, info)
end subroutine

subroutine sorgqr_sppart_lapack(m, n, k, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, k, lda, lwork, info
    complex(c_float) :: A(*), tau(*), work(*)
    call sorgqr(m, n, k, A, lda, tau, work, lwork, info)
end subroutine
subroutine dorgqr_sppart_lapack(m, n, k, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, k, lda, lwork, info
    complex(c_double) :: A(*), tau(*), work(*)
    call dorgqr(m, n, k, A, lda, tau, work, lwork, info)
end subroutine
subroutine cungqr_sppart_lapack(m, n, k, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, k, lda, lwork, info
    complex(c_float_complex) :: A(*), tau(*), work(*)
    call cungqr(m, n, k, A, lda, tau, work, lwork, info)
end subroutine
subroutine zungqr_sppart_lapack(m, n, k, A, lda, tau, work, lwork, info) bind(c)
    use iso_c_binding
    implicit none
    integer(c_int) :: m, n, k, lda, lwork, info
    complex(c_double_complex) :: A(*), tau(*), work(*)
    call zungqr(m, n, k, A, lda, tau, work, lwork, info)
end subroutine

max_stars_repo_name: yfg/GDSP

max_issues_repo_name: yfg/GDSP

max_forks_repo_name: yfg/GDSP


text:
!-----------------------------------------------------------------------
!     Program:       VMEC2STEL
!     Authors:       S. Lazerson
!     Date:          04/15/2014
!     Description:   The VMEC2STEL code reads a VMEC input namelist and
!                    returns a STELLOPTV2 OPTIMUM namelist.
!-----------------------------------------------------------------------
      PROGRAM VMEC2STEL
!-----------------------------------------------------------------------
!     Libraries
!-----------------------------------------------------------------------
      USE stel_kinds
      USE vmec_input, arg1_input => arg1
      USE safe_open_mod
!-----------------------------------------------------------------------
!     Local Variables
!          numargs      Number of input arguments
!          i            Index
!          arg_len      Length of input strings
!          arg1         Input file
!          args         Input arguments
!-----------------------------------------------------------------------
      IMPLICIT NONE
      ! Command line related
      integer                                      :: numargs,i,ier,iunit
      integer, parameter                           :: arg_len =256
      character*(arg_len)                          :: arg1
      character*(arg_len),allocatable,dimension(:) :: args
      ! Runtime Related
      INTEGER, PARAMETER     :: nu = 64
      INTEGER, PARAMETER     :: nv = 64
      LOGICAL                :: lvmec, lexist, lminmax, lrbc, lrhomn,ldeltamn, &
                                lfix_ntor, llmdif, lgade, lswarm, lmap, lbasic, &
                                lqas, lneed_booz, lqps, lhelical, lballoon, lneo, &
                                ldkes, lbootsj, ltxport, lmap_plane, ljdotb0, liota, &
                                lkink, lvaciota, ljcurv, loutput_harm, lmode, lorbit, &
                                lac, lam, lai, lphiedge, lpscale, lcurtor, lkappa, &
                                lwell, lcurvature, lfieldlines
      INTEGER                :: m,n,ns,j
      REAL(rprec)            :: bound_min, bound_max, var, var_min, var_max, &
                                temp, rho_exp,r1t,r2t,z1t, delta, filter_harm, pi2
      REAL(rprec), DIMENSION(-ntord:ntord,-mpol1d:mpol1d) ::  deltamn
      REAL(rprec), DIMENSION(-ntord:ntord,0:mpol1d)       ::  rhobc
      REAL(rprec), DIMENSION(-ntord:ntord,0:mpol1d)       :: rbc_temp,zbs_temp
      REAL(rprec), DIMENSION(nu,nv)                       :: rreal,zreal
      character(arg_len)     :: id_string, var_name

      ! Define output
      CHARACTER(LEN=*), PARAMETER :: onevar  = "(2X,A,1X,'= T ',3(2X,A,1X,'=',1X,ES22.12E3))"
      CHARACTER(LEN=*), PARAMETER :: vecvar  = "(2X,A,'(',I3.3,')',1X,'= T ',3(2X,A,'(',I3.3,')',1X,'=',1X,ES22.12E3))"
      CHARACTER(LEN=*), PARAMETER :: vecvar2 = "(21X,2(2X,A,'(',I3.3,')',1X,'=',1X,ES22.12E3))"
      CHARACTER(LEN=*), PARAMETER :: arrvar  = "(2X,A,'(',I4.3,',',I4.3,') = T',3(2X,A,'(',I4.3,',',I4.3,') = ',1X,ES22.12E3))"
      CHARACTER(LEN=*), PARAMETER :: arrvar2 = "(27x,3(2X,A,'(',I4.3,',',I4.3,') = ',1X,ES22.12E3))"
      CHARACTER(LEN=*), PARAMETER :: target2 = "(2(2X,A,'(',I3.3,')',1X,'=',1X,F8.4))"
      CHARACTER(LEN=*), PARAMETER :: target3 = "(3(2X,A,'(',I3.3,')',1X,'=',1X,F8.4))"

      REAL(rprec), PARAMETER :: VMEC2STEL_VERSION = 1.31_rprec

      REAL(rprec), EXTERNAL :: piota
!-----------------------------------------------------------------------
!     Begin Program
!-----------------------------------------------------------------------
      ! Set Defaults
      pi2 = 8.0 * ATAN(1.0)
      ier = 0
      lexist = .FALSE.
      lvmec = .FALSE.
      lminmax = .FALSE.
      lrhomn = .TRUE.
      ldeltamn = .FALSE.
      lrbc = .FALSE.
      lmode = .FALSE.
      lac = .FALSE.
      lam = .FALSE.
      lai = .FALSE.
      lphiedge= .FALSE.
      lpscale = .FALSE.
      lcurtor = .FALSE.
      lmap_plane = .FALSE.
      lfix_ntor = .FALSE.
      llmdif    = .TRUE.
      lgade     = .FALSE.
      lswarm    = .FALSE.
      lmap      = .FALSE.
      lbasic    = .FALSE.
      lneed_booz= .FALSE.
      lqas = .FALSE.
      lqps = .FALSE.
      lhelical = .FALSE.
      lballoon = .FALSE.
      lneo = .FALSE.
      ldkes = .FALSE.
      lbootsj = .FALSE.
      ltxport = .FALSE.
      ljdotb0 = .FALSE.
      liota = .FALSE.
      ljcurv = .FALSE.
      lkink = .FALSE.
      lvaciota = .FALSE.
      lorbit = .FALSE.
      lfieldlines = .FALSE.
      lkappa = .FALSE.
      lwell  = .FALSE.
      lcurvature = .FALSE.
      loutput_harm = .FALSE.
      bound_min = -1.0
      bound_max = 2.0
      filter_harm = 0
      iunit = 327
      rbc = 0; zbs = 0; rbc_temp=0; zbs_temp=0
      ! Hanlde in arguments
      numargs = 0
      i       = 1
      arg1    = ''
      CALL GETCARG(1,arg1,numargs)
      ALLOCATE(args(numargs))
      DO WHILE (i <= numargs)
         CALL GETCARG(i,args(i),numargs)
         SELECT CASE(args(i))
            CASE ("-bounds")
               lminmax = .TRUE.
               i = i + 1
               CALL GETCARG(i,args(i),numargs)
               READ(args(i),*) bound_min
               i = i + 1
               CALL GETCARG(i,args(i),numargs)
               READ(args(i),*) bound_max
            CASE ("-vmec")
               i = i + 1
               lvmec = .TRUE.
               CALL GETCARG(i,id_string,numargs)
            CASE ("-filter")
               i = i + 1
               CALL GETCARG(i,args(i),numargs)
               READ(args(i),*) filter_harm
            CASE ("-am")
               lam = .TRUE.
            CASE ("-ac")
               lac = .TRUE.
            CASE ("-ai")
               lai = .TRUE.
            CASE ("-pscale")
               lpscale = .TRUE.
            CASE ("-curtor")
               lcurtor = .TRUE.
            CASE ("-phiedge")
               lphiedge = .TRUE.
            CASE ("-rbc")
               lrbc     = .TRUE.
               lrhomn   = .FALSE.
               ldeltamn = .FALSE.
               lmode    = .FALSE.
            CASE ("-rhomn")
               lrbc     = .FALSE.
               lrhomn   = .TRUE.
               ldeltamn = .FALSE.
               lmode    = .FALSE.
            CASE ("-deltamn")
               lrbc     = .FALSE.
               lrhomn   = .FALSE.
               ldeltamn = .TRUE.
               lmode    = .FALSE.
            CASE ("-mode")
               lrbc     = .FALSE.
               lrhomn   = .FALSE.
               ldeltamn = .FALSE.
               lmode    = .TRUE.
            CASE ("-lmdif")
               llmdif = .TRUE.
               lgade  = .FALSE.
               lswarm = .FALSE.
               lmap   = .FALSE.
               lmap_plane = .FALSE.
            CASE ("-gade")
               llmdif = .FALSE.
               lgade  = .TRUE.
               lswarm = .FALSE.
               lmap   = .FALSE.
               lmap_plane = .FALSE.
            CASE ("-swarm")
               llmdif = .FALSE.
               lgade  = .FALSE.
               lswarm = .TRUE.
               lmap   = .FALSE.
               lmap_plane = .FALSE.
            CASE ("-map")
               llmdif = .FALSE.
               lgade  = .FALSE.
               lswarm = .FALSE.
               lmap   = .TRUE.
               lmap_plane = .FALSE.
            CASE ("-map_plane")
               llmdif = .FALSE.
               lgade  = .FALSE.
               lswarm = .FALSE.
               lmap   = .FALSE.
               lmap_plane = .TRUE.
            CASE ("-basic")
               lbasic = .TRUE.
            CASE ("-qas")
               lqas = .TRUE.
               lqps = .FALSE.
               lhelical = .FALSE.
               lneed_booz = .TRUE.
            CASE ("-qps")
               lqas = .FALSE.
               lqps = .TRUE.
               lhelical = .FALSE.
               lneed_booz = .TRUE.
            CASE ("-helical")
               lqas = .FALSE.
               lqps = .FALSE.
               lhelical = .TRUE.
               lneed_booz = .TRUE.
            CASE ("-balloon")
               lballoon = .TRUE.
            CASE ("-neo")
               lneo = .TRUE.
               lneed_booz = .TRUE.
            CASE ("-dkes")
               ldkes = .TRUE.
               lneed_booz = .TRUE.
            CASE ("-fix_ntor")
               lfix_ntor = .TRUE.
            CASE ("-bootstrap")
               lneed_booz = .TRUE.
               lbootsj = .TRUE.
            CASE ("-jdotb0")
               ljdotb0 = .TRUE.
            CASE ("-jcurv")
               ljdotb0 = .TRUE.
            CASE ("-vaciota")
               lvaciota = .TRUE.
            CASE ("-txport")
               ltxport = .TRUE.
            CASE ("-iota")
               liota = .TRUE.
            CASE ("-kink")
               lkink = .TRUE.
            CASE ("-orbit")
               lorbit = .TRUE.
            CASE ("-fieldlines")
               lfieldlines = .TRUE.
            CASE ("-harm")
               loutput_harm = .TRUE.
            CASE ("-kappa")
               lkappa= .TRUE.
            CASE ("-magwell")
               lwell= .TRUE.
            CASE ("-curvature")
               lcurvature= .TRUE.
            CASE ("-help","-h")
               WRITE(6,'(a,f5.2)') 'VMEC2STEL Version ',VMEC2STEL_VERSION
               WRITE(6,*) ' STELLOPTV2 Input Generation Utility'
               WRITE(6,*) ' Usage: xvmec2stel <options>'
               WRITE(6,*) '   <options>'
               WRITE(6,*) '   -vmec <ext>   VMEC input extension'
               WRITE(6,*) '   -bounds %min %max Min/Max scaling'
               WRITE(6,*) '   -phiedge          Vary PHIEDGE'
               WRITE(6,*) '   -pscale           Vary PSCALE'
               WRITE(6,*) '   -curtor           Vary CURTOR'
               WRITE(6,*) '   -am               Vary AM Array'
               WRITE(6,*) '   -ai               Vary AC Array'
               WRITE(6,*) '   -ac               Vary AI Array'
               WRITE(6,*) '   -filter %ratio    Boundary Harm. Filter'
               WRITE(6,*) '   -rbc              VMEC Boundary Representation'
               WRITE(6,*) '   -rhomn            H/B Boundary Representation (default)'
               WRITE(6,*) '   -deltamn          Garabedian Boundary Representation'
               WRITE(6,*) '   -mode             Mode pair targeting'
               WRITE(6,*) '   -harm             Output Harmonics (RBC/ZBS) 1% filter'
               WRITE(6,*) '   -fix_ntor         Fix m=0 modes (fixed boundary)'
               WRITE(6,*) '   -lmdif            Levenberg Optimization'
               WRITE(6,*) '   -gade             Differential Evolution'
               WRITE(6,*) '   -swarm            Particle Swarm'
               WRITE(6,*) '   -map              N-Dimensional Mapping'
               WRITE(6,*) '   -map_plane        Hyperplane (2D) Mapping'
               WRITE(6,*) '   -basic            Basic Targets'
               WRITE(6,*) '   -kappa            Plasma Elongation Target'
               WRITE(6,*) '   -qas              QAS Target'
               WRITE(6,*) '   -qps              QPS Target'
               WRITE(6,*) '   -helical          Helical Target'
               WRITE(6,*) '   -balloon          Ballooning Target'
               WRITE(6,*) '   -neo              Neoclassical (NEO) Target'
               WRITE(6,*) '   -dkes             Neoclassical (DKES) Target'
               WRITE(6,*) '   -bootstrap        Bootstrap (BOOTSJ) Target'
               WRITE(6,*) '   -txport           Turbulent Transport Target'
               WRITE(6,*) '   -iota             Iota Profile Target'
               WRITE(6,*) '   -kink             Kink Stability (TERPSICHORE) Target'
               WRITE(6,*) '   -jdotb0           <JdotB> Target'
               WRITE(6,*) '   -jcurv            <Jcurv> Target'
               WRITE(6,*) '   -vaciota          Vacuum Iota (-S12/S11)'
               WRITE(6,*) '   -magwell          Magnetic Well Target'
               WRITE(6,*) '   -curvature        Curvature Kurtosis Target'
               WRITE(6,*) '   -orbit            Orbit (BEAMS3D) Target'
               WRITE(6,*) '   -help             This help message'
               STOP
            CASE DEFAULT
               WRITE(6,'(a,f5.2)') 'VMEC2STEL Version ',VMEC2STEL_VERSION
               WRITE(6,*) ' STELLOPTV2 Input Generation Utility'
               WRITE(6,*) '    CALL with -h or -help for more info.'
               STOP
         END SELECT
         i = i + 1
      END DO
      DEALLOCATE(args)

      ! Generate the OPTIMUM NAMELIST
      WRITE(6,'(A)') '&OPTIMUM'
      IF (llmdif) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          OPTIMIZER RUN CONTROL PARAMETERS'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,I5.4)')       'NFUNC_MAX  = ',1000
         IF (lvmec) WRITE(6,'(2x,A)') 'EQUIL_TYPE = ''VMEC2000'''
         WRITE(6,'(2x,A)')            'OPT_TYPE   = ''LMDIF'''
         WRITE(6,'(2X,A,ES10.2)')     'FTOL       = ',1.0E-6
         WRITE(6,'(2X,A,ES10.2)')     'XTOL       = ',1.0E-30
         WRITE(6,'(2X,A,ES10.2)')     'GTOL       = ',1.0E-30
         WRITE(6,'(2X,A,F6.1)')       'FACTOR     = ',10.0
         WRITE(6,'(2X,A,ES10.2)')     'EPSFCN     = ',1.0E-6
         WRITE(6,'(2X,A,I1.1)')       'MODE       = ',1
         WRITE(6,'(2X,A,I1.1)')       'NOPTIMIZERS =',16
         WRITE(6,'(2X,A)')            'LKEEP_MINS = T'
      ELSEIF (lgade) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          OPTIMIZER RUN CONTROL PARAMETERS'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,I5.4)')       'NFUNC_MAX   = ',1000
         IF (lvmec) WRITE(6,'(2x,A)') 'EQUIL_TYPE  = ''VMEC2000'''
         WRITE(6,'(2x,A)')            'OPT_TYPE    = ''GADE'''
         WRITE(6,'(2X,A,F6.1)')       'FACTOR      = ',0.5
         WRITE(6,'(2X,A,F6.1)')       'EPSFCN      = ',0.3
         WRITE(6,'(2X,A,I5.4)')       'MODE        = ',2
         WRITE(6,'(2X,A,I5.4)')       'CR_STRATEGY = ',0
         WRITE(6,'(2X,A)')            'LKEEP_MINS  = T'
         WRITE(6,'(2X,A,I5.4)')       'NPOPULATION = ',1000
      ELSEIF (lswarm) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          OPTIMIZER RUN CONTROL PARAMETERS'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,I5.4)')       'NFUNC_MAX  = ',1000
         IF (lvmec) WRITE(6,'(2x,A)') 'EQUIL_TYPE = ''VMEC2000'''
         WRITE(6,'(2x,A)')            'OPT_TYPE   = ''PSO'''
         WRITE(6,'(2X,A,ES10.2)')     'FTOL       = ',1.0E-6
         WRITE(6,'(2X,A,ES10.2)')     'XTOL       = ',1.0E-6
         WRITE(6,'(2X,A,F6.1)')       'EPSFCN     = ',0.5
         WRITE(6,'(2X,A,F6.1)')       'FACTOR     = ',100.0
      ELSEIF (lmap) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          OPTIMIZER RUN CONTROL PARAMETERS'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,I5.4)')       'NFUNC_MAX  = ',1000
         IF (lvmec) WRITE(6,'(2x,A)') 'EQUIL_TYPE = ''VMEC2000'''
         WRITE(6,'(2x,A)')            'OPT_TYPE   = ''MAP'''
         WRITE(6,'(2X,A,I2.2)')       'MODE       = ',10
         WRITE(6,'(2X,A,I2.2)')       'NPOPULATION = ',16
      ELSEIF (lmap_plane) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          OPTIMIZER RUN CONTROL PARAMETERS'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,I5.4)')       'NFUNC_MAX  = ',1000
         IF (lvmec) WRITE(6,'(2x,A)') 'EQUIL_TYPE = ''VMEC2000'''
         WRITE(6,'(2x,A)')            'OPT_TYPE   = ''MAP_PLANE'''
         WRITE(6,'(2X,A,I2.2)')       'MODE       = ',10
         WRITE(6,'(2X,A,I2.2)')       'NPOPULATION = ',16
      ENDIF
      WRITE(6,'(A)')'!-----------------------------------------------------------------------'
      WRITE(6,'(A)')'!          OPTIMIZED QUANTITIES'
      WRITE(6,'(A)')'!-----------------------------------------------------------------------'
      IF (lvmec .and. .not. lmap_plane) THEN
         lfreeb = .false.
         ! Read the input file
         INQUIRE(FILE='input.'//TRIM(id_string),EXIST=lexist)
      	IF (.not.lexist) STOP '!!!!!COULD not file input file!!!!!'
         CALL safe_open(iunit,ier,'input.'//TRIM(id_string),'old','formatted')
         IF(ier /= 0) STOP '!!!!!ERROR opening input file!!!!!'
         CALL read_indata_namelist(iunit,ier)
         IF(ier /= 0) STOP '!!!!!ERROR reading &INDATA namelist!!!!!'
         CLOSE(iunit)
         ! Handle lfreeb=.true. default
         IF (ALL(extcur==0) .and. lfreeb) lfreeb = .FALSE.
         ! Fourier Transform rbc zbs
         rreal = 0; zreal=0;
         DO i = 1, nu
            DO j = 1, nv
               DO m = 0, mpol-1
                  DO n = -ntor,ntor
                     rreal(i,j) = rreal(i,j) + rbc(n,m)*cos(pi2*(m*DBLE(i-1)/(nu-1)-n*DBLE(j-1)/(nv-1)))
                     zreal(i,j) = zreal(i,j) + zbs(n,m)*sin(pi2*(m*DBLE(i-1)/(nu-1)-n*DBLE(j-1)/(nv-1)))
                  END DO
               END DO
            END DO
         END DO
         ! Handle the optimizer
         ! Handle PHIEDGE
         IF (lphiedge) THEN
            var = phiedge
            var_name = 'PHIEDGE'
            IF (var == 0) var = 1
            var_min = bound_min*var
            var_max = bound_max*var
            IF (var_max < var_min) THEN
               temp = var_max
               var_max = var_min
               var_min = temp
            END IF
            WRITE(6,onevar) 'L'//TRIM(var_name)//'_OPT',TRIM(var_name)//'_MIN',var_min,TRIM(var_name)//'_MAX',var_max,'D'//TRIM(var_name)//'_OPT',1.0
         END IF
         ! Handle CURTOR
         IF (lcurtor) THEN
            var = curtor
            var_name = 'CURTOR'
            IF (var == 0) var = 1
            var_min = bound_min*var
            var_max = bound_max*var
            IF (var_max < var_min) THEN
               temp = var_max
               var_max = var_min
               var_min = temp
            END IF
            WRITE(6,onevar) 'L'//TRIM(var_name)//'_OPT',TRIM(var_name)//'_MIN',var_min,TRIM(var_name)//'_MAX',var_max,'D'//TRIM(var_name)//'_OPT',1.0
         END IF
         ! Handle PSCALE
         IF (lpscale) THEN
            var = pres_scale
            var_name = 'PSCALE'
            IF (var == 0) var = 1
            var_min = bound_min*var
            var_max = bound_max*var
            IF (var_max < var_min) THEN
               temp = var_max
               var_max = var_min
               var_min = temp
            END IF
            IF (var_min < 0) var_min = 0  ! Positive Pressure
            WRITE(6,onevar) 'L'//TRIM(var_name)//'_OPT',TRIM(var_name)//'_MIN',var_min,TRIM(var_name)//'_MAX',var_max,'D'//TRIM(var_name)//'_OPT',1.0
         END IF
         IF (lfreeb) THEN
            ! Handle EXTCUR
            var_name = 'EXTCUR'
            DO i = LBOUND(extcur,DIM=1), UBOUND(extcur,DIM=1)
               IF (ABS(extcur(i)) > 0) THEN
                  var = extcur(i)
                  var_min = bound_min*var
                  var_max = bound_max*var
                  IF (var_max < var_min) THEN
                     temp = var_max
                     var_max = var_min
                     var_min = temp
                  END IF
                  WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
               END IF
            END DO
         END IF
         ! Pressure Profile
         IF (lam) THEN
            CALL tolower(pmass_type)
            SELECT CASE(pmass_type)
               CASE('cubic_spline','akima_spline')
                  var_name='AM_F'
                  DO i = LBOUND(am_aux_f,DIM=1),UBOUND(am_aux_f,DIM=1)
                     IF (am_aux_s(i) .ge. 0) THEN
                        var = am_aux_f(i)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                     END IF
                  END DO
               CASE DEFAULT
                  var_name='AM'
                  DO i = LBOUND(am,DIM=1),UBOUND(am,DIM=1)
                     IF (ABS(am(i)) > 0) THEN
                        var = am(i)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                     END IF
                  END DO
            END SELECT
         END IF
         ! Current/Iota Profile
         IF (ncurr == 1 .and. lac) THEN
            CALL tolower(pcurr_type)
            SELECT CASE(pcurr_type)
               CASE('cubic_spline','akima_spline','cubic_spline_ip','akima_spline_ip')
                  var_name='AC_F'
                  DO i = LBOUND(ac_aux_f,DIM=1),UBOUND(ac_aux_f,DIM=1)
                     IF (ac_aux_s(i) .ge. 0) THEN
                        var = ac_aux_f(i)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                     END IF
                  END DO
               CASE DEFAULT
                  var_name='AC'
                  DO i = LBOUND(ac,DIM=1),UBOUND(ac,DIM=1)
                     IF (ABS(ac(i)) > 0) THEN
                        var = ac(i)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                     END IF
                  END DO
            END SELECT
         ELSEIF (ncurr==0 .and. lai) THEN
            CALL tolower(piota_type)
            SELECT CASE(piota_type)
               CASE('cubic_spline','akima_spline')
                  var_name='AI_F'
                  DO i = LBOUND(ai_aux_f,DIM=1),UBOUND(ai_aux_f,DIM=1)
                     IF (ai_aux_s(i) .ge. 0) THEN
                        var = ai_aux_f(i)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                     END IF
                  END DO
               CASE DEFAULT
                  var_name='AI'
                  DO i = LBOUND(ai,DIM=1),UBOUND(ai,DIM=1)
                     IF (ABS(ai(i)) > 0) THEN
                        var = ai(i)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,TRIM(var_name)//'_MIN',i,var_min,TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                     END IF
                  END DO
            END SELECT
         END IF
         ! Magnetic Axis
         IF (.not.lfreeb) THEN
            var_name = 'AXIS'
            DO i = LBOUND(raxis_cc,DIM=1), UBOUND(raxis_cc,DIM=1)
               IF (ABS(raxis_cc(i)) > 0 .or. ABS(zaxis_cs(i)) > 0) THEN
                  var = raxis_cc(i)
                  var_min = bound_min*var
                  var_max = bound_max*var
                  IF (var_max < var_min) THEN
                     temp = var_max
                     var_max = var_min
                     var_min = temp
                  END IF
                  WRITE(6,vecvar) 'L'//TRIM(var_name)//'_OPT',i,'R'//TRIM(var_name)//'_MIN',i,var_min,'R'//TRIM(var_name)//'_MAX',i,var_max,'D'//TRIM(var_name)//'_OPT',i,1.0
                  var = zaxis_cs(i)
                  var_min = bound_min*var
                  var_max = bound_max*var
                  IF (var_max < var_min) THEN
                     temp = var_max
                     var_max = var_min
                     var_min = temp
                  END IF
                  WRITE(6,vecvar2) 'Z'//TRIM(var_name)//'_MIN',i,var_min,'Z'//TRIM(var_name)//'_MAX',i,var_max
               END IF
            END DO
            ! Now do boundary
            IF (lrbc) THEN
               var_name = 'BOUND'
               DO n = LBOUND(rbc,DIM=1), UBOUND(rbc,DIM=1)
                  DO m = LBOUND(rbc,DIM=2), UBOUND(rbc,DIM=2)
                     IF (ABS(rbc(n,m)) > 0 .or. ABS(zbs(n,m)) > 0) THEN
                        var = rbc(n,m)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,arrvar) 'L'//TRIM(var_name)//'_OPT',n,m,'RBC_MIN',n,m,var_min,'RBC_MAX',n,m,var_max,'DBOUND_OPT',n,m,1.0
                        var = zbs(n,m)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,arrvar2) 'ZBS_MIN',n,m,var_min,'ZBS_MAX',n,m,var_max
                     END IF
                  END DO
               END DO
            ELSEIF (lmode) THEN
               var_name = 'MODE'
               DO n = LBOUND(rbc,DIM=1), UBOUND(rbc,DIM=1)
                  DO m = LBOUND(rbc,DIM=2), UBOUND(rbc,DIM=2)
                     IF (ABS(rbc(n,m)) > 0 .or. ABS(zbs(n,m)) > 0) THEN
                        var = 0.5*(rbc(n,m) + zbs(n,m))
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,arrvar) 'L'//TRIM(var_name)//'_OPT',n,m,'BOUND_MIN',n,m,var_min,'BOUND_MAX',n,m,var_max,'DBOUND_OPT',n,m,1.0
                     END IF
                  END DO
               END DO
            ELSEIF (lrhomn) THEN
               rhobc = 0.0_rprec
               rho_exp = 4
               rbc_temp = rbc
               zbs_temp = zbs
               CALL convert_boundary(rbc_temp,zbs_temp,rhobc,mpol1d,ntord,rho_exp)
               rbc_temp = rbc
               zbs_temp = zbs
               WHERE(ABS(rhobc) < ABS(filter_harm*rhobc(0,1))) rhobc = 0
               IF (loutput_harm) THEN
                  DO n = -ntor,ntor
                     DO m = 0, mpol
                        IF (abs(rhobc(n,m)) > 0.0) &
                            WRITE(6,'(1(A,I2,A,I2,A,E22.12))') '!  RHOMN(',n,',',m,') = ',rhobc(n,m)
                     END DO
                  END DO
               END IF
               CALL unique_boundary(rbc_temp,zbs_temp,rhobc,mpol1d,ntord,mpol-1,ntor,mpol-1,rho_exp)
               IF (loutput_harm) THEN
                  DO n = -ntor,ntor
                     DO m = 0, mpol
                         IF (abs(rbc_temp(n,m)) > 0.0 .or. abs(zbs_temp(n,m)) > 0.0) &
                         WRITE(6,'(2(A,I2,A,I2,A,E22.12))') '  RBC(',n,',',m,') = ',rbc_temp(n,m),'  ZBS(',n,',',m,') = ',zbs_temp(n,m)
                     END DO
                  END DO
               END IF
               delta = 0
               DO m = 0, mpol
                  DO n = -ntor, ntor
                     IF (rbc(n,m) /= 0) delta = delta + (rbc(n,m)-rbc_temp(n,m))**2/rbc(n,m)**2
                     IF (zbs(n,m) /= 0) delta = delta + (zbs(n,m)-zbs_temp(n,m))**2/zbs(n,m)**2
                  END DO
               END DO
               delta = sqrt(delta)
               WRITE(6,'(A)')'!-----------------------------------------------------------------------'
               WRITE(6,'(A)')'!          HIRSHMAN-BRESLAU BOUNDARY REPRESENTATION'
               WRITE(6,'(A,F10.2,A)')'!            BOUNDARY CONVERSION ACCURACY: ',100*(1-delta),'%'
               WRITE(6,'(A)')'!-----------------------------------------------------------------------'
               ! Mimic LFIX_NTOR
               m=0
               var_name = 'RHO'
               DO n = 0,ntor
                  IF ((rbc(n,0) /= 0 .or. zbs(n,0) /= 0) .and. (n /= 0) .and. (.not. lfix_ntor)) THEN
                     var = rbc(n,0)
                     var_min = bound_min*var
                     var_max = bound_max*var
                     IF (var_max < var_min) THEN
                        temp = var_max
                        var_max = var_min
                        var_min = temp
                     END IF
                     WRITE(6,arrvar) 'LBOUND_OPT',n,m,'RBC_MIN',n,m,var_min,'RBC_MAX',n,m,var_max,'DBOUND_OPT',n,m,1.0
                     var = zbs(n,0)
                     var_min = bound_min*var
                     var_max = bound_max*var
                     IF (var_max < var_min) THEN
                        temp = var_max
                        var_max = var_min
                        var_min = temp
                     END IF
                     WRITE(6,arrvar2) 'ZBS_MIN',n,m,var_min,'ZBS_MAX',n,m,var_max
                  END IF
               END DO
               ! Now do rho
               !DO n = LBOUND(rhobc,DIM=1), UBOUND(rhobc,DIM=1)
               DO n = -ntor,ntor
                  DO m = LBOUND(rhobc,DIM=2), UBOUND(rhobc,DIM=2)
                     IF (ABS(rhobc(n,m)) > 0 .and. (m /= 0 .or. n >= 0)) THEN
                        var = rhobc(n,m)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,arrvar) 'L'//TRIM(var_name)//'_OPT',n,m,'BOUND_MIN',n,m,var_min,'BOUND_MAX',n,m,var_max,'DRHO_OPT',n,m,1.0
                     END IF
                  END DO
               END DO
            ELSEIF (ldeltamn) THEN
               var_name = 'DELTA'
               deltamn = 0.0_rprec
               rbc_temp = rbc
               zbs_temp = zbs
               CALL convert_boundary_PG(rbc_temp,zbs_temp,deltamn,mpol1d,ntord)
               ! Quick and dirty LPKU Test
               !deltamn = 0
               !deltamn(-1,-1) = 0.087
               !deltamn( 0,-1) = 0.119
               !deltamn( 0, 0) = 1.000
               !deltamn( 1, 0) = 0.099! deltamn(0,0) = 5.178*2
               !deltamn( 0, 1) = 5.178
               !deltamn( 1, 1) = 0.107
               !deltamn( 2, 1) =-0.035
               !deltamn(-1, 2) = 0.049
               !deltamn( 0, 2) =-0.313
               !deltamn( 1, 2) =-0.350
               !deltamn( 2, 2) =-0.019
               !deltamn(-1, 3) =-0.020
               !deltamn( 0, 3) = 0.132
               !deltamn( 1, 3) = 0.069
               !deltamn( 2, 3) = 0.061
               !deltamn( 0, 4) =-0.002
               !deltamn( 1, 4) = 0.000
               !deltamn( 3, 4) =-0.017
               rbc_temp = rbc
               zbs_temp = zbs
               WHERE(ABS(deltamn) < ABS(filter_harm*deltamn(0,1))) deltamn = 0
               IF (loutput_harm) THEN
                  DO n = -ntor,ntor
                     DO m = -mpol, mpol
                        IF (abs(deltamn(n,m)) > 0.0) &
                            WRITE(6,'(1(A,I2,A,I2,A,E22.12))') '!  DELTAMN(',n,',',m,') = ',deltamn(n,m)
                     END DO
                  END DO
               END IF
               CALL unique_boundary_PG(rbc_temp,zbs_temp,deltamn,ntord,mpol1d,mpol,ntor)
               IF (loutput_harm) THEN
                  DO n = -ntor,ntor
                     DO m = 0, mpol
                         IF (abs(rbc_temp(n,m)) > 0.0 .or. abs(zbs_temp(n,m)) > 0.0) &
                         WRITE(6,'(2(A,I2,A,I2,A,E22.12))') '  RBC(',n,',',m,') = ',rbc_temp(n,m),'  ZBS(',n,',',m,') = ',zbs_temp(n,m)
                     END DO
                  END DO
               END IF
               delta = 0
               DO m = 0, mpol
                  DO n = -ntor, ntor
                     IF (rbc(n,m) /= 0) delta = delta + (rbc(n,m)-rbc_temp(n,m))**2/rbc(n,m)**2
                     IF (zbs(n,m) /= 0) delta = delta + (zbs(n,m)-zbs_temp(n,m))**2/zbs(n,m)**2
                  END DO
               END DO
               delta = sqrt(delta)
               WRITE(6,'(A)')'!-----------------------------------------------------------------------'
               WRITE(6,'(A)')'!          GARABEDIAN BOUNDARY REPRESENTATION'
               WRITE(6,'(A,F10.2,A)')'!            BOUNDARY CONVERSION ACCURACY: ',100*(1-delta),'%'
               WRITE(6,'(A)')'!-----------------------------------------------------------------------'
               !DO n = LBOUND(deltamn,DIM=1), UBOUND(deltamn,DIM=1)
               DO n = -ntor,ntor
                  DO m = LBOUND(deltamn,DIM=2), UBOUND(deltamn,DIM=2)
                     IF (ABS(deltamn(n,m)) > 0 &
                         .and. .not.(n == 0 .and. m == 0)) THEN
                        var = deltamn(n,m)
                        var_min = bound_min*var
                        var_max = bound_max*var
                        IF (var_max < var_min) THEN
                           temp = var_max
                           var_max = var_min
                           var_min = temp
                        END IF
                        WRITE(6,arrvar) 'L'//TRIM(var_name)//'MN_OPT',n,m,'DELTA_MIN',n,m,var_min,'DELTA_MAX',n,m,var_max,'DDELTAMN_OPT',n,m,1.0
                     END IF
                  END DO
               END DO
               ! Add in RBC(n,m=0) modes
               m=0
               DO n = 0, ntor
                  IF (rbc(n,0) .ne. 0 .or. zbs(n,0) .ne. 0) THEN
                  var = rbc(n,0)
                     var_min = bound_min*var
                     var_max = bound_max*var
                     IF (var_max < var_min) THEN
                        temp = var_max
                        var_max = var_min
                        var_min = temp
                     END IF
                     WRITE(6,arrvar) 'LBOUND_OPT',n,m,'RBC_MIN',n,m,var_min,'RBC_MAX',n,m,var_max,'DBOUND_OPT',n,m,1.0
                     var = zbs(n,0)
                     var_min = bound_min*var
                     var_max = bound_max*var
                     IF (var_max < var_min) THEN
                        temp = var_max
                        var_max = var_min
                        var_min = temp
                     END IF
                     WRITE(6,arrvar2) 'ZBS_MIN',n,m,var_min,'ZBS_MAX',n,m,var_max
                  END IF
               END DO
            END IF
         END IF
      ELSE IF (lvmec .and. lmap_plane) THEN
         ! Read the input file
         INQUIRE(FILE='input.'//TRIM(id_string),EXIST=lexist)
      	IF (.not.lexist) STOP '!!!!!COULD not file input file!!!!!'
         CALL safe_open(iunit,ier,'input.'//TRIM(id_string),'old','formatted')
         IF(ier /= 0) STOP '!!!!!ERROR opening input file!!!!!'
         CALL read_indata_namelist(iunit,ier)
         IF(ier /= 0) STOP '!!!!!ERROR reading &INDATA namelist!!!!!'
         CLOSE(iunit)
         WRITE(6,'(2X,A)')'LPHIEDGE_OPT = T'
         WRITE(6,'(2X,A)')'LPSCALE_OPT = T'
         WRITE(6,'(2X,A)')'LCURTOR_OPT = T'
         CALL tolower(pmass_type)
         SELECT CASE(pmass_type)
            CASE('cubic_spline','akima_spline')
               m = LBOUND(am_aux_f,DIM=1)
               n = UBOUND(am_aux_f,DIM=1)
               WRITE(6,'(2X,A,I5,A)')'LAM_F_OPT = ',n-m+1,'*T'
            CASE DEFAULT
               m = LBOUND(am,DIM=1)
               n = UBOUND(am,DIM=1)
               WRITE(6,'(2X,A,I5,A)')'LAM_OPT = ',n-m+1,'*T'
         END SELECT
         IF (ncurr == 1) THEN
            CALL tolower(pcurr_type)
            SELECT CASE(pcurr_type)
               CASE('cubic_spline','akima_spline','cubic_spline_ip','akima_spline_ip')
                  m = LBOUND(ac_aux_f,DIM=1)
                  n = UBOUND(ac_aux_f,DIM=1)
                  WRITE(6,'(2X,A,I5,A)')'LAC_F_OPT = ',n-m+1,'*T'
               CASE DEFAULT
                  m = LBOUND(ac,DIM=1)
                  n = UBOUND(ac,DIM=1)
                  WRITE(6,'(2X,A,I5,A)')'LAC_OPT = ',n-m+1,'*T'
            END SELECT
         ELSE
            CALL tolower(piota_type)
            SELECT CASE(piota_type)
               CASE('cubic_spline','akima_spline')
                  m = LBOUND(ai_aux_f,DIM=1)
                  n = UBOUND(ai_aux_f,DIM=1)
                  WRITE(6,'(2X,A,I5,A)')'LAI_F_OPT = ',n-m+1,'*T'
               CASE DEFAULT
                  m = LBOUND(ai,DIM=1)
                  n = UBOUND(ai,DIM=1)
                  WRITE(6,'(2X,A,I5,A)')'LAI_OPT = ',n-m+1,'*T'
            END SELECT
         END IF
         IF (lfreeb) THEN
            m = LBOUND(extcur,DIM=1)
            n = UBOUND(extcur,DIM=1)
            WRITE(6,'(2X,A,I5,A)')'LEXTCUR_OPT = ',n-m+1,'*T'
         END IF
         WRITE(6,'(2X,A,I5,A)')'LAXIS_OPT = ',ntor+1,'*T'
         IF (lrbc) THEN
            DO m = 0, mpol-1
               WRITE(6,"(2X,A,I4.3,':',I3.3,',',I4,A,I4,A)") 'LBOUND_OPT(',-ntor,ntor,m,') = ',2*ntor+1,'*T'
            END DO
         ELSEIF (lrhomn) THEN
            DO m = 0, mpol-2
               WRITE(6,"(2X,A,I4.3,':',I3.3,',',I4,A,I4,A)") 'LRHO_OPT(',-ntor,ntor,m,') = ',2*ntor+1,'*T'
            END DO
         ELSEIF (ldeltamn) THEN
            DO m = -mpol, mpol
               WRITE(6,"(2X,A,I4.3,':',I3.3,',',I4,A,I4,A)") 'LDELTAMN_OPT(',-ntor,ntor,m,') = ',2*ntor+1,'*T'
            END DO
         END IF
      END IF
      IF (lbasic) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          PLASMA PROPERTIES'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_ASPECT  = ',rbc(0,0)/rbc(0,1),'SIGMA_ASPECT = ',0.001
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_BETA    = ',0.05,'SIGMA_BETA = ',0.001
         WRITE(6,'(2X,A,ES10.1,2X,A,ES10.1)') 'TARGET_CURTOR  = ',curtor,'SIGMA_CURTOR = ',0.01*curtor
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_PHIEDGE = ',phiedge,'SIGMA_PHIEDGE = ',0.01*phiedge
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_RBTOR   = ',1.0,'SIGMA_RBTOR = ',0.01
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_R0      = ',raxis_cc(0),'SIGMA_R0 = ',0.01*raxis_cc(0)
         IF (lasym) &
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_Z0      = ',zaxis_cs(0),'SIGMA_Z0 = ',0.01*raxis_cs(0)
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_VOLUME  = ',1.0,'SIGMA_VOLUME = ',0.01
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_WP      = ',1.0,'SIGMA_WP = ',0.01
      END IF
      IF (lkappa) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          PLASMA ELONGATION (kappa)'
         WRITE(6,'(A)')'!             PHI is toroidal angle [0,2pi] over whole device'
         WRITE(6,'(A)')'!             Values output are approximate'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         r1t = SUM(rbc(0,0:mpol-1))
         r2t = SUM(rbc(0,0:mpol-1:2)) - SUM(rbc(0,1:mpol-1:2))
         z1t = SUM(zbs(0,1:mpol-1:2))
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1,2X,A,F6.3)') 'TARGET_KAPPA     = ',2*z1t/(r1t-r2t),'SIGMA_KAPPA     = ',0.01*z1t/(r1t-r2t),' PHI_KAPPA = ',0.0
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1,2X,A,F6.3)') 'TARGET_KAPPA_BOX = ',2*z1t/(r1t-r2t),'SIGMA_KAPPA_BOX = ',0.01*z1t/(r1t-r2t),' PHI_KAPPA_BOX = ',0.0
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)')           'TARGET_KAPPA_AVG = ',2*z1t/(r1t-r2t),'SIGMA_KAPPA_AVG = ',0.01*z1t/(r1t-r2t)
      END IF
      IF (lneed_booz) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!          Boozer Coordinate Transformation'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3)') 'MBOZ = ',2 ** CEILING(log(REAL(MAX(6*mpol,2)))/log(2.0_rprec))
         WRITE(6,'(2X,A,I3)') 'NBOZ = ',2 ** CEILING(log(REAL(MAX(2*ntor-1,1)))/log(2.0_rprec))
      END IF
      ns = MAXVAL(ns_array)
      IF (liota) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       IOTA PROFILE TARGETS'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         DO i = 1, ns
            temp = REAL(i-1) / REAL(ns-1)
            WRITE(6,target3) 'TARGET_IOTA',i,piota(temp),'SIGMA_IOTA',i,0.01,'S_IOTA',i,temp
         END DO
      END IF
      IF (lvaciota) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       VACUUM IOTA PROFILE TARGETS (-S12/S11)'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         DO i = 1, ns
            temp = REAL(i-1) / REAL(ns-1)
            WRITE(6,target3) 'TARGET_VACIOTA',i,piota(temp),'SIGMA_VACIOTA',i,0.01,'S_VACIOTA',i,temp
         END DO
      END IF
      IF (lqas .or. lqps .or. lhelical) THEN
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Boozer Coordinate Helicity'
         WRITE(6,'(A)')'!         Note that helicity targeting is by surface.  Axis (01) is ignored.'
         WRITE(6,'(A)')'!         (X,0): Quasi-Axisymetry'
         WRITE(6,'(A)')'!         (0,X): Quasi-Poloidal Symmetry'
         WRITE(6,'(A)')'!         (L,K): Quasi-Helical Symmetry (m *K + n*L)'
         WRITE(6,'(A)')'!-----------------------------------------------------------------------'
         IF (lqas) WRITE(6,'(2X,A)') 'HELICITY = (1,0)'
         IF (lqps) WRITE(6,'(2X,A)') 'HELICITY = (0,1)'
         IF (lhelical) WRITE(6,'(2X,A)') 'HELICITY = (2,1)'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_HELICITY(1:',ns,') = ',ns,'*0.0  SIGMA_HELICITY(1:',ns,') = ',ns,'*-1.0'
      END IF
      IF (lballoon) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Ballooning Stability (as calculated by COBRA_VMEC)'
         WRITE(6,'(A)')'!         Note that ballooning stability is by surface.  Axis (01) is ignored.'
         WRITE(6,'(A)')'!         THETA, ZETA: Ballooning angle perturbations'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A)') 'BALLOON_THETA = 0.0'
         WRITE(6,'(2X,A)') 'BALLOON_ZETA  = 0.0'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_BALLOON(1:',ns,') = ',ns,'*0.0  SIGMA_BALLOON(1:',ns,') = ',ns,'*1.0'
      END IF
      IF (lneo) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Neoclassical Transport Calculation (as calculated by NEO)'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_NEO(1:',ns,') = ',ns,'*0.0  SIGMA_NEO(1:',ns,') = ',ns,'*1.0'
      END IF
      IF (ldkes) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Neoclassical Transport Calculation (as calculated by DKES)'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_DKES(1:',ns,') = ',ns,'*0.0  SIGMA_DKES(1:',ns,') = ',ns,'*1.0'
      END IF
      IF (lbootsj) THEN
         ! Note boozer quantities are on half grid so nboot = ns-1
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Bootstrap Current Calculation (as calculated by BOOTSJ)'
         WRITE(6,'(A)')'!       NE/TE/TI profiles required!'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_BOOTSTRAP(2:',ns,') = ',ns-1,'*0.0  SIGMA_BOOTSTRAP(1:',ns-1,') = ',ns-1,'*1.0'
      END IF
      IF (lkink) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Kink Stability Calculation (as calculated by TERPSICHORE)'
         WRITE(6,'(A)')'!           terpsichore_input file required in run directory!'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A)') 'MLMNB_KINK = 264 IVAC_KINK = 24'
         WRITE(6,'(2X,A)') 'TARGET_KINK(01) = 1.0E-3  SIGMA_KINK(01) = 1.0   ! terpsichore_input_00'
         WRITE(6,'(4X,A)') 'NJ_KINK(01) = 256 NK_KINK(01) = 256'
         WRITE(6,'(4X,A)') 'MLMNS_KINK(01) = 76 LSSD_KINK(01) = 4096 LSSL_KINK(01) = 4096'
         WRITE(6,'(2X,A)') 'TARGET_KINK(02) = 1.0E-3  SIGMA_KINK(02) = 1.0   ! terpsichore_input_01'
         WRITE(6,'(4X,A)') 'NJ_KINK(02) = 256 NK_KINK(02) = 256'
         WRITE(6,'(4X,A)') 'MLMNS_KINK(02) = 76 LSSD_KINK(02) = 4096 LSSL_KINK(02) = 4096'
      END IF
      IF (lorbit) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       ORBIT (BEAMS3D) OPTIMIZATION'
         WRITE(6,'(A)')'!          ASSUMES ALPHAS'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A)') 'MASS_ORBIT = 6.64465675E-27'
         WRITE(6,'(2X,A)') 'Z_ORBIT = 2'
         WRITE(6,'(2X,A)') 'NU_ORBIT = 16'
         WRITE(6,'(2X,A)') 'NV_ORBIT = 16'
         WRITE(6,target2) 'TARGET_ORBIT',2,0.0,'SIGMA_ORBIT',2,1.0
         WRITE(6,'(2X,A)') 'NP_ORBIT = 8'
         DO i = 1, 8
            WRITE(6,target2) 'VLL_ORBIT',i,1.0,'VPERP_ORBIT',i,1.0
         END DO
      END IF
      IF (ltxport) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       TURBULENT TRANSPORT'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A)') 'TXPORT_PROXY = ''prox1d'''
         WRITE(6,'(2X,A)') 'LGLOBAL_TXPORT = F'
         WRITE(6,'(2X,A)') 'NZ_TXPORT = 128'
         WRITE(6,'(2X,A)') 'NALPHA_TXPORT = 1'
         WRITE(6,'(2X,A)') 'ALPHA_START_TXPORT = 0.0'
         WRITE(6,'(2X,A,ES10.8)') 'ALPHA_END_TXPORT = ', pi2/(2*nfp)
         DO i = 2, ns
            WRITE(6,target3) 'TARGET_TXPORT',i,0.0,'SIGMA_TXPORT',i,1.0,'S_TXPORT',i,REAL(i)/REAL(ns)
         END DO
      END IF
      IF (ljdotb0) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Flux surface averaged parallel current density (<JDOTB>)'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_JDOTB(1:',ns,') = ',ns,'*0.0  SIGMA_JDOTB(1:',ns,') = ',ns,'*1.0'
      END IF
      IF (ljcurv) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Flux surface averaged toroidal current density (<JCURV>)'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_JCURV(1:',ns,') = ',ns,'*0.0  SIGMA_JCURV(1:',ns,') = ',ns,'*1.0'
      END IF
      IF (lwell) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Magnetic Well'
         WRITE(6,'(A)')'!       Stable:    +'
         WRITE(6,'(A)')'!       Un-stable: -'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,I3.3,A,I3.3,A,I3.3,A,I3.3,A)') 'TARGET_MAGWELL(1:',ns,') = ',ns,'*1.0  SIGMA_MAGWELL(1:',ns,') = ',ns,'*1.0'
      END IF
      IF (lcurvature) THEN
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Curvature Kurtosis at Boundary'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(2X,A,F6.3,2X,A,ES10.1)') 'TARGET_CURVATURE = ',0.0,'SIGMA_CURVATURE = ',1.00
      END IF
      ! END OPTIMUM Namelist
      WRITE(6,'(A)') '/'
      ! Add namelists
      IF (lneo) THEN
         WRITE(6,'(A)') '&NEO_IN'
         WRITE(6,'(A)') '/'
      END IF
      IF (lbootsj) THEN
         WRITE(6,'(A)') '&BOOTIN'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)')'!       Notes'
         WRITE(6,'(A)')'!       ZEFF:  Effective Ion Charge'
         WRITE(6,'(A)')'!       DENS0: Maximum density (10^20 m^-3) IFF TEMPRES>=0'
         WRITE(6,'(A)')'!       TEMPRES:  Controls density profile shape'
         WRITE(6,'(A)')'!       TETI:  TETI Ratio'
         WRITE(6,'(A)')'!       Note defaults below use STELLOPT NE, TE, TI'
         WRITE(6,'(A)')'!------------------------------------------------------------------------'
         WRITE(6,'(A)') '  ZEFF1 = 1'
         WRITE(6,'(A)') '  TEMPRES = -1.0 ! Switch (-1: use STEL prof, >0: use alternative)'
         WRITE(6,'(A)') '  DENS0 = 0.5 ! Density (10^20 m^-3)'
         WRITE(6,'(A)') '  TETI = -1.0 ! TE/TI ratio (set negative to use STEL TI profile)'
         WRITE(6,'(A)') '/'
      END IF
      IF (lorbit) THEN
         WRITE(6,'(A)') '&BEASM3D'
         WRITE(6,'(2X,A)') 'NR = 128'
         WRITE(6,'(2X,A,I3)') 'NPHI = ',180/nfp
         WRITE(6,'(2X,A)') 'NZ = 128'
         WRITE(6,'(2X,A,F6.3)') 'RMAX = ',MAXVAL(MAXVAL(rreal,2),1)+0.1
         WRITE(6,'(2X,A,F6.3)') 'RMIN = ',MINVAL(MINVAL(rreal,2),1)-0.1
         WRITE(6,'(2X,A,F6.3)') 'ZMAX = ',MAXVAL(MAXVAL(zreal,2),1)+0.1
         WRITE(6,'(2X,A,F6.3)') 'ZMIN = ',MINVAL(MINVAL(zreal,2),1)-0.1
         WRITE(6,'(2X,A,F6.3)') 'PHIMIN = ',0.0
         WRITE(6,'(2X,A,F12.10)') 'PHIMAX = ',pi2/nfp
         WRITE(6,'(2X,A)') 'NPOINC = 512'
         WRITE(6,'(2X,A)') 'INT_TYPE = ''LSODE'''
         WRITE(6,'(2X,A)') 'FOLLOW_TOL = 1.0E-9'
         WRITE(6,'(2X,A)') 'T_END_IN = 2*1.0E-2'
         WRITE(6,'(2X,A)') 'R_START_IN(1) = 1.0'
         WRITE(6,'(A)') '/'
      END IF
      IF (lfieldlines) THEN
         WRITE(6,'(A)') '&FIELDLINES_INPUT'
         WRITE(6,'(2X,A)') 'NR = 128'
         WRITE(6,'(2X,A,I3)') 'NPHI = ',180/nfp
         WRITE(6,'(2X,A)') 'NZ = 128'
         WRITE(6,'(2X,A,F6.3)') 'RMAX = ',MAXVAL(MAXVAL(rreal,2),1)+0.5
         WRITE(6,'(2X,A,F6.3)') 'RMIN = ',MINVAL(MINVAL(rreal,2),1)-0.5
         WRITE(6,'(2X,A,F6.3)') 'ZMAX = ',MAXVAL(MAXVAL(zreal,2),1)+0.5
         WRITE(6,'(2X,A,F6.3)') 'ZMIN = ',MINVAL(MINVAL(zreal,2),1)-0.5
         WRITE(6,'(2X,A,F6.3)') 'PHIMIN = ',0.0
         WRITE(6,'(2X,A,F12.10)') 'PHIMAX = ',pi2/nfp
         WRITE(6,'(2X,A)') 'NPOINC = 16'
         WRITE(6,'(2X,A)') 'INT_TYPE = ''LSODE'''
         WRITE(6,'(2X,A)') 'FOLLOW_TOL = 1.0E-9'
         WRITE(6,'(2X,2(A,F6.3))') 'R_START = ',sum(raxis_cc),'  ',MAXVAL(rreal(:,1))
         WRITE(6,'(2X,2(A,F6.3))') 'Z_START = ',0.0,'  ',MAXVAL(zreal(:,1))
         WRITE(6,'(2X,A)') 'PHI_START = 2*0.0'
         WRITE(6,'(2X,A,E20.10)') 'PHI_END = 2*',1000*pi2/nfp
         WRITE(6,'(A)') '/'
      END IF
      CALL FLUSH(6)
!-----------------------------------------------------------------------
!     End Program
!-----------------------------------------------------------------------
      END PROGRAM VMEC2STEL

max_stars_repo_name: joseluisvelasco/STELLOPT

max_issues_repo_name: joseluisvelasco/STELLOPT

max_forks_repo_name: joseluisvelasco/STELLOPT


text:
      subroutine inp_data(rel,skip,ec,nze,njv,minj,maxj,pflsj)

      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
      PARAMETER (NOD=220,NWCD=20,NWD=60,NTERMD=31,LINT=500)
      INCLUDE 'mpif.h'
      parameter (MAXPROC=9999)
      common /MPI/ myid, nprocs, ierr, istat(MPI_STATUS_SIZE)

      COMMON /INOUT/IREAD,IWRITE,ISCW,iuc,iuw,ioul,iouj,iout,
     :             iouhn,iouhz,iouhs,iouhm,iLS,idisk

      LOGICAL rel,skip
      logical onlydvd

      COMMON /PARAM/H,H1,H3,CH,EH,RHO,Z,TOL,NO,ND,NWF,MSOO,NCFG,IB,IC,ID
     :   ,D0,D1,D2,D3,D4,D5,D6,D8,D10,D12,D16,D30,FINE,NSCF,NCLOSD,RMASS

      POINTER (qjptr, jptr(1))
      POINTER (IQLSP, LSP(1))
      CHARACTER*3 EL(NWD)
      POINTER(IQP,P(NOD,1)),(IQN,N(1)),(IQL,L(1)),(IQAZ,AZ(1)),
     :       (IQMAX,MAX(1))
      COMMON /NEL/IQP,IQN,IQL,IQAZ,IQMAX,IQ(7)

      POINTER (qintptr,intptr(1)),(qpackn,ipackn(1)),(qvalue,value(1))
      COMMON /TABLE/qintptr,qpackn,qvalue,lmax
      COMMON /NCFGS/ IQLSP,index(ntermd),IJK,nterm,termsh(ntermd)
      pointer(pflsj,nze_flsj(1,1,1,1));

!      print *, 'iout,skip', iout,skip
      read(iout) MSOO,nclosd, maxorb, lsdim, ncfg
      nwf = maxorb+nclosd
      call alctab(ncfg,nwf,skip)
      call alloc(qjptr,ncfg,4)
      call alloc(iqlsp, ncfg, 4)
      call alloc(qiajcmp,maxorb, 4)
      if(nclosd.ne.0) call alloc(qiajcld, nclosd, 4)
      read(iout) l(1:nwf)
!      print *, 'l(:)', l(1:nwf)
      read(iout) el(1:nwf)
!      print *, 'el(i)', el(1:nwf)
      read(iout) lmax,nnel, skip
!      print *, 'lmax,nnel,skip',lmax,nnel,skip
      read(iout) lsp(1:ncfg),jptr(1:ncfg)
!      print *,'lsp', lsp(1:ncfg),jptr(1:ncfg)
      read(iout) nterm, index(1:nterm)
!      print *, 'nterm',nterm, index(1:nterm)

      call READW(el,rel,ec,nnel,skip,onlydvd,iounew)

      call flsj_comp(ncfg,nterm,index,njv,maxj,minj,
     :               pflsj,lsp)

      call MPI_Barrier(MPI_COMM_WORLD,ierr)
      return
      end

ext: f


text:
Kemble K. Pope chooses to be a downtown Davisite and is proud to have been born a http://en.wikipedia.org/wiki/Scottish_American 6th generation Texan. He gardens, has two dogs, prefers his bicycle over his car, likes to play in the great outdoors and is happily married to a pomologist.

Since November 2011, he has been the Executive Director of the Davis Chamber of Commerce. Prior to that position, Kemble worked as a consultant that advised a variety of private companies, elected officials and nonprofits on a wide range of business strategy, communications and civic engagement solutions.  Friends and family say that he has an overdeveloped Civic Duty Organ:

Open Space and Habitat Commission, Past Commissioner & Chairperson (200510)
Climate Action Team, Chairperson (200810)
The Davis Voice, Founder & Editor
Chamber of Commerce, Government Relations Committee Chairperson (2010)
Davis Downtown Business Association, Visioning Committee Member (200910)

Kembles favorite bars are Sophias Thai Kitchen and the mysterious Luna Lounge.  He subscribes to The Davis Enterprise, Capay Organic and The Pepper Peddler.  Few people know that Kemble is a classically trained vocalist, but now that hes a member of University Chorus The UC Davis University Chorus the secret is out.

A favorite quote: “We cannot live only for ourselves.  A thousand fibers connect us with our fellow men” – Herman Melville

Favorite DavisWiki page  Keep Davis Boring  now that is some finely honed sarcasm... or is it?

20091201 15:44:40 nbsp from http://daviswiki.org/Wiki_Community/Room_to_grow

Im not sure where you get the idea that curse words are okay for adults. Outside of 17 to 24 year olds, if somebody is using curse words in normal conversation (i.e., not having just been dumped, sued, drunk off their ass, etc), they are simply uncouth, and it tends to be an indicator of other, less savory aspects of their personality or simply poor manners. I like the way NPR handles it (note that NPR, not being commercial, could use any words they like onair): they do not allow swearing in their stories unless they are newsworthy quotes, and then they prefer not to censor anything, playing the sound clip or reading the quote directly. Thus, they were the only source for the whole Tyson Im gonna f you in the ass, you fing n clip. That format would make sense for the wiki.

Personally, I avoid people who swear casually in public. I also avoid people who slap me on the arm, who belch loudly after eating in a nice restaurant, who pick their teeth in public with their thumbnail, who pick their nose in public... i.e., people who dont know how to behave in a civilized manner. That said, I like art (poetry, movies and books) that use all those things, as they are being used to convey aspects of society or desperation that arent civilized. Theres no contradiction; I like reading Exquisite Corpse, but I dont want to hang around serial killers who rape and eat dead bodies. During a performance of Rocky Horror, I yell more curse words than some people hear in a lifetime and make horribly raunchy jokes. But when the show ends, and the cast goes to a diner, I am with friends rather than characters and I dont swear at all.

Fundamentally, it is an issue of time and place. An entry in the wiki about bad service in a restaurant shouldnt have cursing, IMO. If a Mayor Pro Tem made a comment in public about The fing bad job the police are doing, I think it should be quoted word for word, no censorship. The Wiki isnt a work of art; it is a work of reference. — JabberWokky Users/KemblePope

20100212 12:50:20 nbsp Hey, I noticed your edit comment quick fix to comply with new template. Keep in mind that templates are suggestions and collections of good ideas, not a standard that entries have to comply to.  They help make entries more useful by presenting the information in an easy to grasp and flexible layout, and are not a requirement that forces everything to slavishly follow a fixed format.  If there were fixed fields and records, it would be much easier to simply do everything in a database.  A wiki gives freedom to craft each entry in whatever way works best for the subject at hand.  Templates are great tools, but they arent mandates... they are merely one good idea for a layout. Users/JabberWokky

20100212 14:21:10 nbsp Hey, if you really like em use em.  I just dont want you to feel constrained by them.  Sometimes people see repeated examples and think okay, this is how it is done.  Pretty much anything common on the wiki is only common because somebody early on just started doing it that way.  Its easy to see it as fluid when you watched it all appear from nothing, and its easy to fall into a trap of this is the one true way to do this when you see it done that way over and over on the wiki.  I only mention it to you because you took such an interest in the templates and reworking layouts. Users/JabberWokky

20100524 18:29:32 nbsp To all of my fellow Wiki Editors  If youd like to change the content of this page that describes my love affair with Davis, how about leaving a comment or emailing me first?  I write for a living, so Id prefer that this page reflects my style.  Each word has been chosen carefully e.g. subscribes is better than consumes because I want to subtly point out that all three of these wonderful services actually deliver to my door and send me an invoice. Users/KemblePope

20101202 14:54:40 nbsp what is the luna lounge? Users/DagonJones

20110811 11:44:35 nbsp Thats freaking awesome, great shot of the Paesanos sign! Users/TomGarberson

20110811 16:41:40 nbsp good catch on Paesanos Users/StevenDaubert

20111014 12:01:49 nbsp I dont really see anything egregiously wrong with Anderson Place Apartments either.  Seems to highlight the benefits and flaws nicely. Users/JabberWokky

20111014 12:44:24 nbsp The 100 staged photos :P Users/EdWins

20111014 13:19:53 nbsp Apartments/Talk Users/EdWins

20111014 14:01:19 nbsp Also, something about http://daviswiki.org/Anderson_Place_Apartments?actionFiles&doview&target1x1BRWindow.jpg some http://daviswiki.org/Anderson_Place_Apartments?actionFiles&doview&target2x1MBRFull.jpg of these http://daviswiki.org/Anderson_Place_Apartments?actionFiles&doview&target2x1MBRPartial.jpg pictures look a bit odd, dont they?  Perhaps its just me.  Users/EdWins

20111014 14:08:12 nbsp Regarding the Anderson Courts page, awwwful lot of editorializing going on in there too. parklike setting...fantastic location...HUGE walkin closets. It really reads like a commercial, not to mention the part down at the bottom that does, in fact, list prices. Users/JoePomidor
   Editorializing is good.  It also goes on about the noise level and how it probably isnt for people who dont want young kids running around.  Id ding some of the bulleted points for not having any sort of supporting statements (and also for all caps, which is just plain bad writing).  Huge walk in closets without any explanation is one thing.  The closets are so huge that local band Madeup managed to actually play in one for a birthday party in a unit in 2011 is another kind of statement, which is far superior.  Even a the closets, at 20 feet by 50 feet, are some of the most staggering, gobstruck awesomely huge closets you will ever find in town statement would be fine.  In fact, that wording, if true, would also be freaking cool.  Editorializing and commercial motive are two different things.  Sometimes the community of Davis does enthusiastically Farmers Market laud places or bicycling activities.  jw
     I lived at Anderson which is why the page http://daviswiki.org/Anderson_Place_Apartments/Comment_Archive stuck out funny, especially the photos.  I could go on for pages about it in great detail, which might actually delight JW!   Anyway, looking over the Anderson Place Apartments/Reviews from 2006 and the current comments, I actually feel there should be much more of a negative slant to the page.  But thats not what led me to put advert on the page.  users/edwins ES

20120402 15:31:16 nbsp Hi Kemble, Its Kate Martin, now Kate Bosworth... friend of Aimee and Ric, Cameron, etc. here in Sac.  I hope youve been well!  I would like to invite you to an event we are organizing, but I dont think I have your current email address.  Mine is kate@cafwd.org, drop me a line, hope you are well!
Kate Users/KateMartinBosworth

20120514 07:23:08 nbsp You can create an entry for ChamberPAC by clicking on that underlined word.  If theres enough information to stand alone, it should probably have a distinct entry. Users/JabberWokky

20120514 10:33:08 nbsp How is it not a conflict of interest that you helped in Souzas 2008 campaign?  Also, what do you think the purpose of the municipal ordinance to limit campaign contributions is? What makes it ethically okay for your PAC to override the intent of that law? I find it disappointing when I see the Yost contribution of $1000. Are we in the community really supposed to believe that Yost is contributing that much primarily for Measure D, since a normal interpretation of the law should limit their contribution to $100 for candidate support? This has nothing to do with people like Souza trying to fasttrack the water project, right? If its not a good old boys club, then please tell us the voting results of the PAC members in their decision of who to support for candidacy. Did all 5 PAC members unanimously decide on the same 3 candidates, or was there any dissent, as one would generally expect in such decisions? Also, what is Alyce LLC, and why is there almost no information of them online, and yet they donated $1000. Is this mysterious Alyce LLC as much in love with public parks as Yost clearly is? Users/ScottMeehleib

 Conflict of interest? We live in a small town. If you are the least bit involved in this community, then you will immediately have multiple connections/relationships across town. The presence of a conflict of interest is independent from the execution of impropriety (wikipedia). So, youll just have to take me at my word that I gave all of the candidates a fair hearing.

 The Davis ChamberPAC is following, and has always followed Davis Municipal Code 12.01.035. Please note that any amount over $100 donated by an individual or business will not be used for a council candidate independent expenditure in this election cycle. The remainder of that amount will be spent in support of Measure D and building the organizations infrastructure (i.e. website). You dont even have to suspend belief very long to confirm this statement, we are voluntarily releasing Financial Disclosures for money raised and money spent every Friday until the election and then according to state and local regulations.

 Your good ol boys club includes a woman, but everyone seems to ignore that Janis Lott is an active member of the Davis ChamberPAC Board. There was hours of discussion, dissent and arguing. We came to consensus on Frerichs, Wolk & Souza for a variety of reasons that have been stated over and over again.

 Allyce LLC  Owned by a friend of one of the Board members who is interested in promoting a more rational public policy discourse in our community, but he has no stomach for the type of innuendos and mud slinging that you seem so comfortable with. I dont even remember the owners names or what they do; weve never heard from them except for their donation to support a more sustainable local economy. I couldnt comment on their level or mystery or amount of love for public parks.
 Users/KemblePope

20120514 11:09:18 nbsp You asked me why I deleted the PACs reasoning for picking its candidates. That is a fair question. Looking back, there were a few things that I should have kept. The fact of the matter is that its much easier for all the other editors if you make small incremental edits instead of one giant edit that both adds and deletes a bunch of substantial content in one shot. Since I disagreed with a lot of your massive changes to the page, I was forced to go back and cherrypick the parts that seemed worthy of inclusion. Inevitably, I missed some of the reasonable info and opinions you originally supplied simply because there was so much to wade through. You gave a couple concrete reasons for why the candidates were chosen, but they were given in the midst of a lot of generic political ideals that could be applied to literally ANY of the candidates, including the ones your PAC doesnt support. If you truly strive to be transparent, I recommend giving more concrete reasoning. I also recommend moving away from generic banalities that read like propaganda, because they will only fuel further suspicion and probably continue to be reverted by myself and/or other editors as selfpromoting (advertisey) fluff. Users/ScottMeehleib

 Unfortunately, you are wrong about the generic political ideals that could be applied to literally ANY of the candidates... that just aint so. Recommend all you like.
 Users/KemblePope

20120514 19:41:21 nbsp Are you behind the account Users/DavisChamberPAC? If not, who is? Have they acted under your direction? Users/WilliamLewis

   One of my staff members created the user account DavisChamberPAC after I asked her to create a page on the DavisWiki about our efforts and to closely follow the editing guidelines of the DavisWiki. Upon realizing that she created this organizational handle, I asked her to delete it and to start posting under her own name... which she is now doing.
    Did you or she not see the discussion on Davis ChamberPAC/Talk this page, which was underway when she came along and created the PAC page?  It is not following the editing guidelines of the DW to ignore discussion whether action X should be taken, and instead, go ahead and take action X unilaterally.  If youre wondering why so many people were ticked off, that was one of the reasons.   Users/CovertProfessor

So Kemble Pope supports Steve Souza? Have I got that right? Users/GeorgeSantayana
    Yes. Users/DonShor
    No, DonShor. The Davis ChamberPAC supports Yes on Measure D, Lucas Frerichs, Dan Wolk & Stephen Souza. I, as an individual, support Yes on Measure D monetarily and with my endorsement. I have neither endorsed nor donated to any of the candidates campaigns. My contract with the Davis Chamber of Commerce precludes me from participating in City Council elections outside of ChamberPAC work. So, my vote is secret. However, I dont think its a secret to anyone that Ive long been an http://www.davisvoice.com/2008/06/editorsendorsement/ A.B.S. voter.

20120521 19:16:54 nbsp You should all be ashamed to allow this type of treatment of anyone who takes the time to help give more information with this community resource that NOBODY OWNS... not you Don Shor...
I have no idea why you singled me out, first on your list, Kemble. I have intentionally stayed out of the discussion there. I have made zero edits to the ChamberPAC page, and a total of three edits to the Chamber page over the course of five years.  Users/DonShor

 Your changes on the Chamber page are onesided and youve let your past feuds with the Chamber and DDBA cloud your judgement about ANYTHING that we do to try and improve this community.
 Users/KemblePope
  I have not made changes on the Chamber page, Kemble. Do you know how to look at edit history? http://daviswiki.org/Davis_Chamber_of_Commerce?actioninfo Users/DonShor

20120521 20:38:39 nbsp I got a good chuckle out of the part where we should all be ashamed for calling you out. Let me break out a leaf to cover my gonads. Users/ScottMeehleib

20120521 20:40:49 nbsp I do appreciate your attempts at answers, although they were only halfsatisfactory, IMO. But perhaps thats just due to the limitation of the medium. I will give you the benefit of the doubt in this case. May you find peace in this short life and the root of all happiness. You are in my prayers, dear Kemble. Users/ScottMeehleib

20120612 17:36:08 nbsp Again, if you say it is inaccurate, then what is the accurate count?  I would be interested in your count, and then DS can say how he did his.  If you are disagreeing over what counts as a retailer, then showing how you did your counts would be revealing and informative.

Who the Chamber represents... exactly.  Part of that is who are its members.  If it disproportionately has certain types of members, then there is a reason for that, and it is information about the Chamber that some  including me  care about.  Retailers tend to be the businesses that many of us have the most personal relationships with and care the most about.  I think DS is right when he says that people tend to think that Chambers are made up of retailers.  It is not irrelevant.  List proportions of different types of members if you like, and explain what which businesses you consider to be of which type.

It very much looks like you are trying to delete information that you think reflects badly on the Chamber.  I am tired of you trying to whitewash the page.

 Users/CovertProfessor

20120612 18:06:36 nbsp If you object to my actions and my anonymity, take it up with the wiki community.

I am describing the behavior I see.  It looks like whitewashing to me.  I am describing my feelings about the Chamber.  They are (now) negative.  I assume that I am not alone in my reactions.  I could, of course, be wrong about that.  I have never claimed to take a survey.

I have said where I got my data from.  I got it from DS.  He has provided an elaboration of his data.  I have also invited you to provide alternate data to support your claim that DSs is wrong.  What is the problem?  Of course, any data will be a snapshot  thus, I put a date on the data that I cited.  It does not need to be updated monthly.

I am not trying to intimidate you.  I am trying to get you to stop whitewashing the page by deleting things, and to encourage you to add data rather than delete.  You carped at me for deleting just a few days ago.  Remember? Users/CovertProfessor

20131013 11:59:32 nbsp Congrats on the marriage Kemble. What kind of pooches? Users/StevenDaubert
Thanks Daubert! The new one is 1/2 lab & 1/4 Aussie + 1/4 Spaniel, SPCA rescue at 10 weeks old, five months old now and his big bro is some kind of Greater Swiss Mountain dog mutt (also a rescue).  Users/KemblePope
Oh nice did big bro come with a mini barrel of scotch around the neck for saving people in wintertime? Good call on the rescue they make fantastic pets

max_stars_repo_name: voflo/Search

max_issues_repo_name: voflo/Search

max_forks_repo_name: voflo/Search


text:
program Reales

implicit none

!4 bytes (8 cifras significativas)
!real:: a,b,d
!4 bytes (8 cifras significativas)
!real(kind=4):: a,b,d
!8 bytes (16 cifras significativas)
!real(kind=8):: a,b,d
!8 bytes (16 cifras significativas)
!double precision::a,b,d

print*,"Este programa realiza operaciones con enteros"
print*,"Favor de ingresar a"
read*, a
print*,"Favor de ingresar b"
read*, b
print*,"La suma ed a+b es"
d=a+b
print*, d
print*,"La resta de a-b es"
d=a-b
print*, d
print*, "La multiplicaion de a*b es"
d=a*b
print*, d
print*,"La division de a/b es"
d=a/b
print*, d
print*,"a elevado a la b es"
d=a**b
print*, d

pause
end program

max_stars_repo_name: Angelpacman/fundamentos-de-fortran

max_issues_repo_name: Angelpacman/fundamentos-de-fortran

max_forks_repo_name: Angelpacman/fundamentos-de-fortran


text:
c               Copyright 1993 Colorado State University
c                       All Rights Reserved

      subroutine wthini

      implicit none
      include 'chrvar.inc'

c ... Open daily weather data file
      close(unit=9)
      open(unit=9,file=wthnam,status='OLD',err=1000)
      rewind 9

      return

1000  call message(' Fatal error: unknown weather file :'//wthnam)
      stop ' Abnormal Termination'

      end


text:
  SUBROUTINE allocate_cable_vars(air,bgc,canopy,met,bal,rad,rough,soil,ssoil, &
       sum_flux,veg,model_structure,arraysize)
    use cable_types
    TYPE (met_type), INTENT(INOUT) :: met
    TYPE (air_type), INTENT(INOUT) :: air
    TYPE (soil_snow_type), INTENT(OUT) :: ssoil
    TYPE (veg_parameter_type), INTENT(OUT)  :: veg
    TYPE (bgc_pool_type), INTENT(OUT)  :: bgc
    TYPE (soil_parameter_type), INTENT(OUT) :: soil
    TYPE (canopy_type), INTENT(OUT)    :: canopy
    TYPE (roughness_type), INTENT(OUT) :: rough
    TYPE (radiation_type),INTENT(OUT)  :: rad
    TYPE (sum_flux_type), INTENT(OUT)  :: sum_flux
    TYPE (balances_type), INTENT(OUT)  :: bal
    TYPE (model_structure_type), INTENT(INOUT) :: model_structure
    INTEGER, INTENT(IN) :: arraysize

    ! First nullify all pointers:
    CALL dealloc_cbm_var(air, arraysize, model_structure)
    CALL dealloc_cbm_var(bgc, arraysize, model_structure)
    CALL dealloc_cbm_var(canopy, arraysize, model_structure)
    CALL dealloc_cbm_var(met, arraysize, model_structure)
    CALL dealloc_cbm_var(bal, arraysize, model_structure)
    CALL dealloc_cbm_var(rad, arraysize, model_structure)
    CALL dealloc_cbm_var(rough, arraysize, model_structure)
    CALL dealloc_cbm_var(soil, arraysize, model_structure)
    CALL dealloc_cbm_var(ssoil, arraysize, model_structure)
    CALL dealloc_cbm_var(sum_flux, arraysize, model_structure)
    CALL dealloc_cbm_var(veg, arraysize, model_structure)

    ! Allocate CABLE's main variables:
    CALL alloc_cbm_var(air, arraysize, model_structure)
    CALL alloc_cbm_var(bgc, arraysize, model_structure)
    CALL alloc_cbm_var(canopy, arraysize, model_structure)
    CALL alloc_cbm_var(met, arraysize, model_structure)
    CALL alloc_cbm_var(bal, arraysize, model_structure)
    CALL alloc_cbm_var(rad, arraysize, model_structure)
    CALL alloc_cbm_var(rough, arraysize, model_structure)
    CALL alloc_cbm_var(soil, arraysize, model_structure)
    CALL alloc_cbm_var(ssoil, arraysize, model_structure)
    CALL alloc_cbm_var(sum_flux, arraysize, model_structure)
    CALL alloc_cbm_var(veg, arraysize, model_structure)

    ! Allocate patch fraction variable:
!    ALLOCATE(patch(arraysize))

  END SUBROUTINE allocate_cable_vars

max_stars_repo_name: KathyNie/LISF

max_issues_repo_name: dmocko/LISF

max_forks_repo_name: dmocko/LISF


text:
*----------------------------------------------------------------------*
      subroutine print_form_list_p(lulog,form_head,op_info)
*----------------------------------------------------------------------*
*     print formula on linked list to unit lulog
*     version that prints contractions in topo matrix form
*----------------------------------------------------------------------*
      implicit none

      include 'opdim.h'
      include 'mdef_operator_info.h'
      include 'def_contraction.h'
      include 'def_formula_item.h'

      integer, intent(in) ::
     &     lulog
      type(formula_item), intent(in), target ::
     &     form_head
      type(operator_info), intent(in) ::
     &     op_info

      integer ::
     &     idx, nvtx, nj
      integer(8), pointer ::
     &     xlines(:,:), topo(:,:), vtx(:)

      type(formula_item), pointer ::
     &     form_ptr

      integer, external ::
     &     njres_contr

      idx = 0
      form_ptr => form_head
      do
        select case(form_ptr%command)
        case(command_end_of_formula)
          write(lulog,*) '[END]'
        case(command_set_target_init)
          write(lulog,*) '[INIT TARGET]',form_ptr%target
        case(command_set_target_update)
          write(lulog,*) '[SET TARGET]',form_ptr%target
        case(command_new_intermediate)
          write(lulog,*) '[NEW INTERMEDIATE]',form_ptr%target
        case(command_del_intermediate)
          write(lulog,*) '[DELETE INTERMEDIATE]',form_ptr%target
        case(command_add_contribution)
          idx = idx+1
          write(lulog,*) '[ADD]',form_ptr%target,'( term #',idx,')'
          write(lulog,*) 'factor = ',form_ptr%contr%fac
          nj = njres_contr(form_ptr%contr)
          nvtx = form_ptr%contr%nvtx
          allocate(vtx(nvtx),xlines(nvtx,nj),topo(nvtx,nvtx))
          call pack_contr(form_ptr%contr%svertex,
     &                    vtx,topo,xlines,form_ptr%contr,nj)
          call prt_contr_p(lulog,form_ptr%contr%svertex,
     &         vtx,topo,xlines,nvtx,nj)
          deallocate(vtx,xlines,topo)
        case(command_symmetrise)
          write(lulog,*) '[SYMMETRISE TARGET]',form_ptr%target
        end select

        if (.not.associated(form_ptr%next)) exit
        form_ptr => form_ptr%next

      end do

      return
      end

max_stars_repo_name: ak-ustutt/GeCCo-public

max_issues_repo_name: ak-ustutt/GeCCo-public

max_forks_repo_name: ak-ustutt/GeCCo-public