-
Notifications
You must be signed in to change notification settings - Fork 137
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
Adding a function that could deal with the magnetic_force and spin when using the ABACUS's deltaspin module #657
Conversation
WalkthroughThe recent update focuses on code quality improvements, reorganization, and minor functional enhancements across multiple files. Key changes include fixing import statements, reformatting code, and adding new functions to handle specific data in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Out of diff range and nitpick comments (1)
dpdata/abacus/scf.py (1)
Line range hint
370-401
: Remove commented-out print statements.Commented-out code should be removed to maintain code cleanliness.
- # print(force_deltaspin) - # print(coords_deltaspin) - # print(spin) - # print(mag_forces) - # print(force) - # print(coords) - # print("atom_names = ", data['atom_names']) - # print("natoms = ", data['atom_numbs']) - # print("types = ", data['atom_types']) - # print("cells = ", data['cells']) - # print("coords = ", data['coords']) - # print("energy = ", data['energies']) - # print("force = ", data['forces']) - # print("virial = ", data['virials']) - # print("spin = ", data['spin']) - # print("mag_forces = ", data['mag_forces']) - # print("force_deltaspin = ", data['force_deltaspin']) - # print("coords_deltaspin = ", data['coords_deltaspin'])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
…nto my-fix-branch
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Out of diff range and nitpick comments (7)
dpdata/abacus/scf.py (7)
Line range hint
26-26
: Use format specifiers instead of percent format for better readability and consistency.- print("Can not find file %s" % ifile) + print("Can not find file {}".format(ifile))
Line range hint
94-94
: Use format specifiers instead of percent format for better readability and consistency.- print("coord_type = %s" % coord_type) + print("coord_type = {}".format(coord_type))
Line range hint
134-134
: Use format specifiers instead of percent format for better readability and consistency.- print("Input coordination type is invalid.\n Only direct and cartesian are accepted.") + print("Input coordination type is invalid.\n Only direct and cartesian are accepted.")
Line range hint
527-527
: Use format specifiers instead of percent format for better readability and consistency.- out += "%.3f " % mass[iele] + out += "{:.3f} ".format(mass[iele])
Line range hint
531-531
: Use format specifiers instead of percent format for better readability and consistency.- out += "%s\n" % pp_file[iele] + out += "{}\n".format(pp_file[iele])
Line range hint
540-540
: Use format specifiers instead of percent format for better readability and consistency.- out += "%s\n" % numerical_orbital[iele] + out += "{}\n".format(numerical_orbital[iele])
Line range hint
545-545
: Use format specifiers instead of percent format for better readability and consistency.- out += "NUMERICAL_DESCRIPTOR\n%s\n" % numerical_descriptor + out += "NUMERICAL_DESCRIPTOR\n{}\n".format(numerical_descriptor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
…nto my-fix-branch
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Out of diff range and nitpick comments (7)
dpdata/abacus/scf.py (7)
Line range hint
26-26
: Use format specifiers instead of percent format for better readability and consistency.- print("Can not find file %s" % ifile) + print("Can not find file {}".format(ifile))
Line range hint
94-94
: Use format specifiers instead of percent format for better readability and consistency.- print("coord_type = %s" % coord_type) + print("coord_type = {}".format(coord_type))
Line range hint
134-134
: Use format specifiers instead of percent format for better readability and consistency.- path_out = os.path.join(fname, "OUT.%s/running_scf.log" % suffix) + path_out = os.path.join(fname, "OUT.{}/running_scf.log".format(suffix))
Line range hint
530-530
: Use format specifiers instead of percent format for better readability and consistency.- inlines = ["ntype %d" % nele] + inlines = ["ntype {}".format(nele)]
Line range hint
534-534
: Use format specifiers instead of percent format for better readability and consistency.- out += "%.3f " % mass[iele] + out += "{:.3f} ".format(mass[iele])
Line range hint
543-543
: Use format specifiers instead of percent format for better readability and consistency.- out += "%s\n" % pp_file[iele] + out += "{}\n".format(pp_file[iele])
Line range hint
548-548
: Use format specifiers instead of percent format for better readability and consistency.- out += "%s\n" % numerical_orbital[iele] + out += "{}\n".format(numerical_orbital[iele])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
…nto my-fix-branch
@amcadmus @chazeon I cloned the original dpdata code into my local space. But failed to pip install with these codes. Now, I add some function into the dpdata to deal with the deltaspin_scf abacus calculation results. And now, it failed with the PR process. I checked my code. It should be workable. Could you please help me with it?
|
for more information, see https://pre-commit.ci
…nto my-fix-branch
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
for more information, see https://pre-commit.ci
…nto my-fix-branch
for more information, see https://pre-commit.ci
…nto my-fix-branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you changed the line ending of each file from LF to CRLF, which should be reverted
Signed-off-by: Jinzhe Zeng <[email protected]>
I don't know in what step led me to make this mistake. I will change the format and resubmit again. |
for more information, see https://pre-commit.ci
data["mag_forces"] = mag_forces[np.newaxis, :, :] | ||
data["spin"] = spin[np.newaxis, :, :] | ||
data["coords_deltaspin"] = coords_deltaspin[np.newaxis, :, :] | ||
data["force_deltaspin"] = force_deltaspin[np.newaxis, :, :] | ||
data["deltaspin"] = deltaspin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, these data types should be added to DTYPES
, otherwise I don't think indexing, slicing, or appending will work.
Lines 1193 to 1198 in 1d87e82
DTYPES: tuple[DataType, ...] = System.DTYPES + ( | |
DataType("energies", np.ndarray, (Axis.NFRAMES,)), | |
DataType("forces", np.ndarray, (Axis.NFRAMES, Axis.NATOMS, 3)), | |
DataType("virials", np.ndarray, (Axis.NFRAMES, 3, 3), required=False), | |
DataType("atom_pref", np.ndarray, (Axis.NFRAMES, Axis.NATOMS), required=False), | |
) |
# print("spin = ", data['spin']) | ||
# print("mag_forces = ", data['mag_forces']) | ||
# print("force_deltaspin = ", data['force_deltaspin']) | ||
# print("coords_deltaspin = ", data['coords_deltaspin']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented codes should be removed
Adding a new function, two files were changed.
I add three parameters in the data when reading data from the OUT.ABACUS/running_scf.log.
When we use the deltaspin module during the scf calculation, the dpdata could grep the magnetic force and spin to the system and print the modified coords.npy and forces.npy.
Summary by CodeRabbit
Bug Fixes
py3Dmol
to ensure proper functionality.Refactor
Chores
.pre-commit-config.yaml
with new URLs and revisions for repositories..gitattributes
to enforce line endings for Python test files.