Probe-Particle / ppafm

Classical force field model for simulating atomic force microscopy images.
MIT License
50 stars 19 forks source link

Python API GPU tutorial #269

Closed NikoOinonen closed 8 months ago

NikoOinonen commented 9 months ago

Fixes #268

Added a tutorial to the sphinx docs for how to run GPU-accelerated simulations via the Python API.

I found a way to write the document in Markdown instead of reST, using the myst-parser extension in sphinx, so this should also work as an example of how to add documentation if we decide to migrate the wiki content to the sphinx docs like we were briefly discussing previously.

A preview of the added page can be seen here: https://ppafm.readthedocs.io/en/api-tutorials/tutorials/afmulator-tutorial.html.

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 46.44%. Comparing base (063cc9a) to head (90b4550).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #269 +/- ## ======================================= Coverage 46.44% 46.44% ======================================= Files 35 35 Lines 5180 5180 ======================================= Hits 2406 2406 Misses 2774 2774 ``` | [Flag](https://app.codecov.io/gh/Probe-Particle/ppafm/pull/269/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle) | Coverage Δ | | |---|---|---| | [python-3.10](https://app.codecov.io/gh/Probe-Particle/ppafm/pull/269/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle) | `46.45% <ø> (ø)` | | | [python-3.11](https://app.codecov.io/gh/Probe-Particle/ppafm/pull/269/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle) | `46.42% <ø> (ø)` | | | [python-3.12](https://app.codecov.io/gh/Probe-Particle/ppafm/pull/269/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle) | `46.42% <ø> (ø)` | | | [python-3.7](https://app.codecov.io/gh/Probe-Particle/ppafm/pull/269/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle) | `46.25% <ø> (ø)` | | | [python-3.9](https://app.codecov.io/gh/Probe-Particle/ppafm/pull/269/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle) | `46.34% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Probe-Particle#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

NikoOinonen commented 9 months ago

@ProkopHapala is someone who used and developed this API before, so could maybe offer an expert opinion.

For others (@ondrejkrejci, @mondracek, @yakutovicha) who probably don't know this part of the code could maybe give more of a newcomer's perspective on whether the tutorial makes sense.

NikoOinonen commented 8 months ago

Thanks @yakutovicha, I applied the suggestions.

ProkopHapala commented 8 months ago

@NikoOinonen - I read it now. I think it is great. Thanks that you did it.

NikoOinonen commented 8 months ago

@ProkopHapala

I'm not sure I understood exactly what you wrote here:

  • I found a way to write the document in Markdown instead of reST, using the myst-parser extension in sphinx, so this should also work as an example of how to add documentation

By default the sphinx system uses reStructuredText (reST) instead of Markdown, which is what the Github wiki uses. So with this addition it should be easier to just copy-paste material between the wiki and the sphinx docs, if we want to do that.

I recently put some instructions on how the documentation system works in the wiki here: https://github.com/Probe-Particle/ppafm/wiki/For-Developers#sphinx-documentation. Basically there are a couple of additional dependencies for building the HTML pages locally, but editing the document itself does not require anything extra, the web page will get automatically updated once a commit is made to the main branch.