1711 Commits

Author SHA1 Message Date
Vyom Patel
5ae1e72a65 deep copy bonds (#5307) 2026-06-02 10:48:45 -07:00
Sai Asish Y
f99249f5c3 docs: document atom-to-particle index correspondence (#5289) 2026-05-19 08:55:10 -07:00
Peter Eastman
aa8ec1a8e9 SimulatedTempering uses ExpandedEnsembleSampler (#5281) 2026-05-07 11:30:27 -07:00
Peter Eastman
ce9fcace1c Created ExpandedEnsembleSampler (#5265)
* Created ExpandedEnsembleSampler

* Attempt at fixing test errors on Windows

* Another attempt at fixing test errors on Windows

* More output options

* Minor fixes

* Still trying to fix Windows errors

* Debugging

* Just skip the test on Windows

* Fix error on older Python
2026-05-05 12:18:10 -07:00
Peter Eastman
46376ea3e4 Created ReplicaExchangeReporter (#5261)
* Created ReplicaExchangeReporter

* Documentation for ReplicaExchangeReporter
2026-04-17 15:29:39 -07:00
Peter Eastman
efd891695c Created ReplicaExchangeSampler (#5257)
* Created ReplicaExchangeSampler

* Improvements to ReplicaExchangeSampler
2026-04-10 07:58:58 -07:00
Peter Eastman
9aae4bb35c PythonForce can be restricted to a subset of particles (#5246)
* PythonForce can be restricted to a subset of particles

* Fix exception with CUDA
2026-04-06 14:11:45 -07:00
Peter Eastman
9f17d0f884 Infrastructure for multistate sampling (#5231)
* Infrastructure for multistate sampling

* Added computeRelativeEnergies()
2026-04-02 10:45:18 -07:00
Jeff Wagner
13c568d08d Fix leaked variable causing spurious template constraint assignment (#5236)
* fix 5234 and add test

* clean up docstring and standardize test name
2026-03-26 08:49:35 -07:00
Peter Eastman
3e8a62ba3f Fixed bug in selecting HIS variant (#5221) 2026-02-26 14:46:55 -08:00
Peter Eastman
acf36fd6e3 Added two more synonyms for HOH (#5213)
* Added two more synonyms for HOH

* Change H20 to H2O
2026-02-17 15:23:16 -08:00
Peter Eastman
10b23bf067 Specify extras_require on all platforms (#5207) 2026-02-11 07:29:28 -08:00
Peter Eastman
834b1294a9 Residue templates can specify constraints (#5197)
* Residue templates can specify constraints

* Patched template generation preserves constraints
2026-02-09 13:29:40 -08:00
Peter Eastman
add95438df API for querying devices (#5192)
* API for querying devices

* CUDA and HIP implementations of getDevices()

* Fix test failures

* Fix test failures

* CUDA returns correct devices even if no context has been created

* Return a single device for Reference and CPU

* Fix CI failure
2026-02-09 11:00:29 -08:00
Peter Eastman
8eeee16de9 Templates can match whole molecules (#5181)
* Templates can match whole molecules

* addExtraParticles() supports molecule templates

* Documentation on molecule templates

* Bug fix
2026-01-30 11:16:39 -08:00
Peter Eastman
421eb42a69 Fix memory error in PythonForce (#5182) 2026-01-13 17:54:12 -08:00
Peter Eastman
e688b86e20 Fix error reading CONECT records in PDB with multiple models (#5179) 2026-01-07 16:09:35 -08:00
Christian Clauss
82703dff73 Fix typos discovered by codespell in Python files (#5173) 2025-12-30 12:21:00 -08:00
Evan Pretti
adfd84c273 Add LCPO method (#5130)
* Basic LCPO support

* Add basic test for LCPO from a prmtop file

* API for LCPOForce

* Started LCPO reference implementation

* Finished reference forces & test cases

* Use other test for finite difference since grid might have discontinuous forces

* Reference platform formatting

* Initial implementation of CPU platform

* Bugfixes

* More vectorization and improve neighbor list query speed

* Parallelize part of neighbor search

* Check box size for LCPO with periodic boundary conditions

* Fixes for updating parameters in context

* GBSAOBCForce doesn't use first & last indices for updates, so no need for this optimization here

* Changes to neighbor checking and optimization

* Fixes and minor changes

* Add global surface tension parameter

* Only process half of the pairs in the neighbor list

* Remove unnecessary checks

* Initial version of common platform implementation

* Asynchronously download neighbor list size

* Debugging

* Do pair precomputation in copyPairsToNeighborList

* Recompute interactions instead of scanning neighbor list in inner loop

* Condense position array before computations

* Also make neighbor count download asynchronous on device

* Fixes for kernel launching

* Topology-based LCPO parameter assignment

* Fixes, and use test system for LCPO with nucleic acids

* Always raise instead of warn when LCPO parameters can't be assigned

* Use Amber convention for phosphates
2025-12-11 13:28:36 -08:00
Peter Eastman
ccb83f1db9 GromacsTopFile supports vsite type 3fad (#5155) 2025-12-02 09:51:33 -08:00
Peter Eastman
a112fbfcc7 PDBx/mmCIF files are case insensitive (#5149) 2025-11-26 09:49:34 -08:00
9527567
321934222e Add pythonforce.i to SWIG input files (#5148)
Added pythonforce.i to SWIG input files for Python.
2025-11-25 10:55:16 -08:00
Evan Pretti
103b64b3c2 Remove ff19ipq (#5143) 2025-11-18 12:33:55 -08:00
Peter Eastman
2fbed59258 Created PythonForce (#5122)
* Initial implementation of PythonForce

* Continuing implementation of PythonForce

* Tests for PythonForce

* Fix memory leaks

* Documentation for PythonForce

* Fixed incorrect return type

* Fix compilation error on Python older than 3.12

* Handle all dtypes

* Optimizations to PythonForce

* Optimized getPositions()

* Test all platforms

* Fix test failures
2025-11-12 09:14:19 -08:00
Peter Eastman
58378cceac Fixed errors in computeCurrentPressure() (#5114) 2025-10-21 18:19:33 -07:00
João Morado
eaf56f96bc Update AMOEBA XML, .prm files, and parsing of Tinker files (#5086)
* Correct AmoebaAngleTorsion in test_Amoeba18Nucleic of TestForceField

* Update processTinkerForceField to handle latest .prm Tinker files

* Update amoeba2018 XML files

* Update amoeba2013 XML files

* Update amoeba2009 XML files

* Adapt addTorTor to new format in the .prm files

* Fix TorsionTorsion

* Also update the total energy in test_Amoeba18Nucleic

* Update amoebabio18.prm

* Fix nucleic acid test energies

* Correct AmoebaAngleTorsionForce params

* Add new addTorTor to TinkerFiles

* Revert unit fix

* Change to .pdb file which Tinker likes

* Update test_Amoeba18BPTI

* Remove trailing zeros from XML files

* Leave trailing zeros only on 2018 ff

* New element names in 2018

* More digits for surfaceAreaFactor

* More digits for surfaceAreaFactor

* More digits

* Remove debugging print

* Add support to 2009 and 2013 AMOEBA ffs to processTinkerForceField.py

* Add FF specific residues XML files

* Delete old residuesFinal.xml

* Update AMOEBA XML ffs

* Update FFs

* Fix some formatting issues

* Fix "." in scientific notation

* Remove old assertions
2025-10-14 12:55:21 -07:00
João Morado
489e2c46a2 Cleanup TinkerReader, ForceField, and amoebaforces (#5080)
* Fresh branch refactoring the new AMOEBA code

* Finish cleaning up AmoebaAngleForce and AmoebaInPlaneAngleForce

* Cleanup AmoebaTorsionTorsionForce

* Cleanup AmoebaOutOfPlaneBend

* Cleanup AmoebaMultipoleForce

* Remove unnecessary gkForce

* Simplify usage of atomClasses in ForceField

* Formatting

* Fix type of class on WCA

* Simplify angle forces

* Add parsing of units to PiTorsion and StretchBond, and misc. formatting adjustments

* Update code per review feedback

* Clearly defined API for TorsionTorsion,  and correct matching for UB,

* Unindent break statements

* Raise ValueError if classes and types are mixed in a Urey-Bradley term definition
2025-10-14 08:59:01 -07:00
Evan Pretti
1a67542eef Make distinct parameter dictionaries for _TemplateAtomData by default (#5091) 2025-09-24 16:22:43 -07: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
Evan Pretti
16efb71b6e Add Lipid21 and update documentation (#5066) 2025-09-16 09:47:27 -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
Evan Pretti
0ad623417f Fix error message formatting related to bonds to extra sites (#5065) 2025-09-08 09:12:47 -07:00
Peter Eastman
54fa65ed0d Created OrientationRestraintForce (#5048)
* Created OrientationRestraintForce

* Python API

* Documentation

* Serialization

* GPU implementation of OrientationRestraintForce

* Bug fix

* Remove unused code
2025-08-26 11:44:32 -07:00
feiglab
44524bd1e7 NBFIX in Gromacs for 1-4 pairs (#5050)
* fix to correctly read Gromacs topology files for CHARMM force field

* updated fix to correctly read topology files with NBFIX and different combination rules

* fixes to read topology files with NBFIX and different combination rules

* changed default for useDispersionCorrection to True

* changed docstring default for useDispersionCorrection to 'True'

* fix scaling of 1-4 LJ pairs when NBFIX is used

* apply NBFIXes to 1-4 pairs if no pair parameters are given

* rerun CI
2025-08-21 17:24:25 -07:00
Peter Eastman
1b6236a8cc Radius of gyration force (#5031)
* Reference implementation of RGForce

* GPU implementation of RGForce

* Serialization

* Documentation

* Fix compilation error

* Fixed error building API docs
2025-08-14 08:26:25 -07:00
Evan Pretti
4958ba269b Forbid LJPME when LJ uses CustomNonbondedForce (#5044) 2025-08-13 11:55:06 -07:00
Emilio Gallicchio
3645e1eeb7 Variable distance-based displacements for ATMForce (#4776)
* Variable displacements based on particle positions

* set variable displacements when adding particles

* update documentation

* address compilation error in OpenMMFortranWrapper

* update python API tests

* fix stray 'and'

* addParticle() without arguments add a particle that is not displaced

* pack displacement particles into int4

* put back default displacement removed in error

* ATMForce interface with coordinate transformation objects

* revise variable displacement API

* documentation, formatting, serialization

* Fixed C and Fortran wrappers

* Fixed Python wrappers

* Fixed factory

* Sort files to ensure classes are listed in the correct order

* Converted APIUnits test to new ATMForce API

* write class name

* skip the documentation for forward declarations

* undo 9e91d0b since it does not fix the doc build

* remove temporary doc files for nested classes

* Clean away tabs

---------

Co-authored-by: Peter Eastman <peastman@stanford.edu>
2025-08-12 12:22:58 -07:00
Peter Eastman
4a956a72fa Convert C++ types to Python types in API docs (#5036)
* Convert C++ types to Python types in API docs

* Translate some more types

* Convert return types that are STL containers
2025-08-12 12:09:57 -07:00
Peter Eastman
2af004b652 Adaptive quantum thermal bath (#4995)
* Began implementing QTBIntegrator

* Adaptation and deconvolution

* Continuing reference implementation

* Continuing to implement QTBIntegrator

* Use common thread pool

* More tests, documentation, and threading

* Fix segfault

* Serialize adapted friction when creating a State

* Beginning of GPU implementation

* Added missing files

* Bug fixes

* Fixed inverse FFT

* Continuing GPU implementation

* Checkpointing

* Bug fixes

* Test cases run faster

* Changes needed for latest main branch

* Minor optimizations

* Documentation

* Fixed atom reordering

* Added parahydrogen test case

* Workaround for bug in Microsoft's compiler

* Added a Python test

* Normalize kernel in deconvolution

* Minor documentation improvements
2025-08-11 08:03:06 -07:00
feiglab
d2a5d7e409 fix for scaled 1-4 LJ interactions when NBFIX is present in Gromacs topology file (#5032)
* fix to correctly read Gromacs topology files for CHARMM force field

* updated fix to correctly read topology files with NBFIX and different combination rules

* fixes to read topology files with NBFIX and different combination rules

* changed default for useDispersionCorrection to True

* changed docstring default for useDispersionCorrection to 'True'

* fix scaling of 1-4 LJ pairs when NBFIX is used
2025-08-07 11:18:11 -07:00
feiglab
0a4edb841b Fix reading of Gromacs topologies created from CHARMM force field (#5026)
* fix to correctly read Gromacs topology files for CHARMM force field

* updated fix to correctly read topology files with NBFIX and different combination rules

* fixes to read topology files with NBFIX and different combination rules

* changed default for useDispersionCorrection to True

* changed docstring default for useDispersionCorrection to 'True'
2025-08-06 16:43:49 -07:00
Evan Pretti
be856c222b Remove some references to SimTK 2025-08-05 11:13:54 -07:00
Evan Pretti
546d1a4e28 Merge pull request #5021 from epretti/safe-save
Always safely overwrite checkpoint and state files
2025-07-28 09:43:20 -07:00
Evan Pretti
51adf8c2cb Merge pull request #5020 from epretti/template-match-errors
Output more detailed messages when template matching fails
2025-07-28 09:18:00 -07:00
Evan Pretti
50f9085ca0 Always safely save checkpoints and states when filenames are given 2025-07-24 17:00:25 -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
Evan Pretti
1cf4277422 Additional explanation messages for special cases and tests 2025-07-23 15:56:43 -07:00
Evan Pretti
71208da2b0 Output more detailed messages when template matching fails 2025-07-23 10:43:34 -07:00
Evan Pretti
be64687891 Merge pull request #4989 from epretti/fix-charmm-water-models
Update CHARMM36 2024 and add water models
2025-07-07 09:03:50 -07:00