Skip to content

Commit

Permalink
Apply pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Nov 13, 2024
1 parent fe04961 commit 1fc6b81
Show file tree
Hide file tree
Showing 98 changed files with 1,261,252 additions and 1,261,261 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ RUN python setup.py develop
#CMD ["/bin/bash"]
CMD [ "python", "abcd/server/__init__.py" ]
#CMD ["gunicorn", "-w 4", "-b 0.0.0.0:8000", "server:app"]


24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
[![Doc](https://img.shields.io/badge/docs-master-green.svg)](https://libatoms.github.io/abcd/)
[![Build Status](https://travis-ci.org/libAtoms/abcd.svg?branch=master)](https://travis-ci.org/libAtoms/abcd)

Database storage and discovery of atomistic data.
Database storage and discovery of atomistic data.

Take a look at the `examples.md` file for.. examples!

Main features:

- Configurations that consist of atom positions, elements, forces, and various metadata are stored as a dictionary by a MongoDB backend.
- There is no predefined schema, any combination of keys are allowed for all configurations.
- Two modes: "discovery" and "download". Both use filter-type queries, but in "discovery" mode, summary statistics of the configurations that pass the filter are reported. In "download" mode, the matching configurations are downloaded and exported to a file.
- The "discovery" mode can be used to learn what keys exist in the set of configurations that have passed the current quiery filter. The user can use this to refine the query.
- Complex queries on dictionary key-value pairs are allowed, and their logical combinations.
- Configurations that consist of atom positions, elements, forces, and various metadata are stored as a dictionary by a MongoDB backend.
- There is no predefined schema, any combination of keys are allowed for all configurations.
- Two modes: "discovery" and "download". Both use filter-type queries, but in "discovery" mode, summary statistics of the configurations that pass the filter are reported. In "download" mode, the matching configurations are downloaded and exported to a file.
- The "discovery" mode can be used to learn what keys exist in the set of configurations that have passed the current quiery filter. The user can use this to refine the query.
- Complex queries on dictionary key-value pairs are allowed, and their logical combinations.

## Installation

Expand All @@ -24,13 +24,13 @@ $ pip install git+https://github.com/libAtoms/abcd.git

## Setup

If you have an already running mongo server, or install your own, they you are ready to go. Alternatively,
If you have an already running mongo server, or install your own, they you are ready to go. Alternatively,

```
docker run -d --rm --name abcd-mongodb -v <path-on-your-machine-to-store-database>:/data/db -p 27017:27017 mongo
```

will download and install a docker and run a database in it.
will download and install a docker and run a database in it.

To connect to a mongodb that is already running, use
```
Expand All @@ -56,7 +56,7 @@ You can set up an `abcd` user on your machine where the database is running, and
command="/path/to/abcd --remote ${SSH_ORIGINAL_COMMAND}",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa <public-key> your@email
```

Then you'll be able to access the database remotely using, e.g.
Then you'll be able to access the database remotely using, e.g.
```
ssh [email protected] summary
```
Expand All @@ -74,18 +74,18 @@ To access it:
docker pull stenczelt/projection-abcd:latest
```
2. create a docker network, which enables the containers to communicate with each other and the outside world as well
2. create a docker network, which enables the containers to communicate with each other and the outside world as well
```
docker network create --driver bridge abcd-network
```
3. run the mongo (ABCD) and the visualiser as well
```
docker run -d --rm --name abcd-mongodb-net -v <path-on-your-machine-to-store-database>:/data/db -p 27017:27017 --network abcd-network mongo
docker run -it --rm --name visualiser-dev -p 9999:9999 --network abcd-network stenczelt/projection-abcd
```
NB: You need a a directory where the database files are kept locally and you need to connect this to the mongo
NB: You need a a directory where the database files are kept locally and you need to connect this to the mongo
container. More info about this can be found in the original ABCD repo
This will start the visualiser with ABCD integration! Have fun!
Expand Down
26 changes: 13 additions & 13 deletions abcd/parsers/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
NAME: ("_"|LETTER|DIGIT) ("_"|"-"|LETTER|DIGIT)*
?value:
?value:
| ESCAPED_STRING -> string
| integer
| float
| boolean
| WORD
| "null" -> null
arrays: "[" value (","? value)* "]"
| "{" value (","? value)* "}"
| "(" value (","? value)* ")"
?integer: INT -> int
?integer: INT -> int
| array_int
?float: FLOAT -> float
?float: FLOAT -> float
| array_float
?boolean: true | false | array_boolean
true: "T" | "true"
Expand All @@ -36,20 +36,20 @@
array_int: "[" integer ([","] integer)* "]"
| "{" integer ([","] integer)* "}"
| "(" integer ([","] integer)* ")"
array_float: "[" float ([","] float)* "]"
| "{" float ([","] float)* "}"
| "(" float ([","] float)* ")"
array_boolean: "[" boolean ([","] boolean)* "]"
| "{" boolean ([","] boolean)* "}"
| "(" boolean ([","] boolean)* ")"
INT.3: SIGNED_INT
INT.3: SIGNED_INT
FLOAT.4: SIGNED_FLOAT
%import common.ESCAPED_STRING
%import common.LETTER
%import common.WORD
Expand Down
44 changes: 22 additions & 22 deletions abcd/parsers/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
?statement: -> empty
| expression -> single_statement
| statement relation_ops expression -> multi_statement
?expression: NAME -> single_expression
| NAME comparison_ops value -> operator_expression
| value reversed_ops NAME -> reversed_expression
| "(" statement ")" -> grouped_expression
?expression: NAME -> single_expression
| NAME comparison_ops value -> operator_expression
| value reversed_ops NAME -> reversed_expression
| "(" statement ")" -> grouped_expression
| NOT statement -> negation_expression
?comparison_ops: EQ
| NEQ
| RE
Expand All @@ -27,21 +27,21 @@
| LT
| LTE
?relation_ops: AND
| OR
?relation_ops: AND
| OR
AND: "&&" | "and"
OR: "||" | "or"
NOT: "!" | "not"
?reversed_ops: IN
EQ: "="
NEQ: "!="
RE: "~"
GT: ">"
GTE: ">="
LT: "<"
EQ: "="
NEQ: "!="
RE: "~"
GT: ">"
GTE: ">="
LT: "<"
LTE: "<="
IN: "in"
Expand All @@ -54,26 +54,26 @@
| array
array: "[" value ([","] value)* "]"
//function: all | any
//all: "all" "(" NAME ")"
//all: "all" "(" NAME ")"
//any: "any" "(" NAME ")"
//NAME : /(?!and\b)/ /(?!or\b)/ /(?!not\b)/ CNAME
// Strings
_STRING_INNER: /.*?/
_STRING_ESC_INNER: _STRING_INNER /(?<!\\)(\\\\)*?/
_STRING_ESC_INNER: _STRING_INNER /(?<!\\)(\\\\)*?/
STRING : "\"" _STRING_ESC_INNER "\""
| "'" _STRING_ESC_INNER "'"
NAME: ("_"|LETTER|DIGIT) ("_"|"-"|LETTER|DIGIT)*
NAME: ("_"|LETTER|DIGIT) ("_"|"-"|LETTER|DIGIT)*
%import common.LETTER
%import common.DIGIT
%import common.SIGNED_FLOAT -> FLOAT
%import common.SIGNED_INT -> INT
%import common.WS_INLINE
Expand Down
1 change: 0 additions & 1 deletion abcd/server/app/templates/database/database.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,3 @@
</div>

{%- endblock %}

1 change: 0 additions & 1 deletion abcd/server/app/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ <h1 class="h3 mb-3 font-weight-normal">Sign in</h1>


{%- endblock %}

2 changes: 1 addition & 1 deletion abcd/test.xyz
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2
Properties=species:S:1:pos:R:3 s="string value" _vtk_test="t e s t _ s t r" pbc="F F F"
Si 0.00000000 0.00000000 0.00000000
Si 0.00000000 0.00000000 0.00000000
Si 0.00000000 0.00000000 0.00000000
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ services:
- ME_CONFIG_MONGODB_ADMINUSERNAME=${DB_USER}
- ME_CONFIG_MONGODB_ADMINPASSWORD=${DB_PASS}
depends_on:
- mongo
- mongo
2 changes: 1 addition & 1 deletion docs_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ help:
# 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)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1 change: 0 additions & 1 deletion docs_src/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ Local installation

Installation with remote access
-------------------------------

4 changes: 0 additions & 4 deletions docs_src/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ Command line tool

Python interface
----------------




4 changes: 2 additions & 2 deletions examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ abcd upload -e cas VelocityVerlet_flexible_step0.5.xyz
abcd upload -e cas silicon_database_gp_iter6_sparse9k.xml.xyz
# get around the silly calculator/atoms object storage nightmare of ASE:
# the -i option tells ABCD to ignore the fake ASE calculator that gets created when xyz files are imported
abcd upload -i -e cas Ti_N54_database.xyz
abcd upload -i -e cas Ti_N54_database.xyz
```
The most often used command is `summary`, it tells you how many configurations match a query. Together with the `-p` option, it gives histograms of those properties.
```
Expand All @@ -24,7 +24,7 @@ abcd summary -q 'formula="H250O125"' -q cas -p formula
# regular expressions! the `~` operator does RegExp matching
abcd summary -q 'formula~"H.*O.*"' -q cas -p formula
```
Note how all strings need to be quoted, and those quotes protected from the shell.
Note how all strings need to be quoted, and those quotes protected from the shell.

```
abcd rename-key --help
Expand Down
Loading

0 comments on commit 1fc6b81

Please sign in to comment.