Repository: quantumlib/OpenFermion
Pull request #642 (2020-08-09 16:00:35)

Move DATA_DIRECTORY out of the library
DATA_DIRECTORY is now in the examples folder.

Many tests pull from the DATA_DIRECTORY for sample Hamiltonians
or MolecularData objects.  Nothing is ever written to the DATA_DIRECTORY
outside of the MolecularData filename.

This PR follows the recommendation of #616 


Patch:
diff --git a/src/openfermion/config.py b/src/openfermion/config.py
index fe2449e..2174550 100644
--- a/src/openfermion/config.py
+++ b/src/openfermion/config.py
@@ -18,4 +18,4 @@ EQ_TOLERANCE = 1e-8
 # Molecular data directory.
 THIS_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
 DATA_DIRECTORY = os.path.abspath(
-    os.path.join(THIS_DIRECTORY, 'data'))
+    os.path.join(THIS_DIRECTORY, '../../examples/data'))


Test patch:
diff --git a/src/openfermion/data/H1-Li1_sto-3g_singlet_1.45.hdf5 b/examples/data/H1-Li1_sto-3g_singlet_1.45.hdf5
similarity index 100%
rename from src/openfermion/data/H1-Li1_sto-3g_singlet_1.45.hdf5
rename to examples/data/H1-Li1_sto-3g_singlet_1.45.hdf5
diff --git a/src/openfermion/data/H2_6-31g_singlet_0.75.hdf5 b/examples/data/H2_6-31g_singlet_0.75.hdf5
similarity index 100%
rename from src/openfermion/data/H2_6-31g_singlet_0.75.hdf5
rename to examples/data/H2_6-31g_singlet_0.75.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.1.hdf5 b/examples/data/H2_sto-3g_singlet_0.1.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.1.hdf5
rename to examples/data/H2_sto-3g_singlet_0.1.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.2.hdf5 b/examples/data/H2_sto-3g_singlet_0.2.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.2.hdf5
rename to examples/data/H2_sto-3g_singlet_0.2.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.3.hdf5 b/examples/data/H2_sto-3g_singlet_0.3.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.3.hdf5
rename to examples/data/H2_sto-3g_singlet_0.3.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.4.hdf5 b/examples/data/H2_sto-3g_singlet_0.4.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.4.hdf5
rename to examples/data/H2_sto-3g_singlet_0.4.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.5.hdf5 b/examples/data/H2_sto-3g_singlet_0.5.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.5.hdf5
rename to examples/data/H2_sto-3g_singlet_0.5.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.6.hdf5 b/examples/data/H2_sto-3g_singlet_0.6.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.6.hdf5
rename to examples/data/H2_sto-3g_singlet_0.6.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.7.hdf5 b/examples/data/H2_sto-3g_singlet_0.7.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.7.hdf5
rename to examples/data/H2_sto-3g_singlet_0.7.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.7414.hdf5 b/examples/data/H2_sto-3g_singlet_0.7414.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.7414.hdf5
rename to examples/data/H2_sto-3g_singlet_0.7414.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.8.hdf5 b/examples/data/H2_sto-3g_singlet_0.8.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.8.hdf5
rename to examples/data/H2_sto-3g_singlet_0.8.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_0.9.hdf5 b/examples/data/H2_sto-3g_singlet_0.9.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_0.9.hdf5
rename to examples/data/H2_sto-3g_singlet_0.9.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.0.hdf5 b/examples/data/H2_sto-3g_singlet_1.0.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.0.hdf5
rename to examples/data/H2_sto-3g_singlet_1.0.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.1.hdf5 b/examples/data/H2_sto-3g_singlet_1.1.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.1.hdf5
rename to examples/data/H2_sto-3g_singlet_1.1.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.2.hdf5 b/examples/data/H2_sto-3g_singlet_1.2.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.2.hdf5
rename to examples/data/H2_sto-3g_singlet_1.2.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.3.hdf5 b/examples/data/H2_sto-3g_singlet_1.3.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.3.hdf5
rename to examples/data/H2_sto-3g_singlet_1.3.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.4.hdf5 b/examples/data/H2_sto-3g_singlet_1.4.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.4.hdf5
rename to examples/data/H2_sto-3g_singlet_1.4.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.5.hdf5 b/examples/data/H2_sto-3g_singlet_1.5.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.5.hdf5
rename to examples/data/H2_sto-3g_singlet_1.5.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.6.hdf5 b/examples/data/H2_sto-3g_singlet_1.6.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.6.hdf5
rename to examples/data/H2_sto-3g_singlet_1.6.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.7.hdf5 b/examples/data/H2_sto-3g_singlet_1.7.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.7.hdf5
rename to examples/data/H2_sto-3g_singlet_1.7.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.8.hdf5 b/examples/data/H2_sto-3g_singlet_1.8.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.8.hdf5
rename to examples/data/H2_sto-3g_singlet_1.8.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_1.9.hdf5 b/examples/data/H2_sto-3g_singlet_1.9.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_1.9.hdf5
rename to examples/data/H2_sto-3g_singlet_1.9.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.0.hdf5 b/examples/data/H2_sto-3g_singlet_2.0.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.0.hdf5
rename to examples/data/H2_sto-3g_singlet_2.0.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.1.hdf5 b/examples/data/H2_sto-3g_singlet_2.1.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.1.hdf5
rename to examples/data/H2_sto-3g_singlet_2.1.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.2.hdf5 b/examples/data/H2_sto-3g_singlet_2.2.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.2.hdf5
rename to examples/data/H2_sto-3g_singlet_2.2.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.3.hdf5 b/examples/data/H2_sto-3g_singlet_2.3.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.3.hdf5
rename to examples/data/H2_sto-3g_singlet_2.3.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.4.hdf5 b/examples/data/H2_sto-3g_singlet_2.4.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.4.hdf5
rename to examples/data/H2_sto-3g_singlet_2.4.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.5.hdf5 b/examples/data/H2_sto-3g_singlet_2.5.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.5.hdf5
rename to examples/data/H2_sto-3g_singlet_2.5.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.6.hdf5 b/examples/data/H2_sto-3g_singlet_2.6.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.6.hdf5
rename to examples/data/H2_sto-3g_singlet_2.6.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.7.hdf5 b/examples/data/H2_sto-3g_singlet_2.7.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.7.hdf5
rename to examples/data/H2_sto-3g_singlet_2.7.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.8.hdf5 b/examples/data/H2_sto-3g_singlet_2.8.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.8.hdf5
rename to examples/data/H2_sto-3g_singlet_2.8.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_2.9.hdf5 b/examples/data/H2_sto-3g_singlet_2.9.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_2.9.hdf5
rename to examples/data/H2_sto-3g_singlet_2.9.hdf5
diff --git a/src/openfermion/data/H2_sto-3g_singlet_3.0.hdf5 b/examples/data/H2_sto-3g_singlet_3.0.hdf5
similarity index 100%
rename from src/openfermion/data/H2_sto-3g_singlet_3.0.hdf5
rename to examples/data/H2_sto-3g_singlet_3.0.hdf5
diff --git a/src/openfermion/data/bad_type_operator.data b/examples/data/bad_type_operator.data
similarity index 100%
rename from src/openfermion/data/bad_type_operator.data
rename to examples/data/bad_type_operator.data
diff --git a/src/openfermion/data/geometry_example.txt b/examples/data/geometry_example.txt
similarity index 100%
rename from src/openfermion/data/geometry_example.txt
rename to examples/data/geometry_example.txt
diff --git a/src/openfermion/chem/molecular_data_test.py b/src/openfermion/chem/molecular_data_test.py
index 5d704b8..d0afbd3 100644
--- a/src/openfermion/chem/molecular_data_test.py
+++ b/src/openfermion/chem/molecular_data_test.py
@@ -33,8 +33,7 @@ class MolecularDataTest(unittest.TestCase):
         self.geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         self.basis = 'sto-3g'
         self.multiplicity = 1
-        self.filename = os.path.join(THIS_DIRECTORY, 'data',
-                                     'H2_sto-3g_singlet_0.7414')
+        self.filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         self.molecule = MolecularData(self.geometry,
                                       self.basis,
                                       self.multiplicity,
@@ -105,7 +104,7 @@ class MolecularDataTest(unittest.TestCase):
     def test_geometry_from_file(self):
         water_geometry = [('O', (0., 0., 0.)), ('H', (0.757, 0.586, 0.)),
                           ('H', (-.757, 0.586, 0.))]
-        filename = os.path.join(THIS_DIRECTORY, 'data', 'geometry_example.txt')
+        filename = os.path.join(DATA_DIRECTORY, 'geometry_example.txt')
         test_geometry = geometry_from_file(filename)
         for atom in range(3):
             self.assertAlmostEqual(water_geometry[atom][0],
@@ -128,7 +127,7 @@ class MolecularDataTest(unittest.TestCase):
     def test_dummy_save(self):
 
         # Make fake molecule.
-        filename = os.path.join(THIS_DIRECTORY, 'data', 'dummy_molecule')
+        filename = os.path.join(DATA_DIRECTORY, 'dummy_molecule')
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = '6-31g*'
         multiplicity = 7
@@ -202,7 +201,7 @@ class MolecularDataTest(unittest.TestCase):
 
     def test_file_loads(self):
         """Test different filename specs"""
-        data_directory = os.path.join(THIS_DIRECTORY, 'data')
+        data_directory = os.path.join(DATA_DIRECTORY)
         molecule = MolecularData(self.geometry,
                                  self.basis,
                                  self.multiplicity,
diff --git a/src/openfermion/circuits/low_rank_test.py b/src/openfermion/circuits/low_rank_test.py
index 7ebfd4b..fecd7ee 100644
--- a/src/openfermion/circuits/low_rank_test.py
+++ b/src/openfermion/circuits/low_rank_test.py
@@ -15,7 +15,7 @@ import os
 import unittest
 import numpy
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.ops.operators import FermionOperator
 from openfermion.transforms.opconversions import (get_fermion_operator,
@@ -125,8 +125,7 @@ class LowRankTest(unittest.TestCase):
 
         # Initialize H2 InteractionOperator.
         n_qubits = 4
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         molecule = MolecularData(filename=filename)
         molecule_interaction = molecule.get_molecular_hamiltonian()
         molecule_operator = get_fermion_operator(molecule_interaction)
@@ -183,8 +182,7 @@ class LowRankTest(unittest.TestCase):
         # Initialize H2 InteractionOperator.
         n_qubits = 4
         n_orbitals = 2
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         molecule = MolecularData(filename=filename)
         molecule_interaction = molecule.get_molecular_hamiltonian()
         fermion_operator = get_fermion_operator(molecule_interaction)
@@ -273,8 +271,7 @@ class LowRankTest(unittest.TestCase):
 
         # Initialize H2 InteractionOperator.
         n_qubits = 4
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         molecule = MolecularData(filename=filename)
         molecule_interaction = molecule.get_molecular_hamiltonian()
         get_fermion_operator(molecule_interaction)
diff --git a/src/openfermion/circuits/unitary_cc_test.py b/src/openfermion/circuits/unitary_cc_test.py
index bd22309..d13e166 100644
--- a/src/openfermion/circuits/unitary_cc_test.py
+++ b/src/openfermion/circuits/unitary_cc_test.py
@@ -17,7 +17,7 @@ import numpy
 from numpy.random import randn
 import scipy
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.ops.operators import FermionOperator
 from openfermion.transforms.opconversions import (get_fermion_operator,
@@ -218,8 +218,7 @@ class UnitaryCC(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
@@ -283,8 +282,7 @@ class UnitaryCC(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
diff --git a/src/openfermion/data/.gitignore b/src/openfermion/data/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/src/openfermion/data/__init__.py b/src/openfermion/data/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/src/openfermion/linalg/sparse_tools_test.py b/src/openfermion/linalg/sparse_tools_test.py
index 09cc83f..d4d6cdd 100644
--- a/src/openfermion/linalg/sparse_tools_test.py
+++ b/src/openfermion/linalg/sparse_tools_test.py
@@ -24,7 +24,7 @@ from scipy.sparse import csc_matrix
 import scipy
 from scipy.special import comb
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.hamiltonians import (fermi_hubbard, jellium_model,
                                       wigner_seitz_length_scale,
@@ -1289,8 +1289,7 @@ class GetNumberPreservingSparseOperatorIntegrationTestLiH(unittest.TestCase):
         geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., 1.45))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H1-Li1_sto-3g_singlet_1.45')
+        filename = os.path.join(DATA_DIRECTORY, 'H1-Li1_sto-3g_singlet_1.45')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
diff --git a/src/openfermion/measurements/equality_constraint_projection_test.py b/src/openfermion/measurements/equality_constraint_projection_test.py
index ecf8375..8bd9f06 100644
--- a/src/openfermion/measurements/equality_constraint_projection_test.py
+++ b/src/openfermion/measurements/equality_constraint_projection_test.py
@@ -15,7 +15,7 @@ import unittest
 import numpy
 
 from openfermion.chem import MolecularData
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.transforms.opconversions import get_fermion_operator
 from openfermion.linalg import (get_sparse_operator, get_ground_state,
                                 jw_number_restrict_operator,
@@ -36,8 +36,7 @@ class EqualityConstraintProjectionTest(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         molecule = MolecularData(geometry,
                                  basis,
                                  multiplicity,
diff --git a/src/openfermion/measurements/rdm_equality_constraints_test.py b/src/openfermion/measurements/rdm_equality_constraints_test.py
index b8189c9..7d9f70a 100644
--- a/src/openfermion/measurements/rdm_equality_constraints_test.py
+++ b/src/openfermion/measurements/rdm_equality_constraints_test.py
@@ -13,7 +13,7 @@
 import unittest
 import os
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.transforms.repconversions import get_interaction_operator
 from openfermion.measurements import (one_body_fermion_constraints,
@@ -28,8 +28,7 @@ class FermionConstraintsTest(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         molecule = MolecularData(geometry,
                                  basis,
                                  multiplicity,
diff --git a/src/openfermion/ops/representations/interaction_rdm_test.py b/src/openfermion/ops/representations/interaction_rdm_test.py
index e5bd882..eb57b31 100644
--- a/src/openfermion/ops/representations/interaction_rdm_test.py
+++ b/src/openfermion/ops/representations/interaction_rdm_test.py
@@ -14,7 +14,7 @@ import os
 import unittest
 import numpy
 
-from openfermion.config import THIS_DIRECTORY, EQ_TOLERANCE
+from openfermion.config import EQ_TOLERANCE, DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.ops.operators import QubitOperator
 from openfermion.ops.representations.interaction_rdm import InteractionRDMError
@@ -27,8 +27,7 @@ class InteractionRDMTest(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
diff --git a/src/openfermion/testing/hydrogen_integration_test.py b/src/openfermion/testing/hydrogen_integration_test.py
index 9a9e4a6..a6c6226 100644
--- a/src/openfermion/testing/hydrogen_integration_test.py
+++ b/src/openfermion/testing/hydrogen_integration_test.py
@@ -15,7 +15,7 @@ import os
 import unittest
 import numpy
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.utils.operator_utils import count_qubits
 from openfermion.linalg.sparse_tools import (get_sparse_operator,
@@ -36,8 +36,7 @@ class HydrogenIntegrationTest(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
diff --git a/src/openfermion/testing/lih_integration_test.py b/src/openfermion/testing/lih_integration_test.py
index f5fea30..3176cd9 100644
--- a/src/openfermion/testing/lih_integration_test.py
+++ b/src/openfermion/testing/lih_integration_test.py
@@ -14,7 +14,7 @@ import os
 import unittest
 import numpy
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 
 from openfermion.chem import MolecularData
 from openfermion.transforms.opconversions import (get_fermion_operator,
@@ -35,8 +35,7 @@ class LiHIntegrationTest(unittest.TestCase):
         geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., 1.45))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H1-Li1_sto-3g_singlet_1.45')
+        filename = os.path.join(DATA_DIRECTORY, 'H1-Li1_sto-3g_singlet_1.45')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
@@ -137,4 +136,4 @@ class LiHIntegrationTest(unittest.TestCase):
         frozen_hamiltonian = freeze_orbitals(
             get_fermion_operator(self.molecular_hamiltonian), [0, 1])
         self.assertTrue(frozen_hamiltonian == get_fermion_operator(
-            self.molecular_hamiltonian_no_core))
\ No newline at end of file
+            self.molecular_hamiltonian_no_core))
diff --git a/src/openfermion/transforms/opconversions/bksf_test.py b/src/openfermion/transforms/opconversions/bksf_test.py
index dd61fa2..14d5d6c 100644
--- a/src/openfermion/transforms/opconversions/bksf_test.py
+++ b/src/openfermion/transforms/opconversions/bksf_test.py
@@ -16,7 +16,7 @@ import unittest
 
 import numpy
 
-from openfermion.config import THIS_DIRECTORY
+from openfermion.config import DATA_DIRECTORY
 from openfermion.chem import MolecularData
 from openfermion.ops.operators import FermionOperator, QubitOperator
 from openfermion.ops.representations import InteractionOperator
@@ -34,8 +34,7 @@ class bravyi_kitaev_fastTransformTest(unittest.TestCase):
         geometry = [('H', (0., 0., 0.)), ('H', (0., 0., 0.7414))]
         basis = 'sto-3g'
         multiplicity = 1
-        filename = os.path.join(THIS_DIRECTORY, 'data',
-                                'H2_sto-3g_singlet_0.7414')
+        filename = os.path.join(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')
         self.molecule = MolecularData(geometry,
                                       basis,
                                       multiplicity,
@@ -301,4 +300,4 @@ class bravyi_kitaev_fastTransformTest(unittest.TestCase):
                             jw_eig_spec[i] == bravyi_kitaev_fast_eig_spec))):
                 evensector_n += 1
         self.assertEqual(evensector_H, 2**(n_qubits - 1))
-        self.assertEqual(evensector_n, 2**(n_qubits - 1))
\ No newline at end of file
+        self.assertEqual(evensector_n, 2**(n_qubits - 1))