Comments (16)
Great question - I saw your earlier tag. Partly, this has been due to lack of time. (I'm behind on writing documentation for Avogadro 2 as well. 😄 ) Partly, it's been not knowing the best mechanism to encode the spec (e.g., using something formal like Pydantic.)
A somewhat more readable "ground truth" is in https://github.com/OpenChemistry/avogadro-cclib/blob/main/cclibScript.py which I'm working hard to keep that up-to-date and merge into cclib
as well.
I've been discussing also with the cclib team on other attributes.
A few things that are definitely missing:
- total charge / total spin
- energies for multiple coordinate sets (e.g., conformers, IRC, optimization steps, etc.)
- Right now this is going in
"properties": { "energies": [ … ] }
which makes some sense.
- Right now this is going in
- other kinds of molecular / atomic / bond properties (e.g., electrostatics, tensors, …)
- calculation metadata (IIRC it's in the
avogadro-cclib
script, but not the C++ yet)
Right now, it supports IR / Raman, electronic, and NMR spectra, but only in a limited way because plotting has been somewhat complicated in Avogadro 2.
Suggestions / discussion are definitely welcome.
from chemicaljson.
The format is used by other code, particularly the MongoChem web components, but these are mostly extensions or reverse-engineering the work done for the web components.
from chemicaljson.
I would prefer a spec to implement against instead of another implementation, but I'll work with what is available.
total charge / total spin
Only half of the formats xtb
supports via mctc-lib
have this (Turbomole coords, CTFiles like mol/sdf, QCSchema JSON, QChem molfiles, Gaussian external inputs), this is why we have overwrites via cmd-args or .CHRG
/ .UHF
files, so not a big issue. Of course we loose the information when writing in the same format since xtb
preserves the input format.
from chemicaljson.
using something formal like Pydantic
JSON Schema (either from the spec or as produced by Pydantic) has some annoying limitations, but overall my experience generating schemas and JSON blobs via Pydantic is great, and certainly better than hand-writing JSON.
from chemicaljson.
I would prefer a spec to implement against instead of another implementation, but I'll work with what is available.
In my experience, both a spec, and an implementation and/or live examples are critical, but I understand completely.
I just discovered https://jsontopydantic.com which should help writing a more formal spec and Pydantic model. Given my workload this week and a conference next week, this may take a while, but I'm happy to answer questions in the meantime.
from chemicaljson.
I wonder what is supposed to happen if a chemical JSON such as
{"chemical json": 2, "chemicalJson": 1}
is provided, should the reader reject it or pass it like currently done in Avogadro 2? This behaviour is somewhat inconsistent with
{"chemical json": 1, "chemicalJson": 2}
which is going to fail due to the version number specified.
The specs don't mention that there are alternative keys and how an implementation should deal with duplicated entries.
from chemicaljson.
In general in JSON, non-matching keys are ignored. So a key of "chemical json" is irrelevant, because it's not "chemicalJson".
At the moment, there are not alternative keys and I'm not sure that would be a good idea.
from chemicaljson.
At the moment, there are not alternative keys and I'm not sure that would be a good idea.
This is not true if I check the actual implementation at
which allows both chemical json
and chemicalJson
as key for the version numbers, same for several other keys.
from chemicaljson.
Dealing with spaces in JSON keys is more cumbersome in JavaScript as well: https://stackoverflow.com/a/4968448/131896
molecule.atoms
vs molecule["vibrational modes"]
from chemicaljson.
This is not true if I check the actual implementation
I think that's due to some unfortunate backwards compatibility. It's a bad idea and I don't recommend it.
As I mentioned, Avogadro now always writes Cartesian coordinates and cell vectors even with periodic systems. (Very old versions would convert to fractional and write parameters .. but you drop useful information.)
Yes, it's why a spec is needed vs. an implementation that tries to ensure backwards compatibility with not-quite compatible files.
from chemicaljson.
Yes, it's why a spec is needed vs. an implementation that tries to ensure backwards compatibility with not-quite compatible files.
This is good to know, since I got the impression that I have the choice as implementor which key I can write, but have to always support both variants when reading. So the camelCase ones are the correct ones? (I should go change this than in my implementation)
from chemicaljson.
My general view on parsers is flexible on read, but correct on write. (This is motivated particularly by "PDB" files. 🙄
Let's also agree on properties => "totalCharge" and properties => "totalSpinMultiplicity" and I promise I'll get that into avogadrolibs
tonight.
from chemicaljson.
Let's also agree on properties => "totalCharge" and properties => "totalSpinMultiplicity" and I promise I'll get that into
avogadrolibs
tonight.
totalCharge
and totalSpinMultiplicity
are fine with me.
My general view on parsers is flexible on read, but correct on write.
I have to disagree on this one, every flexibility allowed in the parser will get used at some point by somebody and is than expected to be supported for all future. Even worse, future implementations are expected to support the same extensions (like this SDF stuff grimme-lab/mctc-lib#49). A parser should enforce the correctness of the format, rigorously.
from chemicaljson.
Thanks for OpenChemistry/avogadrolibs#1058, however this doesn't solve the issue that avogadrolibs implements something else than documented here.
from chemicaljson.
I'm aware - I'm at a conference this week, so my time to write a spec is limited. I will certainly write up a more complete current spec in the next few weeks.
from chemicaljson.
Fortunately, it was a bit easier to push things into Pydantic than I worried. Here's a start, which will turn into a pull request.
https://gist.github.com/ghutchis/3a31e5b597dafb15de9ea048cad35268
Yes, some of these examples are really old and need to be removed.
from chemicaljson.
Related Issues (9)
- Unit cell => Translation Axes HOT 2
- Consider writing a json schema file HOT 4
- Clarify orbital properties for open-shell systems HOT 1
- Clarify relative energies for 3dSets HOT 3
- Support orbital sets with energies HOT 2
- Example with multiple coordinate sets / animations? HOT 6
- Connections reflexive? HOT 6
- Atomic gradients? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chemicaljson.