-
Notifications
You must be signed in to change notification settings - Fork 47
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
A draft for read and write bond type for lammps data #478
base: master
Are you sure you want to change the base?
Conversation
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.
Sorry for the very long delay for the review. This looks pretty good overall!
My main concern is about the handling of bond types in the LAMMPS code. It looks like currently the code will create a set containing all bonds, where we would like to only have one entry per bond type (which should be a much smaller number).
I think the code should try to look for bond types in the topology, and if it can not find one, fallback to the old bond type generation.
The new bond type parameter to add_bond
should also be added to the C API, to make it accessible from Python/Rust/Julia/...
/// @param atom_j the index of the second atom in the bond | ||
/// @throws OutOfBounds if `atom_i` or `atom_j` are greater than `size()` | ||
/// @throws Error if no bond between `atom_i` and `atom_j` exists. | ||
std::string bond_type(size_t atom_i, size_t atom_j) const; |
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.
std::string bond_type(size_t atom_i, size_t atom_j) const; | |
const std::string& bond_type(size_t atom_i, size_t atom_j) const; |
this should return a const reference instead of a copy
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
Co-authored-by: Guillaume Fraux <luthaf@luthaf.fr>
@Luthaf Hi, sorry for bothering you. |
I'm not sure I understand here. |
Dear @Luthaf and other developers,
According to the previous discussion #476 , I write an untested draft that read and write bond type from lammps data file. In this PR, I want to read and write bond/angle/dihedral data from lammps data and trajectory.
Since issue #462 is planning to support symbolic atom type, I choose std::string as the representation for bond type.
In the following code, I completely complied with the storage method of BondOrder. But here I want to initiate a discussion about whether to use
bond type
or evenbond order
as a member attribute ofBond
, liketype
inAtom
. I think the benefits are as follows: The form is tidier, and the bond information can be obtained directly by iteratingtopology.bonds
I hope you can review my code in your free time so that I can complete these features in the future~
Thanks a lot!