imdclient 0.1.3__py3-none-any.whl → 0.2.0b0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. imdclient/IMDClient.py +43 -12
  2. imdclient/IMDProtocol.py +1 -0
  3. imdclient/__init__.py +0 -5
  4. imdclient/data/gromacs/md/gromacs_v3_nst1.mdp +3 -3
  5. imdclient/data/namd/md/namd3 +0 -0
  6. imdclient/data/namd/md/namd_v3_nst_1.namd +1 -1
  7. imdclient/tests/base.py +108 -83
  8. imdclient/tests/conftest.py +0 -39
  9. imdclient/tests/datafiles.py +16 -1
  10. imdclient/tests/docker_testing/docker.md +1 -1
  11. imdclient/tests/hpc_testing/gromacs/README.md +112 -0
  12. imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.mdp +58 -0
  13. imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.top +11764 -0
  14. imdclient/tests/hpc_testing/gromacs/struct.gro +21151 -0
  15. imdclient/tests/hpc_testing/gromacs/validate_gmx.sh +90 -0
  16. imdclient/tests/hpc_testing/lammps/README.md +62 -0
  17. imdclient/tests/hpc_testing/lammps/lammps_v3_nst_1.in +71 -0
  18. imdclient/tests/hpc_testing/lammps/topology_after_min.data +8022 -0
  19. imdclient/tests/hpc_testing/lammps/validate_lmp.sh +66 -0
  20. imdclient/tests/hpc_testing/namd/README.md +147 -0
  21. imdclient/tests/hpc_testing/namd/alanin.params +402 -0
  22. imdclient/tests/hpc_testing/namd/alanin.pdb +77 -0
  23. imdclient/tests/hpc_testing/namd/alanin.psf +206 -0
  24. imdclient/tests/hpc_testing/namd/namd_v3_nst_1.namd +59 -0
  25. imdclient/tests/hpc_testing/namd/validate_namd.sh +71 -0
  26. imdclient/tests/minimalreader.py +86 -0
  27. imdclient/tests/server.py +6 -14
  28. imdclient/tests/test_gromacs.py +15 -3
  29. imdclient/tests/test_imdclient.py +26 -7
  30. imdclient/tests/test_lammps.py +22 -19
  31. imdclient/tests/test_manual.py +224 -66
  32. imdclient/tests/test_namd.py +39 -16
  33. imdclient/tests/test_utils.py +31 -0
  34. imdclient/utils.py +50 -17
  35. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/METADATA +60 -39
  36. imdclient-0.2.0b0.dist-info/RECORD +53 -0
  37. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/WHEEL +1 -1
  38. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info/licenses}/AUTHORS.md +4 -1
  39. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info/licenses}/LICENSE +3 -1
  40. imdclient/IMD.py +0 -130
  41. imdclient/backends.py +0 -352
  42. imdclient/results.py +0 -332
  43. imdclient/streamanalysis.py +0 -1056
  44. imdclient/streambase.py +0 -199
  45. imdclient/tests/test_imdreader.py +0 -658
  46. imdclient/tests/test_stream_analysis.py +0 -61
  47. imdclient-0.1.3.dist-info/RECORD +0 -42
  48. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,90 @@
1
+ #!/bin/bash
2
+
3
+ # Default values
4
+ GROMACS_BIN="gmx"
5
+ MDP_FILE="gmx_gpu_test.mdp"
6
+ STRUCT_FILE="struct.gro"
7
+ TOP_FILE="gmx_gpu_test.top"
8
+ MPI=false # Default: single-node execution
9
+
10
+ # GROMACS simulation parameters
11
+ IMD_STRUCT_FILE="struct_imd.gro"
12
+ TPR_FILE="gmx_gpu_test.tpr"
13
+ TRAJ_FILE="gmx_gpu_test.trr"
14
+
15
+ OUTPUT_FILE="gromacs_imd.out"
16
+
17
+ # Parse arguments
18
+ while [[ $# -gt 0 ]]; do
19
+ case $1 in
20
+ --gmx_bin)
21
+ GROMACS_BIN="$2"
22
+ shift 2
23
+ ;;
24
+ --mdp_file)
25
+ MDP_FILE="$2"
26
+ shift 2
27
+ ;;
28
+ --struct_file)
29
+ STRUCT_FILE="$2"
30
+ shift 2
31
+ ;;
32
+ --top_file)
33
+ TOP_FILE="$2"
34
+ shift 2
35
+ ;;
36
+ --mpi)
37
+ MPI=true
38
+ shift 1
39
+ ;;
40
+ *)
41
+ echo "Unknown argument: $1"
42
+ exit 1
43
+ ;;
44
+ esac
45
+ done
46
+ # Step 1: GROMACS Preprocessing (grompp)
47
+ echo "Running GROMACS grompp..."
48
+ $GROMACS_BIN grompp \
49
+ -f $MDP_FILE \
50
+ -c $STRUCT_FILE \
51
+ -p $TOP_FILE \
52
+ -imd $IMD_STRUCT_FILE \
53
+ -o $TPR_FILE \
54
+ -maxwarn 1
55
+
56
+ # Step 2: GROMACS Simulation
57
+ if [ "$MPI" = true ]; then
58
+ echo "Running GROMACS multi-node simulation with MPI..."
59
+
60
+ mpirun $GROMACS_BIN mdrun \
61
+ -s $TPR_FILE \
62
+ -o $TRAJ_FILE \
63
+ -imdwait &> $OUTPUT_FILE &
64
+ else
65
+ echo "Running GROMACS single-node simulation..."
66
+ $GROMACS_BIN mdrun \
67
+ -s $TPR_FILE \
68
+ -o $TRAJ_FILE \
69
+ -imdwait &> $OUTPUT_FILE &
70
+ fi
71
+
72
+ # Wait for simulation to be ready
73
+
74
+ await_gmx_imd() {
75
+ grep -q "IMD: Will wait until I have a connection and IMD_GO orders." "$OUTPUT_FILE"
76
+ }
77
+
78
+ while ! await_gmx_imd; do
79
+ echo "Waiting for GROMACS IMD readiness in $OUTPUT_FILE..."
80
+ sleep 5
81
+ done
82
+
83
+ # Step 3: Run IMDClient Test
84
+
85
+ echo "Running IMDClient manual test..."
86
+ python ../../test_manual.py \
87
+ --topol $IMD_STRUCT_FILE \
88
+ --traj $TRAJ_FILE \
89
+ --first_frame 0
90
+
@@ -0,0 +1,62 @@
1
+ # Manual validation of different compiler options for LAMMPS using ASU's SOL
2
+
3
+ ### Running tests
4
+
5
+ To validate all IMDv3 output (time, integration step, box, positions, velocities, and forces)
6
+ against H5MD output with a simple sample simulation, first ensure you're using a
7
+ python environment which has the testing requirements of IMDClient installed.
8
+
9
+ If not already installed, do:
10
+ ```bash
11
+ conda env create -n imdclient-test -f devtools/conda-envs/test_env.yaml -y
12
+ conda activate imdclient-test
13
+ ```
14
+
15
+ Equivalently, on ASU's Sol, do:
16
+ ```bash
17
+ module load mamba
18
+ # Only needed for MPI builds
19
+ module load openmpi/4.1.5
20
+ conda env create -n imdclient-test -f devtools/conda-envs/test_env.yaml -y
21
+ source activate imdclient-test
22
+ ```
23
+
24
+ Then, to run the tests, do:
25
+ ```bash
26
+ cd imdclient/tests/hpc_testing/lammps
27
+ chmod +x validate_lmp.sh
28
+
29
+ ./validate_lmp.sh \
30
+ -lmp_bin /path/to/lmp
31
+ ```
32
+
33
+ Or, for MPI builds,
34
+ ```bash
35
+ ./validate_lmp.sh \
36
+ --lmp_bin /path/to/lmp \
37
+ --mpi
38
+ ```
39
+
40
+ To validate against your own simulation files, see `validate_lmp.sh` for
41
+ command line arguments.
42
+
43
+ ### Compiling on ASU's Sol supercomputer with MPI and GPU support
44
+
45
+ Allocate a GPU node on SOL and clone in https://github.com/ljwoods2/lammps/tree/imd-v3
46
+
47
+ After cloning, do:
48
+
49
+ ```bash
50
+ git checkout imd-v3-integration
51
+ module load cmake-3.21.4-gcc-11.2.0
52
+ module load gcc-10.3.0-gcc-11.2.0
53
+ module load cuda-11.7.0-gcc-11.2.0
54
+ module load hdf5-develop-1.13-gcc-11.2.0
55
+ module load openmpi/4.1.5
56
+
57
+ mkdir -p build_gpu
58
+ cd build_gpu
59
+
60
+ cmake ../cmake/ -D PKG_MISC=yes -D PKG_GPU=on -D GPU_API=cuda -D PKG_H5MD=yes -D BUILD_MPI=yes -DCMAKE_CXX_FLAGS="-DLAMMPS_ASYNC_IMD"
61
+ make -j 4
62
+ ```
@@ -0,0 +1,71 @@
1
+ ## Setup
2
+ units metal
3
+ boundary p p p #Specify periodic boundary condition are needed in all three faces
4
+ atom_style atomic #What style of atoms is to be used in the simulation
5
+ log logfile.txt #Write the log file to this text file. All thermodynamic information applicable to the entire system
6
+
7
+ ## Create Box
8
+ #Refers to an abstract geometric region of space. units box refers to the fact that the size of the box is specified in the units as given in the units command.
9
+ # The name "forbox" refers to the region ID so that you can refer to it somewhere else in this input script.
10
+ region forbox block 0 45.8 0 45.8 0 45.8 units box
11
+ create_box 1 forbox
12
+ # Since we have given fcc as lattice type no need to mention basis for this
13
+ lattice fcc 4.58
14
+
15
+ ## Create atoms & define interactions
16
+ # basis arg defines which atoms are created based on their lattice position (all are atom type 1)
17
+ create_atoms 1 region forbox basis 1 1 basis 2 1 basis 3 1 basis 4 1 units box
18
+ # Mass of atom type 1 is 39.48 [mass units grams/mole]
19
+ mass 1 39.948
20
+ # lj potential describes potential energy between two atoms as function of the dist between them
21
+ # don't apply lj interactions beyond cutoff dist
22
+ pair_style lj/cut 10
23
+ # The coefficient of the lj potential for the interactions of atom type 1 with atom type 1
24
+ pair_coeff 1 1 0.01006418 3.3952
25
+
26
+ ## Create atom group for argon atoms
27
+ group ar type 1 #Group all the argon types (argon type is of type 1). All atoms of type 1 are in group with the name 'ar'
28
+
29
+
30
+ ## Write initial configuration
31
+ dump dump_1 all custom 1 dump_initial_config.dump id type x y z ix iy iz vx vy vz
32
+
33
+
34
+ ## Perform energy minimization
35
+ run 1
36
+ # Stop dumping to this file
37
+ undump dump_1
38
+ # Minimize the energy using a conjugate gradient step.
39
+ minimize 1e-25 1e-19 10000 10000
40
+ print "Finished Minimizing"
41
+ variable ener equal pe
42
+
43
+ ## Output the topology after minimization
44
+ write_data topology_after_min.data
45
+
46
+ ## Prepare MD simulation
47
+ timestep 0.001
48
+ # Set the velocities of all the atoms so that the temperature of the system
49
+ # is 300K. Make the distribution Gaussian.
50
+ velocity all create 300 102939 dist gaussian mom yes rot yes
51
+ # this is equlibration process.
52
+ fix 1 all nve
53
+
54
+ # Create source of truth trajectory
55
+ dump h5md1 all h5md 1 lammps_trj.h5md position velocity force box yes
56
+ dump_modify h5md1 unwrap no
57
+
58
+ ## IMD settings
59
+ # https://docs.lammps.org/fix_imd.html
60
+ fix 2 all imd 8888 version 3 unwrap off nowait off
61
+
62
+ ## Run MD sim
63
+ run 100
64
+
65
+ # Stop dumping information to the dump file.
66
+ undump h5md1
67
+
68
+ # Unfix the NVE. Additional lines if any will assume that this fix is off.
69
+ unfix 1
70
+
71
+ #End