Skip to content

Commit 92bd2fe

Browse files
Fix indentation error - remove duplicate code from merge
1 parent b00de3f commit 92bd2fe

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

space_server.py

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,34 +110,9 @@ def simplified_vqe(bond_length, shots=1024):
110110
}
111111
except Exception as e:
112112
raise HTTPException(status_code=500, detail=str(e)) from e
113-
114-
backend = AerSimulator()
115-
job = backend.run(circuit, shots=shots)
116-
result = job.result()
117-
counts = result.get_counts()
118-
119-
# Calculate approximate energy based on bond length
120-
# H₂ ground state energy approximation
121-
exact = -1.116 + 0.5 * (bond_length - 0.74)**2
122-
vqe_energy = exact + np.random.normal(0, 0.01) # Small error
123-
124-
return {
125-
"energy": vqe_energy,
126-
"error": abs(vqe_energy - exact),
127-
"depth": circuit.depth(),
128-
"iterations": np.random.randint(20, 50)
129-
}
130-
131-
exact_energy = -1.116 + 0.5 * (request.bond_length - 0.74)**2
132-
result = simplified_vqe(request.bond_length, request.shots)
133-
134-
return {
135-
"exact_energy": exact_energy,
136-
"vqe_energy": result["energy"],
137-
"error": result["error"],
138-
"depth": result["depth"],
139-
"iterations": result["iterations"],
140-
"mode": "simplified"
113+
114+
115+
# Noisy Simulation Endpoint
141116
}
142117
except Exception as e:
143118
raise HTTPException(status_code=500, detail=str(e)) from e

0 commit comments

Comments
 (0)