VMD-L Mailing List
From: Ronald Cohen (rcohen_at_carnegiescience.edu)
Date: Sun Aug 04 2024 - 18:10:38 CDT
- Next message: Diego Gomes: "Re: CHGCAR file read in VMD"
- Previous message: Joel Subach: "Re: Re: flipping a .inp file for a water interaction INQUIRY"
- In reply to: Ronald Cohen: "Re: VMD reads vasp files with variable cells incorrectly"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
This script takes a very long time to run and needs lots of memory, but finally I got it to run. it only puts the lattice in the xst file. I think there is still a problem though,
because when the xml file is read into vmd it uses the first frame cell to multiply the fractional coordinates *for all frames* so even the positions of the atoms are wrong, and
this xst file I do not think will fix that. A different workaround is to use ase and say:
ase convert -i vasp-xdatcar XDATCAR -o xsf vasp.xsf
This runs quickly and the xsf file is read correctly by vmd I think
Sincerely,
Ron
> On Aug 2, 2024, at 2:58 PM, Ronald Cohen <rcohen_at_carnegiescience.edu> wrote:
>
> Please also note that XDATCAR has the same problems,
>
> Ron
>
>
>> On Aug 2, 2024, at 1:06 PM, Diego Gomes <diego.enry_at_gmail.com <mailto:diego.enry_at_gmail.com>> wrote:
>>
>> Hi Ronald,
>> I'm writing to confirm the issue of reading cell dimensions while reading the VASP .xml file.
>> I'm opening an issue in our GitLab.
>>
>> By now, I wrote you a script as a workaround. It extracts the cell dimensions from vasprun.xml to a vasprun.xst file.
>> You can then into VMD using the pbctools plugin.
>>
>> # Open the Tk Console
>> Extensions->Tk Console
>>
>> # Read the .xst file.
>> pbc readxst vasprun.xst
>>
>> # Learn more about the PBCTools plugin here.
>> https://www.ks.uiuc.edu/Research/vmd/plugins/pbctools/ <https://www.ks.uiuc.edu/Research/vmd/plugins/pbctools/>
>>
>>
>> Friendly,
>> Diego.
>>
>> #
>> # Python Script to read "vasprun.xml" and write "vasprun.xst"
>> #
>> # Import required module
>> import xml.etree.ElementTree as ET
>>
>> # Load/Parse the file
>> tree = ET.parse('vasprun.xml')
>> root = tree.getroot()
>>
>> # Initialize a list to hold all basis info
>> all_basis_info = []
>>
>> # Extract basis info for each occurrence of <structure>
>> for structure in root.findall(".//structure"):
>> basis_info = []
>> for v in structure.find(".//varray[@name='basis']"):
>> basis_vector = [float(num) for num in v.text.split()]
>> basis_info.append(basis_vector)
>> all_basis_info.append(basis_info)
>>
>>
>> # Flatten the list of lists using a lambda function
>> flatten = lambda lst: [item for sublist in lst for item in sublist]
>>
>> # Write all basis info to a file
>> with open('vasprun.xst', 'w') as output:
>> for index, basis in enumerate(all_basis_info):
>> flattened_list = flatten(basis)
>> xst = ' '.join("{:.4f}".format(num) for num in flattened_list)
>> output.write(f'{index+1} {xst}\n')
>>
>> On Wed, Jul 31, 2024 at 11:24 AM Ronald Cohen <rcohen_at_carnegiescience.edu <mailto:rcohen_at_carnegiescience.edu>> wrote:
>> Sure I will be glad to. I have looked at the VASP plugins and all of them assume a fixed cell. Even the atomic positions are thus wrong, because it multiplies the fractional coordinates in the frames by the wrong cell. I just haven't had time to try to modify the plugins myself. It seems there is not a standard form for the plugins, so it is a bit complicated how to do it best. Here are two examples of iron liquid:
>>
>> https://urldefense.com/v3/__https://www.dropbox.com/scl/fi/e5ydb9lsqddxvh9s8r42v/vasprun.xml.gz?rlkey=zdtmbuo8b5y2epb0jkigqjph2&dl=0__;!!DZ3fjg!_4cMlxBLzEi_TiQr0FtL-nX5AdGcYh9siJtLOP0qxVNf_AWSn1zjEsp1hMe2HuZMVa76jZI58baiSO0Crn8UUBsN3A$ <https://urldefense.com/v3/__https://www.dropbox.com/scl/fi/e5ydb9lsqddxvh9s8r42v/vasprun.xml.gz?rlkey=zdtmbuo8b5y2epb0jkigqjph2&dl=0__;!!DZ3fjg!_4cMlxBLzEi_TiQr0FtL-nX5AdGcYh9siJtLOP0qxVNf_AWSn1zjEsp1hMe2HuZMVa76jZI58baiSO0Crn8UUBsN3A$ >
>> https://urldefense.com/v3/__https://www.dropbox.com/scl/fi/ay770hk9kj27egaltew9w/XDATCAR.gz?rlkey=74rdf2plofpbzqkqj975pcax8&dl=0__;!!DZ3fjg!_4cMlxBLzEi_TiQr0FtL-nX5AdGcYh9siJtLOP0qxVNf_AWSn1zjEsp1hMe2HuZMVa76jZI58baiSO0Crn_0_xXU5g$ <https://urldefense.com/v3/__https://www.dropbox.com/scl/fi/ay770hk9kj27egaltew9w/XDATCAR.gz?rlkey=74rdf2plofpbzqkqj975pcax8&dl=0__;!!DZ3fjg!_4cMlxBLzEi_TiQr0FtL-nX5AdGcYh9siJtLOP0qxVNf_AWSn1zjEsp1hMe2HuZMVa76jZI58baiSO0Crn_0_xXU5g$ >
>>
>>
>>
>> Sincerely,
>>
>> Ron
>>
>>
>>> On Jul 31, 2024, at 11:10 AM, Diego Gomes <diego.enry_at_gmail.com <mailto:diego.enry_at_gmail.com>> wrote:
>>>
>>> Hi Ronald,
>>> thank you for bringing this up.
>>>
>>> Can you send me a sample file and if you know details about the VASP file, a brief explanation of the expected result?
>>>
>>> Friendly,
>>> Diego.
>>>
>>> --
>>> Diego Enry. B. Gomes, PhD
>>> Department of Physics at Auburn University &
>>> NIH Center for Macromolecular Modeling and Visualization
>>> Leach Science Center - Ste. 3182
>>> Auburn, AL, 36849 - (334) 844-4264
>>> dgomes_at_auburn.edu <mailto:dgomes_at_auburn.edu>
>>> On Mon, Jul 29, 2024 at 2:58 PM Ronald Cohen <rcohen_at_carnegiescience.edu <mailto:rcohen_at_carnegiescience.edu>> wrote:
>>> I have followed up this in the course of the plugins, and not only does vmd not read the cell parameters correctly with a variable cell, but it even reads the atomic positions wrong!
>>> It converts them to cartesian coordinates (angstroms) using the cell of the first frame.
>>>
>>> Ronald Cohen
>>>
>>>
>>>
>>>
>>> --
>>> Diego Enry B. Gomes, PhD
>>> Department of Physics at Auburn University &
>>> NIH Center for Macromolecular Modeling and Visualization
>>> Leach Science Center - Ste. 3182 - Auburn, AL
>>> dgomes_at_auburn.edu <mailto:dgomes_at_auburn.edu>
>>
>>
>>
>> --
>> Diego Enry B. Gomes, PhD
>> Department of Physics at Auburn University &
>> NIH Center for Macromolecular Modeling and Visualization
>> Leach Science Center - Ste. 3182 - Auburn, AL
>> dgomes_at_auburn.edu <mailto:dgomes_at_auburn.edu>
>
- Next message: Diego Gomes: "Re: CHGCAR file read in VMD"
- Previous message: Joel Subach: "Re: Re: flipping a .inp file for a water interaction INQUIRY"
- In reply to: Ronald Cohen: "Re: VMD reads vasp files with variable cells incorrectly"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]