Get forces without calculation in prepare_structures using VASP
Dear developers:
I am trying to generate reference structures for FCP following the tutorial, with changing the calculator from EMT into Vasp, and importing a POSCAR from work directory. However, a strange issue was occured.
At first, when the current work directory contains only a POSCAR structure file. The command prepare_structures(structures,atom_lat,calc) would submit a Vasp calculation, but with an error: "No such file or directory: 'OUTCAR'".
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/publics/.local/lib/python3.7/site-packages/hiphive/utilities.py", line 141, in prepare_structures
return [prepare_structure(s, atoms_ideal, calc) for s in structures]
File "/home/publics/.local/lib/python3.7/site-packages/hiphive/utilities.py", line 141, in <listcomp>
return [prepare_structure(s, atoms_ideal, calc) for s in structures]
File "/home/publics/.local/lib/python3.7/site-packages/hiphive/utilities.py", line 79, in prepare_structure
forces = atoms_tmp.get_forces()
File "/home/publics/.local/lib/python3.7/site-packages/ase/atoms.py", line 788, in get_forces
forces = self._calc.get_forces(self)
File "/home/publics/.local/lib/python3.7/site-packages/ase/calculators/abc.py", line 23, in get_forces
return self.get_property('forces', atoms)
File "/home/publics/.local/lib/python3.7/site-packages/ase/calculators/calculator.py", line 737, in get_property
self.calculate(atoms, [name], system_changes)
File "/home/publics/.local/lib/python3.7/site-packages/ase/calculators/vasp/vasp.py", line 331, in calculate
self.read_results()
File "/home/publics/.local/lib/python3.7/site-packages/ase/calculators/vasp/vasp.py", line 551, in read_results
outcar = self.load_file('OUTCAR')
File "/home/publics/.local/lib/python3.7/site-packages/ase/calculators/vasp/vasp.py", line 654, in load_file
with open(filename, 'r') as fd:
FileNotFoundError: [Errno 2] No such file or directory: 'OUTCAR'
Then, after finishing of the Vasp calculation, files "OUTCAR" and "vasprun.xml" are created. When I executed the command prepare_structures(structures,atom_lat,calc) again, the arrays "forces" and "displacements" in every structure in the list "structures" are created automatically. However, the calculation of rattled structures are still not finished.
Are these arrays reasonable for FCP generation? Where are these parameters from? Is there something wrong collecting forces and displacements following these steps? Is there a better way to generate FCP with Vasp? My structure file has nearly 200 atoms so it takes time to do a force calculation.
I am using the following environments: Anaconda3 with python 3.7
| Package | Version |
|---|---|
| ase | 3.22.1 |
| h5py | 3.6.0 |
| hiphive | 0.7.1 |
| matplotlib | 3.5.0 |
| numpy | 1.20.3 |
| phonopy | 2.12.0 |
| scikit-learn | 1.0.1 |
| scipy | 1.7.3 |
| spglib | 1.16.3 |
And my code until the structure preparation is:
from ase.io import read,write
from ase.calculators.vasp import Vasp
from hiphive.structure_generation import generate_mc_rattled_structures
from hiphive.utilities import prepare_structures
n_structures = 3
cell_size = 1
cell_size_2d = 1
rattle_std = 0.05
minimum_distance = 1.2
calc=Vasp()
is2d = 0
structures_fname = 'rattled_structures.extxyz'
atom_lat=[read('POSCAR').repeat((cell_size,cell_size,cell_size)),read('POSCAR').repeat((cell_size_2d,cell_size_2d,1))][is2d]
structures = generate_mc_rattled_structures(atom_lat, n_structures, rattle_std, minimum_distance)
structures = prepare_structures(structures, atoms_lat, calc)