materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.51k stars 863 forks source link

zeo++ in pymatgen #290

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi I would like to use interstitial package in pymatgen. I installed cython, voro++ and zeo++ on a linux machine separately, but I don't see any cython_wrapper code as mentioned in the following link , and perhaps thats why I can't import zeo in python https://08315912851165136057.googlegroups.com/attach/e8c3e6f353747/ZeoPython_Linux_instructions.txt?part=0.2&view=1&vt=ANaJVrF_4PpYvza7CM9okdbJNI_321GLYGzgY02QsM7r4t25LgTmtX9LYBB5-xDavHUgwj-7eEB8_fIQUjHDn_9DUet9f2Fv2_YVIDe3IDujOtu0nebsmQc

I didn't use svn because it didn't give me permission to download. Could anyone help linking my installed zeo++ with pymatgen?

Best Regards Kamal

mbkumar commented 8 years ago

Hello Kamal,

The svn access was modified slightly. Try the links to download Zeo++ and Voro++

https://code.lbl.gov/scm/?group_id=97

https://code.lbl.gov/scm/?group_id=108

In the Zeo++ trunk folder, cython folder is present.\ Keep in mind, there is a naming clash with zeo++ in pymatgen at present. I will push a fix soon.

Bharat

On Tue, Dec 22, 2015 at 8:21 AM, kamal-ch notifications@github.com wrote:

Hi I would like to use interstitial package in pymatgen I installed cython, voro++ and zeo++ on a linux machine separately, but I don't see any cython_wrapper code as mentioned in the following link , and perhaps thats why I can't import zeo in python

https://08315912851165136057googlegroupscom/attach/e8c3e6f353747/ZeoPython_Linux_instructionstxt?part=02&view=1&vt=ANaJVrF_4PpYvza7CM9okdbJNI_321GLYGzgY02QsM7r4t25LgTmtX9LYBB5-xDavHUgwj-7eEB8_fIQUjHDn_9DUet9f2Fv2_YVIDe3IDujOtu0nebsmQc

I didn't use svn because it didn't give me permission to download Could anyone help me in this?

Best Regards Kamal

— Reply to this email directly or view it on GitHub https://github.com/materialsproject/pymatgen/issues/290.

ashtonmv commented 8 years ago

Just for the sake of having all of Bharat's helpful tips in one place, to install Zeo++/Voro++ and use them in Pymatgen:

Download and install Voro++

$ cd ~
$ mkdir Voro++; mkdir Voro++/voro
$ cd Voro++/voro
$ svn checkout --username anonsvn https://code.lbl.gov/svn/voro/trunk  # password is 'anonsvn'
$ cd trunk

Add -fPIC to the CFLAGS variable in config.mk, and then

$ make

Download and install Zeo++

$ cd ~
$ mkdir Zeo++; mkdir Zeo++/zeo
$ cd Zeo++/zeo
$ svn checkout --username anonsvn https://code.lbl.gov/svn/zeo/trunk  # password is 'anonsvn'
$ cd trunk
$ make dylib

Create python bindings with Cython

$ pip install cython
$ cd cython_wrapper
$ python setup_alt.py develop

Test that the installation worked, and use it in Pymatgen

$ ipython  # or whatever you would like to use
In [1]: from pymatgen.analysis.defects.point_defects import Interstitial, ValenceIonicRadiusEvaluator

In [2]: from pymatgen.core.structure import Structure

In [3]: structure = Structure.from_file('/path/to/file')

In [4]: evaluator = ValenceIonicRadiusEvaluator(structure)

In [5]: interstitial = Interstitial(structure, radii=evaluator.radii, valences=evaluator.valences)

In [6]: print interstitial._defect_sites
shyuep commented 8 years ago

Thanks. I just added this to the official pymatgen installation page:

http://pymatgen.org/installation.html#zeo

Shyue Ping

From: ashtonmv notifications@github.com Reply: materialsproject/pymatgen reply@reply.github.com Date: February 19, 2016 at 7:13:06 AM To: materialsproject/pymatgen pymatgen@noreply.github.com Subject:  Re: [pymatgen] zeo++ in pymatgen (#290)

Just for the sake of having all of Bharat's helpful tips in one place, to install Zeo++/Voro++ and use them in Pymatgen:

Download and install Voro++

$ cd ~ $ mkdir Voro++; mkdir Voro++/voro $ cd Voro++/voro $ svn checkout --username anonsvn https://code.lbl.gov/svn/voro/trunk # password is 'anonsvn' $ cd trunk

Add -fPIC to the CFLAGS variable in config.mk, and then

$ make

Download and install Zeo++

$ cd ~ $ mkdir Zeo++; mkdir Zeo++/zeo $ cd Zeo++/zeo $ svn checkout --username anonsvn https://code.lbl.gov/svn/zeo/trunk # password is 'anonsvn' $ cd trunk $ make dylib

Create python bindings with Cython

$ pip install cython $ cd cython_wrapper $ python setup_alt.py develop

Test that the installation worked, and use it in Pymatgen

$ ipython # or whatever you would like to use

In [1]: from pymatgen.analysis.defects.point_defects import Interstitial

In [2]: from pymatgen.core.structure import Structure

In [3]: structure = Structure.from_file('/path/to/file')

In [4]: radii, valences = {}, {}

In [5]: for element in structure.composition.elements: ...: radii[element.symbol] = element.atomic_radius ...: valence = element.group # Just a first guess.. ...: if element.group > 12: ...: valence -= 10 ...: valences[element.symbol] = valence

In [6]: interstitial = Interstitial(structure, radii=radii, valences=valences)

In [7]: interstitial._defect_sites — Reply to this email directly or view it on GitHub.