From 907e254a51322ee565620e08f58baadad0095e54 Mon Sep 17 00:00:00 2001 From: Lenz Fiedler Date: Mon, 2 Dec 2024 15:15:43 +0100 Subject: [PATCH] Three elements in principle work, but atomic density formula not for some reason --- mala/descriptors/bispectrum.py | 6 +- mala/descriptors/in.bgrid_n3.python | 57 +++++++++++++++++++ .../in.bgridlocal_defaultproc_n2.python | 2 +- .../in.bgridlocal_defaultproc_n3.python | 41 +++++++++++++ mala/descriptors/in.bgridlocal_n3.python | 46 +++++++++++++++ .../in.ggrid_defaultproc_n3.python | 26 +++++++++ mala/descriptors/in.ggrid_n3.python | 33 +++++++++++ 7 files changed, 207 insertions(+), 4 deletions(-) create mode 100644 mala/descriptors/in.bgrid_n3.python create mode 100644 mala/descriptors/in.bgridlocal_defaultproc_n3.python create mode 100644 mala/descriptors/in.bgridlocal_n3.python create mode 100644 mala/descriptors/in.ggrid_defaultproc_n3.python create mode 100644 mala/descriptors/in.ggrid_n3.python diff --git a/mala/descriptors/bispectrum.py b/mala/descriptors/bispectrum.py index 46fa6848..3027b6bb 100755 --- a/mala/descriptors/bispectrum.py +++ b/mala/descriptors/bispectrum.py @@ -132,10 +132,10 @@ def __calculate_lammps(self, outdir, **kwargs): # general LAMMPS import. from lammps import constants as lammps_constants - if len(set(self._atoms.numbers)) > 2: + if len(set(self._atoms.numbers)) > 3: raise ValueError( - "MALA can only compute bispectrum descriptors for 1- or " - "2-element systems currently." + "MALA can only compute bispectrum descriptors up to " + "3-element systems currently." ) use_fp64 = kwargs.get("use_fp64", False) diff --git a/mala/descriptors/in.bgrid_n3.python b/mala/descriptors/in.bgrid_n3.python new file mode 100644 index 00000000..08ee0db7 --- /dev/null +++ b/mala/descriptors/in.bgrid_n3.python @@ -0,0 +1,57 @@ +# Calculate bispectrum descriptors on a 3D grid + +# pass in values ngridx, ngridy, ngridz, twojmax, rcutfac, atom_config_fname +# using command-line -var option + +# Initialize simulation + +units metal + +read_data ${atom_config_fname} + +mass * 1.0 + +# Needs to be defined for Kokkos +run_style verlet + +# define grid compute and atom compute + +group snapgroup type 1 2 3 +variable rfac0 equal 0.99363 +variable rmin0 equal 0 + +#variable radelem equal 0.5 +variable radelem1 equal 0.5 +variable radelem2 equal 0.5 +variable radelem3 equal 0.5 + +variable bzero equal 0 +variable quadratic equal 0 + +#variable snap_options string & +#"${rcutfac} ${rfac0} ${twojmax} ${radelem} ${wj} rmin0 ${rmin0} quadraticflag ${quadratic} bzeroflag ${bzero} switchflag ${switch}" + +#compute bgrid all sna/grid grid ${ngridx} ${ngridy} ${ngridz} ${snap_options} + +compute bgrid all sna/grid grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${rfac0} ${twojmax} ${radelem1} ${radelem2} ${radelem3} ${wj1} ${wj2} ${wj3} rmin0 ${rmin0} bzeroflag ${bzero} quadraticflag ${quadratic} switchflag ${switch} + + +# create dummy potential for neighbor list + + +# is this important? or does it just need to be big enough? +variable rcutneigh equal 2.0*${rcutfac}*${radelem1} +# for water +#variable rcutneigh equal 4.0*${rcutfac}*${radelem1} + +pair_style zero ${rcutneigh} +pair_coeff * * + +# define output + +thermo_style custom step temp ke pe vol c_bgrid[1][1] +thermo_modify norm yes + +# run + +run 0 diff --git a/mala/descriptors/in.bgridlocal_defaultproc_n2.python b/mala/descriptors/in.bgridlocal_defaultproc_n2.python index 826f8a23..b315d1d5 100644 --- a/mala/descriptors/in.bgridlocal_defaultproc_n2.python +++ b/mala/descriptors/in.bgridlocal_defaultproc_n2.python @@ -13,7 +13,7 @@ mass * 1.0 # define grid compute and atom compute -group snapgroup type 1 +group snapgroup type 1 2 variable rfac0 equal 0.99363 variable rmin0 equal 0 # variable wj1 equal 1 diff --git a/mala/descriptors/in.bgridlocal_defaultproc_n3.python b/mala/descriptors/in.bgridlocal_defaultproc_n3.python new file mode 100644 index 00000000..49d2a534 --- /dev/null +++ b/mala/descriptors/in.bgridlocal_defaultproc_n3.python @@ -0,0 +1,41 @@ +# Calculate bispectrum descriptors on a 3D grid + +# pass in values ngridx, ngridy, ngridz, twojmax, rcutfac, atom_config_fname +# using command-line -var option + +# Initialize simulation + +units metal + +read_data ${atom_config_fname} + +mass * 1.0 + +# define grid compute and atom compute + +group snapgroup type 1 2 3 +variable rfac0 equal 0.99363 +variable rmin0 equal 0 +variable wj1local equal ${wj1}-1.0e-15 # inject a bit of fuzz +variable wj2local equal ${wj2}-1.0e-15 # inject a bit of fuzz +variable wj3local equal ${wj2}-1.0e-15 # inject a bit of fuzz +variable radelem1 equal 0.5 +variable radelem2 equal 0.5 +variable radelem3 equal 0.5 +variable bzero equal 0 +variable quadratic equal 0 + +compute bgridlocal all sna/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${rfac0} ${twojmax} ${radelem1} ${radelem2} ${radelem3} ${wj1local} ${wj2local} ${wj3local} rmin0 ${rmin0} bzeroflag ${bzero} quadraticflag ${quadratic} switchflag ${switch} + +# is this important? or does it just need to be big enough? + +variable rcutneigh equal 2.0*${rcutfac}*${radelem1} + +pair_style zero ${rcutneigh} +pair_coeff * * + +# define output + +thermo_modify norm yes + +run 0 diff --git a/mala/descriptors/in.bgridlocal_n3.python b/mala/descriptors/in.bgridlocal_n3.python new file mode 100644 index 00000000..d4cf2fcf --- /dev/null +++ b/mala/descriptors/in.bgridlocal_n3.python @@ -0,0 +1,46 @@ +# Calculate bispectrum descriptors on a 3D grid + +# pass in values ngridx, ngridy, ngridz, twojmax, rcutfac, atom_config_fname +# using command-line -var option + +# set up processor grid to match QE +${lammps_procs} + +# Initialize simulation + +units metal + +read_data ${atom_config_fname} + +mass * 1.0 + +# is this important? or does it just need to be big enough? + +variable radelem1 equal 0.5 +variable radelem2 equal 0.5 +variable radelem3 equal 0.5 +variable rcutneigh equal 2.0*${rcutfac}*${radelem1} + +pair_style zero ${rcutneigh} +pair_coeff * * + +# set up plane cutoff values to evenly distribute grid points + +${zbal} + +# define grid compute and atom compute + +group snapgroup type 1 2 3 +variable rfac0 equal 0.99363 +variable rmin0 equal 0 +variable wj1local equal ${wj1}-1.0e-15 # inject a bit of fuzz +variable wj2local equal ${wj2}-1.0e-15 # inject a bit of fuzz +variable wj3local equal ${wj2}-1.0e-15 # inject a bit of fuzz +variable bzero equal 0 +variable quadratic equal 0 + +compute bgridlocal all sna/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${rfac0} ${twojmax} ${radelem1} ${radelem2} ${radelem3} ${wj1local} ${wj2local} ${wj3local} rmin0 ${rmin0} bzeroflag ${bzero} quadraticflag ${quadratic} switchflag ${switch} + +thermo_modify norm yes + +run 0 diff --git a/mala/descriptors/in.ggrid_defaultproc_n3.python b/mala/descriptors/in.ggrid_defaultproc_n3.python new file mode 100644 index 00000000..c3e34431 --- /dev/null +++ b/mala/descriptors/in.ggrid_defaultproc_n3.python @@ -0,0 +1,26 @@ +# Calculate Gaussian atomic density descriptors on a 3D grid + +# pass in values ngridx, ngridy, ngridz, sigma, atom_config_fname +# using command-line -var option + +# Initialize simulation + +units metal +read_data ${atom_config_fname} +mass * 1.0 + + +# is this important? or does it just need to be big enough? +variable radelem1 equal 0.5 +variable radelem2 equal 0.5 +variable radelem3 equal 0.5 +variable rcutneigh equal 2.0*${rcutfac}*${radelem1} + +pair_style zero ${rcutneigh} +pair_coeff * * + +compute ggrid all gaussian/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${radelem1} ${radelem2} ${radelem3} ${sigma1} ${sigma2} ${sigma3} + +thermo_modify norm yes + +run 0 diff --git a/mala/descriptors/in.ggrid_n3.python b/mala/descriptors/in.ggrid_n3.python new file mode 100644 index 00000000..e0a582bc --- /dev/null +++ b/mala/descriptors/in.ggrid_n3.python @@ -0,0 +1,33 @@ +# Calculate Gaussian atomic density descriptors on a 3D grid + +# pass in values ngridx, ngridy, ngridz, sigma, atom_config_fname +# using command-line -var option + +# set up processor grid to match QE +${lammps_procs} + +# Initialize simulation + +units metal +read_data ${atom_config_fname} +mass * 1.0 + + +# is this important? or does it just need to be big enough? +variable radelem1 equal 0.5 +variable radelem2 equal 0.5 +variable radelem3 equal 0.5 +variable rcutneigh equal 2.0*${rcutfac}*${radelem} + +pair_style zero ${rcutneigh} +pair_coeff * * + +# set up plane cutoff values to evenly distribute grid points +${zbal} + + +compute ggrid all gaussian/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${radelem1} ${radelem2} ${radelem3} ${sigma1} ${sigma2} ${sigma3} + +thermo_modify norm yes + +run 0