Skip to content

Commit

Permalink
Bispectrum descriptor calculation for two elements in principle works
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomDefaultUser committed Nov 15, 2024
1 parent d145d55 commit ffe13c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion mala/descriptors/bispectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ def __calculate_lammps(self, outdir, **kwargs):
# general LAMMPS import.
from lammps import constants as lammps_constants

if len(set(self.atoms.numbers)) > 2:
raise ValueError(
"MALA can only compute bispectrum descriptors for 1- or "
"2-element systems currently."
)

use_fp64 = kwargs.get("use_fp64", False)
keep_logs = kwargs.get("keep_logs", False)

Expand Down Expand Up @@ -173,7 +179,10 @@ def __calculate_lammps(self, outdir, **kwargs):
)
else:
self.parameters.lammps_compute_file = os.path.join(
filepath, "in.bgrid.python"
filepath,
"in.bgrid_n{0}.python".format(
len(set(self.atoms.numbers))
),
)

# Do the LAMMPS calculation and clean up.
Expand Down Expand Up @@ -279,6 +288,12 @@ def __calculate_python(self, **kwargs):
"large systems."
)

if len(set(self.atoms.numbers)) > 1:
raise ValueError(
" MALA cannot compute bispectrum descriptors for "
"multi-element systems with python currently."
)

# The entire bispectrum calculation may be extensively profiled.
profile_calculation = kwargs.get("profile_calculation", False)
if profile_calculation:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ compute bgrid all sna/grid grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${rfac0


# is this important? or does it just need to be big enough?
variable rcutneigh equal 2.0*${rcutfac}*${radelem}
variable rcutneigh equal 2.0*${rcutfac}*${radelem1}
# for water
#variable rcutneigh equal 4.0*${rcutfac}*${radelem1}

Expand Down

0 comments on commit ffe13c5

Please sign in to comment.