Skip to content

Conversation

@rouson
Copy link
Collaborator

@rouson rouson commented Jan 24, 2026

What type of PR is this? (check all applicable)

  • Feature
  • Example
  • Documentation
  • Test

Description

This PR makes a fresh pass at adding Fortran implementations in a minimally intrusive way:

  1. A new git submodule,
  2. A new fpm.toml file that requires no additional files or soft links, and
  3. An updated README.md describing the cloning, installing, testing, and examples for the Fortran implementation.

As before, the fpm.toml file builds the C++ and Fortran implementations and their prerequisites.

Related Issues & Documents

This PR supercedes all previous PRs related to the now-deleted dev/fortran branch.

QA Instructions, Screenshots, Recordings

With git and fpm installed on macOS, Linux, or Windows, and with the formal branch checked out and your present working directory set to MOLE's root directory, run the following commands:

git switch formal
git submodule update --init --recursive
fpm install --profile release
fpm test --profile release
fpm run --example --profile release

fpm can be installed via package manager or by compiling one source file and putting the resulting executable file in your PATH.

Added/updated tests?

  • Yes

Read Contributing Guide and Code of Conduct

Are there any post deployment tasks we need to perform?

No.

What gif best describes this PR or how it makes you feel?

This commit adds a git submodule containing the initial Formal
(https://github.com/berkeleylab/formal) Fortran implementations
of mimetic discretizations.
This commit differentiates the submodule name from the path.
This commit adds an "fpm.toml" file in the root source directory,
which enables the following command to build MOLE's C++ and Fortran
libraries, including their prerequisites:

fpm install --profile release --flag "-I./src/fortran/include"

where it is assumed that the "formal" git submodule has been cloned
into "src/fortran" by, for example, executing

git submodule update --init --recursive
Now `fpm install` works without additional arguments.
@rouson rouson changed the title Fortran implementation, fpm manifest, and updated README.md Feature/Documentation: Fortran implementation, fpm manifest, and updated README.md Jan 24, 2026
Copy link
Collaborator

@jbrzensk jbrzensk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this out, and it works great. I hit the same issues as last time, where I had to include

--flag "-ffree-line-length-none -fcoarray=single"

at the end of every command I ran, because of errors with GNU gfortran 13.3.0. A note in the README would be nice to address the coarray part. I note your README has the free-line-length mentioned.

I am going to bring this up with the MOLE group today. You implemented a few things we have never done before:

  • Linking another repository with submodules
  • "renaming" MOLE to formal in your repo ( not a bad thing, just like with PyMOLE )
  • Separate set of examples ( again, not a bad thing, just something to discuss )

Overall, I really like it, and really like the testing you have. We really need something like that for the C++ and MATLAB codes.

@jbrzensk
Copy link
Collaborator

My Workflow to run this

  • clone repo
  • git switch formal
  • git submodule update --init --recursive
  • fpm install --flag "-ffree-line-length-none -fcoarray=single"
  • fpm test --flag "-ffree-line-length-none -fcoarray=single"
  • cd src/fortran/example
  • fpm run --example div-grad-laplacian-1D --flag "-ffree-line-length-none -fcoarray=single"
  • fpm run --example extended-gauss-divergence --flag "-ffree-line-length-none -fcoarray=single"

@rouson
Copy link
Collaborator Author

rouson commented Jan 26, 2026

@jbrzensk thanks for testing this out and for all the helpful feedback. Ifyou use --profile (e.g., --profile release or --profile debug), then fpm should automatically include the -fcoarray=single for you.

@rouson
Copy link
Collaborator Author

rouson commented Jan 26, 2026

@jbrzensk sorry. I missed that you already found the -ffree-line-length-none flag in the README so I just deleted that part of my previous response.

@rouson
Copy link
Collaborator Author

rouson commented Jan 26, 2026

@jbrzensk I just edited the git commands in this PR's original comment to include git switch formal and --profile release.

@rouson
Copy link
Collaborator Author

rouson commented Jan 26, 2026

There's a lot more that fpm could be doing with some effort. For example, it might be able to run the C++ test suite. I made a quick attempt to add features, but didn't succeed. It would be a great project for a student if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants