lumol-org / lumol

Universal extensible molecular simulation engine
http://lumol.org/
BSD 3-Clause "New" or "Revised" License
190 stars 18 forks source link

[WIP]Tutorial for pair potential implementation #196

Closed g-bauer closed 6 years ago

g-bauer commented 7 years ago

EDIT: New structure

This PR will teach users how to add a PairPotential to Lumol.

These are the steps discussed in the tutorial: Part 1:

Part 2 (moving the implementation into lumol core):

You can clone this PR and locally build the manual using

mdbook serve --open

from within the lumol/doc/ directory (you can install mdbook using cargo).

Luthaf commented 7 years ago

This looks very nice!

I have a suggestion about the organisation of this tutorial. Lumol is written such as it can be extended from the outside; which means the users do not need to write code in this repository to have it work with the rest of the engine. The tutorial could be written to use this property: just create a new cargo project, make it depend on the lumol crate, and implement the potential here.

This can have two benefits:

Your tutorial outline could then be splitted in two parts: the basics with

Introduction Prerequisites Building the struct impl Potential impl PairPotential

and then the extra, only needed to include code in the main repository

add API documentation add unit tests add parser for input files add documentation in the manual

The only issue is until we get a plugin system (#45), users needs to write there own main function if they want to use any newly developed potential/MC move/propagator/...

g-bauer commented 7 years ago

Thanks for the feedback!

The tutorial could be written to use this property: just create a new cargo project, make it depend on the lumol crate, and implement the potential here.

That's a good idea, I reorganize the tutorial accordingly. Would you still have this as part of the manual (I would, see the 2nd part about docs and input) or would we treat tutorials of this kind differently? Where would you put the tutorial repo (create a tutorials dir in lumol root or have this in another repo lumol tutorials)?

I'll keep on pushing to this PR - it already includes all codes necessary to put them into a separate repo so this will be a quick change in the end.

Luthaf commented 7 years ago

Concerning organisation, I think we can have everything in this repo for now, so the text in the manual, and the code in a tutorials directory. If it gets annoying, we can still move it to a separated repo later.

g-bauer commented 6 years ago

Added first part of the tutorial. I also added a tutorials directory in the root with a separate package that implements the discussed material as well as a small sample simulation setup to test the implementation.

I somehow screwed up the git history (sorry).

Not sure how long it will take me to write the second part. Maybe it makes sense to merge this as is.

Luthaf commented 6 years ago

I somehow screwed up the git history (sorry).

No, this does not look like so =)

Not sure how long it will take me to write the second part. Maybe it makes sense to merge this as is.

Yeah, we can merge this as it is, and keep the advanced part of the tutorial for later.


Can you also add a test in .travis.yml that check that the code compiles (you don't need to run the simulation, just build everything with cargo build), and that it keeps compiling even when we will change other things?

g-bauer commented 6 years ago

I'm done with this part.

Luthaf commented 6 years ago

And thank you again for doing this: having a good documentation is essential, especially for open source software!