Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
 * document usage in README
 * remove unused CLI
  • Loading branch information
ltalirz committed Apr 7, 2019
1 parent f106b5f commit b51711d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 79 deletions.
84 changes: 70 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/ltalirz/aiida-qeq.svg?branch=master)](https://travis-ci.org/ltalirz/aiida-qeq)
[![Coverage Status](https://coveralls.io/repos/github/ltalirz/aiida-qeq/badge.svg?branch=master)](https://coveralls.io/github/ltalirz/aiida-qeq?branch=master)
[![Docs status](https://readthedocs.org/projects/aiida-qeq/badge)](http://aiida-qeq.readthedocs.io/)
[![Build Status](https://travis-ci.org/ltalirz/aiida-qeq.svg?branch=master)](https://travis-ci.org/ltalirz/aiida-qeq)
[![Coverage Status](https://coveralls.io/repos/github/ltalirz/aiida-qeq/badge.svg?branch=master)](https://coveralls.io/github/ltalirz/aiida-qeq?branch=master)
[![Docs status](https://readthedocs.org/projects/aiida-qeq/badge)](http://aiida-qeq.readthedocs.io/)
[![PyPI version](https://badge.fury.io/py/aiida-qeq.svg)](https://badge.fury.io/py/aiida-qeq)

# aiida-qeq
Expand All @@ -9,14 +9,69 @@ AiiDA plugin for computing electronic charges on atoms using equilibration-type

Templated using the [AiiDA plugin cutter](https://github.com/aiidateam/aiida-plugin-cutter).

## Features

### QeQ charges
* Add input structure in CIF format
```python
CifData = DataFactory('cif')
inputs['structure'] = CifData(file='/path/to/file')
```

* Add parameters for electronegativity and Idempotential data of the elements.
```python
SinglefileData = DataFactory('singlefile')
inputs['parameters'] = SinglefileData(file='/path/to/file')
```

* (optional) Specify `configure.input` options using a python dictionary and `QeqParameters`
```python
QeqParameters = DataFactory('qeq.qeq')
inputs['configure'] = QeqParameters(dict={'save_grid': [True, 'grid.cube']})
```

* `QeqParameters` validates the command line options using [voluptuous](https://github.com/alecthomas/voluptuous).
```python
QeqParameters = DataFactory('qeq.qeq')
print(QeqParameters.schema) # shows supported options
```

### EQeQ charges
* Add input structure in CIF format
```python
CifData = DataFactory('cif')
inputs['structure'] = CifData(file='/path/to/file')
```

* Add parameters for ionization data of the elements.
```python
SinglefileData = DataFactory('singlefile')
inputs['ionization_data'] = SinglefileData(file='/path/to/file')
```

* Add parameters for common oxidation states of the elements.
```python
SinglefileData = DataFactory('singlefile')
inputs['charge_data'] = SinglefileData(file='/path/to/file')
```

* Specify command line options using a python dictionary and `EQeqParameters`
```python
EQeqParameters = DataFactory('qeq.eqeq')
inputs['parameters'] = EQeqParameters(dict={'method': 'ewald'})
```

* `EQeqParameters` validates the command line options using [voluptuous](https://github.com/alecthomas/voluptuous).
```python
QeqParameters = DataFactory('qeq.eqeq')
print(EQeqParameters.schema) # show supported options
```

## Installation

```shell
git clone https://github.com/ltalirz/aiida-qeq .
cd aiida-qeq
pip install -e . # also installs aiida, if missing (but not postgres)
#pip install -e .[pre-commit,testing] # install extras for more features
verdi quicksetup # better to set up a new profile
pip install aiida-qeq
verdi quicksetup # set up a new profile
verdi calculation plugins # should now show your calclulation plugins
```

Expand All @@ -30,15 +85,17 @@ verdi daemon start # make sure the daemon is running
cd examples
verdi run submit_qeq.py # submit qeq test calculation
verdi run submit_eqeq.py # submit eqeq test calculation
verdi calculation list -a # check status of calculation
verdi process list -a # check status of calculation
```

## Tests
## Development

The following will discover and run all unit test:
```shell
pip install -e .[testing]
python manage.py
git clone https://github.com/ltalirz/aiida-qeq .
cd aiida-qeq
pip install -e .[pre-commit,testing]
pre-commit install # enable pre-commit hooks
pytest # run unit tests
```

## License
Expand All @@ -49,4 +106,3 @@ MIT
## Contact

leopold.talirz@gmail.com

54 changes: 0 additions & 54 deletions aiida_qeq/data/data_cli.py

This file was deleted.

5 changes: 3 additions & 2 deletions aiida_qeq/data/eqeq.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class EQeqParameters(Dict):
Command line options for eqeq.
"""

schema = Schema(options)
_schema = Schema(options)
schema = _schema.schema # alias for easier printing

# pylint: disable=redefined-builtin
def __init__(self, dict=None, **kwargs):
Expand All @@ -63,7 +64,7 @@ def __init__(self, dict=None, **kwargs):

def validate(self, parameters_dict):
"""Validate command line options."""
return EQeqParameters.schema(parameters_dict)
return EQeqParameters._schema(parameters_dict)

def cmdline_params(self,
structure_file_name,
Expand Down
5 changes: 3 additions & 2 deletions aiida_qeq/data/qeq.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class QeqParameters(Dict):
Command line options for qeq.
"""

schema = Schema(options)
_schema = Schema(options)
schema = _schema.schema # alias for easier printing

# pylint: disable=redefined-builtin
def __init__(self, dict=None, **kwargs):
Expand All @@ -81,7 +82,7 @@ def __init__(self, dict=None, **kwargs):

def validate(self, parameters_dict):
"""Validate command line options."""
return QeqParameters.schema(parameters_dict)
return QeqParameters._schema(parameters_dict)

def cmdline_params(self,
structure_file_name,
Expand Down
6 changes: 3 additions & 3 deletions examples/submit_eqeq.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import aiida_qeq.data.eqeq as data
from aiida_qeq.data import DATA_DIR
from aiida.plugins import DataFactory, CalculationFactory
from aiida.engine import run_get_node
from aiida.engine import run

# Prepare input parameters
parameters = DataFactory('qeq.eqeq')({'method': 'ewald'})
Expand Down Expand Up @@ -46,5 +46,5 @@
},
}

_result, node = run_get_node(CalculationFactory('qeq.eqeq'), **inputs)
print(node)
result = run(CalculationFactory('qeq.eqeq'), **inputs)
print(result)
8 changes: 4 additions & 4 deletions examples/submit_qeq.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import aiida_qeq.data.qeq as data
from aiida_qeq.data import DATA_DIR
from aiida.plugins import DataFactory, CalculationFactory
from aiida.engine import run_get_node
from aiida.engine import run

# Prepare input parameters
CifData = DataFactory('cif')
Expand All @@ -25,7 +25,7 @@
file=os.path.join(tests.TEST_DIR, 'HKUST1.cif'), parse_policy='lazy')

inputs = {
# make sure the "eqeq" binary is in your PATH
# make sure the "qeq" binary is in your PATH
'code': tests.get_code(entry_point='qeq.qeq'),
# 'configure': data.QeqParameters()
'structure': cif,
Expand All @@ -43,5 +43,5 @@
},
}

_result, node = run_get_node(CalculationFactory('qeq.qeq'), **inputs)
print(node)
result = run(CalculationFactory('qeq.qeq'), **inputs)
print(result)

0 comments on commit b51711d

Please sign in to comment.