Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a file (totalenergy.dat) containing the lattice constants and total energies per atom and i want to convert it to to a file (cohesive.dat) containing atomic volumes and cohesive energies by the script. How do i write the script?
where the cohesive energy = (total energy per unit cell/number of atoms)-energy per atom
To be frank with you, you could have formulated your question otherwise; you could have placed a sample of your data file here and asked about the tools in a Linux system which could help you solve your problem.
Anyway, I think Bash is not best suited for your problem, because, even if you can do arithmetics in Bash, it is highly dependent on other utilities for doing the math as Bash is not intended for that in the first place.
What other languages do you know? C, Python, FORTRAN?
Hello there
First of all nobody is getting paid, the arithemric is not the problem here, I need the FHI-aims bash script so that I will do all my work using FHI-aims.
So now we have the formula and the original input ... good start
What does the desired output look like and as asked above, what if any languages do you know?
Not sure if anyone else does, but I am also unfamiliar with what 'FHI-aims' is?? (it may not be important)
I will advise that whilst you could do this in bash and use bc, I would probably pick a language that can perform decimal arithmetic itself.
Suggestions would be something like :- awk, perl, python, ruby,...
So now we have the formula and the original input ... good start
What does the desired output look like and as asked above, what if any languages do you know?
Not sure if anyone else does, but I am also unfamiliar with what 'FHI-aims' is?? (it may not be important)
I will advise that whilst you could do this in bash and use bc, I would probably pick a language that can perform decimal arithmetic itself.
Suggestions would be something like :- awk, perl, python, ruby,...
I don't even think bash does floating point, if I remember correctly... especially with E left overs, but I could be wrong.
OP would be better off trying @John VV Idea post #7 unless pascal might work for OP,
Lazarus and open pascal got graphs too. make it look all fancy like even.
Open Pascal is an easy programming language to learn. IMO and lots others too.
. As noted by others, bash does not support floating point arithmetic.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.