Skip to content

Commit

Permalink
Merge pull request #1702 from JaGeo/master
Browse files Browse the repository at this point in the history
Fix bug in lobsterout
  • Loading branch information
shyuep committed Dec 9, 2019
2 parents da1225a + 63e2dfa commit 6da568d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 17 deletions.
25 changes: 13 additions & 12 deletions pymatgen/io/lobster.py
Expand Up @@ -7,25 +7,26 @@
on LOBSTER see www.cohp.de.
"""

import re
import numpy as np
import collections
import os
from monty.io import zopen
from monty.serialization import loadfn
from monty.json import MSONable
import fnmatch
import itertools
import os
import re
import warnings
import spglib
from typing import Dict, Any, Optional, List
from collections import defaultdict
from typing import Dict, Any, Optional, List

import numpy as np
import spglib
from monty.io import zopen
from monty.json import MSONable
from monty.serialization import loadfn
from pymatgen.core.structure import Structure
from pymatgen.electronic_structure.bandstructure import LobsterBandStructureSymmLine
from pymatgen.electronic_structure.core import Spin, Orbital
from pymatgen.io.vasp.outputs import Vasprun
from pymatgen.electronic_structure.dos import Dos, LobsterCompleteDos
from pymatgen.electronic_structure.bandstructure import LobsterBandStructureSymmLine
from pymatgen.core.structure import Structure
from pymatgen.io.vasp.inputs import Incar, Kpoints, Potcar
from pymatgen.io.vasp.outputs import Vasprun
from pymatgen.symmetry.bandstructure import HighSymmKpath

__author__ = "Janine George, Marco Esters"
Expand Down Expand Up @@ -848,7 +849,7 @@ def _get_threads(self, data):
for row in data:
splitrow = row.split()
if len(splitrow) > 11:
if (splitrow[11]) == "threads":
if (splitrow[11]) == "threads" or (splitrow[11] == "thread"):
return splitrow[10]

def _get_spillings(self, data, number_of_spins):
Expand Down
14 changes: 9 additions & 5 deletions pymatgen/io/tests/test_lobster.py
Expand Up @@ -2,19 +2,20 @@
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.

import unittest
import os
import json
import os
import tempfile
import unittest
import warnings

import numpy as np
import tempfile
from pymatgen import Structure
from pymatgen.electronic_structure.core import Spin, Orbital
from pymatgen.io.lobster import Cohpcar, Icohplist, Doscar, Charge, Lobsterout, Fatband, Lobsterin, Bandoverlaps, \
Grosspop
from pymatgen.io.vasp import Vasprun
from pymatgen.electronic_structure.core import Spin, Orbital
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.vasp.inputs import Incar, Kpoints, Potcar
from pymatgen.util.testing import PymatgenTest

__author__ = "Janine George, Marco Esters"
__copyright__ = "Copyright 2017, The Materials Project"
Expand Down Expand Up @@ -548,6 +549,7 @@ def setUp(self):
self.lobsterout_twospins = Lobsterout(filename=os.path.join(test_dir, "lobsterout.twospins"))
self.lobsterout_GaAs = Lobsterout(filename=os.path.join(test_dir, "lobsterout.GaAs"))
self.lobsterout_from_projection = Lobsterout(filename=os.path.join(test_dir, "lobsterout_from_projection"))
self.lobsterout_onethread = Lobsterout(filename=os.path.join(test_dir, "lobsterout.onethread"))

def tearDown(self):
warnings.simplefilter("default")
Expand Down Expand Up @@ -803,6 +805,8 @@ def testattributes(self):
'sys_time': {'h': '0', 'min': '0', 's': '0', 'ms': '180'}})
self.assertAlmostEqual(self.lobsterout_GaAs.totalspilling[0], [0.0859][0])

self.assertEqual(self.lobsterout_onethread.number_of_threads, 1)

def test_get_doc(self):
comparedict = {'restart_from_projection': False, 'lobster_version': 'v3.1.0', 'threads': 8,
'Dftprogram': 'VASP', 'chargespilling': [0.0268], 'totalspilling': [0.044000000000000004],
Expand Down
45 changes: 45 additions & 0 deletions test_files/cohp/lobsterout.onethread
@@ -0,0 +1,45 @@
LOBSTER v (g++ 5.4.0)
Copyright (C) 2019 by Chair of Solid-State and Quantum Chemistry, RWTH Aachen.
All rights reserved. Contributions by S. Maintz, V. L. Deringer, M. Esser, R. Nelson, C. Ertural, A. L. Tchougreeff and R. Dronskowski
starting on host node0817 on 2019-12-07 at 11:17:50 CET using 1 thread
detecting used PAW program... VASP
initializing PW system...
initializing Augmentations...
recommended basis functions:
O 2p 2s
U 5f 6d 6p 6s 7s
initializing LCAO system...
setting up local basis functions...
O (pbeVaspFit2015) 2s 2p_y 2p_z 2p_x
U (pbeVaspFit2015) 6s 7s 6p_y 6p_z 6p_x 6d_xy 6d_yz 6d_z^2 6d_xz 6d_x^2-y^2 5f_y(3x^2-y^2) 5f_xyz 5f_yz^2 5f_z^3 5f_xz^2 5f_z(x^2-y^2) 5f_x(x^2-3y^2)
INFO: There are more PAW bands than local basis functions available.
INFO: To prevent trouble in orthonormalization and Hamiltonian reconstruction
INFO: the PAW bands from 30 and upwards will be ignored.
setting up CO interactions... found 276 interactions.
projecting...
calculating overlaps...
post-processing projection...
WARNING: 118 of 1332 k-points could not be orthonormalized with an accuracy of 1.0E-5.
WARNING: Generally, this is not a critical error. But to help you analyze it,
WARNING: I dumped the band overlap matrices to the file bandOverlaps.lobster.
WARNING: Please check how much they deviate from the identity matrix and decide to
WARNING: use your results only, if you are sure that this is ok.

saving projection to projectionData.lobster...
spillings for spin channel 1
abs. total spilling: 7.64%
abs. charge spilling: 1.55%

spillings for spin channel 2
abs. total spilling: 7.64%
abs. charge spilling: 1.55%

calculating pDOS...
writing DOSCAR.lobster...
writing COOPCAR.lobster and ICOOPLIST.lobster...
calculating pCOHPs...
writing COHPCAR.lobster and ICOHPLIST.lobster...
writing CHARGE.lobster and GROSSPOP.lobster...
finished in 1 h 17 min 44 s 923 ms of wall time
1 h 16 min 34 s 120 ms of user time
0 h 0 min 5 s 270 ms of sys time

0 comments on commit 6da568d

Please sign in to comment.