OK cool, thanks anyway! For now I'll see if I can use OpenMPI instead... <div><br></div><div>Cheers,</div><div>Kane<br><br></div><div class="gmail_quote"><div dir="auto" class="gmail_attr">On Thursday, January 14, 2021 at 8:07:12 PM UTC+1 ge...@gmail.com wrote:<br/></div><blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Kane,
<br>Sorry, I did not check it out for cp2k-v8.1.
<br>I have been mostly using CP2K-v6.1 with ase.
<br>Maybe someone who is more familiar with code knows which subroutine
<br>does the job reading positions from standard input,
<br>then It will be easier to adopt the code.
<br>
<br>Best,
<br>Geng
<br>
<br>Kane Shenton <<a href data-email-masked rel="nofollow">jk...@gmail.com</a>> 于2021年1月14日周四 上午7:56写道:
<br>>
<br>> Hi!
<br>>
<br>> I've just run into the same issue. Thanks, Geng, for shedding some light and providing the hack to fix it!
<br>>
<br>> It's unclear to me how to adapt your fortran code to newer versions of cp2k since, as you say, there have been lots of changes.
<br>>
<br>> Have you, by any chance, subsequently written a similar hack for newer versions of cp2k (e.g. v8.1)?
<br>>
<br>> Best,
<br>> Kane
<br>>
<br>>
<br>> On Wednesday, August 19, 2020 at 11:33:38 PM UTC+2 <a href data-email-masked rel="nofollow">ani...@gmail.com</a> wrote:
<br>>>
<br>>> Thanks a lot!!
<br>>>
<br>>>
<br>>> On Tuesday, August 18, 2020 at 9:05:44 AM UTC-7, Sun Geng wrote:
<br>>>>
<br>>>> Hi Aniruddha M Dive,
<br>>>> Below is the code that I changed a few lines in cp2k_shell.F and ase-cp2k calculator. ( You will see the lines I commented out)
<br>>>> Please note that the code is only tested wit cp2k-v6.1 (I found the most recent cp2k code revised cp2k_shell.F significantly).
<br>>>> The idea is that the python code will write a file " CP2K_POSITIONS" with coordinates instead of writing them into PIPE,
<br>>>> and cp2k_shell will read the positions from the file instead of the PIPE.
<br>>>> Best,
<br>>>> Geng
<br>>>>
<br>>>>
<br>>>>         IF (para_env%mepos==para_env%source) THEN
<br>>>>            !READ (*,*,iostat=iostat) n_atom2
<br>>>>            !IF (iostat/=0) CPABORT('setpos read n_atom')
<br>>>>            !IF (n_atom2/=SIZE(pos)) THEN
<br>>>>            !   CALL my_assert(.FALSE.,'setpos invalid number of atoms',failure)
<br>>>>            !   DO i=1,n_atom
<br>>>>            !      READ(*,'(a)',iostat=iostat) cmdStr
<br>>>>            !      CALL compress(cmdStr,full=.TRUE.)
<br>>>>            !      CALL uppercase(cmdStr)
<br>>>>            !      IF (cmdStr=='*END') EXIT
<br>>>>            !   END DO
<br>>>>            !   GOTO 10
<br>>>>            !END IF
<br>>>>            !READ (*,*,iostat=iostat) pos
<br>>>>            !IF (iostat/=0) CPABORT('setpos read coord')
<br>>>>            inquire(unit=201,opened=unitalive)
<br>>>>            if (unitalive) CPABORT('UNIT 201 is being used')
<br>>>>            inquire(file="CP2K_POSITIONS",exist=filepresence)
<br>>>>            if (.not. filepresence) CPABORT('FILE CP2K_POSITIONS NOT EXIST')
<br>>>>            open(201,action='READ',file="CP2K_POSITIONS",iostat=iostat,status='OLD',form='FORMATTED',ACCESS='SEQUENTIAL')
<br>>>>            if (iostat/=0) CPABORT('read CP2K_POSITIONS')
<br>>>>            READ(201,*,iostat=iostat) n_atom2
<br>>>>            IF (iostat/=0) CPABORT('setpos read n_atom2')
<br>>>>            IF (n_atom2/=SIZE(pos)) THEN
<br>>>>               CALL my_assert(.FALSE.,'setpos invalid number of atoms',failure)
<br>>>>               DO i=1,n_atom
<br>>>>                  READ(201,'(a)',iostat=iostat) cmdStr
<br>>>>                  CALL compress(cmdStr,full=.TRUE.)
<br>>>>                  CALL uppercase(cmdStr)
<br>>>>                  IF (cmdStr=='*END') EXIT
<br>>>>               END DO
<br>>>>               GOTO 10
<br>>>>            END IF
<br>>>>            READ (201,*,iostat=iostat) pos
<br>>>>            CLOSE(201)
<br>>>>            IF (iostat/=0) CPABORT('setpos read coord')
<br>>>>            pos(:) = pos(:)/pos_fact
<br>>>>            READ(*,'(a)',iostat=iostat) cmdStr
<br>>>>            CALL compress(cmdStr,full=.TRUE.)
<br>>>>            CALL uppercase(cmdStr)
<br>>>>            CALL my_assert(cmdStr=='*END',' missing *END',failure)
<br>>>>         END IF
<br>>>>
<br>>>>
<br>>>> ---changes in ase cp2k calcualtor -----
<br>>>>         if 'positions' in system_changes:
<br>>>>             with open("CP2K_POSITIONS","w") as fp:
<br>>>>                 fp.write("%d\n" % (3*n_atoms))
<br>>>>                 for pos in self.atoms.get_positions():
<br>>>>                     fp.write('%.18e %.18e %.18e\n' % tuple(pos))
<br>>>>             self._shell.send('SET_POS %d' % self._force_env_id)
<br>>>>             #self._shell.send('%d' % (3 * n_atoms))
<br>>>>             #for pos in self.atoms.get_positions():
<br>>>>             #    self._shell.send('%.18e %.18e %.18e' % tuple(pos))
<br>>>>             self._shell.send('*END')
<br>>>>             max_change = float(self._shell.recv())
<br>>>>             assert max_change >= 0 # sanity check
<br>>>>             self._shell.expect('* READY')
<br>>>>             if os.path.isfile("CP2K_POSITIONS"):
<br>>>>                 os.remove("CP2K_POSITIONS")
<br>>>>
<br>>>> 在2020年8月17日星期一 UTC-7 下午4:42:29<<a href data-email-masked rel="nofollow">ani...@gmail.com</a>> 写道:
<br>>>>>
<br>>>>> Thanks Geng,
<br>>>>>
<br>>>>> I went through your earlier post regarding the same issue. Can you send me the respective cp2k_shell.F file that works for you. I would like to incorporate it and check.
<br>>>>>
<br>>>>> Also can you send me the python script you used as well.
<br>>>>>
<br>>>>> Best Regards,
<br>>>>> Aniruddha M Dive
<br>>>>>
<br>>>>>
<br>>>>> On Monday, August 17, 2020 at 7:44:08 AM UTC-7, Sun Geng wrote:
<br>>>>>>
<br>>>>>> Dear Aniruddha,
<br>>>>>>
<br>>>>>> Sometimes ago, I have encountered a similar problem,
<br>>>>>> I think the reason is that the python code communicates positions/forces with the mpi cp2k_shell.popt.
<br>>>>>> There is a problem when MPI code read the pipe: the MPI code will only read truncated data  (such as positions) from the pipe, not all of them.
<br>>>>>> So CP2K_shell.popt is still waiting for more coordinates and gets stuck.
<br>>>>>>
<br>>>>>> Best,
<br>>>>>> Geng
<br>>>>>>
<br>>>>>>
<br>>>>>>
<br>>>>>> 在2020年8月13日星期四 UTC-7 下午1:20:17<<a href data-email-masked rel="nofollow">ani...@gmail.com</a>> 写道:
<br>>>>>>>
<br>>>>>>> Thanks Hasan,
<br>>>>>>>
<br>>>>>>> I was able to get the Cp2K working. However I face another issue. The simulation runs well for few steps and after that I cannot see my output file being updated. The simulation shows running however I am not able to see any output being updated in the cp2k output file as well as the slurm output file. I have attached my job submission script, python script as well as the out files for reference. Could this be a memory issue?
<br>>>>>>>
<br>>>>>>> Best,
<br>>>>>>> Aniruddha M Dive
<br>>>>>>>
<br>>>>>>>
<br>>>>>>> On Tuesday, August 4, 2020 at 10:12:17 AM UTC-7, Hasan Al-Mahayni wrote:
<br>>>>>>>>
<br>>>>>>>> Hello,
<br>>>>>>>>
<br>>>>>>>> I had similar problems starting CP2K with ASE earlier this summer. I will attach an example of geometric optimization for a slab, I hope it helps. You need to copy paste a large portion of your cp2k input file in your python script, because ASE does not provide all the input parameters you will need to perform geo_opt. Please find an example attached below.
<br>>>>>>>>
<br>>>>>>>> Cheers,
<br>>>>>>>>
<br>>>>>>>> Hasan.
<br>>>>>>>>
<br>>>>>>>> On Tue, Aug 4, 2020 at 1:16 AM Maxime Van den Bossche <<a href data-email-masked rel="nofollow">maxi...@gmail.com</a>> wrote:
<br>>>>>>>>>
<br>>>>>>>>> Dear Aniruddha,
<br>>>>>>>>>
<br>>>>>>>>> Since you haven't provided a minimal example, nor the error message you're getting
<br>>>>>>>>> from ASE or CP2K, I haven't looked into debugging the (bulky) example you sent.
<br>>>>>>>>>
<br>>>>>>>>> But I don't think you can do the geometry optimization in this way. ASE uses the cp2k_shell binary,
<br>>>>>>>>> which seems to only perform single-point calculations but not e.g. geometry optimizations.
<br>>>>>>>>>
<br>>>>>>>>> The idea behind cp2k_shell is that the 'driver' (in this case ASE) is the one moving the atoms
<br>>>>>>>>> around, and what CP2K does is e.g. calculating the energy and the gradients for a given geometry.
<br>>>>>>>>>
<br>>>>>>>>> Here is a minimal example of a geometry optimization, and you can work your way up
<br>>>>>>>>> from there:
<br>>>>>>>>>
<br>>>>>>>>> from ase.build import molecule
<br>>>>>>>>> from ase.calculators.cp2k import CP2K
<br>>>>>>>>> from ase.optimize import BFGS
<br>>>>>>>>>
<br>>>>>>>>> atoms = molecule('H2O')
<br>>>>>>>>> atoms.center(vacuum=2.0)
<br>>>>>>>>>
<br>>>>>>>>> calc = CP2K(command='cp2k_shell.sopt')
<br>>>>>>>>> atoms.set_calculator(calc)
<br>>>>>>>>>
<br>>>>>>>>> dyn = BFGS(atoms)
<br>>>>>>>>> dyn.run(fmax=0.05)
<br>>>>>>>>>
<br>>>>>>>>> Best regards,
<br>>>>>>>>> Maxime
<br>>>>>>>>>
<br>>>>>>>>> --
<br>>>>>>>>> You received this message because you are subscribed to the Google Groups "cp2k" group.
<br>>>>>>>>>
<br>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, send an email to <a href data-email-masked rel="nofollow">c...@googlegroups.com</a>.
<br>>>>>>>>>
<br>>>>>>>>>
<br>>>>>>>>> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/cp2k/df050a2d-1161-4e2c-98c9-0463adcb4c3do%40googlegroups.com" target="_blank" rel="nofollow" data-saferedirecturl="https://www.google.com/url?hl=en&q=https://groups.google.com/d/msgid/cp2k/df050a2d-1161-4e2c-98c9-0463adcb4c3do%2540googlegroups.com&source=gmail&ust=1610785158990000&usg=AFQjCNGvnuhEoCZdMvxtVKN-7jAZYB4RLw">https://groups.google.com/d/msgid/cp2k/df050a2d-1161-4e2c-98c9-0463adcb4c3do%40googlegroups.com</a>.
<br>>
<br>> --
<br>> You received this message because you are subscribed to the Google Groups "cp2k" group.
<br>> To unsubscribe from this group and stop receiving emails from it, send an email to <a href data-email-masked rel="nofollow">cp...@googlegroups.com</a>.
<br>> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/cp2k/7d31cb08-bfbd-4a88-a0d3-8990d132c7d4n%40googlegroups.com" target="_blank" rel="nofollow" data-saferedirecturl="https://www.google.com/url?hl=en&q=https://groups.google.com/d/msgid/cp2k/7d31cb08-bfbd-4a88-a0d3-8990d132c7d4n%2540googlegroups.com&source=gmail&ust=1610785158990000&usg=AFQjCNHmI7C8eNAYKjVeK1HF_pk6HU2B6A">https://groups.google.com/d/msgid/cp2k/7d31cb08-bfbd-4a88-a0d3-8990d132c7d4n%40googlegroups.com</a>.
<br></blockquote></div>