diff mbox series

[bug#58261,v2,10/13] gnu: Add yaehmop-tightbind.

Message ID 20221007152148.32591-11-david.elsing@posteo.net
State Accepted
Headers show
Series None | expand

Commit Message

David Elsing Oct. 7, 2022, 3:21 p.m. UTC
* gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
---
 gnu/packages/chemistry.scm | 110 +++++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

Comments

Liliana Marie Prikler Oct. 9, 2022, 12:02 p.m. UTC | #1
Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
Don't forget to update the ChangeLog.
> ---
>  gnu/packages/chemistry.scm | 110
> +++++++++++++++++++++++++++++++++++++
>  1 file changed, 110 insertions(+)
> 
> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
> index 1510cbab41..68d28a52c3 100644
> --- a/gnu/packages/chemistry.scm
> +++ b/gnu/packages/chemistry.scm
> @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages documentation)
>    #:use-module (gnu packages flex)
>    #:use-module (gnu packages fontutils)
> +  #:use-module (gnu packages gcc)
>    #:use-module (gnu packages gl)
>    #:use-module (gnu packages graphviz)
>    #:use-module (gnu packages gv)
> @@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
>    #:use-module (gnu packages serialization)
>    #:use-module (gnu packages sphinx)
>    #:use-module (gnu packages stb)
> +  #:use-module (gnu packages tex)
>    #:use-module (gnu packages web)
>    #:use-module (gnu packages xml)
>    #:use-module (guix build-system cmake)
> @@ -818,3 +820,111 @@ (define-public coordgenlibs
>      (description "@code{coordgenlibs} contains algorithms to
> generate 2D
>  coordinates.  It has an emphasis on quality rather than speed.")
>      (license license:bsd-3)))
> +
> +(define-public yaehmop
> +  (package
> +    (name "yaehmop")
> +    (version "2022.09.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/greglandrum/yaehmop")
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  ;; Separate program
> +                  (delete-file-recursively "viewkel")
> +                  ;; Remove example output (some are corrupted)
> +                  (for-each delete-file (find-files "examples"
> "\\.Z$"))
> +                  ;; Documentation outputs
> +                  (for-each delete-file (find-files "docs"
> "\\.(ps|pdf)$"))
> +                  ;; These are transpiled from Fortran to C, but we
> build the
> +                  ;; Fortran code instead
> +                  (delete-file-recursively "tightbind/f2c_files")
> +                  (delete-file "tightbind/diag.c")
> +                  (delete-file "tightbind/cboris.c")
> +                  (delete-file "tightbind/abfns.c")
> +                  (delete-file "tightbind/lovlap.c")))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list
> +      #:configure-flags
> +      #~(list
> +         "-DUSE_BLAS_LAPACK=ON"
> +         (string-append "-DPARM_FILE_LOC=" #$output
> +                        "/share/" #$name "-" #$version
> "/eht_parms.dat")
> +         "-DBIND_EXE_NAME=yaehmop-bind")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'chdir
> +            (lambda _
> +              (chdir "tightbind")))
> +          (add-after 'chdir 'patch-fortran-functions
> +            (lambda _
> +              (substitute* '("mov.c" "prototypes.h")
> +                (("lovlap\\(") "lovlap_(")
> +                (("abfns\\(") "abfns_("))))
> +          (add-after 'chdir 'patch-cmake
> +            (lambda _
> +              (substitute* "CMakeLists.txt"
> +                (("project\\(yaehmop C\\)") "project(yaehmop C
> Fortran)")
> +                (("abfns.c") "fortran77/abfns.f")
> +                (("lovlap.c") "fortran77/lovlap.f")
> +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
> +                 (string-append init " CACHE STRING \"\")"))
> +                (("add_library\\(yaehmop_eht" lib)
> +                 (string-append lib " SHARED "))
> +                (("target_link_libraries\\(test_eht
> \\$\\{LAPACK_LIBRARIES\\}.*"
> +                  all)
> +                 (string-append all
> "\ntarget_link_libraries(yaehmop_eht "
> +                                "${LAPACK_LIBRARIES})\n")))))
> +          (add-after 'build 'fix-latex
> +            (lambda _
> +              (chdir "../docs")
> +              (substitute* "bind_manual.tex"
> +                (("\\\\usepackage\\{bindpage\\}")
> +                 (string-append
> +                 
> "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
> +                  "{geometry}")))
> +              (substitute* "Zmat_appendix.tex"
> +                (("file=dihedral\\.eps")
> +                 "file=figs/dihedral.eps"))))
> +          (add-after 'fix-latex 'build-doc
> +            (lambda _
> +              ;; TODO: not reproducible
> +              (setenv "FORCE_SOURCE_DATE" "1")
> +              ;; Needs to run twice to compile completely
> +              (invoke "pdflatex" "bind_manual.tex")
> +              (invoke "pdflatex" "bind_manual.tex")
> +              (chdir "../build")))
Note that we have rubber to automate building PDFs.  Also prefer "with-
directory-excursion" over chdir where possible.
> +          (add-after 'install 'install-eht-parms
> +            (lambda _
> +              (install-file "../tightbind/eht_parms.dat"
> +                            (string-append #$output "/share/"
> +                                           #$name "-" #$version))))
> +          (add-after 'install-eht-parms 'install-doc
> +            (lambda _
> +              (install-file "../docs/bind_manual.pdf"
> +                            (string-append #$output "/share/doc/"
> +                                           #$name "-" #$version))))
> +          (delete 'check)
> +          (add-after 'install-doc 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (invoke "./test_eht")))))))
> +    (native-inputs
> +     `(("gfortran" ,gfortran)
> +       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
> +                                             texlive-latex-graphics
> +                                             texlive-latex-
> geometry)))))
I think you can do without labels here (see my comment regarding
rubber).
> +    (inputs (list openblas))
> +    (home-page "https://github.com/greglandrum/yaehmop")
> +    (synopsis "Yet Another extended Hueckel Molecular Orbital
> Package")
You can use this as an @acronym in the description.  For the synopsis,
I'd use something else, e.g. "Perform Hückel calculations".
> +    (description "@code{YAeHMOP} contains a program and library for
> performing
> +extended Hückel calculations.")
I recommend adding "and analyzing and visualizing the results." (see
plug_it.tex)
> +    (license license:bsd-2)))

Cheers
David Elsing Oct. 13, 2022, 9 p.m. UTC | #2
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
>> * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
> Don't forget to update the ChangeLog.
Ah thanks. :)
>> ---
>>  gnu/packages/chemistry.scm | 110
>> +++++++++++++++++++++++++++++++++++++
>>  1 file changed, 110 insertions(+)
>> 
>> diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
>> index 1510cbab41..68d28a52c3 100644
>> --- a/gnu/packages/chemistry.scm
>> +++ b/gnu/packages/chemistry.scm
>> @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages documentation)
>>    #:use-module (gnu packages flex)
>>    #:use-module (gnu packages fontutils)
>> +  #:use-module (gnu packages gcc)
>>    #:use-module (gnu packages gl)
>>    #:use-module (gnu packages graphviz)
>>    #:use-module (gnu packages gv)
>> @@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
>>    #:use-module (gnu packages serialization)
>>    #:use-module (gnu packages sphinx)
>>    #:use-module (gnu packages stb)
>> +  #:use-module (gnu packages tex)
>>    #:use-module (gnu packages web)
>>    #:use-module (gnu packages xml)
>>    #:use-module (guix build-system cmake)
>> @@ -818,3 +820,111 @@ (define-public coordgenlibs
>>      (description "@code{coordgenlibs} contains algorithms to
>> generate 2D
>>  coordinates.  It has an emphasis on quality rather than speed.")
>>      (license license:bsd-3)))
>> +
>> +(define-public yaehmop
>> +  (package
>> +    (name "yaehmop")
>> +    (version "2022.09.1")
>> +    (source (origin
>> +              (method git-fetch)
>> +              (uri (git-reference
>> +                    (url "https://github.com/greglandrum/yaehmop")
>> +                    (commit (string-append "v" version))))
>> +              (file-name (git-file-name name version))
>> +              (sha256
>> +               (base32
>> +               
>> "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
>> +              (modules '((guix build utils)))
>> +              (snippet
>> +               '(begin
>> +                  ;; Separate program
>> +                  (delete-file-recursively "viewkel")
>> +                  ;; Remove example output (some are corrupted)
>> +                  (for-each delete-file (find-files "examples"
>> "\\.Z$"))
>> +                  ;; Documentation outputs
>> +                  (for-each delete-file (find-files "docs"
>> "\\.(ps|pdf)$"))
>> +                  ;; These are transpiled from Fortran to C, but we
>> build the
>> +                  ;; Fortran code instead
>> +                  (delete-file-recursively "tightbind/f2c_files")
>> +                  (delete-file "tightbind/diag.c")
>> +                  (delete-file "tightbind/cboris.c")
>> +                  (delete-file "tightbind/abfns.c")
>> +                  (delete-file "tightbind/lovlap.c")))))
>> +    (build-system cmake-build-system)
>> +    (arguments
>> +     (list
>> +      #:configure-flags
>> +      #~(list
>> +         "-DUSE_BLAS_LAPACK=ON"
>> +         (string-append "-DPARM_FILE_LOC=" #$output
>> +                        "/share/" #$name "-" #$version
>> "/eht_parms.dat")
>> +         "-DBIND_EXE_NAME=yaehmop-bind")
>> +      #:phases
>> +      #~(modify-phases %standard-phases
>> +          (add-after 'unpack 'chdir
>> +            (lambda _
>> +              (chdir "tightbind")))
>> +          (add-after 'chdir 'patch-fortran-functions
>> +            (lambda _
>> +              (substitute* '("mov.c" "prototypes.h")
>> +                (("lovlap\\(") "lovlap_(")
>> +                (("abfns\\(") "abfns_("))))
>> +          (add-after 'chdir 'patch-cmake
>> +            (lambda _
>> +              (substitute* "CMakeLists.txt"
>> +                (("project\\(yaehmop C\\)") "project(yaehmop C
>> Fortran)")
>> +                (("abfns.c") "fortran77/abfns.f")
>> +                (("lovlap.c") "fortran77/lovlap.f")
>> +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
>> +                 (string-append init " CACHE STRING \"\")"))
>> +                (("add_library\\(yaehmop_eht" lib)
>> +                 (string-append lib " SHARED "))
>> +                (("target_link_libraries\\(test_eht
>> \\$\\{LAPACK_LIBRARIES\\}.*"
>> +                  all)
>> +                 (string-append all
>> "\ntarget_link_libraries(yaehmop_eht "
>> +                                "${LAPACK_LIBRARIES})\n")))))
>> +          (add-after 'build 'fix-latex
>> +            (lambda _
>> +              (chdir "../docs")
>> +              (substitute* "bind_manual.tex"
>> +                (("\\\\usepackage\\{bindpage\\}")
>> +                 (string-append
>> +                 
>> "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
>> +                  "{geometry}")))
>> +              (substitute* "Zmat_appendix.tex"
>> +                (("file=dihedral\\.eps")
>> +                 "file=figs/dihedral.eps"))))
>> +          (add-after 'fix-latex 'build-doc
>> +            (lambda _
>> +              ;; TODO: not reproducible
>> +              (setenv "FORCE_SOURCE_DATE" "1")
>> +              ;; Needs to run twice to compile completely
>> +              (invoke "pdflatex" "bind_manual.tex")
>> +              (invoke "pdflatex" "bind_manual.tex")
>> +              (chdir "../build")))
> Note that we have rubber to automate building PDFs.  Also prefer "with-
> directory-excursion" over chdir where possible.
I used latexmk as it's already included in texlive-bin
(it is also reproducible with \pdfsuppressptexinfo=-1).
>> +          (add-after 'install 'install-eht-parms
>> +            (lambda _
>> +              (install-file "../tightbind/eht_parms.dat"
>> +                            (string-append #$output "/share/"
>> +                                           #$name "-" #$version))))
>> +          (add-after 'install-eht-parms 'install-doc
>> +            (lambda _
>> +              (install-file "../docs/bind_manual.pdf"
>> +                            (string-append #$output "/share/doc/"
>> +                                           #$name "-" #$version))))
>> +          (delete 'check)
>> +          (add-after 'install-doc 'check
>> +            (lambda* (#:key tests? #:allow-other-keys)
>> +              (when tests?
>> +                (invoke "./test_eht")))))))
>> +    (native-inputs
>> +     `(("gfortran" ,gfortran)
>> +       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
>> +                                             texlive-latex-graphics
>> +                                             texlive-latex-
>> geometry)))))
> I think you can do without labels here (see my comment regarding
> rubber).
>> +    (inputs (list openblas))
>> +    (home-page "https://github.com/greglandrum/yaehmop")
>> +    (synopsis "Yet Another extended Hueckel Molecular Orbital
>> Package")
> You can use this as an @acronym in the description.  For the synopsis,
> I'd use something else, e.g. "Perform Hückel calculations".
>> +    (description "@code{YAeHMOP} contains a program and library for
>> performing
>> +extended Hückel calculations.")
> I recommend adding "and analyzing and visualizing the results." (see
> plug_it.tex)
The visualization program is not built, so maybe without visualizing?
>> +    (license license:bsd-2)))
>
> Cheers
Liliana Marie Prikler Oct. 14, 2022, 9:33 p.m. UTC | #3
Am Donnerstag, dem 13.10.2022 um 21:00 +0000 schrieb David Elsing:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > Am Freitag, dem 07.10.2022 um 15:21 +0000 schrieb David Elsing:
> > > * gnu/packages/chemistry.scm (yaehmop-tightbind): New variable.
> > Don't forget to update the ChangeLog.
> Ah thanks. :)
> > > ---
> > >  gnu/packages/chemistry.scm | 110
> > > +++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 110 insertions(+)
> > > 
> > > diff --git a/gnu/packages/chemistry.scm
> > > b/gnu/packages/chemistry.scm
> > > index 1510cbab41..68d28a52c3 100644
> > > --- a/gnu/packages/chemistry.scm
> > > +++ b/gnu/packages/chemistry.scm
> > > @@ -42,6 +42,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages documentation)
> > >    #:use-module (gnu packages flex)
> > >    #:use-module (gnu packages fontutils)
> > > +  #:use-module (gnu packages gcc)
> > >    #:use-module (gnu packages gl)
> > >    #:use-module (gnu packages graphviz)
> > >    #:use-module (gnu packages gv)
> > > @@ -56,6 +57,7 @@ (define-module (gnu packages chemistry)
> > >    #:use-module (gnu packages serialization)
> > >    #:use-module (gnu packages sphinx)
> > >    #:use-module (gnu packages stb)
> > > +  #:use-module (gnu packages tex)
> > >    #:use-module (gnu packages web)
> > >    #:use-module (gnu packages xml)
> > >    #:use-module (guix build-system cmake)
> > > @@ -818,3 +820,111 @@ (define-public coordgenlibs
> > >      (description "@code{coordgenlibs} contains algorithms to
> > > generate 2D
> > >  coordinates.  It has an emphasis on quality rather than speed.")
> > >      (license license:bsd-3)))
> > > +
> > > +(define-public yaehmop
> > > +  (package
> > > +    (name "yaehmop")
> > > +    (version "2022.09.1")
> > > +    (source (origin
> > > +              (method git-fetch)
> > > +              (uri (git-reference
> > > +                    (url
> > > "https://github.com/greglandrum/yaehmop")
> > > +                    (commit (string-append "v" version))))
> > > +              (file-name (git-file-name name version))
> > > +              (sha256
> > > +               (base32
> > > +               
> > > "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
> > > +              (modules '((guix build utils)))
> > > +              (snippet
> > > +               '(begin
> > > +                  ;; Separate program
> > > +                  (delete-file-recursively "viewkel")
> > > +                  ;; Remove example output (some are corrupted)
> > > +                  (for-each delete-file (find-files "examples"
> > > "\\.Z$"))
> > > +                  ;; Documentation outputs
> > > +                  (for-each delete-file (find-files "docs"
> > > "\\.(ps|pdf)$"))
> > > +                  ;; These are transpiled from Fortran to C, but
> > > we
> > > build the
> > > +                  ;; Fortran code instead
> > > +                  (delete-file-recursively
> > > "tightbind/f2c_files")
> > > +                  (delete-file "tightbind/diag.c")
> > > +                  (delete-file "tightbind/cboris.c")
> > > +                  (delete-file "tightbind/abfns.c")
> > > +                  (delete-file "tightbind/lovlap.c")))))
> > > +    (build-system cmake-build-system)
> > > +    (arguments
> > > +     (list
> > > +      #:configure-flags
> > > +      #~(list
> > > +         "-DUSE_BLAS_LAPACK=ON"
> > > +         (string-append "-DPARM_FILE_LOC=" #$output
> > > +                        "/share/" #$name "-" #$version
> > > "/eht_parms.dat")
> > > +         "-DBIND_EXE_NAME=yaehmop-bind")
> > > +      #:phases
> > > +      #~(modify-phases %standard-phases
> > > +          (add-after 'unpack 'chdir
> > > +            (lambda _
> > > +              (chdir "tightbind")))
> > > +          (add-after 'chdir 'patch-fortran-functions
> > > +            (lambda _
> > > +              (substitute* '("mov.c" "prototypes.h")
> > > +                (("lovlap\\(") "lovlap_(")
> > > +                (("abfns\\(") "abfns_("))))
> > > +          (add-after 'chdir 'patch-cmake
> > > +            (lambda _
> > > +              (substitute* "CMakeLists.txt"
> > > +                (("project\\(yaehmop C\\)") "project(yaehmop C
> > > Fortran)")
> > > +                (("abfns.c") "fortran77/abfns.f")
> > > +                (("lovlap.c") "fortran77/lovlap.f")
> > > +                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
> > > +                 (string-append init " CACHE STRING \"\")"))
> > > +                (("add_library\\(yaehmop_eht" lib)
> > > +                 (string-append lib " SHARED "))
> > > +                (("target_link_libraries\\(test_eht
> > > \\$\\{LAPACK_LIBRARIES\\}.*"
> > > +                  all)
> > > +                 (string-append all
> > > "\ntarget_link_libraries(yaehmop_eht "
> > > +                                "${LAPACK_LIBRARIES})\n")))))
> > > +          (add-after 'build 'fix-latex
> > > +            (lambda _
> > > +              (chdir "../docs")
> > > +              (substitute* "bind_manual.tex"
> > > +                (("\\\\usepackage\\{bindpage\\}")
> > > +                 (string-append
> > > +                 
> > > "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
> > > +                  "{geometry}")))
> > > +              (substitute* "Zmat_appendix.tex"
> > > +                (("file=dihedral\\.eps")
> > > +                 "file=figs/dihedral.eps"))))
> > > +          (add-after 'fix-latex 'build-doc
> > > +            (lambda _
> > > +              ;; TODO: not reproducible
> > > +              (setenv "FORCE_SOURCE_DATE" "1")
> > > +              ;; Needs to run twice to compile completely
> > > +              (invoke "pdflatex" "bind_manual.tex")
> > > +              (invoke "pdflatex" "bind_manual.tex")
> > > +              (chdir "../build")))
> > Note that we have rubber to automate building PDFs.  Also prefer
> > "with-
> > directory-excursion" over chdir where possible.
> I used latexmk as it's already included in texlive-bin
> (it is also reproducible with \pdfsuppressptexinfo=-1).
> > > +          (add-after 'install 'install-eht-parms
> > > +            (lambda _
> > > +              (install-file "../tightbind/eht_parms.dat"
> > > +                            (string-append #$output "/share/"
> > > +                                           #$name "-"
> > > #$version))))
> > > +          (add-after 'install-eht-parms 'install-doc
> > > +            (lambda _
> > > +              (install-file "../docs/bind_manual.pdf"
> > > +                            (string-append #$output
> > > "/share/doc/"
> > > +                                           #$name "-"
> > > #$version))))
> > > +          (delete 'check)
> > > +          (add-after 'install-doc 'check
> > > +            (lambda* (#:key tests? #:allow-other-keys)
> > > +              (when tests?
> > > +                (invoke "./test_eht")))))))
> > > +    (native-inputs
> > > +     `(("gfortran" ,gfortran)
> > > +       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
> > > +                                             texlive-latex-
> > > graphics
> > > +                                             texlive-latex-
> > > geometry)))))
> > I think you can do without labels here (see my comment regarding
> > rubber).
> > > +    (inputs (list openblas))
> > > +    (home-page "https://github.com/greglandrum/yaehmop")
> > > +    (synopsis "Yet Another extended Hueckel Molecular Orbital
> > > Package")
> > You can use this as an @acronym in the description.  For the
> > synopsis,
> > I'd use something else, e.g. "Perform Hückel calculations".
> > > +    (description "@code{YAeHMOP} contains a program and library
> > > for
> > > performing
> > > +extended Hückel calculations.")
> > I recommend adding "and analyzing and visualizing the results."
> > (see
> > plug_it.tex)
> The visualization program is not built, so maybe without visualizing?
SGTM
diff mbox series

Patch

diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 1510cbab41..68d28a52c3 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -42,6 +42,7 @@  (define-module (gnu packages chemistry)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gv)
@@ -56,6 +57,7 @@  (define-module (gnu packages chemistry)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages stb)
+  #:use-module (gnu packages tex)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
@@ -818,3 +820,111 @@  (define-public coordgenlibs
     (description "@code{coordgenlibs} contains algorithms to generate 2D
 coordinates.  It has an emphasis on quality rather than speed.")
     (license license:bsd-3)))
+
+(define-public yaehmop
+  (package
+    (name "yaehmop")
+    (version "2022.09.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/greglandrum/yaehmop")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1x0d75m1hgdb411fiv7c5bwq1n4y0swrll0gigh8v5c73kjxrja0"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Separate program
+                  (delete-file-recursively "viewkel")
+                  ;; Remove example output (some are corrupted)
+                  (for-each delete-file (find-files "examples" "\\.Z$"))
+                  ;; Documentation outputs
+                  (for-each delete-file (find-files "docs" "\\.(ps|pdf)$"))
+                  ;; These are transpiled from Fortran to C, but we build the
+                  ;; Fortran code instead
+                  (delete-file-recursively "tightbind/f2c_files")
+                  (delete-file "tightbind/diag.c")
+                  (delete-file "tightbind/cboris.c")
+                  (delete-file "tightbind/abfns.c")
+                  (delete-file "tightbind/lovlap.c")))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DUSE_BLAS_LAPACK=ON"
+         (string-append "-DPARM_FILE_LOC=" #$output
+                        "/share/" #$name "-" #$version "/eht_parms.dat")
+         "-DBIND_EXE_NAME=yaehmop-bind")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "tightbind")))
+          (add-after 'chdir 'patch-fortran-functions
+            (lambda _
+              (substitute* '("mov.c" "prototypes.h")
+                (("lovlap\\(") "lovlap_(")
+                (("abfns\\(") "abfns_("))))
+          (add-after 'chdir 'patch-cmake
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("project\\(yaehmop C\\)") "project(yaehmop C Fortran)")
+                (("abfns.c") "fortran77/abfns.f")
+                (("lovlap.c") "fortran77/lovlap.f")
+                (("(set\\(PARM_FILE_LOC.*)\\)" all init)
+                 (string-append init " CACHE STRING \"\")"))
+                (("add_library\\(yaehmop_eht" lib)
+                 (string-append lib " SHARED "))
+                (("target_link_libraries\\(test_eht \\$\\{LAPACK_LIBRARIES\\}.*"
+                  all)
+                 (string-append all "\ntarget_link_libraries(yaehmop_eht "
+                                "${LAPACK_LIBRARIES})\n")))))
+          (add-after 'build 'fix-latex
+            (lambda _
+              (chdir "../docs")
+              (substitute* "bind_manual.tex"
+                (("\\\\usepackage\\{bindpage\\}")
+                 (string-append
+                  "\\usepackage[left=2cm,right=2cm,top=4cm,bottom=2cm]"
+                  "{geometry}")))
+              (substitute* "Zmat_appendix.tex"
+                (("file=dihedral\\.eps")
+                 "file=figs/dihedral.eps"))))
+          (add-after 'fix-latex 'build-doc
+            (lambda _
+              ;; TODO: not reproducible
+              (setenv "FORCE_SOURCE_DATE" "1")
+              ;; Needs to run twice to compile completely
+              (invoke "pdflatex" "bind_manual.tex")
+              (invoke "pdflatex" "bind_manual.tex")
+              (chdir "../build")))
+          (add-after 'install 'install-eht-parms
+            (lambda _
+              (install-file "../tightbind/eht_parms.dat"
+                            (string-append #$output "/share/"
+                                           #$name "-" #$version))))
+          (add-after 'install-eht-parms 'install-doc
+            (lambda _
+              (install-file "../docs/bind_manual.pdf"
+                            (string-append #$output "/share/doc/"
+                                           #$name "-" #$version))))
+          (delete 'check)
+          (add-after 'install-doc 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "./test_eht")))))))
+    (native-inputs
+     `(("gfortran" ,gfortran)
+       ("texlive" ,(texlive-updmap.cfg (list texlive-fonts-ec
+                                             texlive-latex-graphics
+                                             texlive-latex-geometry)))))
+    (inputs (list openblas))
+    (home-page "https://github.com/greglandrum/yaehmop")
+    (synopsis "Yet Another extended Hueckel Molecular Orbital Package")
+    (description "@code{YAeHMOP} contains a program and library for performing
+extended Hückel calculations.")
+    (license license:bsd-2)))