-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New CHARMM package #4245
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
base: develop
Are you sure you want to change the base?
New CHARMM package #4245
Conversation
copying my comment from Slack over here: I like your ideas, in general. Additional label maps could fit into the bigger idea of having an arbitrary number of label maps, with a convention for specifying the label map name before the type label. These label map names could be created by the user, or by commands such as your psf reader. This functionality was the direction we were going in the original type labels PR, but we delayed this 'advanced' feature in favor of getting type labels implemented with fewer complications. |
@alphataubio @jrgissing I disagree with (ab-)using label maps for storing generic properties. For that we have fix STORE/ATOM or fix property/atom, depending on whether users should have direct access to them or not. As for the read_psf command, I fail to see it creating atoms, bonds, angles, dihedrals, impropers, cmaps. Also there are several variants of PSF files with different formats (x-plor vs. charmm format and CMAP, CHEQ, and EXT variants). At the very least it should be flagged with an error, if an unsupported format is encountered. As for the write_psf command, it is bad idea to use MPI_Allreduce() here. This needlessly blows up the memory requirements and also limits how large a system can be handled. Instead constructs should be used where MPI rank 0 receives chunks of "owned" data from the other ranks, and it should be investigated, if it is possible to back all topology data into a single communication buffer to avoid having to do N-1 communications for each item. Since LAMMPS supports the polarizable CHARMM force field, an effort should be made to specifically import and write out such topologies. |
i copied that from performance is not a big issue of concern here because you only call |
It is not about performance but about memory consumption, which directly impacts how large a system can be handled. |
@akohlmey segment/residue/name are actually all kinds of types, and they need to be stored as integers in atom custom array with a map to strings, ie.
it doesnt have to because that information is already correctly imported by The primary and only reason for
Also, this PR now somewhat resolves https://matsci.org/t/following-water-box-in-lammps-guide-h2o-molecules-look-strange-in-dump-file/56123/9 because a previous
"The default PSF format of CHARMM is the same as "XPLOR" format. "EXT" is for "extended format", which allows longer names for atoms, residues, etc. "CMAP" is for dihedral cross-term corrections. "CHEQ" is an option which is not usually important, so we will not discuss it." https://www.charmm-gui.org/?doc=lecture&module=pdb&lesson=6 EXT format is 8 byte strings for segment/residue/name/type, backward compatible with non-EXT which is 4 byte strings. i'm using "CHEQ is supported in the sense that CHEQ data is simply ignored." https://userguide.mdanalysis.org/1.1.1/formats/reference/psf.html#psf-spec since everyone seems to be ignoring CHEQ, so will i. i can ignore CMAP also since that's getting imported by
ok ill rewrite it without
yes i started working with DRUDE recently for my journal article. CHARMM updated DRUDE parameters in 2023. However, there's no need to export DRUDE topology information to visualization programs AFAIK which is the primary purpose of this PR. |
They are NOT force field types that are associated with force field parameters and that is for me the decisive point. If you want to implement something along those lines, It will have to be either done as a separate package without any significant changes to the core LAMMPS code, or you will have to fork LAMMPS into something called NAMMPS or LAMMD or similar and maintain your changes there and advertise it a "LAMMPS with NAMD support".
A read_psf command that does ignore most of the content of the file does not deserve to be called read_psf.
All of this can be easily done outside of LAMMPS.
Again, that is not a concern of LAMMPS, but rather something that can very well be done outside of LAMMPS.
This is in contradiction with the psf plugin code in VMD and my personal recollection. CHARMM format has a number as atom type, while NAMD/X-PLOR uses a string. |
@akohlmey @jrgissing @stanmoore1 PR4245 ready for review and merge |
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.
As already stated earlier and before looking at anything else, the changes to the labelmap code have to be removed. In my opinion, this is an undesired abuse of this facility for purposes that are not consistent the the rest, i.e. mapping types that are connected to styles that produce forces like pair, bond, angle, dihedral, and improper styles.
why would i reinvent the wheel from scratch when @jrgissing already did 90% of the work ? this was the original intent from the author of this class. you dont understand the universal applicability of this feature which is to map integers to strings and store string data for each atom (segment, residue, name, ...) efficiently in custom per-atom arrays. should i copy the LabelMap class verbatim and call it StringMap ? then duplicate the functionality in variable.cpp by adding new functions that replicate exactly the functionality from labelmap but call it something different even though it does the same thing ? |
I see the convenience, but you are neglecting that from the maintainer perspective this is opening Pandora's box and will give everybody license to abuse this facility for their purposes. Right now, we have well defined boundaries, if we allow you to go beyond that, it will be difficult to argue with others and then we can end up with one big mess. Most of the added functionality here appears to be predominantly for your personal needs and workflows and has limited appeal to the general LAMMPS user community. It was already a hard struggle to boil down the labelmap code to the essential parts and not have it blown up by functionality that wasn't essential or for which a specific use case did not exist yet. There is a lot of redundancy in LAMMPS, just look at accelerator packages. With your line of arguing you could require, for example, that there should not be a KOKKOS package (or OPENMP or GPU or OPT) but the code folded directly into the core of LAMMPS. The OPENMP package was designed from the ground up to be a replacement for the core code and not a package. Making this an add-on package has caused quite a bit of complications and extra work, so you are not alone here. So, as far as I am concerned, I would like to see that everything that are new features would be insulated from the core of LAMMPS and a seperate, optional package (call it CHARMM). There are precedents for that in the KIM or DRUDE or AMOEBA package, to name some examples.
I have not looked at the code at that level of detail, but just copying it would not be sufficient. The main goal would be to keep changes in an optional package and not add maintenance burden to the core code. That will likely need some alternate approaches to get the functionality you are after. The way I see it, there are three different paths open to us, because I expect that we will have the same arguments with other of your pull requests, too:
Let me emphasize at this point that we very much appreciate your efforts and your desire to contribute your changes back to LAMMPS. This is very commendable, since there are lots of people that don't do this and thus there are useful changes that do not make it into the distribution, which is sad. I very much understand that it is not always easy to deal with this. I am talking from personal experience, since I have been in your position and had to argue hard and regularly fail to get functionality into LAMMPS unchanged, where I personally thought the benefits should be obvious. In almost all cases - after the initial frustration and anger - I came back with the requested changes or an alternative implementation and usually this was for the better. At the same time, as a maintainer of LAMMPS I have the obligation to be this hard nosed for any changes to the core code. I can tell you that even now I experience these issues myself (the most recent example is the change to the Error class all() and one() functions which went through many iterations), you just don't see it from the outside. Sometimes these internal discussions are quite intense. Sometimes we do not find a good solution and end up with a compromise that makes neither "side" happy. |
Hi @alphataubio @jrgissing @akohlmey First, thanks @alphataubio for working on this idea to extend LAMMPS Second, I have not looked at your code or followed this discussion in great detail. But I have a code-organization suggestion which might satisfy the concerns of @akohlmey As I understand it, the new functionality needed for CHARMM residues, My suggestion is to structure this in one of two ways. I will call (4) Create a new AtomLabel class (just a suggested name) which derives (5) Similar to (4) but create a new parent class IntLabel (suggested The 2 or 3 resulting classes could be part of the LAMMPS core in I imagine Jake would be willing to help design this new int <--> label This also allow future features to leverage this capability without I'll add that there are many current features in LAMMPS which followed Examples: HTH, |
@akohlmey i dont need your workaround #4492 anymore, you can close it. i added segment/residue/name to now i can from .restart of any timestep:
and i swept all my mess into a new CHARMM package as requested/suggested by you and @sjplimp READY FOR REVIEW |
Summary
compute property/local
add pmolecule1, pmolecule2 to store molecule ID of two atoms in each pairread_psf
write_psf
read_sdf
read data from pubchem into LAMMPSdump local
add step attribute for convenient import by pandas in python.add read_psf and write_psf commands for Protein Structure Format (PSF) files related to CHARMM force field. PSF file is needed together with DCD trajectories created by dump dcd for import into visualization software like ChimeraX, VMD and Molecular Nodes for Blender.
group can now be specified using segment/residue/name, eg. (1) alpha carbons in a protein, or (2) carboxylate oxygens of aspartic and glutamic amino acids:
read_psf
is no longer required forwrite_psf
to work. in that case, defaults are numerical molecule id for segment/molecule/residue, and numerical type id for name/type.refactor all CHARMM-related examples into one directory, and add
gly
which is an even smaller minimal example than1hvn
for generating dump/xtc/dcd testing data for ChimeraX trajectory import.native lammps dump trajectory import will soon be available inLAMMPS native support for importing .data(.gz) and .dump(.gz) now available in daily builds of ChimeraX and will be part of versions 1.10+. toolshed plugin needed for ChimeraX versions <=1.9.chimerax/md_crds/read_coords.py
Related Issue(s)
https://matsci.org/t/following-water-box-in-lammps-guide-h2o-molecules-look-strange-in-dump-file/56123/9
Author(s)
@alphataubio
Licensing
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
Backward Compatibility
the segment, residue, and name properties were implemented using a per-atom custom array to not break backward compatibility of data and restart files for
atom full
.Implementation Notes
read_psf
automatically creates a per-atom custom array calledi2_psf
to store SEGMENT, RESIDUE, and NAME information from PSF file.read_psf
automatically creates atom type labels from PSF file.labelmap was tested on KOKKOS with
examples/typelabel/in.water-copper
from @akohlmey. "labelmap not supported in KOKKOS" error check has been removed.unit tests added for
labelmap create_atoms
, read/write psf, TextFileReader and PotentialFileReader convenience functions.Post Submission Checklist
Further Information, Files, and Links
https://www.charmm-gui.org/?doc=lecture&module=pdb&lesson=6
https://userguide.mdanalysis.org/stable/formats/reference/psf.html