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

Remove convert_foyer_xml and replace with using foyer as the backend #749

Merged
merged 18 commits into from
Sep 12, 2023

Conversation

CalCraven
Copy link
Contributor

@CalCraven CalCraven commented Jul 18, 2023

Issue #748 discusses this, but there are components of forcefield conversion in from Foyer to GMSO that have not been updated in the gmso.external.convert_foyer_xml module, but are supported in forcefield-utilities. Therefore, I think it is worthwhile to move the tests done on this utility to test the same forcefields loaded through that path.

  • unit tests
  • ForceField.load("foyer.xml", backend="forcefield-utilities") is the default
  • Migrate tests to forcefields converted via forcefield-utilities
  • issue raised and addressed

Comment on lines +256 to +257
# with pytest.raises(DocumentInvalid):
# ForceField(get_path("ff-example-nonunique-params.xml"))

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Patch coverage: 76.47% and project coverage change: -0.21% ⚠️

Comparison is base (093a94d) 92.06% compared to head (1b787dd) 91.85%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #749      +/-   ##
==========================================
- Coverage   92.06%   91.85%   -0.21%     
==========================================
  Files          67       66       -1     
  Lines        6890     6702     -188     
==========================================
- Hits         6343     6156     -187     
+ Misses        547      546       -1     
Files Changed Coverage Δ
gmso/external/__init__.py 100.00% <ø> (ø)
gmso/utils/ff_utils.py 91.98% <50.00%> (-4.04%) ⬇️
gmso/core/forcefield.py 96.09% <85.71%> (-0.44%) ⬇️
gmso/utils/decorators.py 78.84% <100.00%> (+3.84%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marjanalbooyeh
Copy link
Contributor

I tried this little script for gaff forcefield and looks like there is an issue with the unit of periodicity parameter n in periodic torsion potentials in to_hoomd_forcefield.

Here's the script:

import mbuild as mb
from gmso.core.forcefield import ForceField
from gmso.parameterization import apply
from gmso.external import from_mbuild, to_hoomd_forcefield

smiles = "c1ccc(S)cc1"
monomer = mb.load(smiles, smiles=True)
topology = from_mbuild(monomer)
topology.identify_connections()
gmso_ff = ForceField("gaff.xml")
apply(topology, gmso_ff)
ff, refs = to_hoomd_forcefield(
    top=topology,
    r_cut=2.5
)

The error is:

  File "gmso/gmso/ff_run.py", line 12, in <module>
    ff, refs = to_hoomd_forcefield(
               ^^^^^^^^^^^^^^^^^^^^
  File "gmso/gmso/external/convert_hoomd.py", line 656, in to_hoomd_forcefield
    "dihedrals": _parse_dihedral_forces(
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/gmso/gmso/external/convert_hoomd.py", line 1109, in _parse_dihedral_forces
    groups[group] = _convert_params_units(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/gmso/gmso/external/convert_hoomd.py", line 1407, in _convert_params_units
    f"({str(base_units[unit].value)} * {str(base_units[unit].units)})",
            ~~~~~~~~~~^^^^^^
KeyError: 'dimensionless'

@CalCraven
Copy link
Contributor Author

I think this should get raised as an issue because I think this base_unit system needs to be extended to have the capability of handing dimensionless conversions via a set of normalizing mass, energy, and distances.

@CalCraven CalCraven force-pushed the 748-remove-gmso-xml-conversions branch from 266b51d to 60025c0 Compare August 10, 2023 15:49
Copy link
Member

@daico007 daico007 left a comment

Choose a reason for hiding this comment

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

Some comments about the deprecating messages.

gmso/core/forcefield.py Outdated Show resolved Hide resolved
gmso/external/convert_foyer_xml.py Outdated Show resolved Hide resolved
gmso/utils/decorators.py Outdated Show resolved Hide resolved
gmso/utils/ff_utils.py Outdated Show resolved Hide resolved
gmso/core/forcefield.py Dismissed Show dismissed Hide dismissed
@daico007 daico007 merged commit a3fa9f4 into mosdef-hub:main Sep 12, 2023
14 of 16 checks passed
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.

None yet

3 participants