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

[BUG] Failure to run when minimising with restraints using OpenMM #340

Closed
mb2055 opened this issue Sep 24, 2024 · 3 comments · Fixed by #341
Closed

[BUG] Failure to run when minimising with restraints using OpenMM #340

mb2055 opened this issue Sep 24, 2024 · 3 comments · Fixed by #341
Labels
bug Something isn't working

Comments

@mb2055
Copy link
Contributor

mb2055 commented Sep 24, 2024

Describe the bug
Same issue as #339 , this time in OpenMM when using Protocol.Minimisation and Protocol.Equilibration with restraints.

To Reproduce
The following code fails to produce a system, with process_m1.getSystem() returning None

import BioSimSpace as BSS

ethane = BSS.Parameters.gaff("CC").getMolecule()

methanol = BSS.Parameters.gaff("CO").getMolecule()

mapping = BSS.Align.matchAtoms(ethane, methanol)

ethane = BSS.Align.rmsdAlign(ethane, methanol, mapping)

merged = BSS.Align.merge(ethane, methanol, mapping)

vac = merged.toSystem()

minimise = BSS.Protocol.Minimisation(restraint="heavy")

process_m1 = BSS.Process.OpenMM(vac, minimise, work_dir="Minimise_Vacuum")

process_m1.start()
process_m1.wait()

removing restraint="heavy" solves the issue

(please complete the following information):

  • OS :Ubuntu 22.04.5 LTS
  • Version of Python: 3.12.4
  • Version of BioSimSpace: 2024.3.0.dev+18.gdc6602e4
  • I confirm that I have checked this bug still exists in the latest released version of BioSimSpace: yes
@mb2055
Copy link
Contributor Author

mb2055 commented Sep 24, 2024

Running openmm_script.py directly highlights the folowing line as the issue:
ref_prm = parmed.load_file('openmm.prm7', 'openmm_ref.rst7')
with the error raised being cannot reshape array of size 0 into shape (0,3).

Attempting to load openmm.prm7 and openmm_ref.rst7 with BioSimSpace gives the following:

In [1]: import BioSimSpace as BSS

INFO:numexpr.utils:Note: NumExpr detected 20 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
INFO:numexpr.utils:NumExpr defaulting to 8 threads.

In [2]: BSS.IO.readMolecules(["openmm.prm7", "openmm_ref.rst7"])
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ in <module>:1                                                                │
│                                                                              │
│ /home/matt/code/biosimspace/python/BioSimSpace/IO/_io.py:550 in              │
│ readMolecules                                                                │
│                                                                              │
│    547 │   │   │   │   if _isVerbose():                                      │
│    548 │   │   │   │   │   raise IOError(msg) from e0                        │
│    549 │   │   │   │   else:                                                 │
│ ❱  550 │   │   │   │   │   raise IOError(msg) from None                      │
│    551 │   │   │   else:                                                     │
│    552 │   │   │   │   msg = "Failed to read molecules from: %s" % files     │
│    553 │   │   │   │   if _isVerbose():                                      │
╰──────────────────────────────────────────────────────────────────────────────╯
OSError: Incompatibility between molecular information in files: ['openmm.prm7',
'openmm_ref.rst7']

@lohedges
Copy link
Contributor

That's strange. Presumably the LJ change is causing a self-consistency issue somewhere. I'll try to debug this tomorrow.

@lohedges
Copy link
Contributor

I see the issue. If None is passed as the reference system then is just takes the system as a reference. However, it doesn't have any logic to deal with perturbable systems, so doesn't extract the end state. As such, the regular coordinates property is used and no atoms are found. Will fix this now.

lohedges added a commit that referenced this issue Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants