muon-spectroscopy-computational-project / pymuon-suite

Collection of scripts and utilities for muon spectroscopy
GNU General Public License v3.0
8 stars 7 forks source link

DFTB+ Max Cycles and Mass settings are not correctly applied #13

Closed lauramurgatroyd closed 11 months ago

lauramurgatroyd commented 3 years ago

Note: this is not an issue with the recent refactoring into ReadWrite classes, and is a completely separate issue to https://github.com/muon-spectroscopy-computational-project/pymuon-suite/issues/12. This seems to be an issue that existed before then.

When creating a DFTB+ input file, pymuonsuite sets the mass of the muon and the max number of scc cycles within the 'driver' input section. For example:

Driver = ConjugateGradient{ 
   Masses = { 
      Mass = { 
         Atoms = -1 
         MassPerAtom [amu] = 0.1134289259 
      } 
   } 
   MaxForceComponent [eV/AA] = 0.05 
   MaxSccIterations = 200 
   MaxSteps = 30 
   } 
Hamiltonian = DFTB{ 
   Charge = 0.0 
   DampXH = Yes 

However, when you run this with DFTB+, you get the following errors:

Reading SK-files:
Done.
WARNING!
-> The following 7 node(s) have been ignored by the parser:
(1)
Path: dftbplusinput/Driver/ConjugateGradient/Masses
Line: 6-11 (File: dftb_in.hsd)
(2)
Path: dftbplusinput/Driver/ConjugateGradient/MaxSccIterations
Line: 13-13 (File: dftb_in.hsd)
(3)
Path: dftbplusinput/Hamiltonian/DFTB/MaxAngularMomentum/C
Line: 25-25 (File: dftb_in.hsd)
...

DFTB+ can't read the Masses, or the MaxSccIterations when they are defined in this way. This means that the DFTB+ runs always default to the standard number of scc iterations (100) and also seems that they don't make use of the muon mass.

Looking at the DFTB+ manual: https://dftbplus.org/fileadmin/DFTBPLUS/public/dftbplus/latest/manual.pdf Page 16 defines the Driver section, and pg 26 defines the Hamiltonian section.

Moving the MaxSccIterations setting into the Hamiltonian section fixes this problem. We need to update this here: https://github.com/muon-spectroscopy-computational-project/pymuon-suite/blob/1b461892d2d4fd1330d2854e97e952c8603880aa/pymuonsuite/io/dftb.py#L287

We also need to work out how to fix setting the muon mass

lauramurgatroyd commented 3 years ago

Currently we are attempting, it seems incorrectly, to set the mass of the muon for a geometry optimisation calculation. I believe that the mass isn't actually used in the geometry optimisation so can we just remove this from being set altogether here?

I notice that the mass and the charge are both not set for a dftb spinpol calculation. Is this the correct behaviour?

lauramurgatroyd commented 3 years ago

The incorrect SCC cycles setting has been resolved in the above PR which has been merged.

lauramurgatroyd commented 3 years ago

To summarise where we are at with this:

The mass is not needed for any of the calculations we run at the moment, but we may need it in future.

The structure of setting it like this:

 Masses = { 
      Mass = { 
         Atoms = -1 
         MassPerAtom [amu] = 0.1134289259 
      } 
   }

is correct, but the Driver section is not the correct section for it to be placed in. The section it should go in will depend on which calculation we want to do that will make use of the mass.

leandro-liborio commented 11 months ago

We will not be using DFTB+ in the near future. No need to dela with this now.