-
Notifications
You must be signed in to change notification settings - Fork 36
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
Formalizing the Schema #37
Changes from 10 commits
e71d410
72e4e80
6843ee5
ba958ef
d4fc8f5
a748f51
9d5faad
a71dc8e
1163ae8
0010693
9a933f7
f7f7ab1
3106cc2
12e0188
50c703d
ca8cdbc
8f92170
585e132
a21678a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# After changing this file, check it on: | ||
# http://lint.travis-ci.org/ | ||
language: python | ||
|
||
# Run jobs on container-based infrastructure, can be overridden per job | ||
sudo: false | ||
|
||
matrix: | ||
include: | ||
- python: 2.7 | ||
- python: 3.5 | ||
|
||
before_install: | ||
- uname -a | ||
- free -m | ||
- df -h | ||
- ulimit -a | ||
- python -V | ||
- pip install --upgrade pip setuptools | ||
- pip install pytest jsonschema | ||
|
||
script: | ||
- py.test -v | ||
|
||
notifications: | ||
email: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ should likely be handled by a higher level driver and not make the spec more dif | |
|
||
The following molecule specification is used. The required fields are: | ||
|
||
- `symbols` (list) - A list of strings | ||
- `symbols` (list) - A list of strings | ||
- `geometry` (list) - A 3N XYZ coordinate list of list in bohr, will likely change to encompass decided unit specifications | ||
|
||
The following are optional fields and default values (option, more a list of possibilities QM programs would want): | ||
|
@@ -23,15 +23,15 @@ The following are optional fields and default values (option, more a list of pos | |
- `comment` (str) - Any additional comment one would attach to the molecule. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, based on #35 that it makes sense to have an "identifier" section, with comment, molecule name, formula, InChI, SMILES, etc. as optional. This would probably also include provenance and DOI. Looking at my notes, I think these were grouped in the discussion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you thinking of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I'm thinking that there's an obvious request for identifiers, and I think comment/title have usually been identifiers in QC codes. So my suggestion is that there's an explicit identifier object - something like:
|
||
- `fragments` (list of tuples, `[]`) - A list of indices (0-indexed) for molecular fragments within the topology. | ||
- `fragment_charges` (list of floats, `[]`) - A list of charges associated with the fragments tuple. | ||
- `fragment_multiplicities` (list of ints, `[]`) - A list of multiplicites associated with each fragment. | ||
- `fragment_multiplicities` (list of ints, `[]`) - A list of multiplicites associated with each fragment. | ||
- `fix_com` (bool) - whether to adjust to the molecule to the COM or not | ||
- `fix_orientation` (bool) - whether to rotate the molecule to a standard orientation or not | ||
- `provenance` (dict, `{}`) - The provencance of the molecule. | ||
- `doi` - A doi reference for the molecule. | ||
|
||
Other possible quantities: | ||
- Bonds - Holding data for MM computations | ||
- Basis Sets per atom | ||
- `fix_com` (bool) - whether to adjust to the molecule to the COM or not | ||
- `fix_orientation` (bool) - whether to rotate the molecule to a standard orientation or not | ||
- Basis Sets per atom | ||
- label (list of str) - Per-atom labels which may be seperate from fragments | ||
- Extend the `real` quantitity to cover real, ghost, absent, qm/mm region, etc. | ||
- EFP quantities `fragment_types`, `coordinate_hints`. This is an example and likely not part of the spec. How would we handle this? | ||
- EFP quantities `fragment_types`, `coordinate_hints`. This is an example and likely not part of the spec. How would we handle this? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = qc_schema | ||
SOURCEDIR = source | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Compiling QC_JSON_Schema's Documentation | ||
|
||
The docs for this project are built with [Sphinx](http://www.sphinx-doc.org/en/master/). | ||
To compile the docs, first ensure that Sphinx and the ReadTheDocs theme are installed. | ||
|
||
```bash | ||
pip install sphinx sphinx_rtd_theme | ||
``` | ||
|
||
Once installed, you can use the `Makefile` in this directory to compile static HTML pages by | ||
```bash | ||
make html | ||
``` | ||
|
||
The compiled docs will be in the `_build` directory and can be viewed by opening `index.html` (which may itself | ||
be inside a directory called `html/` depending on what version of Sphinx is installed). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=_build | ||
set SPHINXPROJ=qc_schema | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% | ||
|
||
:end | ||
popd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file does only contain a selection of the most common options. For a | ||
# full list see the documentation: | ||
# http://www.sphinx-doc.org/en/stable/config | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
# Super hacky auto gen | ||
import sys | ||
import os | ||
sys.path.insert(1, os.path.dirname(__file__)) | ||
import gen_schema_docs | ||
|
||
project = 'A schema for Quantum Chemistry' | ||
copyright = "2018, The Molecular Sciences Software Institute" | ||
author = 'The Molecular Sciences Software Institute' | ||
|
||
# The short X.Y version | ||
version = '' | ||
# The full version, including alpha/beta/rc tags | ||
release = '' | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# If your documentation needs a minimal Sphinx version, state it here. | ||
# | ||
# needs_sphinx = '1.0' | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.mathjax', | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
# | ||
# source_suffix = ['.rst', '.md'] | ||
source_suffix = '.rst' | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
# The language for content autogenerated by Sphinx. Refer to documentation | ||
# for a list of supported languages. | ||
# | ||
# This is also used if you do content translation via gettext catalogs. | ||
# Usually you set "language" from the command line for these cases. | ||
language = None | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path . | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = 'sphinx' | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = 'sphinx_rtd_theme' | ||
|
||
# Theme options are theme-specific and customize the look and feel of a theme | ||
# further. For a list of options available for each theme, see the | ||
# documentation. | ||
# | ||
# html_theme_options = {} | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] | ||
|
||
# Custom sidebar templates, must be a dictionary that maps document names | ||
# to template names. | ||
# | ||
# The default sidebars (for documents that don't match any pattern) are | ||
# defined by theme itself. Builtin themes are using these templates by | ||
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', | ||
# 'searchbox.html']``. | ||
# | ||
# html_sidebars = {} | ||
|
||
|
||
# -- Options for HTMLHelp output --------------------------------------------- | ||
|
||
# Output file base name for HTML help builder. | ||
htmlhelp_basename = 'QC_JSON_Schemadoc' | ||
|
||
|
||
# -- Options for LaTeX output ------------------------------------------------ | ||
|
||
latex_elements = { | ||
# The paper size ('letterpaper' or 'a4paper'). | ||
# | ||
# 'papersize': 'letterpaper', | ||
|
||
# The font size ('10pt', '11pt' or '12pt'). | ||
# | ||
# 'pointsize': '10pt', | ||
|
||
# Additional stuff for the LaTeX preamble. | ||
# | ||
# 'preamble': '', | ||
|
||
# Latex figure (float) alignment | ||
# | ||
# 'figure_align': 'htbp', | ||
} | ||
|
||
# Grouping the document tree into LaTeX files. List of tuples | ||
# (source start file, target name, title, | ||
# author, documentclass [howto, manual, or own class]). | ||
latex_documents = [ | ||
(master_doc, 'QC_JSON_Schema.tex', 'QC_JSON_Schema Documentation', | ||
'QC_JSON_Schema', 'manual'), | ||
] | ||
|
||
|
||
# -- Options for manual page output ------------------------------------------ | ||
|
||
# One entry per manual page. List of tuples | ||
# (source start file, name, description, authors, manual section). | ||
man_pages = [ | ||
(master_doc, 'QC_JSON_Schema', 'QC_JSON_Schema Documentation', | ||
[author], 1) | ||
] | ||
|
||
|
||
# -- Options for Texinfo output ---------------------------------------------- | ||
|
||
# Grouping the document tree into Texinfo files. List of tuples | ||
# (source start file, target name, title, author, | ||
# dir menu entry, description, category) | ||
texinfo_documents = [ | ||
(master_doc, 'QC_JSON_Schema', 'QC_JSON_Schema Documentation', | ||
author, 'QC_JSON_Schema', 'A schema for Quantum Chemistry', | ||
'Miscellaneous'), | ||
] | ||
|
||
|
||
# -- Extension configuration ------------------------------------------------- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" | ||
Very hacky way to write out the schema (for demo purposes only) | ||
""" | ||
import qc_schema | ||
|
||
scf_props = qc_schema.dev.properties.scf_properties.scf_properties | ||
mp_props = qc_schema.dev.properties.mp_properties.mp_properties | ||
|
||
def write_header(data, header): | ||
data.append("") | ||
data.append(header) | ||
data.append("-" * len(header)) | ||
data.append("") | ||
|
||
def write_line_items(data, key, item): | ||
data.append("") | ||
data.append(key) | ||
data.append("~" * len(key)) | ||
data.append("") | ||
if "description" in item: | ||
data.append(item["description"]) | ||
else: | ||
data.append("No description available") | ||
data.append("") | ||
|
||
|
||
prop_file = ["Schema Properties"] | ||
prop_file.append("=" * len(prop_file[-1])) | ||
|
||
intro = """ | ||
A list of valid quantum chemistry properties tracked by the schema. | ||
""" | ||
|
||
prop_file.extend(intro.split()) | ||
|
||
# Write out SCF properties | ||
write_header(prop_file, "SCF Properties") | ||
|
||
for key, value in scf_props.items(): | ||
write_line_items(prop_file, key, value) | ||
|
||
# Write out MP properties | ||
write_header(prop_file, "Moller-Plesset Properties") | ||
|
||
for key, value in mp_props.items(): | ||
write_line_items(prop_file, key, value) | ||
|
||
# Write out the file | ||
with open("auto_props.rst", "w") as outfile: | ||
outfile.write("\n".join(prop_file)) | ||
|
||
|
||
### Write out Topology | ||
|
||
top_file = ["Schema Topology"] | ||
top_file.append("=" * len(top_file[-1])) | ||
|
||
intro = """ | ||
A list of valid quantum chemistry properties tracked by the schema. | ||
""" | ||
|
||
top_file.extend(intro.split()) | ||
|
||
topo_props = qc_schema.dev.molecule.molecule["properties"] | ||
|
||
for key, value in topo_props.items(): | ||
write_line_items(top_file, key, value) | ||
|
||
# Write out the file | ||
with open("auto_topology.rst", "w") as outfile: | ||
outfile.write("\n".join(top_file)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not everyone uses vim, and this is not strictly related to the schema. Maybe put this in your private ignore list? (.git/info/exclude)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, can do. I normally see these left in the
.gitignore
files, is there a reason to move them out?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO projects should have just entries relevant to their code. But of course it's not super important.