[ase-users] bug report: ASE-3.21.1, xsd to VASP POSAR
David Willock
WillockDJ at cardiff.ac.uk
Sun Apr 25 20:56:43 CEST 2021
Dear Huan
Thanks for working on this, it is a lot neater than our original. Have given it a go and it works well.
Best Wishes
David
________________________________
From: 王欢 <huan.wang at whut.edu.cn>
Sent: 25 April 2021 05:14
To: David Willock <WillockDJ at cardiff.ac.uk>
Cc: ase-users at listserv.fysik.dtu.dk <ase-users at listserv.fysik.dtu.dk>
Subject: Re: [ase-users] bug report: ASE-3.21.1, xsd to VASP POSAR
Dear David,
Thank you very much for your great code. It works for my case.
I modified the way for inputting parameters and the printing formats, hoping this new version will also good for you.
The new version of script works on both Linux and Windows systems. Please, type
python fix_layers_v1.1.py -h
It will show the usage and the meaning of each parameter, like
####
usage: fix_layers_1.1.py [-h] [-i <input_file>] [-z <The Z-coordinate>]
This script will constrain the atoms with Z-coordinates below the input value
optional arguments:
-h, --help show this help message and exit
-i <input_file> input file name
-z <The Z-coordinate> Will Freeze all atoms below z =
####
To use it, you may type:
python fix_layers_v1.1.py -i THE_STRUCTURE_FILE_NAME -z THE_VALUE
Hope that works for you.
Huan
Dr. Huan Wang
huan.wang at whut.edu.cn<mailto:huan.wang at whut.edu.cn>
School of Materials Science and Engineering
Wuhan University of Technology
No. 122, Luoshi Road, Wuhan, 430070, P. R. China
On 4/20/2021 23:35,David Willock<WillockDJ at cardiff.ac.uk><mailto:WillockDJ at cardiff.ac.uk> wrote:
Dear Huan
As a work around this problem, we use our own scripts to fix the atoms, an example is attached.
We tend to work on central linux computers and pass the parameters using "sys.argv" which is an array sent to the
python script by the operating system that contains the command line values. In this script:
sys.argv[1] is the z value used as the reference, you could replace this with a value like:
fix_z= 4.0
Then replace the atoms=read('POSCAR') line with the xsd read we used in the last script.
It should then produce the POSCAR_fixed file that you want.
Hope that helps
David
________________________________
From: 王欢 <huan.wang at whut.edu.cn>
Sent: 20 April 2021 15:36
To: David Willock <WillockDJ at cardiff.ac.uk>
Subject: Re: [ase-users] bug report: ASE-3.21.1, xsd to VASP POSAR
Dear David,
Thank you very much for you kindly reply.
I tried your code. It works for labeling the constraint marks, such as "T" and "F". However, as you mentioned, the incorrect atoms are fixed.
When I deal with constraints in Materials Studio, I just choose the atoms using mouse, and then click the "Modify" --> "Constraints" on the tool bar. By checking the "Fix Cartesian position" or "Fix fractional position" in the "Atom panel", the chosen atoms would be fixed. After that, I always double check by using "Color by" --> "Constraint" in the "Display Style" panel. The fixed atoms are in red whereas the free ones are in dark gray.
In my case, the atoms with Z-coordinates smaller than 4 should be fixed.
Unfortunately, I am not sure about the format of the xsd files. It looks like the html style.
Best wishes,
Huan
Dr. Huan Wang
huan.wang at whut.edu.cn<mailto:huan.wang at whut.edu.cn>
School of Materials Science and Engineering
Wuhan University of Technology
No. 122, Luoshi Road, Wuhan, 430070, P. R. China
On 4/20/2021 19:43,David Willock<WillockDJ at cardiff.ac.uk><mailto:WillockDJ at cardiff.ac.uk> wrote:
Dear Huan Wang
We have also been trying to have a way to work with VASP in Materials Studio and set or preserve constraints on atoms.
I had a look at the source of read_xsd and it seems to only pick up atom and cell information. You can pick out the data from the
file directly by doing a read in python directly and then assign the constraints. The attached is an attempt to get this to work.
To try this in your Anaconda install change sys.argv[1] to "Pt_slab.xsd"
or on a linux machine use:
python3 ase_xsd_to_poscar.py Pt_slab.xsd
However, the flags you highlight don't seem to be a direct map to the atom list, so the wrong atoms are fixed.
Do you know the format of the constraint flags in the xsd file? How did you define the constraints in Materials Studio?
Best Wishes
David
Dr David J. Willock
Reader
Cardiff Catalysis Institute
School of Chemistry
Cardiff University
Main Building
Park Place
Cardiff
CF10 3AT
Phone: +44 (0) 29 208 74779
Dr David J. Willock
Darllenydd
Sefydliad Catalyddu Caerdydd
Ysgol Cemeg
Prifysgol Caerdydd
Prif adeilad y
Plas-Y-Parc
Caerdydd
CF10 3AT
Ffôn : +44 (0) 29 208 74779
/*****************************************************/
Molecular Symmetry :
http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470853484.html<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Feu.wiley.com%2FWileyCDA%2FWileyTitle%2FproductCd-0470853484.html&data=04%7C01%7CWillockDJ%40cardiff.ac.uk%7C6a932ed540e741a9e8c708d90409b596%7Cbdb74b3095684856bdbf06759778fcbc%7C1%7C0%7C637545262605677576%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ABD30EbUb5%2FZ8eu%2BOqUDWGLVscjX3codCZOnDDJDPEw%3D&reserved=0>
Cymesuredd Moleciwlaidd :
http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470853484.html<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Feu.wiley.com%2FWileyCDA%2FWileyTitle%2FproductCd-0470853484.html&data=04%7C01%7CWillockDJ%40cardiff.ac.uk%7C6a932ed540e741a9e8c708d90409b596%7Cbdb74b3095684856bdbf06759778fcbc%7C1%7C0%7C637545262605677576%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ABD30EbUb5%2FZ8eu%2BOqUDWGLVscjX3codCZOnDDJDPEw%3D&reserved=0>
/*****************************************************/
________________________________
From: ase-users <ase-users-bounces at listserv.fysik.dtu.dk> on behalf of 王欢 via ase-users <ase-users at listserv.fysik.dtu.dk>
Sent: 20 April 2021 10:25
To: ase-users at listserv.fysik.dtu.dk <ase-users at listserv.fysik.dtu.dk>
Subject: [ase-users] bug report: ASE-3.21.1, xsd to VASP POSAR
External email to Cardiff University - Take care when replying/opening attachments or links.
Nid ebost mewnol o Brifysgol Caerdydd yw hwn - Cymerwch ofal wrth ateb/agor atodiadau neu ddolenni.
Dear ASE developers,
I installed ASE (v3.21.1) via anaconda. When I converted the xsd file (with two-bottom-layer atoms constrained) to VASP POSCAR file, the result did not show "Selective dynamics" line, and was NOT able to label the constraints with "F" in the POSCAR file.
My simple code is shown below.
#######
from ase.io import xsd, vasp
vasp.write_vasp("POSCAR", xsd.read_xsd("Pt_slab.xsd"), direct=True, vasp5=True, ignore_constraints=False)
#######
I was wondering if the xsd.read_xsd() method be able to parse the constraint label, i.e. Constraint="1,0,0,0,0,1,0,0,0,0,1,0", in the xsd file.
I also noticed that the ase.constraints objects provided approaches to fix atoms. However, the arguments of the vasp.write_vasp() method do not show any flag to accept the constrained atoms. The only related argument is "ignore_constraints", which accepts the Boolean type, not the coordinates of atoms.
Attached please fine the "Pt_slab.xsd" file.
Looking forward to hearing replies from you.
All the best,
Dr. Huan Wang
huan.wang at whut.edu.cn<mailto:huan.wang at whut.edu.cn>
School of Materials Science and Engineering
Wuhan University of Technology
No. 122, Luoshi Road, Wuhan, 430070, P. R. China
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20210425/5a2088c7/attachment-0001.htm>
More information about the ase-users
mailing list