Contributions are welcomed via pull requests on GitHub. Developers and/or users will review requested changes and make comments. The rest of this file will serve as a set of general guidelines for contributors.
Foyer is designed to be general and flexible, not limited to single force fields, simulation engines, or simulation methods. Additions to core features should attempt to provide something that is applicable to a variety of use-cases and not targeted at only the focus area of your research. However, some specific features targeted toward a limited use case may be appropriate. Speak to the developers before writing your code and they will help you make design choices that allow flexibility.
We currently use the "standard" Pull Request model. Contributions should be implemented on feature branches of forks.
Please try to keep the master
branch of your fork up-to-date with the master
branch of the main repository.
Small changes are preferred over large changes. A major contribution can often be broken down into smaller PRs. Large PRs that affect many parts of the codebase can be harder to review and are more likely to cause merge conflicts.
It is important to have a consistent style throughout the source code. The following criteria are desired:
- Lines wrapped to 80 characters
- Lines are indented with spaces
- Lines do not end with whitespace
- For other details, refer to PEP8
We use pre-commit to automatically check our code style. Pre-commit is included in the dev environment and its git hooks can be installed using:
pre-commit install
All public-facing functions should have docstrings using the numpy style. This includes concise paragraph-style description of what the class or function does, relevant limitations and known issues, and descriptions of arguments. Internal functions can have simple one-liner docstrings.
All new functionality in Foyer should be tested with automatic unit tests that execute in a few seconds. These tests
should attempt to cover all options that the user can select. All or most of the added lines of source code should be
covered by unit test(s). We currently use pytest, which can be executed simply by calling
pytest
from the root directory of the package. Additions to force field files should include test molecules that encompass
the added or modified atom types or functionality.