google-deepmind / deepmind-research

This repository contains implementations and illustrative code to accompany DeepMind publications
Apache License 2.0
13.22k stars 2.6k forks source link

Reproducing figures from the "Pushing the frontiers of density functionals by solving the fractional electron problem" paper #432

Open sevkel opened 1 year ago

sevkel commented 1 year ago

Hello, im a undergrad student and i currently try to reproduce the plots of fig. 2A and 3A (DM21 paper) with pyscf. Im new to pyscf so i don't have that much experience and i would be very glad if someone could maybe help me out how to implement this or give hints (for example how to handle fractional charge behavior). Is there also maybe an example code somewhere which i didn't see?

i'm also quiete new to GitHub so i hope this is the correct way to ask.

best regards and thanks in advance!

sevkel commented 1 year ago

So as i tried to reproduce the adenine-thymine base pair plot i got this (using VMD with and ISO value of 0.135)

Bildschirmfoto 2023-08-15 um 08 57 22

i dont see the behaviour of the charge density here like in your paper. What did i do wrong? Here is my code:

import sys from pyscf.tools import cubegen import density_functional_approximation_dm21 as dm21 from pylibnxc.pyscf import UKS,RKS

mol = gto.M() mol.atom = """ C 0.79798578248978 0.27519057470284 -0.01890509695066 C 0.70702747312535 -1.06575607739564 -0.01327835807200 N -0.50035980543377 -1.70730936525323 0.06704320769620 C -1.69568922338892 -1.03103345715763 0.14618410761476 N -1.59915072204173 0.31979902406806 0.14076456708071 C -0.43384804095291 1.06625807754303 0.06401971185273 O -2.75362515578970 -1.63531483072713 0.21529615221125 C 2.08908976790964 1.01960035707866 -0.10541973075319 O -0.47822793311336 2.27762741012063 0.06829630572069 H 1.57627045408281 -1.70496020473060 -0.07152939155485 H -0.55050831848261 -2.71559440368892 0.06999153163645 H -2.50968320821782 0.87257126191031 0.20082453496904 H 2.93282644091015 0.33737998664090 -0.15972749421850 H 2.19829952583287 1.66643057215990 0.76341252118527 H 2.08323641963996 1.66285560893889 -0.98372747616555 N -7.17714822826316 3.98156165640549 0.48384323632164 C -5.95643680340869 3.38069640978421 0.41225779243010 C -6.21836587989208 2.00091690901628 0.42425064620424 N -7.57164658925112 1.78664179542793 0.50161649555365 C -8.09733331733828 2.97045848850909 0.53445411326732 C -5.10170291295142 1.14164068588014 0.35787665821786 N -3.89336892284171 1.72204544690860 0.28915771001715 C -3.77953075533591 3.04671488063477 0.28551402597380 N -4.74411706466496 3.93731710283537 0.34350216370909 H -2.76736953251811 3.42383151702245 0.22726326863966 N -5.19140570895963 -0.18743467682696 0.36007719484137 H -7.34835812456523 4.97266827085858 0.49578953243705 H -9.15126094504415 3.15822050439344 0.59538233129986 H -6.10345688775085 -0.60425355030555 0.41244310182460 H -4.35452178378429 -0.76653997475585 0.31127663700995 """ mol.basis = '6-311g' mol.charge = 1 mol.spin = 1 mol.verbose = 4 mol.build()

mf = dft.UKS(mol) mf._numint = dm21.NeuralNumInt(dm21.Functional.DM21) mf.grids.level = 5 mf.damp = 0.5 mf.conv_tol = 1E-5 mf.conv_tol_grad = 1E-2 mf.kernel()

i also had to relax the convergence criteria more because otherwise it didnt.

thanks in advance!

johTin commented 11 months ago

Hi sevkel have you tried to reproduce the plot?