Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init Struct Energy for Train Mode 1 and 2 #770

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

BBBuZHIDAO
Copy link
Contributor

This PR is for #763

There is no initialization for energy if train_mode equals to 1 or 2.
image

When I fix it, the Total Loss is not nan.
image

DIfferent Results (?

I use -DDEBUG flag to compile and compare the loss.out file from initialized and non initialized code. It shows that other columns are also different. The loss.out files are below: (I have removed nep.restart file each time)
loss.out.raw.txt
loss.out.fix.txt

One More Thing

There are many ways to solve this bug. I recommend that initialize it in struct definition. And if it's allowed, make sure all variables will be initialized. This work will not make the code slower but will make it more robust.

@brucefan1983
Copy link
Owner

great finding.

@brucefan1983 brucefan1983 merged commit 3007dba into brucefan1983:master Oct 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants