how to modify .MD file

Asked by SuzyHo

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

Language:
English Edit question
Status:
Solved
For:
Siesta Edit question
Assignee:
No assignee Edit question
Solved by:
SuzyHo
Solved:
Last query:
Last reply:
Revision history for this message
Nick Papior (nickpapior) said :
#1

You should be able to do this using sisl (https://github.com/zerothi/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).

Revision history for this message
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.

Revision history for this message
Nick Papior (nickpapior) said :
#3

Could try:

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

but this requires the development version of sisl!

Revision history for this message
SuzyHo (suzyho) said :
#4

Thanks a lot for you suggestions!

Revision history for this message
SuzyHo (suzyho) said :
#5

For this question, I wrote .py file to sum the .DM files.
This is not difficult by reading and writing orbitals, spins, and sparse format.