From: Diego Gomes (diego.enry_at_gmail.com)
Date: Fri Aug 02 2024 - 12:06:08 CDT

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/

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>
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!9VookdNwHclXQt6PKyNOT9Emb3MlNh1Hnif1m5pmzp5-tmAVeBut9sZg8bAtaJfuNNu0DyfEcROzq0py4NR9$
>
> https://urldefense.com/v3/__https://www.dropbox.com/scl/fi/ay770hk9kj27egaltew9w/XDATCAR.gz?rlkey=74rdf2plofpbzqkqj975pcax8&dl=0__;!!DZ3fjg!9VookdNwHclXQt6PKyNOT9Emb3MlNh1Hnif1m5pmzp5-tmAVeBut9sZg8bAtaJfuNNu0DyfEcROzq22jclUK$
>
>
>
> Sincerely,
>
> Ron
>
>
> On Jul 31, 2024, at 11:10 AM, Diego Gomes <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
>
> On Mon, Jul 29, 2024 at 2:58 PM Ronald Cohen <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
>
>
>

-- 
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