[QE-users] How to define multiplication in QE job script
Paolo Giannozzi
p.giannozzi at gmail.com
Sun Mar 15 09:45:55 CET 2020
Another possibility is to use command "bc". The following example finds a
and c for an hexagonal lattice, given the cell volume and the c/a ratio
#!/bin/bash
# volume in A^3
for volume in 80 90 100 110 120 130
do
# csua = c/a
csua=1.10
a=`echo 'e(l('$volume'*2/sqrt(3)/'$csua')/3.0)'| bc -l`
c=`echo $a'*'$csua| bc -l`
...
done
On Sat, Mar 14, 2020 at 10:58 AM Lorenzo Paulatto <paulatz at gmail.com> wrote:
> > Yes it works! Thanks you very much.
> >
> Iif you need to multiply anything that is not integer, it will not work.
> In this case you can define a little function to do the math, like this:
>
> calc(){ eval awk \'BEGIN{printf \"%12.8f\\n\", $@}\'; }
>
> alat=10.2
> c_over_a=$(calc $alat/6.4)
> echo $c_over_a
>
>
> hth
>
> --
> Lorenzo Paulatto - Paris
> _______________________________________________
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso)
> users mailing list users at lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users
--
Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,
Univ. Udine, via delle Scienze 208, 33100 Udine, Italy
Phone +39-0432-558216, fax +39-0432-558222
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20200315/2a9b930c/attachment.html>
More information about the users
mailing list