Skip to content

Conversation

@gabriele16
Copy link
Contributor

Allegro is an equivariant NN interatomic potential for large-scale systems.

INTEGER, DIMENSION(:), POINTER :: temp_unique_list_a, work_list, work_list2
INTEGER, DIMENSION(:, :), POINTER :: list
REAL(KIND=dp), DIMENSION(3) :: cell_v, cvi
REAL(KIND=dp), DIMENSION(:, :), POINTER :: rwork_list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to replace these POINTERs with ALLOCATABLEs?

Copy link
Contributor Author

@gabriele16 gabriele16 Apr 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done so where possible now. In some cases such as for glob_loc_list, glob_cell_v, glob_loc_list_a, unique_list_a, I have not changed to ALLOCATABLEs as they are defined above in src/manybody_potential.F and used throughout in different routines and modules.

allegro%unit_coords = ""
allegro%unit_forces = ""
allegro%unit_energy = ""
allegro%unit_cell = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set the components just at the definition of the derived type itself. Do you than still need this routine?

Copy link
Contributor Author

@gabriele16 gabriele16 Apr 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am setting the defaults in the definition of the derived type for both Allegro and NequIP, but would like to keep this as well as other routines in src/pair_potential_types.F for consistency and overall clarity, since they are called for the different pair potentials and manybody potentials implemented before.

! **************************************************************************************************
!> \brief Creates the ALLEGRO potential type
!> \param allegro ...
!> \author Teodoro Laino [teo] 11.2005
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace it with your name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done both for NequIP and Allegro, thanks. In general, should one claim authorship of a routine even if it was only slightly modified from a previous one, as it was the case, for example, for all the create, copy, release, clean routines in src/pair_potential_types.F for each manybody or pair potential?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we have the git logs, there is not necessarily the need to add the authorship but if you do, just add a hint that it was copied from code by Teodoro.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, should one claim authorship of a routine even if it was only slightly modified from a previous one,...

It depends ;-)

For simple boilerplate code like this, you can safely put your own name to let others know that you're the Allegro-expert. For more complex code you can share the credit via the \history tag.

Generally, we try to give more visibility to recent work.

allegro_dest%unit_energy = allegro_source%unit_energy
allegro_dest%unit_energy_val = allegro_source%unit_energy_val
allegro_dest%unit_cell = allegro_source%unit_cell
allegro_dest%unit_cell_val = allegro_source%unit_cell_val
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be simpler to just write allegro_dest = allegro_source

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

allegro%unit_coords = 'NULL'
allegro%unit_forces = 'NULL'
allegro%unit_energy = 'NULL'
allegro%unit_cell = 'NULL'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use allegro = allegro_pot_type() instead after you have defined proper defaults at the definition of this type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

IF (ASSOCIATED(allegro)) THEN
DEALLOCATE (allegro)
END IF
END SUBROUTINE pair_potential_allegro_release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need this function (especially if you have removed the create routine)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the create routine, I would like to keep it for consistency with previous code.

IF (use_virial) THEN
virial(1, 1) = 0.0_dp; virial(1, 2) = 0.0_dp; virial(1, 3) = 0.0_dp
virial(2, 1) = 0.0_dp; virial(2, 2) = 0.0_dp; virial(2, 3) = 0.0_dp
virial(3, 1) = 0.0_dp; virial(3, 2) = 0.0_dp; virial(3, 3) = 0.0_dp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am aware that this branch is not yet properly implemented. But just write virial = 0.0_dp and below pv_nonbond = pv_nonbond + virial

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

simplified pair pot types and delete leftover write

now prettified

revert back to pointer in allegro

reduced number of lines for virial

replace pointers with allocatables where possible

prettified again
@fstein93 fstein93 merged commit 6cce7c8 into cp2k:master Apr 13, 2023
mtaillefumier pushed a commit to mtaillefumier/cp2k that referenced this pull request Apr 17, 2023
mtaillefumier pushed a commit to eth-cscs/cp2k that referenced this pull request Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants