Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
yomichi committed Nov 6, 2024
1 parent 12b81bd commit 102d833
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 48 deletions.
6 changes: 3 additions & 3 deletions examples/active_learning_qe/AL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
# source XXX

echo start AL sample
srun -n 8 abics_mlref input.toml >> abics_mlref.out
srun -n 8 abics_mlref input-aenet.toml >> abics_mlref.out

echo start parallel_run 1
sh parallel_run.sh

echo start AL final
srun -n 8 abics_mlref input.toml >> abics_mlref.out
srun -n 8 abics_mlref input-aenet.toml >> abics_mlref.out

#train
# module purge
# module load intel_compiler/2020.2.254
# module load intel_mpi/2020.2.254

echo start training
abics_train input.toml >> abics_train.out
abics_train input-aenet.toml >> abics_train.out

echo Done
2 changes: 1 addition & 1 deletion examples/active_learning_qe/MC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
# source XXX

#sleep 30
srun -n 8 abics_sampling input.toml >> abics_sampling.out
srun -n 8 abics_sampling input-aenet.toml >> abics_sampling.out

echo Done
38 changes: 0 additions & 38 deletions examples/active_learning_qe/calc_DOI.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.

from mpi4py import MPI
from pymatgen.core import Structure
from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator
import os, sys
import numpy as np
import scipy.constants as constants
from abics.mc_mpi import RXParams

throwout = 1
tomlfile = sys.argv[1] if len(sys.argv) > 1 else "input.toml"
rxparams = RXParams.from_toml(tomlfile)
nreplicas = rxparams.nreplicas
comm = MPI.COMM_WORLD

spinel_struct = Structure.from_file("MgAl2O4.vasp")
Asite_struct = spinel_struct.copy()
Expand All @@ -51,30 +40,3 @@ def calc_DOI(structure):
x += 1
x /= float(len(asites))
return x


myT = comm.Get_rank()
kTs = np.load(open("./kTs.npy", "rb"))

if myT < nreplicas:
Trank_hist = np.load(open(str(myT) + "/Trank_hist.npy", "rb"))
nstep = len(Trank_hist)
os.chdir("Tseparate/{}".format(myT))
DOI = []
for i in range(nstep):
DOI.append(calc_DOI(Structure.from_file("structure.{}.vasp".format(i))))
DOI = np.array(DOI)
np.savetxt("DOI.dat", DOI)
DOImean = DOI[throwout:].mean()
os.chdir("..")
myT_kelvin = kTs[myT] / constants.value(u"Boltzmann constant in eV/K")

for i in range(len(kTs)):
comm.Barrier()
if myT != i:
continue
outfi = open("DOI_T.dat", "a")
outfi.write("{:6.1f} \t".format(myT_kelvin))
outfi.write("{}\n".format(DOImean))
outfi.close()

7 changes: 5 additions & 2 deletions examples/active_learning_qe/input-aenet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,8 @@ num = 8 #216 #8000


[observer]
reference_structure = "MgAl2O4.vasp"
ignored_species = ["Al", "O"]
[[observer.solver]]
name = "DOI"
type = "user"
function = "calc_DOI.calc_DOI"
perturb = 0.0
7 changes: 5 additions & 2 deletions examples/active_learning_qe/input-mlip-3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,8 @@ num = 8 #216 #8000


[observer]
reference_structure = "MgAl2O4.vasp"
ignored_species = ["Al", "O"]
[[observer.solver]]
name = "DOI"
type = "user"
function = "calc_DOI.calc_DOI"
perturb = 0.0
7 changes: 5 additions & 2 deletions examples/active_learning_qe/input-nequip.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,8 @@ num = 8 #216 #8000


[observer]
reference_structure = "MgAl2O4.vasp"
ignored_species = ["Al", "O"]
[[observer.solver]]
name = "DOI"
type = "user"
function = "calc_DOI.calc_DOI"
perturb = 0.0

0 comments on commit 102d833

Please sign in to comment.