Skip to content

Commit

Permalink
delete normalize modification because it is getting worse
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengqian-Zhang committed Sep 24, 2023
1 parent 4a7b41e commit f91ad7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions deepmd_pt/model/model/ener.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def __init__(
descriptor['ntypes'] = ntypes
self.combination = descriptor.get('combination',False)
if(self.combination):
import logging
logging.info("combination right")
self.prefactor=descriptor.get('prefactor', [0.5,0.5])
self.descriptor_type = descriptor['type']

Expand Down
11 changes: 8 additions & 3 deletions deepmd_pt/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,14 @@ def single_preprocess(self, batch, sid):
return batch
else:
batch['clean_type'] = clean_type
batch['clean_coord'] = clean_coord
'''
if self.pbc:
_clean_coord = normalize_coord(clean_coord, region, nloc)
else:
_clean_coord = clean_coord.clone()
batch['clean_coord'] = _clean_coord
'''
# add noise
for i in range(self.max_fail_num):
mask_num = 0
Expand Down Expand Up @@ -591,13 +594,13 @@ def single_preprocess(self, batch, sid):
)
else:
NotImplementedError(f"Unknown noise type {self.noise_type}!")
noised_coord = _clean_coord.clone().detach()
noised_coord = clean_coord.clone().detach()
noised_coord[coord_mask] += noise_on_coord
batch['coord_mask'] = torch.tensor(coord_mask,
dtype=torch.bool,
device=env.PREPROCESS_DEVICE)
else:
noised_coord = _clean_coord
noised_coord = clean_coord
batch['coord_mask'] = torch.tensor(np.zeros_like(coord_mask, dtype=np.bool),
dtype=torch.bool,
device=env.PREPROCESS_DEVICE)
Expand All @@ -615,7 +618,8 @@ def single_preprocess(self, batch, sid):
dtype=torch.bool,
device=env.PREPROCESS_DEVICE)
if self.pbc:
_coord = region.move_noised_coord_all_in_box(noised_coord, _clean_coord)
_coord = normalize_coord(noised_coord, region, nloc)
#_coord = region.move_noised_coord_all_in_box(noised_coord, _clean_coord)
else:
_coord = noised_coord.clone()
batch['coord'] = _coord
Expand All @@ -630,6 +634,7 @@ def single_preprocess(self, batch, sid):
RuntimeError(f"Add noise times beyond max tries {self.max_fail_num}!")
continue
batch['atype'] = masked_type
batch['coord'] = noised_coord
batch['nlist'] = nlist
batch['nlist_loc'] = nlist_loc
batch['nlist_type'] = nlist_type
Expand Down

0 comments on commit f91ad7b

Please sign in to comment.