Skip to content

Commit 9268ce3

Browse files
Merge branch 'master' into cluster_computed_fix
2 parents 2b1c728 + 9002001 commit 9268ce3

8 files changed

Lines changed: 282 additions & 153 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import print_function
3+
"""
4+
This example uses the marconi cluster
5+
to submit a force and energy calculation of a subset of 10 configurations
6+
from the simple ensemble
7+
"""
8+
9+
import ase
10+
11+
import cellconstructor as CC
12+
import cellconstructor.Phonons
13+
14+
from cellconstructor.calculators import Espresso
15+
16+
import sscha
17+
import sscha.Ensemble
18+
import sscha.Cluster
19+
20+
# Load the dynamical matrix
21+
dyn = CC.Phonons.Phonons("dyn")
22+
ens = sscha.Ensemble.Ensemble(dyn, 0)
23+
24+
# Generate a random ensemble
25+
ens.generate(10)
26+
27+
# Prepare the espresso calculator
28+
# NOTE: these files should be located in the cluster $HOME/espresso/pseudo directory
29+
pseudo = {"H": "H.upf",
30+
"O": "O.upf"}
31+
32+
input_data = {
33+
"control" : {
34+
"disk_io" : "none",
35+
"tprnfor" : True,
36+
"tstress" : True,
37+
},
38+
"system" : {
39+
"ecutwfc" : 45,
40+
"input_dft" : "pbe",
41+
"ecutrho" : 45*8,
42+
"occupations" : "fixed"},
43+
"electrons" : {
44+
"conv_thr" : 1e-8
45+
}
46+
}
47+
KPTS = (3,3,2) # K points
48+
49+
calc = Espresso(input_data = input_data, pseudopotentials = pseudo, kpts = KPTS)
50+
51+
# Prepare the cluster
52+
# marconi (setted from .ssh_config) => pippo@login.marconi.cineca.it
53+
# No pwd, login with private key
54+
cluster = sscha.LocalCluster.LocalCluster("localhost",
55+
binary="pw.x -npool NPOOL -i PREFIX.pwi > PREFIX.pwo")
56+
57+
# Setup the working directory
58+
cluster.workdir = "$SCRATCH/sscha_prova"
59+
cluster.n_nodes = 1
60+
cluster.n_cpu = 32
61+
cluster.account_name = "IscrC_TDSTO"
62+
cluster.n_pool = 4
63+
cluster.partition_name = "g100_usr_prod"
64+
cluster.load_modules = """
65+
module load profile/chem-phys
66+
module load autoload qe
67+
68+
export OMP_NUM_THREADS=1
69+
"""
70+
71+
cluster.setup_workdir()
72+
73+
print("Sending the ensemble for the calculation.")
74+
cluster.compute_ensemble(ens, calc)
75+
76+
ens.save_bin(".")
77+
print("Ensemble saved.")

0 commit comments

Comments
 (0)