Commit 0c070ac9 authored by Adam Fekete's avatar Adam Fekete
Browse files

cleanup

parent c8d6acd2
%% Cell type:code id:realistic-humanity tags:
``` python
from abiflows.database.mongoengine.utils import DatabaseData
from pymatgen.core import Structure
from abiflows.database.mongoengine.abinit_results import RelaxResult, DfptResult
from jupyter_jsmol.pymatgen import quick_view
```
%% Cell type:code id:martial-football tags:
``` python
%matplotlib notebook
```
%% Cell type:code id:altered-outdoors tags:
``` python
db = DatabaseData(host='mongo', port=27017, collection='relax',
database='fireworks', username=None, password=None)
db.connect_mongoengine()
```
%% Cell type:code id:proprietary-humidity tags:
``` python
with db.switch_collection(RelaxResult) as RelaxResult:
relaxed_results = RelaxResult.objects(mp_id="mp-149")
relaxed = relaxed_results[0]
```
%% Cell type:code id:useful-indicator tags:
``` python
# load the relaxed Structure
structure = Structure.from_dict(relaxed.abinit_output.structure)
```
%% Cell type:code id:going-agent tags:
``` python
quick_view(structure)
```
%% Cell type:code id:suitable-czech tags:
``` python
gsr = relaxed.abinit_output.gsr.abiopen()
print(gsr)
```
%% Cell type:code id:swedish-poison tags:
``` python
fig = gsr.plot_bz()
```
%% Cell type:code id:proved-endorsement tags:
``` python
db.collection = "phonon"
with db.switch_collection(DfptResult) as DfptResult:
ph_results = DfptResult.objects()
ph_res = ph_results[0]
```
%% Cell type:code id:narrative-religion tags:
``` python
ddb = ph_res.abinit_output.ddb.abiopen()
```
%% Cell type:code id:antique-ceremony tags:
``` python
phb = ddb.anaget_phmodes_at_qpoint([0,0,0])
```
%% Cell type:code id:cutting-hopkins tags:
``` python
phb.phfreqs
```
%% Cell type:code id:ambient-glossary tags:
``` python
phbst, phdos = ddb.anaget_phbst_and_phdos_files(line_density=10)
```
%% Cell type:code id:electric-narrative tags:
``` python
fig = phbst.plot_phbands()
```
%% Cell type:code id:comparative-pacific tags:
``` python
phbst.phbands.create_phononwebsite_json("/home/jovyan/Si_phononwebsite.json")
```
%% Cell type:markdown id:electric-second tags:
Download the Si_phononwebsite.json file on your local machine and upload it on the following website to display the atomic displacents associated to the phonon modes: http://henriquemiranda.github.io/phononwebsite/phonon.html
%% Cell type:markdown id:exempt-cloud tags:
# Abinit - quickstart
https://abinit.github.io/abipy/flow_gallery/run_sic_relax.html#sphx-glr-flow-gallery-run-sic-relax-py
%% Cell type:code id:necessary-budapest tags:
``` python
!abicheck.py
```
%% Cell type:markdown id:chronic-invention tags:
## Relaxation Flow
This example shows how to build a very simple Flow for the structural relaxation of SiC. One could use a similar logic to perform multiple relaxations with different input parameters…
%% Cell type:code id:handmade-dividend tags:
``` python
import abipy.abilab as abilab
import abipy.data as data
import abipy.flowtk as flowtk
def build_flow(workdir):
pseudos = data.pseudos("14si.pspnc", "6c.pspnc")
structure = data.structure_from_ucell("SiC")
# Initialize the input
relax_inp = abilab.AbinitInput(structure, pseudos=pseudos)
# Set variables
relax_inp.set_vars(
ecut=20,
paral_kgb=1,
iomode=3,
# Relaxation part
ionmov=2,
optcell=1,
strfact=100,
ecutsm=0.5, # Important!
dilatmx=1.15, # Important!
toldff=1e-6,
tolmxf=1e-5,
ntime=100,
)
# K-points sampling
shiftk = [
[0.5,0.5,0.5],
[0.5,0.0,0.0],
[0.0,0.5,0.0],
[0.0,0.0,0.5]
]
relax_inp.set_kmesh(ngkpt=[4, 4, 4], shiftk=shiftk)
# Initialize the flow
flow = flowtk.Flow(workdir)
# Register the task.
flow.register_relax_task(relax_inp)
return flow
```
%% Cell type:markdown id:related-music tags:
Build and run the flow:
%% Cell type:code id:steady-fellowship tags:
``` python
flow = build_flow('flow_sic_relax')
flow.rmtree()
scheduler = flow.make_scheduler()
scheduler.start()
```
%% Cell type:markdown id:confirmed-space tags:
To visualize the evolution of the lattice parameters during the structura relaxation use:
%% Cell type:code id:raising-valuable tags:
``` python
abifile = abilab.abiopen('flow_sic_relax/w0/t0/outdata/out_HIST.nc')
abifile.plot();
```
%% Cell type:code id:changing-bennett tags:
``` python
```
%% Cell type:code id:passing-mineral tags:
``` python
```
%% Cell type:code id:prescribed-mexico tags:
``` python
```