Skip to content

WIP: Lammpsdump velocities (and other fields)#3448

Closed
schlaicha wants to merge 5 commits intoMDAnalysis:developfrom
schlaicha:lammpsdump_velocities
Closed

WIP: Lammpsdump velocities (and other fields)#3448
schlaicha wants to merge 5 commits intoMDAnalysis:developfrom
schlaicha:lammpsdump_velocities

Conversation

@schlaicha
Copy link
Contributor

Following #3360 (thanks for the great work!) I was implementing a first draft of a parser for the velocities.
Before adding tests I quickly wanted to hear if the way of implementing agrees with your concepts.
Other fields, like e.g. forces, could be added straightforward.

Fixes #

Changes made in this Pull Request:

  • allow LAMMPSDUMP parser to read velocities

PR Checklist

  • Tests?
  • [ x] Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@pep8speaks
Copy link

pep8speaks commented Oct 29, 2021

Hello @schlaicha! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 617:80: E501 line too long (83 > 79 characters)
Line 620:80: E501 line too long (144 > 79 characters)

Comment last updated at 2022-04-02 00:30:10 UTC

Copy link
Member

@richardjgowers richardjgowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @schlaicha thanks for starting this. Yes this looks like the correct approach to get this working.

self.close()
self._file = util.anyopen(self.filename)
self.ts = self._Timestep(self.n_atoms, **self._ts_kwargs)
self.ts.frame = -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is deliberately -1 as it gets incremented in the loading process

Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for working on this! A few comments, but generally looking good. 👍


# pass possible additional fields from LAMMPS dump
# pass velocities
velocity_col_names = ["vx", "vy", "vz"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this a class attribute, much like self._conventions is, as the data is not mutable or instance dependent. :)

for cv_name, cv_col_names in enumerate(velocity_col_names):
try:
velocity_cols = [attr_to_col_ix[x] for x in velocity_col_names]
ts.has_velocities = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but I think we only want to set ts.has_velocities = True on exit from this loop, slightly cleaner IMO.

if ts.has_velocities:
ts.velocities = ts.velocities[order]
# LAMMPS reader only supports real units
ts.velocities *= units.speedUnit_factor['Angstrom/femtosecond']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query @richardjgowers on units? I'm no lammps expert, what are the range of possible units?

@orbeckst
Copy link
Member

orbeckst commented Apr 2, 2022

I am going to close and re-open to trigger CI.

@orbeckst orbeckst closed this Apr 2, 2022
@orbeckst
Copy link
Member

orbeckst commented Apr 2, 2022

@schlaicha are you still interested in completing the PR?

@schlaicha
Copy link
Contributor Author

schlaicha commented Apr 7, 2022

@schlaicha are you still interested in completing the PR?

Sorry for the long delay, in fact I forgot about that one.

My collaborator @pstaerk started implementing this in a more general way, I believe, and thus I would suggest that we try to merge this with #3608

We will come back to this after having a first comment on #3608

@hejamu
Copy link
Contributor

hejamu commented Sep 30, 2023

@schlaicha the changes in this PR have been superseded by #3844.

@schlaicha
Copy link
Contributor Author

Thanks @hejamu for reminding me about this open PR. Closing as it is outdated.

@schlaicha schlaicha closed this Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants