Skip to content

Commit

Permalink
Merge branch 'master' of github.com:materialsproject/pymatgen
Browse files Browse the repository at this point in the history
Former-commit-id: e88e66a99265fdeda945df228b1e7ac573b83aa9 [formerly e4980b5]
Former-commit-id: 5a96a81a0c5752cae9f1ec93308e849ee6f2cb71
  • Loading branch information
shyuep committed Aug 18, 2014
2 parents 153d0d2 + 3ccdcb8 commit 0a0133b
Show file tree
Hide file tree
Showing 5 changed files with 8,608 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pymatgen/io/qchemio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def _parse_job(cls, output):
"k?cal/mol")
detailed_charge_pattern = re.compile("(Ground-State )?(?P<method>\w+)( Net)?"
" Atomic Charges")
nbo_charge_pattern = re.compile("(?P<element>[A-Z][a-z]{0,2})\s+(?P<no>\d+)\s+(?P<charge>\-?\d\.\d+)"
nbo_charge_pattern = re.compile("(?P<element>[A-Z][a-z]{0,2})\s*(?P<no>\d+)\s+(?P<charge>\-?\d\.\d+)"
"\s+(?P<core>\-?\d+\.\d+)\s+(?P<valence>\-?\d+\.\d+)"
"\s+(?P<rydberg>\-?\d+\.\d+)\s+(?P<total>\-?\d+\.\d+)"
"(\s+(?P<spin>\-?\d\.\d+))?")
Expand Down
32 changes: 32 additions & 0 deletions pymatgen/io/tests/test_qchemio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,38 @@ def test_nbo_charges(self):
0.86201, 0.85672, -0.35698, -0.35373, -0.35782, -0.35647,
-0.35646, -0.35787, -1.26555]
self.assertEqual(qcout.data[0]["charges"]["nbo"], ans)
filename = os.path.join(test_dir, "crowd_nbo_charges.qcout")
qcout = QcOutput(filename)
self.assertEqual(
qcout.data[0]["charges"]["nbo"],
[-0.33917, -0.6104, -0.15912, -0.17751, -0.61817, -0.3357, 0.24671,
0.19942, 0.19325, 0.2362, 0.23982, 0.21985, 0.2305, 0.20444,
0.23179, 0.20491, 0.85965, -0.59655, -0.59561, -0.14789, -0.13859,
-0.32712, -0.33359, 0.21602, 0.22383, 0.2123, 0.22759, 0.2507,
0.20098, 0.18631, 0.24945, 0.19709, 0.20274, -0.34831, -0.56307,
-0.14572, -0.1431, -0.55866, -0.3572, 0.22695, 0.21983, 0.1963,
0.20977, 0.22298, 0.20875, 0.21081, 0.19586, 0.24708, 0.20067,
-0.34288, -0.55793, -0.16806, -0.15609, -0.56464, -0.34695,
0.22555, 0.20417, 0.206, 0.20825, 0.22409, 0.25415, 0.20977,
0.18976, 0.24647, 0.1993, -0.33605, -0.59395, -0.15985, -0.18024,
-0.60646, -0.32742, 0.22909, 0.19347, 0.21872, 0.2203, 0.23518,
0.25185, 0.23523, 0.18666, 0.22737, 0.2205, -0.35902, -0.56138,
-0.14552, -0.14903, -0.55491, -0.3493, 0.22826, 0.21789, 0.19075,
0.20898, 0.21343, 0.21715, 0.20794, 0.19695, 0.2429, 0.18482,
-0.33943, -0.55659, -0.16437, -0.14503, -0.56155, -0.34131,
0.22339, 0.20483, 0.19376, 0.23395, 0.20784, 0.2096, 0.21945,
0.19192, 0.23089, 0.20493, -0.32963, -0.56949, -0.1446, -0.15244,
-0.55482, -0.34848, 0.22802, 0.20471, 0.19704, 0.20744, 0.22332,
0.2206, 0.20734, 0.18871, 0.22907, 0.20741, -0.33856, -0.564,
-0.16575, -0.17422, -0.56032, -0.3426, 0.22585, 0.20169, 0.20529,
0.20836, 0.21329, 0.25353, 0.23374, 0.19306, 0.23582, 0.20196,
-0.34069, -0.56522, -0.17228, -0.17503, -0.55505, -0.34264,
0.22696, 0.19604, 0.20515, 0.23964, 0.2437, 0.2111, 0.21204,
0.19975, 0.2347, 0.18835, -0.34324, -0.55184, -0.16086, -0.15907,
-0.56319, -0.3384, 0.23866, 0.19808, 0.19728, 0.20205, 0.24698,
0.21416, 0.20398, 0.20475, 0.2265, 0.20141, -0.34339, -0.56344,
-0.14955, -0.14878, -0.55906, -0.34506, 0.23937, 0.20027, 0.19671,
0.2085, 0.21693, 0.22164, 0.20863, 0.20703, 0.22889, 0.1916])

def test_simple_aimd(self):
filename = os.path.join(test_dir, "h2o_aimd.qcout")
Expand Down
7 changes: 7 additions & 0 deletions pymatgen/io/vaspio/tests/test_vasp_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class VasprunTest(unittest.TestCase):
def test_properties(self):
filepath = os.path.join(test_dir, 'vasprun.xml')
vasprun = Vasprun(filepath)

#test pdos parsing
pdos0 = vasprun.complete_dos.pdos[vasprun.final_structure[0]]
self.assertAlmostEqual(pdos0[Orbital.s][1][16], 0.0026)
self.assertAlmostEqual(pdos0[Orbital.pz][-1][16], 0.0012)
self.assertEqual(pdos0[Orbital.s][1].shape, (301, ))

filepath2 = os.path.join(test_dir, 'lifepo4.xml')
vasprun_ggau = Vasprun(filepath2, parse_projected_eigen=True)
totalscsteps = sum([len(i['electronic_steps'])
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/vaspio/vasp_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def _parse_dos(self, elem):
data = np.array(_parse_varray(ss))
nrow, ncol = data.shape
for j in xrange(1, ncol):
pdos[Orbital.from_vasp_index(j - 1)][spin] = data
pdos[Orbital.from_vasp_index(j - 1)][spin] = data[:, j]
pdoss.append(pdos)
elem.clear()
return Dos(efermi, energies, tdensities), \
Expand Down
Loading

0 comments on commit 0a0133b

Please sign in to comment.