From a6ff4c31ec8ddba974202358e44952bc060f23d4 Mon Sep 17 00:00:00 2001 From: Lenz Fiedler Date: Mon, 2 Dec 2024 12:26:43 +0100 Subject: [PATCH] Added runfiles for multielement Gaussian grid --- mala/descriptors/atomic_density.py | 24 +++++++++++--- ....python => in.ggrid_defaultproc_n1.python} | 0 .../in.ggrid_defaultproc_n2.python | 25 +++++++++++++++ mala/descriptors/in.ggrid_n1.python | 32 +++++++++++++++++++ .../{in.ggrid.python => in.ggrid_n2.python} | 5 +-- 5 files changed, 80 insertions(+), 6 deletions(-) rename mala/descriptors/{in.ggrid_defaultproc.python => in.ggrid_defaultproc_n1.python} (100%) create mode 100644 mala/descriptors/in.ggrid_defaultproc_n2.python create mode 100644 mala/descriptors/in.ggrid_n1.python rename mala/descriptors/{in.ggrid.python => in.ggrid_n2.python} (83%) diff --git a/mala/descriptors/atomic_density.py b/mala/descriptors/atomic_density.py index 4459c838b..558f66957 100755 --- a/mala/descriptors/atomic_density.py +++ b/mala/descriptors/atomic_density.py @@ -150,9 +150,16 @@ def __calculate_lammps(self, outdir, **kwargs): # Create LAMMPS instance. lammps_dict = { - "sigma": self.parameters.atomic_density_sigma, "rcutfac": self.parameters.atomic_density_cutoff, } + if len(set(self._atoms.numbers)) == 1: + lammps_dict["sigma"] = self.parameters.atomic_density_sigma + else: + for i in range(len(set(self._atoms.numbers))): + lammps_dict["sigma" + str(i + 1)] = ( + self.parameters.atomic_density_sigma + ) + lmp = self._setup_lammps(nx, ny, nz, lammps_dict) # For now the file is chosen automatically, because this is used @@ -161,15 +168,24 @@ def __calculate_lammps(self, outdir, **kwargs): if self.parameters._configuration["mpi"]: if self.parameters.use_z_splitting: self.parameters.lammps_compute_file = os.path.join( - filepath, "in.ggrid.python" + filepath, + "in.ggrid_n{0}.python".format( + len(set(self._atoms.numbers)) + ), ) else: self.parameters.lammps_compute_file = os.path.join( - filepath, "in.ggrid_defaultproc.python" + filepath, + "in.ggrid_defaultproc_n{0}.python".format( + len(set(self._atoms.numbers)) + ), ) else: self.parameters.lammps_compute_file = os.path.join( - filepath, "in.ggrid_defaultproc.python" + filepath, + "in.ggrid_defaultproc_n{0}.python".format( + len(set(self._atoms.numbers)) + ), ) # Do the LAMMPS calculation and clean up. diff --git a/mala/descriptors/in.ggrid_defaultproc.python b/mala/descriptors/in.ggrid_defaultproc_n1.python similarity index 100% rename from mala/descriptors/in.ggrid_defaultproc.python rename to mala/descriptors/in.ggrid_defaultproc_n1.python diff --git a/mala/descriptors/in.ggrid_defaultproc_n2.python b/mala/descriptors/in.ggrid_defaultproc_n2.python new file mode 100644 index 000000000..dbcd4884b --- /dev/null +++ b/mala/descriptors/in.ggrid_defaultproc_n2.python @@ -0,0 +1,25 @@ +# 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 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} ${sigma1} ${sigma2} + +thermo_modify norm yes + +run 0 diff --git a/mala/descriptors/in.ggrid_n1.python b/mala/descriptors/in.ggrid_n1.python new file mode 100644 index 000000000..c7821beec --- /dev/null +++ b/mala/descriptors/in.ggrid_n1.python @@ -0,0 +1,32 @@ +# 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 rcutneigh equal 2.0*${rcutfac}*${radelem1} + +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} ${sigma1} ${sigma2} + +thermo_modify norm yes + +run 0 diff --git a/mala/descriptors/in.ggrid.python b/mala/descriptors/in.ggrid_n2.python similarity index 83% rename from mala/descriptors/in.ggrid.python rename to mala/descriptors/in.ggrid_n2.python index 265eac8f8..ad362b50a 100644 --- a/mala/descriptors/in.ggrid.python +++ b/mala/descriptors/in.ggrid_n2.python @@ -14,7 +14,8 @@ mass * 1.0 # is this important? or does it just need to be big enough? -variable radelem equal 0.5 +variable radelem1 equal 0.5 +variable radelem2 equal 0.5 variable rcutneigh equal 2.0*${rcutfac}*${radelem} pair_style zero ${rcutneigh} @@ -24,7 +25,7 @@ pair_coeff * * ${zbal} -compute ggrid all gaussian/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${radelem} ${sigma} +compute ggrid all gaussian/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${radelem1} ${radelem2} ${sigma1} ${sigma2} thermo_modify norm yes