From a0ff2581eec248e4cb8187823ce23b60fdb4ec78 Mon Sep 17 00:00:00 2001 From: Lenz Fiedler Date: Tue, 19 Nov 2024 09:23:42 +0100 Subject: [PATCH] Parallel processing works in principle --- mala/descriptors/bispectrum.py | 11 +++-- ...on => in.bgridlocal_defaultproc_n1.python} | 0 .../in.bgridlocal_defaultproc_n2.python | 41 +++++++++++++++++ ...idlocal.python => in.bgridlocal_n1.python} | 0 mala/descriptors/in.bgridlocal_n2.python | 46 +++++++++++++++++++ 5 files changed, 95 insertions(+), 3 deletions(-) rename mala/descriptors/{in.bgridlocal_defaultproc.python => in.bgridlocal_defaultproc_n1.python} (100%) create mode 100644 mala/descriptors/in.bgridlocal_defaultproc_n2.python rename mala/descriptors/{in.bgridlocal.python => in.bgridlocal_n1.python} (100%) create mode 100644 mala/descriptors/in.bgridlocal_n2.python diff --git a/mala/descriptors/bispectrum.py b/mala/descriptors/bispectrum.py index 691012cff..3c5ca514a 100755 --- a/mala/descriptors/bispectrum.py +++ b/mala/descriptors/bispectrum.py @@ -171,11 +171,17 @@ 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.bgridlocal.python" + filepath, + "in.bgridlocal_n{0}.python".format( + len(set(self.atoms.numbers)) + ), ) else: self.parameters.lammps_compute_file = os.path.join( - filepath, "in.bgridlocal_defaultproc.python" + filepath, + "in.bgridlocal_defaultproc_n{0}.python".format( + len(set(self.atoms.numbers)) + ), ) else: self.parameters.lammps_compute_file = os.path.join( @@ -184,7 +190,6 @@ def __calculate_lammps(self, outdir, **kwargs): len(set(self.atoms.numbers)) ), ) - # Do the LAMMPS calculation and clean up. lmp.file(self.parameters.lammps_compute_file) diff --git a/mala/descriptors/in.bgridlocal_defaultproc.python b/mala/descriptors/in.bgridlocal_defaultproc_n1.python similarity index 100% rename from mala/descriptors/in.bgridlocal_defaultproc.python rename to mala/descriptors/in.bgridlocal_defaultproc_n1.python diff --git a/mala/descriptors/in.bgridlocal_defaultproc_n2.python b/mala/descriptors/in.bgridlocal_defaultproc_n2.python new file mode 100644 index 000000000..00d06456e --- /dev/null +++ b/mala/descriptors/in.bgridlocal_defaultproc_n2.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 +variable rfac0 equal 0.99363 +variable rmin0 equal 0 +variable wj1 equal 1 +variable wj2 equal 1 +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 radelem1 equal 0.5 +variable radelem2 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} ${wj1local} ${wj2local} 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.python b/mala/descriptors/in.bgridlocal_n1.python similarity index 100% rename from mala/descriptors/in.bgridlocal.python rename to mala/descriptors/in.bgridlocal_n1.python diff --git a/mala/descriptors/in.bgridlocal_n2.python b/mala/descriptors/in.bgridlocal_n2.python new file mode 100644 index 000000000..11e75fbe8 --- /dev/null +++ b/mala/descriptors/in.bgridlocal_n2.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 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 +variable rfac0 equal 0.99363 +variable rmin0 equal 0 +variable wj1 equal 1 +variable wj2 equal 1 +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 bzero equal 0 +variable quadratic equal 0 + +compute bgridlocal all sna/grid/local grid ${ngridx} ${ngridy} ${ngridz} ${rcutfac} ${rfac0} ${twojmax} ${radelem1} ${radelem2} ${wj1local} ${wj2local} rmin0 ${rmin0} bzeroflag ${bzero} quadraticflag ${quadratic} switchflag ${switch} + +thermo_modify norm yes + +run 0