Commit 3c39b2c5 authored by Marco Govoni's avatar Marco Govoni
Browse files

Added RESTful tutorials

parent b900950f
%% Cell type:markdown id: tags:
<h1>RESTful Tutorials</h1>
%% Cell type:markdown id: tags:
We will show here how to interact with the remote server where the `pw.x`, `wstat.x` and `wfreq.x` are already installed.
%% Cell type:markdown id: tags:
We start by importing WESTPy and generating a ground state input file for methane.
%% Cell type:code id: tags:
``` python
from westpy import *
```
%% Cell type:code id: tags:
``` python
geom = Geometry()
```
%% Cell type:code id: tags:
``` python
geom.setCell((25,0,0),(0,25,0),(0,0,25))
```
%% Cell type:code id: tags:
``` python
geom.addAtomsFromOnlineXYZ( "http://www.west-code.org/doc/training/methane/CH4.xyz" )
```
%% Cell type:code id: tags:
``` python
geom.addSpecies( "C", "http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.0.upf")
geom.addSpecies( "H", "http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.0.upf")
```
%% Cell type:code id: tags:
``` python
gs = GroundState(geom,xc="PBE",ecut=40.0)
```
%% Cell type:code id: tags:
``` python
gs.generateInputPW()
```
%% Cell type:markdown id: tags:
We now create a session on the remote server.
%% Cell type:code id: tags:
``` python
session = Session("marco.outatime@gmail.com")
```
%% Cell type:code id: tags:
``` python
status = session.status()
print(status)
```
%% Cell type:code id: tags:
``` python
download = ["http://www.quantum-simulation.org/potentials/sg15_oncv/upf/C_ONCV_PBE-1.0.upf","http://www.quantum-simulation.org/potentials/sg15_oncv/upf/H_ONCV_PBE-1.0.upf"]
pw_output = session.run("pw","pw.in","pw.out",download,3)
```
%% Cell type:markdown id: tags:
We now generate the input for `wstat.x`.
%% Cell type:code id: tags:
``` python
data = {}
data["input_west"] = {}
data["input_west"]["qe_prefix"] = "calc"
data["input_west"]["west_prefix"] = "calc"
data["input_west"]["outdir"] = "./"
data["wstat_control"] = {}
data["wstat_control"]["wstat_calculation"] = "S"
data["wstat_control"]["n_pdep_eigen"] = 5
writeJsonFile("wstat.in",data)
```
%% Cell type:code id: tags:
``` python
wstat_output = session.run("wstat","wstat.in","wstat.out",download,3)
```
%% Cell type:markdown id: tags:
We now generate the input for `wfreq.x`.
%% Cell type:code id: tags:
``` python
data = {}
data["wfreq_control"] = {}
data["wfreq_control"]["wfreq_calculation"] = "XWGQ"
data["wfreq_control"]["n_pdep_eigen_to_use"] = 50
data["wfreq_control"]["qp_bandrange"] = [1,5]
data["wfreq_control"]["n_refreq"] = 300
data["wfreq_control"]["ecut_refreq"] = 2.0
writeJsonFile("wfreq.in",data)
```
%% Cell type:code id: tags:
``` python
wfreq_output = session.run("wfreq","wfreq.in","wfreq.out",3)
```
%% Cell type:markdown id: tags:
We now stop the session.
%% Cell type:code id: tags:
``` python
session.stop()
```
%% Cell type:code id: tags:
``` python
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment