Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
CalystaT committed Aug 17, 2023
1 parent bdbd8f7 commit 664187c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions macrodensity/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def plot_planar_average(lattice_vector: float,input_file: str=' ',output_file: s
df = df.transpose()
df.to_csv(output_file)

elif filetype == 'gulp':
elif 'gulp' in input_file or '.out' in input_file:
output_file = 'PlanarGulp.csv'
img_file = 'PlanarGulp.png'

Expand Down Expand Up @@ -418,7 +418,7 @@ def plot_planar_average(lattice_vector: float,input_file: str=' ',output_file: s
df.to_csv(output_file)


elif filetype == 'vasp':
elif 'vasp' in input_file or 'LOCPOT' in input_file:
output_file = 'PlanarVasp.csv'
img_file = 'PlanarVasp.png'
pot, NGX, NGY, NGZ, Lattice = read_vasp_density(input_file)
Expand Down
Binary file modified tests/__pycache__/unit_tests.cpython-311.pyc
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_plot_gulp_potential(self):
'''Tests the plot_gulp_potential function'''
gulpcar = pkg_resources.resource_filename(
__name__, path_join('../tests', 'gulp.out'))
out = md.plot_gulp_potential(lattice_vector=3.0,input_file=gulpcar)
out = md.plot_planar_average(lattice_vector=3.0,input_file=gulpcar)
self.assertEqual(out[0][0],-23.16678352)
self.assertAlmostEqual(out[0][10],-1.59508152)
self.assertEqual(out[0][-1],-23.16678352)
Expand All @@ -307,13 +307,13 @@ def test_plot_active_space(self):
self.assertEqual(out,(17, 4079))

def test_plot_planar_cube(self):
'''Tests the plot_planar_cube function'''
'''Tests the plot_planar_average function'''
Density = pkg_resources.resource_filename(
__name__, path_join('../tests', 'cube_001_spin_density.cube'))
Potential = pkg_resources.resource_filename(
__name__, path_join('../tests', 'cube_002_hartree_potential.cube'))
outden = md.plot_planar_cube(input_file=Density,lattice_vector=4.75)
outpot = md.plot_planar_cube(input_file=Potential,lattice_vector=4.75)
outden = md.plot_planar_average(input_file=Density,lattice_vector=4.75)
outpot = md.plot_planar_average(input_file=Potential,lattice_vector=4.75)
self.assertEqual(outden[0][0],0.0200083723051778)
self.assertEqual(outden[0][-1],0.019841719274268536)
self.assertEqual(outpot[0][0],-0.562656062923066)
Expand Down

0 comments on commit 664187c

Please sign in to comment.