Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
choglass committed Jun 2, 2024
1 parent 7a07737 commit 401b3fb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 48 deletions.
2 changes: 1 addition & 1 deletion cell2mol/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ def assess_errors(self, mode):
else : case = 0
elif mode == "reconstruction":
print("-------------------------------")
print("Errors in Reference Molecules")
print("Errors in reconstruction")
print("-------------------------------")
if self.has_isolated_H: case = 1
elif self.has_missing_H: case = 2
Expand Down
82 changes: 35 additions & 47 deletions cell2mol/new_c2m_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,6 @@
# Save reference cell object
refcell.save(ref_cell_fname)

output.close()
sys.stdout = stdout

# Summary
surmmary = open(surmmary_fname, "w")
sys.stdout = surmmary
print("*** Reference molecules ***")
print(refcell)
print_output(refcell.refmoleclist)
surmmary.close()
sys.stdout = stdout

# Error handling
case = refcell.error_case
error_fname = os.path.join(current_dir, f"refcell_error_{case}.out")
error = open(error_fname, "w")
sys.stdout = error
handle_error(case)
error.close()
sys.stdout = stdout

output = open(output_fname, "a")
sys.stdout = error
##########################################
if refcell.error_case != 0:
sys.exit(1)
Expand Down Expand Up @@ -175,27 +152,38 @@
output.close()
sys.stdout = stdout

try:
# Summary
surmmary = open(surmmary_fname, "w")
sys.stdout = surmmary
print("*** Reference molecules ***")
print(refcell)
print_output(refcell.refmoleclist)

print("***Unit cell molecules ***")
print(newcell)
print_output(newcell.moleclist)
surmmary.close()
sys.stdout = stdout

# Error handling
case = newcell.error_case
error_fname = os.path.join(current_dir, f"unitcell_error_{case}.out")
error = open(error_fname, "w")
sys.stdout = error
handle_error(case)
error.close()
sys.stdout = stdout
except:
sys.exit(1)

# Summary
surmmary = open(surmmary_fname, "w")
sys.stdout = surmmary
print("*** Reference molecules ***")
print(refcell)
print_output(refcell.refmoleclist)

print("***Unit cell molecules ***")
print(newcell)
print_output(newcell.moleclist)
surmmary.close()
sys.stdout = stdout

# Error handling
case = refcell.error_case
error_fname = os.path.join(current_dir, f"refcell_error_{case}.out")
error = open(error_fname, "w")
sys.stdout = error
handle_error(case)
error.close()
sys.stdout = stdout

output = open(output_fname, "a")
sys.stdout = output

# Error handling
case = newcell.error_case
error_fname = os.path.join(current_dir, f"unitcell_error_{case}.out")
error = open(error_fname, "w")
sys.stdout = error
handle_error(case)
error.close()
sys.stdout = stdout

0 comments on commit 401b3fb

Please sign in to comment.