Pages

Showing posts with label python3. Show all posts
Showing posts with label python3. Show all posts

Install and Use ASE (Atomic Simulation Environment) in Ubuntu Linux

To install, I tried,

pip install --upgrade --user ase

/home/user/...../pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
Collecting ase
  Downloading https://files.pythonhosted.org/packages/b4/52/df21f492fbd/ase-3.18.0.tar.gz (1.8MB)
    100% |████████████████████████████████| 1.8MB 21.2MB/s 
    Complete output from command python setup.py egg_info:
    Python 3.5 or later is required!
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-tSeI9W/ase/
You are using pip version 18.0, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Then, I tried since "Python 3.5 or later is required!" is given.

pip3 install --upgrade --user ase

Now, I get

Installing collected packages: ase
  Found existing installation: ase 3.17.0
    Uninstalling ase-3.17.0:
      Successfully uninstalled ase-3.17.0
Successfully installed ase-3.18.0

(Earlier I have installed ase 3.17.0. Now it is updated to 3.18.0)


Then I tested the installation using

ase test

========== Summary ==========
Number of tests   317
Passes:           229
Failures:           0
Errors:             0
Skipped:           88
=============================
Test suite passed!
Time elapsed: 167.4 s

Now, ase is successfully installed.


Now, how to use for calculations? Lets try.

Now I tested ase in real calculation.

I checked the example given in this page https://wiki.fysik.dtu.dk/ase/tutorials/surface.html

Saved following script in a file (ase_example.py)

from ase import Atoms
from ase.calculators.emt import EMT
from ase.constraints import FixAtoms
from ase.optimize import QuasiNewton
from ase.build import fcc111, add_adsorbate

h = 1.85
d = 1.10

slab = fcc111('Cu', size=(4, 4, 2), vacuum=10.0)

slab.set_calculator(EMT())
e_slab = slab.get_potential_energy()

molecule = Atoms('2N', positions=[(0., 0., 0.), (0., 0., d)])
molecule.set_calculator(EMT())
e_N2 = molecule.get_potential_energy()

add_adsorbate(slab, molecule, h, 'ontop')
constraint = FixAtoms(mask=[a.symbol != 'N' for a in slab])
slab.set_constraint(constraint)
dyn = QuasiNewton(slab, trajectory='N2Cu.traj')
dyn.run(fmax=0.05)

print('Adsorption energy:', e_slab + e_N2 - slab.get_potential_energy())
Then, I run the python script (ase_example.py) as follow.
python3 ase_example.py
Now, I got following output.
                Step[ FC]     Time          Energy          fmax
*Force-consistent energies used in optimization.
BFGSLineSearch:    0[  0] 12:55:55       11.689927*       1.0797
BFGSLineSearch:    1[  2] 12:55:55       11.670814*       0.4090
BFGSLineSearch:    2[  4] 12:55:55       11.625880*       0.0409
Adsorption energy: 0.32351942231809083
This means that, the installation is successful and ready for calculations.
Hope this post is useful. Comment below if this is useful to you. Subscribe to this blog if you want to receive similar posts.











You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...