Page 1 of 1

Questions about “chgdiff.pl CHGCAR1 CHGCAR2”

Posted: Thu Jun 05, 2014 7:29 am
by Jiang12
Dear Prof. Graeme and others,

For the script chgdiff.pl, the command "chgdiff.pl CHGCAR1 CHGCAR2" is CHGCAR1-CHGCAR2 or CHGCAR2-CHGCAR1.

I have three CHGCAR, how can I realize "CHGCAR1-CHGCAR2-CHGCAR3"?

Thank you very much.

Re: Questions about “chgdiff.pl CHGCAR1 CHGCAR2”

Posted: Thu Jun 05, 2014 9:48 pm
by graeme
I think it's as simple as:

chgdiff.pl CHGCAR1 CHGCAR2
mv CHGCAR_diff CHGCAR1-2
chgdiff.pl CHGCAR1-2 CHGCAR3

Re: Questions about “chgdiff.pl CHGCAR1 CHGCAR2”

Posted: Thu Jan 18, 2018 7:30 am
by lisu555
But I am confused that: the script is

$line1 = <IN1>;
$line2 = <IN2>;
@line1 = split(/\s+/,$line1);
@line2 = split(/\s+/,$line2);
for ($j=1; $j<@line1; $j++) {
$line1[$j] = $line2[$j]-$line1[$j];


it seems to be CHGCAR2 - CHGCAR1 ?

Re: Questions about “chgdiff.pl CHGCAR1 CHGCAR2”

Posted: Thu Jan 18, 2018 1:12 pm
by graeme
Yes, that's right.