@@ -3269,17 +3269,31 @@ def _handle_output_processing(self):
32693269 self ._handle_output_processing ()
32703270
32713271 def _handle_vasp_output_processing_enhanced (self ):
3272- """Enhanced VASP output processing with batch capabilities."""
3272+ """Enhanced VASP output processing with batch capabilities and single-point support ."""
32733273 print ("\n ==== Enhanced VASP Output Processing ====\n " )
32743274
32753275 # Import the enhanced processor
32763276 from pathlib import Path
32773277 import json
32783278
32793279 # Import the VASPOutputProcessor from the enhanced module
3280- # In practice, this would be imported at the top of your main file
32813280 processor = VASPOutputProcessor ()
32823281
3282+ # NEW: Ask about calculation type
3283+ print ("What type of VASP calculation are you processing?" )
3284+ print ("1. Single-point calculation (single energy evaluation)" )
3285+ print ("2. Cell/geometry optimization (multiple ionic steps)" )
3286+
3287+ calc_type_choice = input ("\n Select calculation type (1/2) [2]: " ).strip () or "2"
3288+ is_single_point = (calc_type_choice == "1" )
3289+
3290+ if is_single_point :
3291+ print ("\n [Processing as SINGLE-POINT calculations]" )
3292+ print ("Note: This mode expects OUTCAR with one energy and force evaluation.\n " )
3293+ else :
3294+ print ("\n [Processing as OPTIMIZATION calculations]" )
3295+ print ("Note: This mode expects OUTCAR with multiple ionic steps.\n " )
3296+
32833297 # Ask for processing mode
32843298 print ("Processing modes:" )
32853299 print ("1. Single directory (process one VASP calculation)" )
@@ -3300,20 +3314,33 @@ def _handle_vasp_output_processing_enhanced(self):
33003314 return
33013315
33023316 try :
3303- # Process the calculation
3304- result = processor .process_single_vasp_calculation (calc_path )
3317+ # Process the calculation with the specified calculation type
3318+ result = processor .process_single_vasp_calculation (calc_path , is_single_point = is_single_point )
33053319
33063320 # Save JSON file
33073321 output_json = calc_path / f"{ calc_path .name } _vasp_output.json"
33083322 with open (output_json , 'w' ) as f :
33093323 json .dump (result ["optimization_steps" ], f , indent = 2 )
33103324
33113325 print (f"\n Processing complete:" )
3312- print (f" - Optimization steps: { result ['num_steps' ]} " )
3326+ print (f" - Calculation type: { result ['calculation_type' ]} " )
3327+ print (f" - Number of steps: { result ['num_steps' ]} " )
33133328 print (f" - Output saved to: { output_json } " )
33143329
3330+ # Show a preview of the data
3331+ if result ["optimization_steps" ]:
3332+ first_step = result ["optimization_steps" ][0 ]
3333+ print (f"\n Preview of extracted data:" )
3334+ print (f" - Energy: { first_step .get ('energy' , 'N/A' )} eV" )
3335+ print (f" - Number of atoms: { len (first_step .get ('coordinates' , []))} " )
3336+ print (f" - Cell volume: { first_step .get ('cell_volume' , 'N/A' ):.2f} ų" )
3337+
33153338 except Exception as e :
33163339 print (f"\n Error processing VASP output: { e } " )
3340+ print ("\n Troubleshooting tips:" )
3341+ print (" - Check that POSCAR and OUTCAR files exist in the directory" )
3342+ print (" - Verify that you selected the correct calculation type" )
3343+ print (" - Ensure the OUTCAR file is complete (not from a crashed run)" )
33173344
33183345 else :
33193346 # Batch mode processing
@@ -3331,18 +3358,28 @@ def _handle_vasp_output_processing_enhanced(self):
33313358 recursive = input ("Search recursively for VASP calculations? (y/n) [y]: " ).strip ().lower () != "n"
33323359
33333360 try :
3334- # Process all calculations
3335- summary = processor .process_directory_batch (parent_path , recursive = recursive )
3361+ # Process all calculations with the specified calculation type
3362+ summary = processor .process_directory_batch (
3363+ parent_path ,
3364+ recursive = recursive ,
3365+ is_single_point = is_single_point
3366+ )
3367+
3368+ print (f"\n Batch processing summary:" )
3369+ print (f" - Calculation type: { summary ['calculation_type' ]} " )
3370+ print (f" - Total directories found: { summary ['total_directories' ]} " )
3371+ print (f" - Successfully processed: { summary ['processed_successfully' ]} " )
3372+ print (f" - Errors: { summary ['errors' ]} " )
33363373
33373374 except Exception as e :
33383375 print (f"\n Error during batch processing: { e } " )
33393376
33403377 # Ask if the user wants to process another output
3341- another = input ("\n Process another output? (y/n): " ).strip ().lower ()
3378+ another = input ("\n Process another VASP output? (y/n): " ).strip ().lower ()
33423379 if another == "y" :
33433380 self ._handle_output_processing ()
33443381
3345-
3382+
33463383#### ML DATASET CREATION METHODS ######
33473384
33483385 def _handle_ml_dataset_creation (self ):
0 commit comments