Skip to content

Commit f845565

Browse files
authored
Merge pull request #258 from lee2tae/develop/omni
ML-IAP pytest code
2 parents a733895 + 4c650b9 commit f845565

5 files changed

Lines changed: 401 additions & 10 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
python: python3.11
2+
python: python3.10
33

44
ci:
55
autoupdate_schedule: quarterly

sevenn/main/sevenn_get_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def run(args):
9393
if output_prefix is None:
9494
output_prefix = 'deployed_parallel' if not get_serial else 'deployed_serial'
9595

96-
if use_mliap:
97-
output_prefix += '_mliap'
96+
if use_mliap:
97+
output_prefix += '_mliap'
9898

9999
checkpoint_path = None
100100
if os.path.isfile(checkpoint):

sevenn/mliap.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,34 @@ def compute_forces(self, lmp_data):
176176
self._ensure_model_initialized() # lazy init
177177
assert self.model, 'Model must be initialized'
178178
if lmp_data.nlocal == 0 or lmp_data.npairs <= 1:
179-
# waht about a single atom with 0 pairs?
179+
# what about a single atom with 0 pairs?
180180
return
181181

182182
nlocal = lmp_data.nlocal
183183
ntotal = lmp_data.ntotal
184184

185185
# edge_vectors should be f32 in 7net
186-
edge_vectors = torch.as_tensor(lmp_data.rij, torch.float32, self.device)
186+
edge_vectors = torch.as_tensor(
187+
lmp_data.rij, dtype=torch.float32, device=self.device
188+
)
187189
edge_vectors.requires_grad_(True)
188190

189191
edge_index = torch.vstack(
190192
[
191-
torch.as_tensor(lmp_data.pair_i, torch.int64, self.device),
192-
torch.as_tensor(lmp_data.pair_j, torch.int64, self.device),
193+
torch.as_tensor(
194+
lmp_data.pair_i, dtype=torch.int64, device=self.device
195+
),
196+
torch.as_tensor(
197+
lmp_data.pair_j, dtype=torch.int64, device=self.device
198+
),
193199
]
194200
)
195-
elems = torch.as_tensor(lmp_data.elems, torch.int64, self.device)
196-
num_atoms = torch.as_tensor(nlocal, torch.int64, self.device)
201+
elems = torch.as_tensor(
202+
lmp_data.elems, dtype=torch.int64, device=self.device
203+
)
204+
num_atoms = torch.as_tensor(nlocal, dtype=torch.int64, device=self.device)
197205
mliap_num_local_ghost = torch.as_tensor(
198-
[nlocal, ntotal - nlocal], torch.int64, self.device
206+
[nlocal, ntotal - nlocal], dtype=torch.int64, device=self.device
199207
)
200208

201209
# data prep
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
units metal
2+
boundary __BOUNDARY__
3+
atom_style atomic
4+
atom_modify map yes
5+
newton on
6+
7+
read_data __LMP_STCT__
8+
9+
mass * 1.0 # do not matter since we don't run MD
10+
11+
pair_style mliap unified __PAIR_STYLE__ 0
12+
pair_coeff * * __ELEMENT__
13+
14+
timestep 0.002
15+
16+
compute pa all pe/atom
17+
18+
thermo 1
19+
fix 1 all nve
20+
thermo_style custom step tpcpu pe ke vol pxx pyy pzz pxy pxz pyz press temp
21+
dump mydump all custom 1 __FORCE_DUMP_PATH__ id type element c_pa x y z fx fy fz
22+
dump_modify mydump sort id element __ELEMENT__
23+
24+
run 0

0 commit comments

Comments
 (0)