Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Oct 28, 2024
1 parent c38460f commit 33a54c2
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 44 deletions.
12 changes: 6 additions & 6 deletions deepmd/tf/nvnmd/entrypoints/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ def wrap(self):
# extend data according to the number of bits per row of BRAM
nbit = 32
if nvnmd_cfg.version == 0:
data = [hcfg, hfps, hbps, hswt, hdsw, hfea, hgra]
datas = [hcfg, hfps, hbps, hswt, hdsw, hfea, hgra]
keys = "cfg fps bps swt dsw fea gra".split()
if nvnmd_cfg.version == 1:
keys = "cfg fps bps swt dsw std fea gra gtt avc".split()
data = [hcfg, hfps, hbps, hswt, hdsw, hstd, hfea, hgra, hgtt, havc]
datas = [hcfg, hfps, hbps, hswt, hdsw, hstd, hfea, hgra, hgtt, havc]
nhs = []
nws = []
for ii in range(len(data)):
for ii in range(len(datas)):
k = keys[ii]
d = data[ii]
d = datas[ii]
h = len(d)
w = len(d[0]) # nhex
w4 = w * 4 # nbit
Expand All @@ -138,15 +138,15 @@ def wrap(self):
if jdata_sys["debug"]:
log.info("%s: %d x % d bit" % (k, h, w * 4))
FioTxt().save(f"nvnmd/wrap/h{k}.txt", d)
data[ii] = d
datas[ii] = d
# update h & w of nvnmd_cfg
nvnmd_cfg.size["NH_DATA"] = nhs
nvnmd_cfg.size["NW_DATA"] = nws
nvnmd_cfg.save(nvnmd_cfg.config_file)
head = self.wrap_head(nhs, nws)
# output model
hs = [*head]
for d in data:
for d in datas:
hs.extend(d)

FioBin().save(self.model_file, hs)
Expand Down
2 changes: 1 addition & 1 deletion doc/model/dplr.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pair_style deepmd ener.pb
pair_coeff * *
bond_style zero
bond_coeff *
special_bonds lj/could 1 1 1 angle no
special_bonds lj/coul 1 1 1 angle no
```

Type 1 and 2 (O and H) are `real_atom`s, while type 3 (WCs) are `virtual_atom`s. The model file `ener.pb` stores both the DW and DPLR models, so the position of WCs and the energy can be inferred from it. A virtual bond type is specified by `bond_style zero`. The `special_bonds` command switches off the exclusion of intramolecular interactions.
Expand Down
12 changes: 6 additions & 6 deletions examples/data_conv/OUTCAR
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
LEXCH = PE
EATOM = 432.3788 eV, 31.7789 Ry

TITLE = PAW_PBE O_h 06Feb2004
TITEL = PAW_PBE O_h 06Feb2004
LULTRA = F use ultrasoft PP ?
IUNSCR = 1 unscreen: 0-lin 1-nonlin 2-no
RPACOR = 0.800 partial core radius
Expand Down Expand Up @@ -93,7 +93,7 @@
LEXCH = PE
EATOM = 12.4884 eV, 0.9179 Ry

TITLE = PAW_PBE H_h 06Feb2004
TITEL = PAW_PBE H_h 06Feb2004
LULTRA = F use ultrasoft PP ?
IUNSCR = 0 unscreen: 0-lin 1-nonlin 2-no
RPACOR = 0.000 partial core radius
Expand Down Expand Up @@ -297,8 +297,8 @@ Space group operators:

Intra band minimization:
WEIMIN = 0.0000 energy-eigenvalue tresh-hold
EBREAK = 0.16E-09 absolute break condition
DEPER = 0.30 relative break condition
EBREAK = 0.16E-09 absolut break condition
DEPER = 0.30 relativ break condition

TIME = 0.40 timestep for ELM

Expand Down Expand Up @@ -339,7 +339,7 @@ Space group operators:
KINTER = 0 interpolate to denser k-point grid
CSHIFT =0.1000 complex shift for real part using Kramers Kronig
OMEGAMAX= -1.0 maximum frequency
DEG_THRESHOLD= 0.2000000E-02 threshold for treating states as degenerate
DEG_THRESHOLD= 0.2000000E-02 threshold for treating states as degnerate
RTIME = -0.100 relaxation time in fs
(WPLASMAI= 0.000 imaginary part of plasma frequency in eV, 0.658/RTIME)
DFIELD = 0.0000000 0.0000000 0.0000000 field for delta impulse in time
Expand Down Expand Up @@ -2475,7 +2475,7 @@ Space group operators:



General timing and accounting information for this job:
General timing and accounting informations for this job:
========================================================

Total CPU time used (sec): 877.816
Expand Down
4 changes: 2 additions & 2 deletions examples/water/dplr/lmp/in.lammps
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable KMESH equal 32
variable THERMO_FREQ equal 2
variable DUMP_FREQ equal 20
variable TEMP equal 300.000000
variable PRESS equal 1.000000
variable PRES equal 1.000000
variable TAU_T equal 0.100000
variable TAU_P equal 0.500000

Expand All @@ -33,7 +33,7 @@ pair_style deepmd ener.pb
pair_coeff * *
bond_style zero
bond_coeff *
special_bonds lj/could 1 1 1 angle no
special_bonds lj/coul 1 1 1 angle no

# kspace_style "pppm/dplr" should be used. in addition the
# gewald(1/distance) should be set the same as that used in
Expand Down
12 changes: 6 additions & 6 deletions source/lmp/tests/test_dplr.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def test_pair_deepmd_lr(lammps):
lammps.pair_coeff("* *")
lammps.bond_style("zero")
lammps.bond_coeff("*")
lammps.special_bonds("lj/could 1 1 1 angle no")
lammps.special_bonds("lj/coul 1 1 1 angle no")
lammps.kspace_style("pppm/dplr 1e-5")
lammps.kspace_modify(f"gewald {beta:.2f} diff ik mesh {mesh:d} {mesh:d} {mesh:d}")
lammps.fix(f"0 all dplr model {pb_file.resolve()} type_associate 1 3 bond_type 1")
Expand All @@ -410,7 +410,7 @@ def test_pair_deepmd_lr_efield_constant(lammps):
lammps.pair_coeff("* *")
lammps.bond_style("zero")
lammps.bond_coeff("*")
lammps.special_bonds("lj/could 1 1 1 angle no")
lammps.special_bonds("lj/coul 1 1 1 angle no")
lammps.fix(
f"0 all dplr model {pb_file.resolve()} type_associate 1 3 bond_type 1 efield 0 0 1"
)
Expand Down Expand Up @@ -446,7 +446,7 @@ def test_pair_deepmd_lr_efield_variable(lammps):
lammps.pair_coeff("* *")
lammps.bond_style("zero")
lammps.bond_coeff("*")
lammps.special_bonds("lj/could 1 1 1 angle no")
lammps.special_bonds("lj/coul 1 1 1 angle no")
lammps.fix(
f"0 all dplr model {pb_file.resolve()} type_associate 1 3 bond_type 1 efield 0 0 v_EFIELD_Z"
)
Expand Down Expand Up @@ -481,7 +481,7 @@ def test_min_dplr(lammps):
lammps.pair_coeff("* *")
lammps.bond_style("zero")
lammps.bond_coeff("*")
lammps.special_bonds("lj/could 1 1 1 angle no")
lammps.special_bonds("lj/coul 1 1 1 angle no")
lammps.kspace_style("pppm/dplr 1e-5")
lammps.kspace_modify(f"gewald {beta:.2f} diff ik mesh {mesh:d} {mesh:d} {mesh:d}")
lammps.fix(f"0 all dplr model {pb_file.resolve()} type_associate 1 3 bond_type 1")
Expand All @@ -505,7 +505,7 @@ def test_pair_deepmd_lr_type_map(lammps_type_map):
lammps_type_map.pair_coeff("* * H O")
lammps_type_map.bond_style("zero")
lammps_type_map.bond_coeff("*")
lammps_type_map.special_bonds("lj/could 1 1 1 angle no")
lammps_type_map.special_bonds("lj/coul 1 1 1 angle no")
lammps_type_map.kspace_style("pppm/dplr 1e-5")
lammps_type_map.kspace_modify(
f"gewald {beta:.2f} diff ik mesh {mesh:d} {mesh:d} {mesh:d}"
Expand Down Expand Up @@ -535,7 +535,7 @@ def test_pair_deepmd_lr_si(lammps_si):
lammps_si.pair_coeff("* *")
lammps_si.bond_style("zero")
lammps_si.bond_coeff("*")
lammps_si.special_bonds("lj/could 1 1 1 angle no")
lammps_si.special_bonds("lj/coul 1 1 1 angle no")
lammps_si.kspace_style("pppm/dplr 1e-5")
lammps_si.kspace_modify(
f"gewald {beta / constants.dist_metal2si:.6e} diff ik mesh {mesh:d} {mesh:d} {mesh:d}"
Expand Down
12 changes: 6 additions & 6 deletions source/tests/pt/model/test_dpa1.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_consistency(
dstd = rng.normal(size=(self.nt, nnei, 4))
dstd = 0.1 + np.abs(dstd)

for idt, sm, to, tm, prec, etc in itertools.product(
for idt, sm, to, tm, prec, ect in itertools.product(
[False, True], # resnet_dt
[False, True], # smooth_type_embedding
[False, True], # type_one_side
Expand All @@ -68,8 +68,8 @@ def test_consistency(
smooth_type_embedding=sm,
type_one_side=to,
tebd_input_mode=tm,
use_econf_tebd=etc,
type_map=["O", "H"] if etc else None,
use_econf_tebd=ect,
type_map=["O", "H"] if ect else None,
seed=GLOBAL_SEED,
).to(env.DEVICE)
dd0.se_atten.mean = torch.tensor(davg, dtype=dtype, device=env.DEVICE)
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_jit(
dstd = rng.normal(size=(self.nt, nnei, 4))
dstd = 0.1 + np.abs(dstd)

for idt, prec, sm, to, tm, etc in itertools.product(
for idt, prec, sm, to, tm, ect in itertools.product(
[
False,
], # resnet_dt
Expand Down Expand Up @@ -145,8 +145,8 @@ def test_jit(
smooth_type_embedding=sm,
type_one_side=to,
tebd_input_mode=tm,
use_econf_tebd=etc,
type_map=["O", "H"] if etc else None,
use_econf_tebd=ect,
type_map=["O", "H"] if ect else None,
seed=GLOBAL_SEED,
)
dd0.se_atten.mean = torch.tensor(davg, dtype=dtype, device=env.DEVICE)
Expand Down
12 changes: 6 additions & 6 deletions source/tests/pt/model/test_se_atten_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_consistency(
dstd = rng.normal(size=(self.nt, nnei, 4))
dstd = 0.1 + np.abs(dstd)

for idt, to, prec, etc in itertools.product(
for idt, to, prec, ect in itertools.product(
[False, True], # resnet_dt
[False, True], # type_one_side
[
Expand All @@ -64,8 +64,8 @@ def test_consistency(
precision=prec,
resnet_dt=idt,
type_one_side=to,
use_econf_tebd=etc,
type_map=["O", "H"] if etc else None,
use_econf_tebd=ect,
type_map=["O", "H"] if ect else None,
seed=GLOBAL_SEED,
).to(env.DEVICE)
dd0.se_atten.mean = torch.tensor(davg, dtype=dtype, device=env.DEVICE)
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_jit(
dstd = rng.normal(size=(self.nt, nnei, 4))
dstd = 0.1 + np.abs(dstd)

for idt, prec, to, etc in itertools.product(
for idt, prec, to, ect in itertools.product(
[
False,
], # resnet_dt
Expand All @@ -135,8 +135,8 @@ def test_jit(
precision=prec,
resnet_dt=idt,
type_one_side=to,
use_econf_tebd=etc,
type_map=["O", "H"] if etc else None,
use_econf_tebd=ect,
type_map=["O", "H"] if ect else None,
seed=GLOBAL_SEED,
)
dd0.se_atten.mean = torch.tensor(davg, dtype=dtype, device=env.DEVICE)
Expand Down
6 changes: 3 additions & 3 deletions source/tests/tf/test_data_large_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_data_mixed_type(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down Expand Up @@ -386,7 +386,7 @@ def test_stripped_data_mixed_type(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down Expand Up @@ -586,7 +586,7 @@ def test_compressible_data_mixed_type(self):
sess.run(tf.global_variables_initializer())
[e, f, v] = sess.run([energy, force, virial], feed_dict=feed_dict_test)
# print(sess.run(model.type_embedding))
# np.savetxt('tmp.out', sess.run(descrpt.doubt, feed_dict = feed_dict_test), fmt='%.10e')
# np.savetxt('tmp.out', sess.run(descrpt.dout, feed_dict = feed_dict_test), fmt='%.10e')
# # print(sess.run(model.atype_embed, feed_dict = feed_dict_test))
# print(sess.run(fitting.inputs, feed_dict = feed_dict_test))
# print(sess.run(fitting.outs, feed_dict = feed_dict_test))
Expand Down
4 changes: 2 additions & 2 deletions source/tests/tf/test_descrpt_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_descriptor_hybrid(self):

type_embedding = typeebd.build(ntypes, suffix="_hybrid")

doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand All @@ -115,7 +115,7 @@ def test_descriptor_hybrid(self):

sess = self.cached_session().__enter__()
sess.run(tf.global_variables_initializer())
[model_dout] = sess.run([doubt], feed_dict=feed_dict_test)
[model_dout] = sess.run([dout], feed_dict=feed_dict_test)

ref_dout1 = [
1.34439289e-03,
Expand Down
12 changes: 6 additions & 6 deletions source/tests/tf/test_type_one_side.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_descriptor_one_side_exclude_types(self):

# successful
descrpt = Descriptor(**jdata["model"]["descriptor"])
doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand Down Expand Up @@ -125,8 +125,8 @@ def test_descriptor_one_side_exclude_types(self):

with self.cached_session() as sess:
sess.run(tf.global_variables_initializer())
[model_dout1] = sess.run([doubt], feed_dict=feed_dict_test1)
[model_dout2] = sess.run([doubt], feed_dict=feed_dict_test2)
[model_dout1] = sess.run([dout], feed_dict=feed_dict_test1)
[model_dout2] = sess.run([dout], feed_dict=feed_dict_test2)
[model_dout1_failed] = sess.run([dout_failed], feed_dict=feed_dict_test1)
[model_dout2_failed] = sess.run([dout_failed], feed_dict=feed_dict_test2)
model_dout1 = model_dout1.reshape([6, -1])
Expand Down Expand Up @@ -175,7 +175,7 @@ def test_se_r_one_side_exclude_types(self):

# successful
descrpt = Descriptor(**jdata["model"]["descriptor"])
doubt = descrpt.build(
dout = descrpt.build(
t_coord,
t_type,
t_natoms,
Expand Down Expand Up @@ -231,8 +231,8 @@ def test_se_r_one_side_exclude_types(self):

with self.cached_session() as sess:
sess.run(tf.global_variables_initializer())
[model_dout1] = sess.run([doubt], feed_dict=feed_dict_test1)
[model_dout2] = sess.run([doubt], feed_dict=feed_dict_test2)
[model_dout1] = sess.run([dout], feed_dict=feed_dict_test1)
[model_dout2] = sess.run([dout], feed_dict=feed_dict_test2)
[model_dout1_failed] = sess.run([dout_failed], feed_dict=feed_dict_test1)
[model_dout2_failed] = sess.run([dout_failed], feed_dict=feed_dict_test2)
model_dout1 = model_dout1.reshape([6, -1])
Expand Down

0 comments on commit 33a54c2

Please sign in to comment.