how to modify .MD file

Asked by SuzyHo on 2019-03-13

Hi all,

I'm trying to sum the charge density of two systems and then use the new density as a start state of my calculation. However, I read the manual and realized that only .DM file could be read and initialized.

But I cannot read the .DM file due to the encoding mode, thus the modification of density matrix seems difficult to me.

Do you have any ideas to define initial charge density read by SIESTA?

I appreciate any response and suggestions. Thanks.

Question information

English Edit question
Siesta Edit question
No assignee Edit question
Last query:
Last reply:
Nick Papior (nickpapior) said : #1

You should be able to do this using sisl (

Are the two systems comprising different atoms etc.? I.e. it is not clear whether you want to "merge" two DM or simply do the average of two DM files?

This code is for taking the average between two DM's:

>> import sisl as si
>> DM1 = si.get_sile('RUN1.fdf').read_density_matrix()
>> DM2 = si.get_sile('RUN2.fdf').read_density_matrix()
>> DM = (DM1 + DM2) * 0.5
>> DM.write('siesta.DM')

Then just put the corresponding siesta.DM in the folder where you run for the new system and begin (check the output that it actually uses the file).

SuzyHo (suzyho) said : #2

Thanks for you reply!

Actually, the initial state I want is one proton away from some other atoms. So I'd like to calculate the charge density of one sole proton and of other atoms, then the sum of these two DM files comprising different atoms (same size of cell can be ensured) may stand well for the "proton" away from some other atoms instead of just the whole system with one losing electron after SCF.

Can I make it using sisl? I need time to be familiar with sisl to check whether this can be achived.

Nick Papior (nickpapior) said : #3

Could try:

>> DM = DM1.append(DM2, 0)
>> DM.write('siesta.DM')

but this requires the development version of sisl!

SuzyHo (suzyho) said : #4

Thanks a lot for you suggestions!

Can you help with this problem?

Provide an answer of your own, or ask SuzyHo for more information if necessary.

To post a message you must log in.