1020 Commits

Author SHA1 Message Date
cmd23333
335e6865f3 Fix AmoebaMultipoleForce::ForceInfo particle groups used for molecule detection and atom reordering (#5302)
* <fix>(ameoba): ForceInfo::getParticlesInGroup should include the particle itself

* <fix>(ameoba): ForceInfo::getParticlesInGroup should include the particle itself

---------

Co-authored-by: chenlei.2333 <chenlei.2333@bytedance.com>
2026-06-01 11:49:16 -07:00
Peter Eastman
fc21fd1923 Compile correctly under newer C++ standards (#5296) 2026-05-27 11:01:05 -07:00
Evan Pretti
14f8b06118 Make sure contexts are deselected before evaluation (#5279)
* Context deselection before energy evaluation

* Check that the correct context is popped by popAsCurrent()
2026-05-04 16:26:18 -07:00
Peter Eastman
6717a85cc4 Reduced memory used by SerializationNode (#5249) 2026-04-06 14:10:16 -07:00
Peter Eastman
74912095a9 Refactor reference PME (#5131) 2025-11-11 15:31:38 -08:00
Peter Eastman
c24c619e4f Code cleanup (#5127) 2025-11-06 12:04:52 -08:00
Evan Pretti
05472c9a81 Update file headers (#5074)
* Replace SimTK-containing file headers

* Update file headers for new Tinker reader files added
2025-09-23 10:27:26 -07:00
João Morado
939e0af545 Reader of Tinker files (#4769)
* Add basic version of TinkerFiles

* Refactor TinkerFiles

* Update docstring, type hints, and fix bug when setting box vectors

* Small fixes

* Add unit tests for the TinkerFiles class

* Fixes and updates to TinkerFiles

* Add simuteTinker example

* Update Modeller to work with AMOEBA force fields

* Small fixes

* Relax type hinting

* Fix indices in modeller

* Fix modeller indices

* Fix type hints and usage of Quantity

* Remove numpy protector

* Add reader of .seq files

* Add topology parsing of some protein residues, waters, ions, and generic molecules.

* Miscellaneous improvements

* Update amino acids and nucleotides list

* Various fixes to XML writing, and separate XML writing into a new class

* Comments/warnings

* Add nucleic topological definitions

* Improved handling of peptide residues

* Fix for CYX (disulfide bonds)

* Refactor the topology creation methods

* General improvements, and add support for nucleic-like residues

* No need to handle MP, DP, TP

* Minor improvements

* General refactoring, add automatic determination of topology

* Add TinkerAtomType dataclass, and remove references to biotypes as they are not needed

* Re-add missing parsing of forces and scalars

* Updates to createSystem()

* Add AMOEBA forces

* Add angle-related forces to createSystem

* Add placeholders for missing forces

* Beginning of support for AmoebaMultipoleForce

* Finished support for AmoebaMultipoleForce

* Support for AmoebaVdwForce

* TinkerFiles supports vdw

* Misc updates, and add AmoebaTorsionTorsion, AmoebaWcaDispersion, and AmoebaGeneralizedKirkwood

* Remove XML writer

* Fixes

* Fix wrong indentation in _findBitorsions

* Remove pdb debugging

* Documentation and fixes

* Remove files

* Revert checks in AmoebaVdwForceBuilder and ## @private  markers

* Remove duplicated static methods _getChiralAtomIndex

* Fix GK force

* Fix WcaDispersion force

* Fix WcaDisp

* Fixes and updates

* Cleanup and removing duplicated code

* Bug fixes

* A few more unit conversions

* Minor cleanup

* Misc fixes and updates

* Fix Add AmoebaStretchBendForce

* Simplify force builders

* Update ForceField

* Fix AmoebaPiTorsionForce

* Only add AmoebaWcaDispersionForce if using implicitSolvent

* Simplify amoebaforces

* Stretch torsion and angle torsion

* Misc. fixes

* Improve tests

* Fix cap group identification

* Add/improve tests

* Remove whitespaces from residue names

* Improve tests

* Consistent use of atomClasses list

* Fix match condition in AmoebaOutOfPlaneBendForceBuilder

* Fix AmoebaStretchBendForce

* Final fix for AmoebaStretchBendForce

* Fix AmoebaAngleForce

* Small fixes and improvements

* Update assertion tolerances

* Simplify torsion-torsion force creation

* Small fixes in the tests

* Review comments, type hints, docs for tinkerfiles.py

* Only use standard PDB for AA

* Type hint and docs for amoebaforces

* Reduce tolerances for failing tests

* Fixed error with ZOnly axis type when x particle is not specified

---------

Co-authored-by: peastman <peastman@stanford.edu>
2025-09-18 18:00:59 -07:00
cmd23333
4507205cf2 Bugfix: Zero-initialize padded posq buffer in AmoebaCommonKernels (#5071)
Co-authored-by: chenlei.2333 <chenlei.2333@bytedance.com>
2025-09-13 08:49:44 -07:00
Evan Pretti
f55abcaa5f Add constant potential method (#4870)
* Initial implementation of C++ API

* Add kernel interface and information for API generation

* API updates for updating electrode parameters

* Add serialization proxy for ConstantPotentialForce

* Update file headers

* Add CG error tolerance and fix units on getCharges() return value

* Initial implementation of matrix solver

* Fixes and conjugate gradient solver

* Try to fix Linux and Windows builds

* Make sure charge constraint target is on total charge

* Restore handling of exceptions like NonbondedForce since they won't involve electrode atoms

* Ameliorate numerical instability in constrained conjugate gradient

* Fix uninitialized pointers, memory leak, and style

* Set CG tolerance units in Python API

* Test ConstantPotentialForce serialization

* Read/write ExceptionsUsePeriodicBoundaryConditions as bool

* Improve constrained conjugate gradient robustness to roundoff error accumulation

* Recompute matrix if electrode atoms move due to setPositions()

* Tolerance is now in gradient (potential) units again

* Add neutralizing background correction

* Add Python API tests

* Fixes for CG and nonbonded exceptions

* Add initial tests checking against existing NonbondedForce behavior

* Expand test suite and fix some implementation issues

* Add additional tests using larger reference system

* Add Gaussian test

* Finish test against reference computation

* CPU platform implementation

* Fixes for compilation on some platforms

* Fixes for constant potential with AVX/AVX2

* Test linking CPU PME library to constant potential test directly

* Older SWIG versions don't support Python set to C++ set conversion

* Add user guide entry

* Increase speed of reference test

* Conditional building constant potential CPU test is unreliable

* Debugging

* Miscellaneous fixes and improvements for CI

* Cache charges so solver will not run if system and coordinates have not changed

* Preconditioner flag, stability, and automatic detection improvements

* Add GPU platform-specific constant potential kernel classes

* PME and device-host I/O changes to support constant potential

* Initial common constant potential implementation

* Constant potential fixes:

* Fix preconditioner PME position/charge save/restore logic

* Fix reduction synchronization in constant potential solver kernels

* Add double-float accumulation for conjugate gradient solver when
  double unsupported by hardware

* Improve conditioning of a test system, and make sure particles are in or
out of cutoff for consistency and ease of comparing between platforms

* Reorder guess charges for CG when atom reordering changes positions

* Remove PME queue for now

* Trying to debug optimized direct space derivative kernel

* Remove extraneous debugging lines

* Style updates; just make CPU preconditioner double precision

* Debugging updated optimized direct derivatives kernel for all but OpenCL CPU

* OpenCL CPU implementation of direct space derivatives, and cleanup

* Try to make test even shorter to not time out on CI

* Temporary - Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Remove debugging code and fix reduction synchronization

* Fix other reductions

* Debugging - are tests hanging or just slow on CI?

* Debugging

* Debugging

* Fix macro for case when double precision is available on hardware

* Remove changes for debugging again

* Try to improve matrix solver cache locality by uploading transpose

* Fixes for atom ordering and periodic images

* Can't rely on reorder listener for cell offset updates

* Test reducing number of contexts and timing for CI

* Debugging

* Remove timing code and revert debugging changes

* Matrix solver and plasma term optimizations

* Reduce CG solver kernel calls and downloads

* Don't read back convergence flag from global memory

* Update PME due to refactoring in master branch

* Faster matrix solver (1st step)

* Faster matrix solver for CUDA

* Faster matrix solver compatibility with non-CUDA platforms

* Matrix solver fixes

* Use warp shuffle reductions when possible

* Attempt to work around intermittent compiler crash in Intel CPU OpenCL

* Optimize CG solver kernel 1

* Rework CG solver so some kernels can use more than 1 block

* Don't run out of shared memory

* Asynchronously download convergence flag while clearing buffers

---------

Co-authored-by: Evan Pretti <pretti@sh03-17n15.int>
2025-09-12 13:55:50 -07:00
Peter Eastman
b4507392ff Drude integrators can find DrudeForce inside another force (#5054) 2025-08-29 09:11:58 -07:00
Peter Eastman
bb3073d4f3 Virtual site for symmetric molecules (#4185)
* Reference implementation of SymmetrySite

* Common implementation of SymmetrySite

* Removed duplicated code

* Serialization for SymmetrySite

* Fixed compilation error building C wrapper

* Added SymmetrySite to user guide

* Bug fix

* Added P21 test case
2025-07-23 16:25:28 -07:00
Peter Eastman
2443dceee5 Common implementation of NonbondedForce (#4922)
* Use common API for kernels

* More code uses common interface

* Bug fixes

* Unified interface for sorting

* Simplified interface for FFT

* Use common event API for synchronization

* Minor changes to make code more consistent between platforms

* Common implementation of NonbondedForce

* Bug fixes

* Flag to enable list of single pairs

* CUDA and OpenCL use common implementation of NonbondedForce

* Fixed compilation error

* HIP uses common implementation of NonbondedForce
2025-05-05 08:54:36 -07:00
Peter Eastman
e8e4694d2c Neutralizing plasma self energy for AMOEBA (#4920) 2025-05-02 14:29:50 -07:00
Peter Eastman
bce0c133e0 Added computeCurrentPressure() to MonteCarloBarostat (#4881)
* Added computeCurrentPressure() to MonteCarloBarostat

* Use instantaneous temperature to compute pressure

* Added computeCurrentPressure() to MonteCarloAnisotropicBarostat

* Added computeCurrentPressure() to MonteCarloMembraneBarostat

* Fixed compilation error

* Fixed error in typemap

* Added documentation on computing pressure

* Fixed CUDA compilation errors

* Made test case more robust

* Made a test case more robust

* Added computeCurrentPressure() to MonteCarloFlexibleBarostat

* Fixed compilation error

* More documentation on computing pressure
2025-04-28 11:42:43 -07:00
Peter Eastman
01e99e774c Uniform interface for FFTs (#4911)
* Unified interface for FFTs

* AMOEBA uses unified interface for FFTs

* HIP implementation of common FFT interface
2025-04-25 13:26:00 -07:00
Jinfeng
1ece5c285c Drude wrapper (#4871)
* modifiy CMakeLists.txt to generate drude fortran wrapper

* modify doxyfile and wrapper generation wrapper
2025-04-02 12:53:32 -07:00
Peter Eastman
13c1339687 Remove includes for Dart (#4867)
* Remove includes for Dart

* Fix CMake error

* Fixed broken link

* Pin to cmake<4.0

* Try to make the link checker stop complaining
2025-03-28 10:21:33 -07:00
Peter Eastman
68c97c5bfc Replace pthreads with C++ threads (#4833)
* Replace pthreads with C++ threads

* Try to fix CI errors

* Try including -pthread linker option
2025-03-10 11:58:37 -07:00
Peter Eastman
d7307530a0 Serialization records integration force groups (#4734) 2024-11-25 08:49:50 -08:00
Peter Eastman
027fed2a57 Cleanup of AMOEBA code (#4728)
* Cleanup of AMOEBA code

* Fixed another compilation error

* More Windows compilation errors

* Fixed incorrect syntax
2024-11-21 12:08:35 -08:00
Michael J. Schnieders
61a908cd1c Updates to AmoebaVdwForce, AmoebaGeneralizedKirkwoodForce and AmoebaWcaDispersionForce (#4647)
* Update the AMOEBA OpenMM API for vdW, GK and WCA

* Changes needed for the Corrigan et al Generalized Kirkwood model and minor changes to the vdW force to support CpHMD

* Add casts to real for uses of POW in GK; Pass force by reference within the WCA kernel

* Update swigInputConfig for Amoeba vdW and GK forces

* Update TestAPIUnits.testAmoebaVdwForce

* Set the units for getSolventDielectric and getSoluteDielectric to None

* Update default dispersion offset parameter for the AmoebaWcaDispersionForce

* Remove overloaded getParticleParameters and setParticleParameters from AmoebaGeneralizedKirkwoodForce

* Update the AmoebaWcaDispersionForce TestAPIUnits tests to reflect using the correct units for the C++ parameter default values; Update the alanine-dipeptide-amoeba-forces to reflect the updated GK model

* Move neck descreening constants into AmoebaGeneralizedKirkwoodForceImpl; set the default GK dielecticOffset to 0.09; set the default WCA shctd parameter to 0.82

* Fix Python test cases for WCA and GK

* Load AMOEBA/GK parameters into an array of float4

* Cleaned up the AmoebaGeneralizedKirkwoodForce based on feedback from Peter; the one case where backwards compatibility remains a challenge is application of the dielectric offset parameter - in the prior code this was only applied to the nonpolar cavity term, but not to calculation of Born radii; in this revision the dielectric offset is applied to BOTH the nonpolar cavity term and to calculation of Born radii. At this point I can't think of elegant way to maintain backwards compatibility that isn't confusing, nor does it make sense (at least to me) to only apply the concept of the dieletric offset to one aspect (i.e. only to nonpolar cavity or only to Born radii calculation) but not to both.

* Remove 'using std::vector' from AmoebaGeneralizedKirkwoodForceImpl.h; divide by 10 instead of multiplying by 0.1f in amoebaGk.cc

* Added a parameter called descreenOffset, which is applied during calculation of effective Born radii for GK. The parameter dielectricOffset is only used for the nonpolar cavity term consistent with its prior use. All tests in TestAmoebaGeneralizedKirkwoodForce.h are now backwards compatible with their behavior prior to this PR.

* Change two constants in amoebaGk.cc to single precision; Improved the documentation for getNeckConstants in AmoebaGeneralizedKirkwoodForceImpl.h

* Fix comment for setTanhRescaling in AmoebaGeneralizedKirkwoodForce.h, Fix comment for setTanhParameters in AmoebaReferenceGeneralizedKirkwoodForce.h; set the type of parameter GeneralizedKirkwoodTanhRescaling to bool in AmoebaGeneralizedKirkwoodForceProxy.cpp; In ReferenceCalcAmoebaGeneralizedKirkwoodForceKernel return references of per particle parameters instead of copies; update AmoebaReferenceKernels.h method signatures for per particle parameters to return const vector references

* Minor tweaks to the documentation for the tanh rescaling flag

* Improve the comments for the get and setTanhParameters in AmoebaGeneralizedKirkwoodForce.h and AmoebaReferenceGeneralizedKirkwoodForce.h
2024-11-20 12:18:10 -08:00
Peter Eastman
5377094868 Prevent HipContext.h from including vkFFT.h (#4714) 2024-11-01 08:00:37 -07:00
Anton Gorenko
8ea4295042 Optimize PME spread charge kernel (#4633)
* PME_ORDER threads process one atom;
* PME_ORDER threads access consecutive addresses;
* No need to permute z indices with zindexTable;
* finishSpreadCharge is needed only with fixed point charge spreading;
2024-09-23 16:25:57 -07:00
Anton Gorenko
ecc2d258df Port changes from the main repository
Use cuCtxPushCurrent() and cuCtxPopCurrent() for selecting CUDA context

    https://github.com/openmm/openmm/pull/3258

Fixed uninitialized memory access

    https://github.com/openmm/openmm/issues/3392
    https://github.com/openmm/openmm/pull/3399

Fixed potential invalid memory access

    See https://github.com/openmm/openmm/pull/3428

Improved temperature reporting for Drude particles

    https://github.com/openmm/openmm/pull/3486
    https://github.com/openmm/openmm/commit/a5e42f5

Fixed race condition with multiple GPUs

    6fb1c8a41e

Use blocking sync when creating events

    fe21d5ee4f

Very minor optimizations

    109f6b2535

Use PocketFFT

    1dac981a63

Improved logic for deciding when to reorder atoms

    48664a1f1a

Ensure valid atom order after loading a checkpoint

    a056d5a375

Improve performance running on multiple GPUs

    0c82c2647d

Fixed errors when running on multiple GPUs

    ed9df876d4

Optimized reducing energy

    https://github.com/openmm/openmm/commit/2975f44
2024-09-05 21:23:15 +05:00
Anton Gorenko
f717ed8963 Use VkFFT in HipFFT3D, remove hipFFT and the builtin FFT
* VkFFT-based 3D FFT;
* Caching of compiled VkFFT kernels;
* Extend FFT tests with more sizes.
2024-09-05 21:23:15 +05:00
Anton Gorenko
a0acfbc961 Optimize PME kernels
* Compile with -munsafe-fp-atomics to enable fast hardware f32 atomic
  add on global memory on pre-MI100 GPUs;
* Use fixed point charge spreading on other GPUs, otherwise float atomic
  add will be compiled as a slow CAS loop;
* Tune block sizes, use executeKernelFlat;
* Tune launch bounds of PME grid-related kernels: force the compiler to
  use all registers by limiting max waves per EU to 1.
2024-09-05 21:23:14 +05:00
Anton Gorenko
aca24d5f09 Cleanup Cmake scripts for HIP platform
* Remove setting of link libraries, include and link dirs and compile
  flags for each target, instead let Cmake deal with them by linking the
  main library to hip::host hiprtc::hiprtc hip::hipfft;
* Fix: custom command without ADD_CUSTOM_TARGET and ADD_DEPENDENCIES is
  executed for both static and shared targets;
* Remove IF(APPLE) parts.
2024-09-01 15:53:48 +05:00
Anton Gorenko
6c0f3fbda1 Add hipification of Amoeba, Drude, RPMD plugins
Fix SegFault in HipCalcHippoNonbondedForceKernel

    HipSort was created using a temporary ref. Adding `HipContext& cu`
    field to HipCalcHippoNonbondedForceKernel fixes the issue;
2024-09-01 15:53:34 +05:00
Peter Eastman
8ac9cc441c DrudeForce supports periodic boundary conditions (#4523)
* DrudeForce supports periodic boundary conditions

* Fixed uninitialized memory
2024-04-29 10:15:44 -07:00
Peter Eastman
b32720cc3e Check BUILD_TESTING before building tests (#4487) 2024-03-28 13:22:01 -07:00
Peter Eastman
71f4b3fcb0 Virtual sites can depend on other virtual sites (#4348)
* Reference platform supports nested virtual sites

* Common platform supports nested virtual sites

* Fixed force distribution from nested virtual sites

* Fixed test failures
2024-02-02 11:24:30 -08:00
Peter Eastman
0e9ef3f83a setVelocitiesToTemperature() works with massless Drude particles (#4356) 2023-12-17 10:39:03 -08:00
Peter Eastman
d80ddda33b Faster algorithm for DrudeSCFIntegrator (#4354)
* Faster algorithm for DrudeSCFIntegrator

* Minor code simplification

* Reduced default error tolerance

* Fixed errors on NVIDIA
2023-12-14 19:55:56 -08:00
bdenhollander
f2bdcc7579 Amoeba and ATM Force minor cleanup (#4195)
* Amoeba minor cleanup

- Fix variable name in string
- Remove odd space between variable and period that is inconsistently styled

* Replaces random tabs with spaces in ATM Force
2023-08-18 10:35:14 -07:00
Peter Eastman
f67c7b7e82 Fixed memory error in AMOEBA PME (#4181) 2023-08-13 09:18:02 -07:00
Peter Eastman
dd07fa704f Always use nvrtc for compilation (#4146)
* Always use nvrtc for compilation

* Install nvrtc on CI

* Workaround for compiler error

* Set empty values for deprecated properties
2023-07-20 12:44:41 -07:00
Peter Eastman
644dc1ecc9 Fixed DOF calculation for NoseHooverIntegrator (#4128) 2023-07-03 17:05:04 -07:00
Peter Eastman
add2bbeee8 Attempt at fixing errors with barostat (#4106)
* Attempt at fixing errors with barostat

* Missing ContextSelector
2023-06-12 09:13:34 -07:00
Peter Eastman
8793e7e529 Decreased default epsilon for AmoebaMultipoleForce (#4098) 2023-06-07 10:46:26 -07:00
Peter Eastman
f08a1cf8ee Integrators use double precision constants in mixed precision mode (#4079) 2023-05-31 11:12:04 -07:00
cihe13375
303aaff7bb SYNC_THREADS at the end of FFT (#4090) 2023-05-30 17:48:51 -07:00
Peter Eastman
7af565ed09 Use more efficient version of updateContextState() (#4054) 2023-04-27 15:08:22 -07:00
Peter Eastman
4068b9151c Added checks for invalid sigma in AmoebaVdwForce (#3872) 2022-12-15 08:56:22 -08:00
Peter Eastman
ace97c6127 Remove checks for negative pressure (#3870) 2022-12-13 12:49:30 -08:00
Peter Eastman
cd5029c2e7 Fixed kernel compilation error on Mac (#3866) 2022-12-11 17:31:10 -08:00
Peter Eastman
ae686364ed Improved support for devices without 64 bit atomics (#3737) 2022-08-17 12:53:41 -07:00
Adel Johar
a39fa14acb Final HIP Platform implementation for AMD GPUs on ROCm (#3338)
* Support kernel files with extensions of any length (like .hip)

* Do not allow to replace symbols in single-line comments

* Add OPENMM_BUILD_COMMON CMake option

It allows to build and install common platform files even if
CUDA or OpenCL platforms are not built.
This is required for HIP platform (openmm-hip) if ROCm OpenCL
packages are not installed.

* Add an option for Python wrapper to install into user packages

OPENMM_PYTHON_USER_INSTALL is OFF be default.

* Support FFT backends in Amoeba plugin

The HIP platform supports FFT backends, this commit moves
findLegalFFTDimension to ComputeContext, so platforms can have their own
implementations.

* Compatibility for common platform w/ new HIP platform

* Do not use volatile with private and local AtomData parameters on HIP

The generated code is not optimal, for example, the compiler generates
flat_load instructions instead of ds_read.

* Tune launch bounds for PME grid-related kernels and add WA for RDNA

Force the compiler to use all registers for gridSpreadCharge and
gridInterpolateForce by limiting max waves per EU to 1 on CDNA GPUs,
RDNA GPUs work better without it.

* Optimize atom data structs in GBSA and Amoeba on HIP

Manually rearrange fields, add paddings and force alignments to
have faster accesses to shared memory: ds_read and ds_write may
work slower if addresses are not aligned by 16 bytes.

Co-authored-by: Anton Gorenko <anton@streamhpc.com>
Co-authored-by: Nick Curtis <nicholas.curtis@amd.com>
2022-07-22 08:12:44 -07:00
Peter Eastman
1dac981a63 Use PocketFFT (#3667)
* Use PocketFFT instead of FFTW

* Minor cleanup

* Use PocketFFT instead of fftpack for reference platform

* Remove FFTW as a dependency

* Converted a test case to use PocketFFT

* Fixed an incorrect comment
2022-06-30 12:54:28 -07:00
Peter Eastman
fb03606048 Added FAQ links to error messages (#3600)
* Added FAQ links to error messages

* Added missing Windows export
2022-05-11 08:15:31 -07:00