gmso icon indicating copy to clipboard operation
gmso copied to clipboard

Error when writing/converting foyer to gmso xml files

Open bc118 opened this issue 1 year ago • 2 comments

It seems there is an error with a path function in the gmso.external.convert_foyer_xml_write_gmso_xml function. However, it seems to do the foyer to gmso XML conversion properly. I attached a simple spce water file example.

Output error:


(mosdef_gomc) [brad@localhost example]$ python convert_foyer_to_gmso_xml.py 
/home/brad/Programs/anaconda3/envs/mosdef_gomc/lib/python3.10/site-packages/mbuild/recipes/__init__.py:13: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
  entry_points = metadata.entry_points()["mbuild.plugins"]
Traceback (most recent call last):
  File "/run/media/brad/raid1/brad_files/atomfold/simulations/heavy_metals/common/example/convert_foyer_to_gmso_xml.py", line 18, in <module>
    _write_gmso_xml(gmso_xml_1)
  File "/home/brad/Programs/anaconda3/envs/mosdef_gomc/lib/python3.10/site-packages/gmso/external/convert_foyer_xml.py", line 140, in _write_gmso_xml
    forcefield.attrib["name"] = pathlib.Path(gmso_xml).stem
  File "/home/brad/Programs/anaconda3/envs/mosdef_gomc/lib/python3.10/pathlib.py", line 960, in __new__
    self = cls._from_parts(args)
  File "/home/brad/Programs/anaconda3/envs/mosdef_gomc/lib/python3.10/pathlib.py", line 594, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/home/brad/Programs/anaconda3/envs/mosdef_gomc/lib/python3.10/pathlib.py", line 578, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Example:

example.zip

bc118 avatar Aug 02 '23 00:08 bc118

I think this also needs to get deprecated, as that whole module has lost it's usefulness. The replacement function is in gmso/core/forcefield.py: ForceField.to_xml(filename) function

CalCraven avatar Nov 13 '23 17:11 CalCraven

OK. But we should have some converter from foyer to GMSO, I think

bc118 avatar Nov 13 '23 22:11 bc118