ulissigroup / vasp-interactive

GNU Lesser General Public License v2.1
53 stars 11 forks source link

CONTCAR and XDATCAR can not output right in optimization #56

Open wankiwi opened 7 months ago

wankiwi commented 7 months ago

When I did an optimization task, I got the wrong CONTCAR and XDATCAR files.

The CONTCAR is the same as the POSCAR. image

The configuration output in every ion cycle is the same as the POSCAR. image

My vasp version is 6.3.0 and my execution script is below:

import numpy as np
import os
import shutil
import tempfile

from ase.atoms import Atoms
from ase.optimize import BFGS
from ase.optimize import FIRE
from ase.io import read

from vasp_interactive import VaspInteractive

def run_with_vasp_interactive(atoms):
    print("Running relaxation using VaspInteractive")
    calc = VaspInteractive(
        encut=400,
        ispin=2,
        ismear=0,
        xc="pbe",
        kpts=(1, 1, 1),
        lorbit = 11,
        directory='./',
        ncore = 2,
        parse_vaspout=True,
    )

    # Use the provided atoms object for the calculation
    with calc:
        atoms.calc = calc
        dyn = BFGS(atoms)
        dyn.run(fmax=0.05)

    n_ion, n_elec = calc.read_all_iterations()
    print(f"Relaxation by VaspInteractive in {n_ion - 1} steps")
    print(f"Electronic scf steps per ionic cycle: {n_elec[:-1]}")

# Example usage:
if __name__ == "__main__":
    # Here you would load your structure from a file or other source
    # For example, using ASE's read function:
    # atoms = ase.io.read('path_to_structure_file.xyz')
    # run_with_vasp_interactive(atoms)

    # For demonstration, we'll still create an H2 molecule
    atoms = read('POSCAR')
    run_with_vasp_interactive(atoms)

I think it is a bug, could developers fix this?