Giter Club home page Giter Club logo

amepproject / amep Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 2.0 37.52 MB

The Active Matter Evaluation Package (AMEP) - a Python library for the analysis of particle-based and continuum simulation data of soft and active matter systems

Home Page: https://amepproject.de/

License: GNU General Public License v3.0

Python 100.00%
active-matter analysis brownian-dynamics brownian-dynamics-simulation coarse-graining computational-physics data-analysis molecular-dynamics molecular-dynamics-simulation physics

amep's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

descho00 hjc19

amep's Issues

FRQ: Stress tensor and mechanical pressure.

Proposed new feature or change:

The (local) stress tensor can easily be calculated from simulation data using the Irving-Kirkwood stress tensor [1]. It can also be applied to non-equilibrium systems as shown in Ref. [2] (see Eq. 2). From the stress tensor, one can then calculate the mechanical pressure from its trace.

We should add this feature (stress tensor and pressure calculation) to AMEP's thermo module.

[1] https://pubs.aip.org/aip/jcp/article/18/6/817/201367/The-Statistical-Mechanical-Theory-of-Transport
[2] https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.132.168201

FRQ: chemfiles reader.

Proposed new feature or change:

To enable the loading of various simulation data formats, AMEP should provide a new reader class based on the Chemfiles Python library (https://chemfiles.org/). This new reader class should be implemented as ChemfilesReader in the module amep.reader. It should convert the loaded data to the .h5amep format.

DOC: incorrect spatialcor.pcf_angle example

Problem description:

https://amepproject.de/_autosummary/amep.spatialcor.pcf_angle.html

Within the example, the line import numpy as np is missing. Additionally, the plotting is incorrect.

Suggested content improvement:

Add >>> import numpy as np to the example in the doc string of amep.spatialcor.pcf_angle.

Replace the line mp = amep.plot.field(axs, grt, X, Y) with mp = amep.plot.field(axs, grt.T, X, Y) and add the resulting figure to the documentation.

FRQ: Dynamical structure factor

Proposed new feature or change:

It turns out that a dynamical structure factor is not only really useful for glassy people but also for my breathing particles.
So I'm gonna start to implement this.
But first I'll have to read up a bit.

BUG: `evaluate.ClusterGrowth` does not work with fields

Description:

The ClusterGrowth functionality does not work. It just throws an error because it still wants to use an old version of the field cluster detection.

Code for reproduction:

from amep import load
from amep.evaluate import ClusterGrowth
f_traj = load.traj(<Field_trajectory_path>)
ClusterGrowth(

Error message:

Traceback (most recent call last):
File "/home/kspanheimer/Documents/dev/amep_project/amep_data/amep_publication_plots/gen_cluster_data.py", line 146, in
gen_growth_data(field_trajectories)
File "/home/kspanheimer/Documents/dev/amep_project/amep_data/amep_publication_plots/gen_cluster_data.py", line 72, in gen_growth_data
wmea_c_grow = np.stack([ClusterGrowth(trajec,
^^^^^^^^^^^^^^^^^^^^^^
File "/home/kspanheimer/Documents/dev/amep_project/amep_data/amep_publication_plots/gen_cluster_data.py", line 72, in
wmea_c_grow = np.stack([ClusterGrowth(trajec,
^^^^^^^^^^^^^^^^^^^^^
File "/home/kspanheimer/Documents/dev/amep_project/amep/amep/evaluate.py", line 3538, in init
self.__frames, self.__avg, self.__indices = average_func(
^^^^^^^^^^^^^
File "/home/kspanheimer/Documents/dev/amep_project/amep/amep/utils.py", line 141, in average_func
func_result = [func(x, **kwargs) for x in tqdm(data[evaluated_indices])]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kspanheimer/Documents/dev/amep_project/amep/amep/utils.py", line 141, in
func_result = [func(x, **kwargs) for x in tqdm(data[evaluated_indices])]
^^^^^^^^^^^^^^^^^
File "/home/kspanheimer/Documents/dev/amep_project/amep/amep/evaluate.py", line 3612, in __compute_fields
ids, labels = identify_clusters(
^^^^^^^^^^^^^^^^^^
TypeError: identify_clusters() got an unexpected keyword argument 'field'

Python and AMEP versions:

Python 3.11.9
AMEP 1.0.0

Additional information:

I won't add all the reproducabillity etc. since I'll fix it myself.

How did you install AMEP?

pip

FRQ: local entropy production

Proposed new feature or change:

AMEP should provide a method to calculate the local entropy production, which is an important observable for investigating active matter systems. I suggest to implement the method presented in Ref. [1], the source code of which can be found in Ref. [2]. It is a universal method that does not require any knowledge about the equations of motions and should applicable to both particle-based and continuum simulation data as well as experimental data.

The method should be included in the module amep.thermo and a corresponding evaluate class should also be added to the amep.evaluate module.

[1] https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.129.220601

[2] https://github.com/martiniani-lab/sweetsourcod/tree/master

BUG: Change of timestep does not lead to a change of the physical time

Description:

A new timestep set by traj.dt = <timestep> does not affect traj.times.

Code for reproduction:

import amep
traj = amep.load.traj(<path-to-traj>)
traj.dt = <timestep>
print(traj.times)

Error message:

No response

Python and AMEP versions:

AMEP: 1.0.0
Python: 3.12.2

Additional information:

No response

How did you install AMEP?

conda

FRQ: Plot arrows for annotations.

Proposed new feature or change:

Add the following method (+ docstring + example) to amep.plot:

def draw_arrow(fig, x, y, dx, dy, **kwargs):
    arrow = FancyArrow(x, y, dx, dy, transform=fig.transFigure, length_includes_head=True, **kwargs)
    fig.add_artist(arrow)

This allows to draw an arrow that points from (x, y) to (x+dx, y+dy), which is useful for annotation purposes.

BUG: MSD calculation not possible with pbc=True if no unwrapped coords available

Description:

The data availability checks in amep.evaluate.MSD are not compatible with the current unwrapped_coords and nojump_coords methods of a BaseFrame object. Therefore, the checks themselves raise an error and do not allow to calculate the MSD using nojump coordinates for example.

Code for reproduction:

traj = amep.load.traj(
    "./data",
    mode = "lammps",
    dumps = "*.txt"
)
traj.nojump()

msd = amep.evaluate.MSD(traj, pbc=True, use_nojump=True)

Error message:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[27], line 1
----> 1 msd = amep.evaluate.MSD(traj, pbc=True, use_nojump=True)

File D:\amep\evaluate.py:3812, in MSD.__init__(self, traj, ptype, skip, nav, use_nojump, pbc)
   3807 if self.__use_nojump and self.__traj[0].nojump_coords() is None:
   3808     raise ValueError(
   3809         'No nojump coordinates available. Call traj.nojump() '\
   3810         'to calculate the nojump coordinates.'
   3811     )
-> 3812 elif self.__pbc and self.__traj[0].unwrapped_coords() is None\
   3813 and self.__traj[0].nojump_coords() is None:
   3814     raise ValueError(
   3815         'Neither unwrapped nor nojump coordinates are available. '\
   3816         'Call traj.nojump() to calculate the nojump coordinates or '\
   3817         'do not apply periodic boundary conditions.'
   3818     )
   3819 else:
   3820     # get mode

File D:\amep\base.py:582, in BaseFrame.unwrapped_coords(self, **kwargs)
    566 def unwrapped_coords(self, **kwargs) -> np.ndarray:
    567     """
    568     Returns the unwrapped coordinates of all particles or of 
    569     all particles of a specific particle type.
   (...)
    580 
    581     """
--> 582     return self.__read_data("uwcoords",**kwargs)

File D:\amep\base.py:967, in BaseFrame.__read_data(self, key, ptype, pid)
    964     return data[mask.astype(bool)]
    966 else:
--> 967     raise KeyError(
    968         f"The key {key} does not exist in the frame. "\
    969         "Returning no data!"
    970     )

KeyError: 'The key uwcoords does not exist in the frame. Returning no data!'

Python and AMEP versions:

Python 3.10
AMEP 1.0.1

Additional information:

The data availability checks in amep.evaluate.MSD.__init__ could be done as follows:

# check data availability
        if self.__pbc:
            if self.__use_nojump:
                try:
                    a = self.__traj[0].nojump_coords()
                except:
                    raise ValueError(
                        'No nojump coordinates available. Call traj.nojump() '\
                        'to calculate the nojump coordinates.'
                    )
            else:
                try:
                    a = self.__traj[0].unwrapped_coords()
                except:
                    raise ValueError(
                        'There are no unwrapped coordinates available. '\
                        'Please set use_nojump=True to use nojump coordinates instead '\
                        'or do not apply periodic boundary conditions.'
                    )
        # get mode
        if self.__pbc and self.__use_nojump:
            self.__mode = 'nojump'
        elif self.__pbc:
            self.__mode = 'unwrapped'
        else:
            self.__mode = 'normal'

How did you install AMEP?

from source

BUG: distutils - incompatibility with Python 3.12

Description:

The distutils library is used in the module amep.plot but is not part of Python 3.12 anymore. Therefore, using AMEP within Python 3.12 raises an error.

Code for reproduction:

import amep

Error message:

image

Python and AMEP versions:

python 3.12
amep 1.0.0

Additional information:

Solution:

  1. Replace from distutils.spawn import find_executable with from shutil import which.

  2. Replace if find_executable('latex'): with if which('latex'):.

How did you install AMEP?

pip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.