Previous Thread
Next Thread
Print Thread
Arithmetic calculations
#35818 07/22/16 10:34 AM
Joined: Jul 2015
Posts: 7
A
Anupam Offline OP
Forum Member
OP Offline
Forum Member
A
Joined: Jul 2015
Posts: 7
I want to do a simple algebraic calculation in CHARMM involving floating point numbers. For example, say I want to assign floating point values to variables a,b and c and d and then assign the value of a*b+c/d to e. Is there a direct way to do this? I have tried using calc but it doesn't seem to work, I get "error in conversion" warnings. I am not pasting my input/output file sections as I think this is a very general question but I can do so if further clarification is required. Any help will be greatly appreciated, Thanks!


Anupam Chatterjee
Graduate Student
UC Irvine
Re: Arithmetic calculations
Anupam #35820 07/22/16 11:26 AM
Joined: Sep 2003
Posts: 4,797
Likes: 2
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 4,797
Likes: 2
miscom.doc:

calc a = 1.5
set b 5.3
set c ?pi
set d = @b
incr d by 4
calc e = @a * @b + @c / @d
echo @e


Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Moderated by  lennart, rmv 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 5.6.33-0+deb8u1 Page Time: 0.010s Queries: 18 (0.005s) Memory: 0.8924 MB (Peak: 0.9569 MB) Data Comp: Off Server Time: 2020-10-31 09:54:54 UTC
Valid HTML 5 and Valid CSS