18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

Example<br />

Here is an example of how to calculate the total energy of a CO molecule:<br />

#!/usr/bin/env python<br />

from ase import *<br />

from ase.calculators.jacapo import *<br />

CO = data.molecules.molecule(’CO’)<br />

CO.set_cell([6,6,6])<br />

CO.center()<br />

calc = Jacapo(nc=’CO.nc’,<br />

atoms=CO,<br />

pw=300,<br />

nbands=8)<br />

print CO.get_potential_energy()<br />

Restarting from an old Calculation<br />

With Jacapo it is very easy to restart an old calculation. All necessary information (including the constraints) is<br />

stored in the out.nc file. To continue for example a geometry optimization do something like this:<br />

calc = Jacapo(’old.nc’,stay_alive=True)<br />

atoms = calc.get_atoms()<br />

dyn = QuasiNewton(atoms,logfile=’qn.log’)<br />

dyn.run(fmax=0.05)<br />

Note, that the stay_alive flag is not stored in the .nc file and must be set when the calculator instance is created.<br />

ABINIT<br />

Introduction<br />

ABINIT is a density-functional theory code based on pseudopotentials and a planewave basis.<br />

Environment variables<br />

Note: setting environment variables is necessary only if you configure your ABINIT/<strong>ASE</strong> environment from<br />

scratch.<br />

You need to write a script called abinit.py containing something like this:<br />

import os<br />

abinit = ’/usr/bin/abinis’ # full path to the abinit executable<br />

exitcode = os.system(’%s < %s.files > %s.log’ % (abinit, label, label))<br />

The environment variable ABINIT_SCRIPT must point to that file.<br />

A directory containing the pseudopotential files (at least of .fhi type) is also needed, and it is to be put in the<br />

environment variable ABINIT_PP_PATH. Abinit does not provide tarballs of pseduopotentials so the easiest way<br />

is to download and unpack http://wiki.fysik.dtu.dk/abinit-files/abinit-pseudopotentials-2.tar.gz<br />

Set the environment variables in your in your shell configuration file:<br />

$ export ABINIT_SCRIPT=$HOME/bin/abinit.py<br />

$ export ABINIT_PP_PATH=${HOME}/abinit-pseudopotentials-2/LDA_FHI<br />

$ export ABINIT_PP_PATH=${HOME}/abinit-pseudopotentials-2/GGA_FHI:$ABINIT_PP_PATH<br />

$ export ABINIT_PP_PATH=${HOME}/abinit-pseudopotentials-2/LDA_HGH:$ABINIT_PP_PATH<br />

112 Chapter 7. Documentation for modules in <strong>ASE</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!