Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Development branch with many body feature and energy mapping #162

Merged
merged 375 commits into from
May 14, 2020

Conversation

nw13slx
Copy link
Collaborator

@nw13slx nw13slx commented Apr 8, 2020

  • Energy mapping, and enhanced the ase interface @YuuuuXie
  • Manybody kernel by @AldoGl @ClaudioZeni
  • much shorter unit tests
  • easier gp initialization
  • more structured interface for different kernels
  • compatibility with ZAPPA @stevetorr
  • Faster GP by using copy-on-right with global variable for multiprocessing. (For 188 atomic environments and mc_sephyps kernels, it takes about 0.83 second to predict forces for atomic environment, and 5.7 seconds for set_L_alpha() with 32 Skylake cores. )

stevetorr and others added 30 commits February 14, 2020 18:38
…in/share_memory

Conflicts:
	flare/ase/otf_md.py
	flare/dft_interface/vasp_util.py
	tests/test_ase_setup/test_otf.py
Copy link
Collaborator

@YuuuXie YuuuXie left a comment

Choose a reason for hiding this comment

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

I reviewed the many-body part and here are a few possible enhancement which could be done in the future, will probably do it in a separate branch.

  • env.py
    get_2_body_arrays and get_2_body_arrays_ind are redundant. The latter is used in the get_m_body_arrays, and could be changed into the similar style as get_3_body_arrays, i.e. search arrays from a shorter list (but we need to presume that 2-body cutoff is larger than many body)

  • kernels: sc.py, mc_simple.py, mc_sephyp.py
    For many body kernel, we’d better store the coordination number for the training data directly instead of calculating it from the neighbor list every time in the kernel function

  • test_kernels.py, test_mc_mb_kernel.py
    Simplify the code, and merge test_mc_mb.kernel.py into test_mc_kernels.py

  • mgp.py, mgp_en.py
    Just think of this, since most of the code is duplicated, I will consider merging the two, and set up option for “energy map” or “force map”.
    Also, remove the otf.py in mgp folder, since (1) it is lack of maintenance, (2) it can be substituted by ase/otf.py completely. So it is useless now

@@ -190,6 +200,97 @@ class to allow for njit acceleration with Numba.
return bond_array_2, bond_positions_2, etypes


@njit
def get_2_body_arrays_ind(positions, atom: int, cell, cutoff_2: float, species):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new changes will be made in Lixin's branch of separating cutoffs

flare/env.py Outdated
"""
# TODO: this can be probably improved using stored arrays, redundant calls to get_2_body_arrays
# Get distances, positions, species and indexes of neighbouring atoms
bond_array_mb, __, _, bond_inds = get_2_body_arrays_ind(
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the atomic environment, the coordination number of each neighbor atom is calculated. Then if we loop over atoms in a Structure, then the coordination number of the same atom will be calculated multiple times, which will affect the efficiency.

Let's consider if we can add a method to calculate coordination number for each atom in the whole structure, so as to avoid the redundant computation.

return kern


def many_body_mc_jit(bond_array_1, bond_array_2, neigh_dists_1, neigh_dists_2, num_neigh_1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might store the coordination number for the training data directly instead of calculating it every time



def test_many_body_force():
"""Check that the analytical force kernel matches finite difference of
Copy link
Collaborator

Choose a reason for hiding this comment

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

This chunk of code can be simplified via loops....

Copy link
Collaborator Author

@nw13slx nw13slx Apr 23, 2020

Choose a reason for hiding this comment

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

this will be address in pull request #166

# -----------------------------------------------------------------------------


def test_many_body_force():
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as test_kernels.py, can be simplified

@@ -0,0 +1,221 @@
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

mgp_en.py and mgp.py are quite duplicated. I'll consider merging them, and set up options for "energy map" or "force map"

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.

8 participants