[ase-users] Problem about using ASE with vasp

Dianwei Hou houd at natur.cuni.cz
Sun Mar 11 09:11:24 CET 2018


Hi,
I learn ASE by myself and have some problems.

The run_vasp.py was written like this:
import os
exitcode = os.system('VASP-5.4.1 zq 4 1G')

when we submit vasp job, we have to write like this:

Usage: VASP-5.4.1 <queue_name> <number_of_cpus> <memory_per_cpu>.

When I test the code:

>>> from ase import Atoms, Atom
>>> from ase.calculators.vasp import Vasp
>>> a = [6.5, 6.5, 7.7]
>>> d = 2.3608
>>> NaCl = Atoms([Atom('Na', [0, 0, 0], magmom=1.928),
...               Atom('Cl', [0, 0, d], magmom=0.75)],
...              cell=a)
>>> calc = Vasp(prec='Accurate',
...             xc='PBE',
...             lreal=False)
>>> NaCl.set_calculator(calc)
>>> print(NaCl.get_magnetic_moment())

Submitting VASP job to queue zq for execution on 4 processors.
Your job 37280 ("test-vasp.dqs") has been submitted

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dianwei/ase/ase/atoms.py", line 620, in get_magnetic_moment
    return self._calc.get_magnetic_moment(self)
  File "/home/dianwei/ase/ase/calculators/vasp/vasp.py", line 402, in
get_magnetic_moment
    self.update(atoms)
  File "/home/dianwei/ase/ase/calculators/vasp/vasp.py", line 83, in update
    self.calculate(atoms)
  File "/home/dianwei/ase/ase/calculators/vasp/vasp.py", line 108, in
calculate
    atoms_sorted = ase.io.read('CONTCAR', format='vasp')
  File "/home/dianwei/ase/ase/io/formats.py", line 451, in read
    parallel=parallel, **kwargs))
  File "/home/dianwei/ase/ase/io/formats.py", line 499, in _iread
    fd = open_with_compression(filename, mode)
  File "/home/dianwei/ase/ase/io/formats.py", line 306, in
open_with_compression
    return open(filename, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'CONTCAR'


The vasp job is finish successful. But it has error that CONTCAR could not
be found. Actually, the CONTCAR file is in the file. I hope to know what is
the problem.

The script to submit vasp jobs is here:

#!/bin/bash

# VASP SGE submission script

echo

if [ "$#" -lt 3 ] ; then
    echo "Usage: $(/usr/bin/basename $0) <queue_name> <number_of_cpus>
<memory_per_cpu>"
    echo
    exit 1
fi

queue=$1
ncpus=$2
rqmem=$3

if [ "`echo ${ncpus} | grep '^[0-9]*$'`" != ${ncpus} ]; then
    echo "Error: number_of_cpus parameter is not a number!"
    echo
    exit 2
fi

if [ "${ncpus}" -ne 1 -a "$((${ncpus} % 4))" -ne 0 ]; then
    echo "Error: parrallel jobs must be run on a multiple of 4 processors."
    echo
    exit 2
fi

VASPSP=/usr/local/programs/common/vasp/vasp-5.4.1/arch/x86_64-intel_13.1.0.146/bin/vasp_std
VASPMP=/usr/local/programs/common/vasp/vasp-5.4.1/arch/x86_64-intel_13.1.0.146-openmpi_1.6.5-ofed_3.18_1/bin/vasp_std
MPIRUN=/usr/local/programs/common/openmpi/openmpi-1.6.5/arch/x86_64-intel_13.1.0.146-ofed_3.18_1/bin/mpirun

ICOMPOSER=/usr/local/programs/common/intel/compiler/2013.2.146/composer_xe_2013.2.146
MKLROOT=${ICOMPOSER}/mkl

jobname=$(/usr/bin/basename $(/bin/pwd))

if [ "${ncpus}" = "1" ]; then
    vasp="${VASPSP}"
else
    vasp="${MPIRUN} ${VASPMP}"
fi

/bin/cat >${jobname}.dqs <<EOF
#!/bin/bash

#$ -cwd
#$ -e .
#$ -o .

export PATH=$PATH
export
LD_LIBRARY_PATH=${ICOMPOSER}/compiler/lib/intel64:${MKLROOT}/lib/intel64:${LD_LIBRARY_PATH}

export OMP_NUM_THREADS=1

/bin/uname -a >${jobname}.log
/bin/date >>${jobname}.log
/bin/echo ${vasp} >>${jobname}.log
/bin/echo >>${jobname}.log

/usr/bin/time -a -o ${jobname}.log ${vasp} >>${jobname}.log

/bin/rm -rf ${jobname}.dqs

EOF

if [ "${ncpus}" = "1" ]; then
    echo "Submitting VASP job to queue $queue for single-processor
execution."
    qsub -q ${queue} -l mem_consumable=${rqmem} ${jobname}.dqs
else
    echo "Submitting VASP job to queue $queue for execution on ${ncpus}
processors."
    qsub -q ${queue} -l mem_consumable=${rqmem} -pe mpi ${ncpus}
${jobname}.dqs
fi

echo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180311/a0c55fec/attachment.html>


More information about the ase-users mailing list