zadorlab / KinBot

Automated reaction pathway search for gas-phase molecules
Other
45 stars 15 forks source link

FileNotFoundError: [Errno 2] No such file or directory #68

Closed liqiang4567 closed 7 months ago

liqiang4567 commented 7 months ago

Hello, the following problems occurred when I used kinbot to simulate C6H6. I uploaded C6H6_1.jons text and kinbot.log file, how can I solve them, thank you

image C6H6_1.json kinbot.log

juditzador commented 7 months ago

Hello! How did you install KinBot? From conda or from source? What I see is that you error says:

File "/home/XXX/software/anaconda3/envs/kinbot_v1/lib/python3.8/site-packages/kinbot/qc.py", line 739, in submit_qc
python_template = open(template_head_file, 'r').read() + open(template_file, 'r').read()

But on line 739 this is not what is in qc.py. This line is not in the code anymore actually. Can you try to install the code from the source as given in https://github.com/zadorlab/KinBot?tab=readme-ov-file#from-github

liqiang4567 commented 7 months ago

Hello, thank you for your reply. I installed it through conda install -c conda-Forge kinbot. I will try to install using source code

liqiang4567 commented 7 months ago

I follow your advice, use the source code to install, run C6H6_1.json such an error, how to solve?

20-Jan-24 17:03:06-INFO: Starting optimization of initial well... 20-Jan-24 17:03:29-ERROR: Traceback (most recent call last): File "/home/XXX/software/anaconda3/envs/kinbot_v2/bin/kinbot", line 8, in sys.exit(main()) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/kb.py", line 86, in main qc.qc_opt(well0, well0.geom) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/qc.py", line 650, in qc_opt self.submit_qc(job) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/qc.py", line 726, in submit_qc check = self.check_qc(job) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/qc.py", line 1110, in check_qc if self.is_in_database(job): File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/qc.py", line 1058, in is_in_database for row in rows: File "/home/XXX/software/anaconda3/envs/kinbot_v2/lib/python3.8/site-packages/ase/parallel.py", line 275, in new_generator for result in generator(*args, **kwargs): File "/home/XXX/software/anaconda3/envs/kinbot_v2/lib/python3.8/site-packages/ase/db/core.py", line 486, in select for row in self._select(keys, cmps, explain=explain, File "/home/XXX/software/anaconda3/envs/kinbot_v2/lib/python3.8/site-packages/ase/db/sXXXte.py", line 688, in _select with self.managed_connection() as con: File "/home/XXX/software/anaconda3/envs/kinbot_v2/lib/python3.8/contextlib.py", line 113, in enter return next(self.gen) File "/home/XXX/software/anaconda3/envs/kinbot_v2/lib/python3.8/site-packages/ase/db/sXXXte.py", line 193, in managed_connection self._initialize(con) File "/home/XXX/software/anaconda3/envs/kinbot_v2/lib/python3.8/site-packages/ase/db/sXXXte.py", line 214, in _initialize cur = con.execute( sXXXte3.OperationalError: database is locked

liqiang4567 commented 7 months ago

Hello, the problem with source code installation is still the same.

Traceback (most recent call last): File "/home/XXX/software/anaconda3/envs/kinbot_v2/bin/kinbot", line 8, in sys.exit(main()) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/kb.py", line 164, in main rg.generate() File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/reaction_generator.py", line 116, in generate self.species.reac_step[index] = reac_family.carry_out_reaction( File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/reac_family.py", line 183, in carry_out_reaction step += rxn.qc.submit_qc(rxn.instance_name, singlejob=0, File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/qc.py", line 762, in submit_qc job_template = open(template_head_file, 'r').read() + open(template_file, 'r').read() FileNotFoundError: [Errno 2] No such file or directory: ''

juditzador commented 7 months ago

Regarding the first error: your kinbot.db is locked, because it was accessed too many times in rapid fire perhaps at some point. Maybe you didn't kill the jobs the right order or something like that. That is easy to solve, you'll find a file with lock in its name, just delete it before rerunning.

juditzador commented 7 months ago

If you open a python session in your environment where you are running KinBot, can you do this:

>>> from kinbot import kb_path
>>> kb_path
'/home/jzador/KinBot/kinbot'

What do you get?

liqiang4567 commented 7 months ago

Thank you for your reply, the installation should be no problem, I can get the path of kinbot. But there are problems. This is when the task is running for a long time and there is a problem and a lot of files are generated. According to my tracking, suddenly after running *high.com file "template_head_file" is empty.

image

image

juditzador commented 7 months ago

Can you try this, again, in your kb environment, in python:


>>> from kinbot import kb_path
>>> template_file = f'{kb_path}/tpl/slurm_python.tpl'
>>> template_head_file = f'{kb_path}/tpl/slurm.tpl'
>>> a = open(template_head_file, 'r').read()
>>> a
'#! /bin/bash\n\n#SBATCH -N 1\n#SBATCH -c {ppn}\n#SBATCH -q {queue_name}\n#SBATCH -o {errdir}/{name}.stdout\n#SBATCH -e {errdir}/{name}.err\n#SBATCH --mem=10gb\n{slurm_feature}\n\nexport OMP_NUM_THREADS={ppn}\n'
>>> b = open(template_file, 'r').read()
>>> b
'python {python_file} {arguments}\n'
juditzador commented 7 months ago

I am able to reproduce your bug, give me a bit of time and I can fix this.

juditzador commented 7 months ago

I think I fixed the bug. I pushed the fix to the master branch.

liqiang4567 commented 7 months ago

Hello, after the change, the previous problem has been solved, but this problem occurs again? Do I need to set up a directory for this? My working directory is /home/xxx/kinbot/kinbot_code /run/test2 This error occurs: '/home/xxx/kinbot/kinbot_code /run/chemids'

9837632364, same: 1 22-Jan-24 13:13:58-INFO: Starting hindered rotor calculations of 781982302101340580261_r12_insertion_R_2_1_3 22-Jan-24 13:14:15-INFO: Product 781982302101340580261_r12_insertion_R_2_1_3 energy is 45.79 kcal/mol. 22-Jan-24 13:14:15-ERROR: Traceback (most recent call last): File "/home/xxx/software/anaconda3/envs/kinbot_v2/bin/kinbot", line 8, in sys.exit(main()) File "/home/xxx/Kinbot/kinbot_code/KinBot/kinbot/kb.py", line 164, in main rg.generate() File "/home/xxx/Kinbot/kinbot_code/KinBot/kinbot/reaction_generator.py", line 503, in generate jobs = open(dirwell + '/chemids', 'r').read().split('\n') FileNotFoundError: [Errno 2] No such file or directory: '/home/xxx/Kinbot/kinbot_code/run/chemids'

juditzador commented 7 months ago

I think you are running a kinbot calculation, i.e., a single-well run, but I can see that you set the pes parameter to 1 in your json input file. So the code thinks that you are in the multiwell mode (pes). Either set pes to 0, or run the code in the pes mode. For the latter you need to copy your json input to /home/xxx/kinbot/kinbot_code /run/, and run it from there as pes input.json.

liqiang4567 commented 7 months ago

Yes, you are right. However, when I run the pes.json file, it appears that the read energy is infinite, and the error is as follows. For example, run 781982302101340580261_well_high. My quantitative calculations ended normally. I guess there's a problem reading the power code somewhere?

image

pes.log: .... 22-Jan-24 15:52:04-INFO: len(finished): 1

22-Jan-24 15:52:06-ERROR: Traceback (most recent call last): File "/home/XXX/software/anaconda3/envs/kinbot_v1/bin/pes", line 8, in sys.exit(main()) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/pes.py", line 230, in main postprocess(par, jobs, task, names, well0.mass) File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/pes.py", line 288, in postprocess base_energy, base_zpe = get_energy(jobs, jobs[0], 0, par['high_level'], File "/home/XXX/Kinbot/kinbot_code/KinBot/kinbot/pes.py", line 1365, in get_energy raise ValueError(f'Unable to find an energy for {j}.') ValueError: Unable to find an energy for 781982302101340580261_well_high.

juditzador commented 7 months ago

Is the entry 781982302101340580261_well_high in the kinbot.db of the 781982302101340580261 directory? Just to make sure, you are running pes.json above the directory you previously run the 781982302101340580261 calculations, and you have pes turned on the json. Maybe if you could post the pes.json I can take a look.

liqiang4567 commented 7 months ago

Thank you very much for your help, the program is running now.