Skip to content

Bring mopac syntax.json back with the other plugins and update style#32

Merged
ghutchis merged 3 commits intoOpenChemistry:masterfrom
brockdyer03:move_mopac
Mar 16, 2026
Merged

Bring mopac syntax.json back with the other plugins and update style#32
ghutchis merged 3 commits intoOpenChemistry:masterfrom
brockdyer03:move_mopac

Conversation

@brockdyer03
Copy link
Contributor

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

@welcome
Copy link

welcome bot commented Mar 16, 2026

Thanks for opening this pull request! Please check out our contributing guidelines and check for the automated tests.

@brockdyer03 brockdyer03 changed the title Bring mopac syntax.json back with the other plugins Bring mopac syntax.json back with the other plugins and update style Mar 16, 2026
@brockdyer03
Copy link
Contributor Author

@nbehrnd Please give this a review and make sure I didn't mess up your work!

@nbehrnd
Copy link
Contributor

nbehrnd commented Mar 16, 2026

@brockdyer03 Well

  • the «style file» was subject of a git mv to eventually be in the same directory as the other material; reasonable
  • part(s) of what trailed the block of keywords now became part (and partially substituted) the header
  • thus the block of keywords moved two spaces to the inner:

the top of the file's two versions (top pane new, bottom pane present version)
delta_01

the bottom of the two versions
delta_02

  • the sequence of keywords as such however remained intact

I notice the syntax.toml about NWChem (which I initially used as pattern of reference) both i) isn't anymore in the more difficult to read previous syntax. This is in line with discussions in two.avogradro. Yet ii) still(?) starts a bit differently than your suggestion. To quote a few early lines:

[[default.rules]]
format.preset = "num_literal"
patterns = [
    { regexp = '\b[+-]?[.0-9]+(?:[eEdD][+-]?[.0-9]+)?\b' },
]

[[default.rules]]
format.preset = "keyword"
patterns = [
    { regexp = '\b(?:re)?start\b' },
    { regexp = '\b(?:scratch|permanent)?_dir\b' },
    { regexp = '\bmemory\b' },
    { regexp = '\becho\b' },
    { regexp = '\btitle\b' },
    { regexp = '\b(?:no)?print\b' },
    { regexp = '\b(?:un)?set\b' },
    { regexp = '\bstop\b' },
[...]

Do you think this difference is relevant? If so, keep in mind I basically know about NWChem because it is listed as an output of Avogadro's generators.

I understood the correct working the generators (including the syntax highlighting) only is most reliably checked by building a new Avogadro2 executable. Normally, this would call for a nightly built. Instead of waiting for such an artifact, with insight and resources, this equally could be achieved locally any time earlier, too. But it could help if the proposed change works well, as a probe prior to a merge.

@nbehrnd
Copy link
Contributor

nbehrnd commented Mar 16, 2026

@brockdyer03 options.json about NWChem actually groups keywords -- something I did not attempt for MOPAC

{
  "Title": {
    "type": "string",
    "default": ""
  },
  "Calculation Type": {
    "type": "stringList",
    "default": 1,
    "values": [
      "Single Point",
      "Equilibrium Geometry",
      "Frequencies"
    ]
  },
  "Theory": {
    "type": "stringList",
    "default": 1,
    "values": [
      "RHF",
      "B3LYP",
      "MP2",
      "CCSD"
    ]
  },

@brockdyer03
Copy link
Contributor Author

I tried to use the syntax.json, but it didn't work for reasons I don't particularly have time to work on right now. I have created an identical version but with the TOML format (that matches NWChem's syntax highlighting), and that seems to work. I'm going to use that since it seems to be behaving properly.

@ghutchis ghutchis merged commit 92419fb into OpenChemistry:master Mar 16, 2026
2 of 3 checks passed
@ghutchis
Copy link
Member

One thing I'll think about is the "second line is a comment" syntax for MOPAC. Maybe something like ^[^\n]*\n([^\n]*)
(i.e., match something that's not a newline then the newline, then the whole second line)

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.

3 participants