Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MD-SAPT to MDAKits #47

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Add MD-SAPT to MDAKits #47

wants to merge 10 commits into from

Conversation

ALescoulie
Copy link

My MDAKit MD-SAPT runs SAPT calculations over MD trajectories using Psi4. We currently are working on publishing it in JOSS and it is ready to be submitted as an official MDA kit.

@IAlibay
Copy link
Member

IAlibay commented Apr 17, 2023

@ALescoulie we're in the process of improving our docs for adding mdakits, especially when it comes to adding things so that tests will run properly. We'll come back to this (and other PRs open) once that's done, so that we can point folks to the right steps to getting everything working.

@orbeckst
Copy link
Member

orbeckst commented Jul 3, 2023

FYI, we have the MDAKits tutorial with the section Submitting a MDAKit to the registry.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Meta data requires some obvious changes, in particular the ones to make tests run.

mdakits/mdsapt/metadata.yaml Outdated Show resolved Hide resolved
mdakits/mdsapt/metadata.yaml Outdated Show resolved Hide resolved
## str: the development status of the MDAKit
development_status: Mature
## List(str) a list of publications to cite when using the MDAKit
publications:
Copy link
Member

Choose a reason for hiding this comment

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

paper published?

Copy link
Author

Choose a reason for hiding this comment

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

not yet, were working on it

development_status: Mature
## List(str) a list of publications to cite when using the MDAKit
publications:
community_home:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe enable GitHub discussions on https://github.com/calpolyccg/MDSAPT ??

Copy link
Author

Choose a reason for hiding this comment

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

I enabled discussions

Copy link
Member

Choose a reason for hiding this comment

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

Can you add an link to discussions?

mdakits/mdsapt/metadata.yaml Outdated Show resolved Hide resolved
@orbeckst
Copy link
Member

@ALescoulie could you address the changes above? They are really minor!

- conda package requires dev label
- install pre-requisites for source installation
@orbeckst
Copy link
Member

I played around with the config file to see if I could make it pass the MDAKit tests.

Note that psi4 migrated from their psi4 channel to conda-forge since 1.8.1. However, MDSAPT is pinning psi4>=1.6.1,<1.7 so the psi4 channel is required. Also, mdsapt only exists as a dev package in the psi4 channel at the moment.

@orbeckst
Copy link
Member

The tests don't like to be run with --pyargs

Run tests=$(python utils/get_runtests.py --mdakit mdsapt --runtype latest)
tests: pytest --pyargs mdsapt.tests
ERROR: module or package not found: mdsapt.tests (missing __init__.py?)

Not sure if mdsapt is not installed properly or if it's something else; the tests directory contains __init__.py https://github.com/calpolyccg/MDSAPT/tree/master/mdsapt/tests.

@orbeckst
Copy link
Member

The tests fail because some issues with pydantic. This looks as if it needs to be fixed in MD-SAPT

==================================== ERRORS ====================================
_________________ ERROR collecting mdsapt/tests/test_config.py _________________
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/share/miniconda3/envs/test/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:972: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:972: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:850: in exec_module
    ???
<frozen importlib._bootstrap>:228: in _call_with_frames_removed
    ???
mdsapt/__init__.py:8: in <module>
    from .config import Config, load_from_yaml_file
mdsapt/config.py:132: in <module>
    class RangeFrameSelection(BaseModel):
mdsapt/config.py:145: in RangeFrameSelection
    @root_validator()
/usr/share/miniconda3/envs/test/lib/python3.9/site-packages/pydantic/deprecated/class_validators.py:228: in root_validator
    raise PydanticUserError(
E   pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.
E   
E   For further information visit https://errors.pydantic.dev/2.3/u/root-validator-pre-skip

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

There are problems with pydantic that makes the tests fail, at least with the versions that are used in the testing here. I raised calpolyccg/MDSAPT#42 . When the testing code is changed, we can re-run here.

Please ping me.

## source code.
src_install:
# required dependencies from environment.yaml
- mamba install -c psi4 -c conda-forge -c defaults "psi4>=1.6.1,<1.7" click numpy openmm pandas pdbfixer pytest pydantic pytest-cov pyyaml rdkit
Copy link
Member

Choose a reason for hiding this comment

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

Question for @IAlibay : Is it correct to do the installation of dependencies before the source pip install if I don't want dependencies to be pip-installed? I'd love to be able to say mamba install -f environment.yml but to my knowledge that doesn't work (only works with mamba create). Because I have to list dependencies explicitly, I also have to explicitly add pinning (like for psi4). That looks a bit awkward and prone to breakage. Is there a better way?

Copy link
Member

Choose a reason for hiding this comment

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

🤔 yes that is indeed a bit of a problem.

What would the desired workflow be here? Fetch the yaml file from the remote directory and create the environment using that? Or should we try to read the yaml file and install from there?

This is definitely something to be considered as part of the refactor.

Copy link
Member

Choose a reason for hiding this comment

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

At the end of the day the package developers should be responsible for keeping the meta data in sync with the package installation. I’d rather keep our side simple and suggest that ultimately packages follow standard procedures. In the meantime explicit pinning should be fine as a temporary measure — if this gets the kit installed correctly.

@ALescoulie
Copy link
Author

we now have a conda-forge release (conda install -c conda-forge mdsapt, does that mean I have to still list required dependencies in src_install or can I let conda-forge take care of that?

@ALescoulie
Copy link
Author

ALescoulie commented Jun 24, 2024

I pushed an update that has the conda forge install, I'd appreciate if someone could take a look at this.

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Sorry just giving this a very brief look, the src_install field expects a list, added a suggested change to fix that.

mdakits/mdsapt/metadata.yaml Outdated Show resolved Hide resolved
@ALescoulie ALescoulie requested a review from orbeckst June 24, 2024 20:05
@ALescoulie
Copy link
Author

Icommitted @IAlibay's change to dependency install command, and fixed an issue with the test dependencies command.

@IAlibay and @orbeckst is there anything else to fix for this PR?

@ALescoulie
Copy link
Author

The CI failed because I put a comma between test dependencies on the mamba install line which caused it to fail. I pushed a fix, @orbeckst could you try running the full CI again?

@orbeckst
Copy link
Member

orbeckst commented Jul 2, 2024

There was a fail for develop and I restarted it. Not sure if this is what you meant.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

The develop CI is still failing https://github.com/MDAnalysis/MDAKits/actions/runs/9766164949/job/26961722361?pr=47

Does the command

mamba install -c conda-forge psi4 >= 1.9.1, mdanalysis >=2.7.0, rdkit >=2023.09.5, openmm >=8.1.1, pdbfixer >=1.9, numpy, click, pandas, pyarrow, pyyaml;pip install git+https://github.com/calpolyccg/MDSAPT@master

work when you try it manually?

@orbeckst
Copy link
Member

orbeckst commented Jul 2, 2024

(Is it possible that there should be quotation marks in the install command?)

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

I think this should work

mdakits/mdsapt/metadata.yaml Outdated Show resolved Hide resolved
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Develop installation works but you get a segfault

Thread 0x00007f8ad06fe640/home/runner/work/_temp/e522ce51-b634-481c-b233-3008ac944e02.sh: line 3:  3289 Segmentation fault      (core dumped) pytest -v ./mdsapt/tests
mdsapt/tests/test_sapt.py::TestSAPT::test_run_traj_sapt 

Can you look into what's happening there? Is this locally reproducible?

@ALescoulie
Copy link
Author

Yeah I'll look at that later day. The issue probably is that need to bring develop up to date with master because we've pushed a lot of the recent fixes straight from feature branch into master.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Fix segfault in develop CI.

(Excuse brevity, please)

development_status: Mature
## List(str) a list of publications to cite when using the MDAKit
publications:
community_home:
Copy link
Member

Choose a reason for hiding this comment

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

Can you add an link to discussions?

src_install:
# required dependencies from environment.yaml
- mamba install -c conda-forge "psi4>= 1.9.1" "mdanalysis >=2.7.0" "rdkit >=2023.09.5" "openmm >=8.1.1" "pdbfixer >=1.9" numpy click pandas pyarrow pyyaml
- pip install git+https://github.com/calpolyccg/MDSAPT@master
Copy link
Member

Choose a reason for hiding this comment

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

Note that the „develop“ CI installs your source (ie your master branch) and tests against the MDAnalysis develop branch! That’s the configuration to check for the segfault.

@orbeckst orbeckst added the new create a new MDAKit label Aug 1, 2024
@orbeckst
Copy link
Member

Have you made any progress in figuring out the reason for the segfault? Is it even locally reproducible?

@ALescoulie
Copy link
Author

@orbeckst I haven't gotten around to trying yet, I forgot to mention on this thread that I just moved (I'm still in the bay area, my partner and I found a great deal on a place in SF, so jumped on it) and have been busy with that. Now that I finally set up my desktop again, I'll try and replicate it in a container since I use NixOS and don't want to potentially introduce Nix related problems to the process.

@orbeckst orbeckst added the mdakit About an MDAKit. label Sep 6, 2024
@orbeckst
Copy link
Member

Ping @ALescoulie ;-) — did you have some opportunities to dig into MD-SAPT again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mdakit About an MDAKit. new create a new MDAKit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants