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

Feature exception #140

Merged
merged 31 commits into from
Jan 26, 2024
Merged

Feature exception #140

merged 31 commits into from
Jan 26, 2024

Conversation

chryswoods
Copy link
Contributor

This PR adds support for reading and writing LJ 12-6-4 parameters from Amber topology files. This includes supporting Amber topology files which use LJ exceptions (i.e. the LJ parameter for an atom pair is not equal to a combining-rule combination of the atom-based parameters).

In doing this I have also detected when the topology file uses geometric combining rules and save this into the forcefield.

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): [y]
  • I confirm that I have added a test for any new functionality in this pull request: [y]
  • I confirm that I have added documentation (e.g. a new tutorial page or detailed guide) for any new functionality in this pull request: [n/a - this is something implicit in loading/saving]
  • I confirm that I have added a changelog entry to the changelog (we will add a link to this PR as part of the review): [y]
  • I confirm that I have permission to release this code under the GPL3 license: [y]

Suggested reviewers:

@lohedges

Any additional context of information?

The LJ exceptions can't be written to anything other than an Amber topology file, because only that format supports them. Also, they are not yet copied into the OpenMM context - I will do that via another feature branch. It is complex, as it will have to be via a custom exception force.

…re not used

to assign LJ i,j parameters (also used for LJ 12-6-4 parameters)
…s required

modifying PhysUnit so that it could get the typeName of generic types that
had not been registered previously
…ns to handle LJ_ij exceptions.

In doing this, I saw that I am not properly doing the magic and versioning for streaming
AtomProperty<T> objects...

Partly to fix this, I have added the check in SireStream::readHeader to put the stream back
to its last position if the magic error fails. This allows me to detect a wrong magic, and
to then choose a different class or try to stream differently. I need to check if this
causes any performance problems
…LJ exceptions

read from the Amber topology file before assigning to molecules.
for the magic in the stream. This is more robust, quicker and,
more importantly, actually works. Have used this to properly add
version and magic support to SparseMatrix. This is tested via reading
the neopentane BioSimSpace merged molecule s3 file.
…rsions

from strings to units to make things easier
… atom pairs.

Needs debugging and optimising!
…-4 potentials

where most atom pairs have exceptions. It takes 7-8 seconds, and is challenging
to multi-thread
…ibility and

editability of the current design - first step, make LJExceptionID and LJException
visible classes....

WIP
…ickly, using an O(n)

algorithm. And they still retain the flexibility. Next step is extracting them back
so that I can write out the prmtop file correctly.
… to make sure everything is ok.

It looks like there is a test failure involving saving of the self 12-6-4 parameter
…ct if a prmtop

file uses geometric combining rules, and to save this into the "forcefield" property.
This can be used to make sure that that the prmtop is written out using the
same combining rules as had been read (through most will always be arithmetic)
…for Unit typenames

Also remembered to add this to the changelog
@lohedges
Copy link
Contributor

lohedges commented Jan 8, 2024

Thanks for this.

The LJ exceptions can't be written to anything other than an Amber topology file, because only that format supports them.

Just to check... I seem to be able to write your test system to GroTop format without issue, i.e.:

In [1]: import sire as sr

In [2]: s = sr.load_test_files("apo_1264.prm7", "apo_1264.rst7")

In [3]: sr.save(s, "test.grotop")
Out[3]: ['/home/lester/Code/openbiosim/sire/test.grotop']

Should this trigger an exception, or are there simply additional terms that are not written to the GROMACS topology file? If the latter, should we think about adding a warning to say that these terms aren't supported and will be lost so that the user isn't surprised?

@lohedges lohedges merged commit af237a3 into devel Jan 26, 2024
5 checks passed
@lohedges lohedges deleted the feature_exception branch January 26, 2024 09:18
@chryswoods chryswoods restored the feature_exception branch January 27, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] need to include more Amber topology flags
2 participants