[QE-users] Need a script that can convert primitive cell file file using conventional cell cif file

M.J. Hutcheon mjh261 at cam.ac.uk
Fri Jul 17 12:47:48 CEST 2020


Dear Rekha, 

Just thought it might be worth mentioning that the c2x software
(https://www.c2x.org.uk/) provides a straightforward interface to spglib
and can read/write both CIF and Quantum espresso input files. One would
invoke it with the --primitive operation to do what you require. 

Best, 

Michael (not the same Michael that wrote c2x) 

On 2020-07-17 05:18, Yue-Wen Fang wrote:

> Good, you have already used the dev branch. Then you can check more details through ipython (exceute "ipython" in your terminal)
> In the python IDE, 
> 
> In [1]: import mcu
> 
> In [2]: mcu
> Out[2]: <module 'mcu' from '/Users/fang/mcu/mcu/__init__.py'>
> 
> In [3]: mcu.CELL
> Out[3]: mcu.cell.main.CELL
> 
> You can examine that the loaded MCU is indeed the one you used or not. 
> 
> rekha sharma <rekha1997jpr at gmail.com> 于2020年7月17日周五 下午1:01写道: 
> Dear Sir, 
> This is what I am getting with git log (posting only part of the output) 
> 
> commit 2155314c447b9f8b7b3a837b532cd2baa350c8f4
> Author: hungpham2017 <phamx494 at umn.edu>
> Date:   Tue Jul 14 14:06:02 2020 -0500
> 
> small bug in detecting BAND block in fort.25 of CRYSTAL
> 
> commit 334da12cc2c165d0bf5521f864ab364685979a13
> Author: hungpham2017 <phamx494 at umn.edu>
> Date:   Tue Jul 14 12:57:10 2020 -0500
> 
> small bug in detecting BAND block in fort.25 of CRYSTAL
> 
> commit 90c3ded86771ae49516a1e58b90668a7c432a20b
> Author: hungpham2017 <phamx494 at umn.edu>
> Date:   Sun Jul 12 15:33:42 2020 -0500
> 
> MCU for ELK; revising VASP; make str_format general
> 
> commit ab29fc4fb5ffbd52fe5a730614b2f04442e85e80
> Author: hungpham2017 <phamx494 at umn.edu>
> Date:   Thu Jul 2 13:06:59 2020 -0500
> 
> Bug fixed in vasprun.py
> 
> commit 13c96588eab73c0d3f8bc08b4723dec4d94fdb88
> Author: hungpham2017 <phamx494 at umn.edu> 
> 
> On Fri, Jul 17, 2020 at 8:55 AM Yue-Wen Fang <yuewen.fang at gmail.com> wrote: 
> 
> Hello, Rekha 
> 
> It seemed the latest version of 'dev' branch of MCU wasn't properly loaded in your case. Can you execute the "git log" in the cloned MCU? That can help us to know which branch you are using. 
> 
> rekha sharma <rekha1997jpr at gmail.com> 于2020年7月17日周五 上午3:20写道: 
> 
> Sir, 
> 
> I am running it on Ubuntu18.04 
> 
> steps I followed are: 
> 
> git clone -b dev https://github.com/hungpham2017/mcu.git  
> cd mcu 
> sudo python3.7 setup.py  install 
> 
> updated path in ~/.bashrc as 
> 
> export PYTHONPATH=/home/rekha/mcu:$PYTHONPATH 
> 
> source ~/.bashrc 
> 
> cd ~/case 
> 
> my mcu.py is 
> 
> #!/usr/bin/env python
> import mcu
> work = mcu.CELL(cif='conventional.cif')
> prim_cell = work.to_prim_cell()
> work.write_cif(prim_cell, filename='primitive') 
> 
> the ~/case directory is having a conventional.cif file. 
> 
> Now I run 
> 
> python3.7 mcu.py 
> 
> I am getting  the same error what i get at the start: 
> 
> Traceback (most recent call last):
> File "mcu.py", line 2, in <module>
> import mcu
> File "/home/rekha/case/mcu.py", line 3, in <module>
> work = mcu.CELL(cif='conventional.cif')
> AttributeError: module 'mcu' has no attribute 'CELL' 
> 
> On Thu, Jul 16, 2020 at 11:35 PM Hung Pham <phamx494 at umn.edu> wrote: 
> 
> It looks me like there is some problem with the Python interpreter in your environment, not the code itself. 
> You can try to add this following line at the beginning of your python script and rerun it: 
> #!/usr/bin/env python 
> I found a similar problem here [1]:  
> by the way, are you running it on a Window?  
> 
> On Thu, Jul 16, 2020 at 12:56 PM rekha sharma <rekha1997jpr at gmail.com> wrote: 
> Now I am getting  
> import-im6.q16: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9186.
> when I do 
> import mcu 
> 
> On Thu, Jul 16, 2020 at 11:15 PM Hung Pham <phamx494 at umn.edu> wrote: 
> 
> Hell Rekha, 
> 
> I guess you downloaded the master branch, I haven't had time to document the codes yet with many new functions. 
> Hence, the latest code remains in the dev branch, please: 
> 
> git clone -b dev https://github.com/hungpham2017/mcu.git let me know if you have any other questions. Hung 
> 
> On Thu, Jul 16, 2020 at 12:40 PM rekha sharma <rekha1997jpr at gmail.com> wrote: 
> 
> Dear Sir, 
> I have cloned it and then added the path to ~/.bashrc. 
> 
> But my import mcu is not working. 
> 
> My python path is: 
> export PYTHONPATH=/home/rekha/mcu:$PYTHONPATH 
> 
> I have created a file "mcu.py" in which I kept  import mcu
> work = mcu.CELL(cif='conventional.cif')
> prim_cell = work.to_prim_cell()
> work.write_cif(prim_cell, filename='primitive') 
> 
> and then invoked 
> 
> python mcu.py 
> 
> this gives me error 
> 
> Traceback (most recent call last):
> File "mcu.py", line 1, in <module>
> import mcu
> File "/home/rekha/case/mcu.py", line 2, in <module>
> work = mcu.CELL(cif='conventional.cif')
> AttributeError: module 'mcu' has no attribute 'CELL' 
> 
> I am having my conventional.cif in "/home/rekha/case/" directory. 
> 
> What should I do now? 
> 
> On Thu, Jul 16, 2020 at 10:44 PM Hung Pham <phamx494 at umn.edu> wrote: 
> 
> Sorry, there was a typo in the example script, it should be this: 
> import mcu
> work = mcu.CELL(cif='conventional.cif')
> prim_cell = work.to_prim_cell()
> work.write_cif(prim_cell, filename='primitive') 
> 
> Hung Pham 
> 
> On Thu, Jul 16, 2020 at 12:12 PM Hung Pham <phamx494 at umn.edu> wrote: 
> 
> Hello Rekha, 
> 
> Spglib library [2] is doing what you are looking for. Spglib has a python interface and can be easily installed via Pip or conda.. 
> But you need to make a cell tuple (from CIF) which contains the lattice information, this requires some minimal Python programming. 
> My MCU [3] project supports CIF file as well as the QE output files and it has cell analysis functions using spglib. Within a few lines of code, you can get what you want in the desired format. For example, in a Python interpreter or script: 
> import mcu
> work = mcu.CELL(cif='conventional.cif')
> primitive = work.to_prim_cell()
> work.write_cif(prim_cell, filename='primitive') 
> If you are interested in this, I can assist further. 
> Hung Pham 
> 
> On Thu, Jul 16, 2020 at 11:57 AM rekha sharma <rekha1997jpr at gmail.com> wrote: 
> 
> Thank you very much sir, 
> 
> My materials are very new and not available in any database.
> 
> On Thu, Jul 16, 2020, 22:24 Yuvam Bhateja <yuvamb16 at gmail.com> wrote: 
> Hello Rekha 
> 
> You can check out "Material Project". 
> It's a database where researchers share their findings and results of several different types of materials and of different applications. 
> 
> Every compound is available in primitive, conventional, computed and symmetric unit cell, etc. 
> Hope you find this useful. 
> 
> Regards 
> Yuvam Bhateja 
> 
> On Thu, 16 Jul 2020, 7:40 pm rekha sharma, <rekha1997jpr at gmail.com> wrote: 
> Dear Expert Users, 
> 
> It is possible that this question has been answered many times before but I could not find it on the forum. 
> 
> I have few complex structures and it is not possible to handle on my system in the conventional form. 
> 
> Can you please advise any tool that can help me to convert a conventional cell cif file to a primitive cell file? 
> 
> I have tried with VEST (niggli cell reduction) but it does not work for me.  
> 
> Thank you very much. 
> 
> Rekha 
> 
> _______________________________________________
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso [4])
> users mailing list users at lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users _______________________________________________
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso [4])
> users mailing list users at lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users
 _______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 

-- 

Hung Q. Pham 
Gagliardi Group 
Office: Smith 101 
Email: phamx494 at umn.edu 
Personal page: hungpham2017.github.io [5] 
Department of Chemistry 
University of Minnesota - Twin Cities, Minneapolis, MN 55455 

-- 

Hung Q. Pham 
Gagliardi Group 
Office: Smith 101 
Email: phamx494 at umn.edu 
Personal page: hungpham2017.github.io [5] 
Department of Chemistry 
University of Minnesota - Twin Cities, Minneapolis, MN 55455
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 
  -- 

Best wishes 

Ms. Rekha 
Teaching Assistant, 
Department of Physics 
RK college, Jaipur, India 
Mob.: +11 90-95 790 71 697 
Email: rekha1997jpr at gmail.com
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 

-- 

Hung Q. Pham 
Gagliardi Group 
Office: Smith 101 
Email: phamx494 at umn.edu 
Personal page: hungpham2017.github.io [5] 
Department of Chemistry 
University of Minnesota - Twin Cities, Minneapolis, MN 55455
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 
  -- 

Best wishes 

Ms. Rekha 
Teaching Assistant, 
Department of Physics 
RK college, Jaipur, India 
Mob.: +11 90-95 790 71 697 
Email: rekha1997jpr at gmail.com
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 

-- 

Hung Q. Pham 
Gagliardi Group 
Office: Smith 101 
Email: phamx494 at umn.edu 
Personal page: hungpham2017.github.io [5] 
Department of Chemistry 
University of Minnesota - Twin Cities, Minneapolis, MN 55455
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 
  -- 

Best wishes 

Ms. Rekha 
Teaching Assistant, 
Department of Physics 
RK college, Jaipur, India 
Mob.: +11 90-95 790 71 697 
Email: rekha1997jpr at gmail.com
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 
  -- 

------------------------------------------------------------------------------------------------------------

Yue-Wen FANG, PhD 
Tokyo Institute of Technology, Japan 

  _______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 
  -- 

Best wishes 

Ms. Rekha 
Teaching Assistant, 
Department of Physics 
RK college, Jaipur, India 
Mob.: +11 90-95 790 71 697 
Email: rekha1997jpr at gmail.com
_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 
  -- 

------------------------------------------------------------------------------------------------------------

Yue-Wen FANG, PhD 
Tokyo Institute of Technology, Japan 

_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
[4])
users mailing list users at lists.quantum-espresso.org
https://lists.quantum-espresso.org/mailman/listinfo/users 

 

Links:
------
[1]
https://answers.ros.org/question/164091/rosrun-of-a-working-python-script-fails/
[2] https://spglib.github.io/spglib/index.html
[3] https://github.com/hungpham2017/mcu/tree/dev
[4] http://www.max-centre.eu/quantum-espresso
[5] http://hungpham2017.github.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20200717/fdb53c7c/attachment.html>


More information about the users mailing list